Many fixes, still many to go.

develop
Petr Mrázek 2011-02-18 02:51:17 +01:00
parent 1c8249c55a
commit 9f5ee8a790
2 changed files with 32 additions and 13 deletions

@ -72,10 +72,22 @@ Buildings::Buildings(DFContextShared * d_)
d = new Private;
d->d = d_;
d->owner = d_->p;
d->p_bld = NULL;
d->Inited = d->Started = d->hasCustomWorkshops = false;
VersionInfo * mem = d->d->offset_descriptor;
OffsetGroup * OG_build = mem->getGroup("Buildings");
d->Inited = true;
try
{
d->buildings_vector = OG_build->getAddress ("buildings_vector");
}
catch(DFHack::Error::AllMemdef &e)
{
cerr << "Buildings not available... " << e.what() << endl;
d->Inited = false;
}
if(d->Inited)
{
try
{
d->custom_workshop_vector = OG_build->getAddress("custom_workshop_vector");
@ -89,7 +101,7 @@ Buildings::Buildings(DFContextShared * d_)
{
cerr << "Custom workshops not available. Memory Definition: " << e.what() << endl;
}
d->Inited = true;
}
}
Buildings::~Buildings()
@ -101,6 +113,8 @@ Buildings::~Buildings()
bool Buildings::Start(uint32_t & numbuildings)
{
if(!d->Inited)
return false;
d->p_bld = new DfVector <uint32_t> (d->owner, d->buildings_vector);
numbuildings = d->p_bld->size();
d->Started = true;

@ -72,6 +72,7 @@ Creatures::Creatures(DFContextShared* _d)
d->owner = _d->p;
d->Inited = false;
d->Started = false;
d->p_cre = NULL;
d->d->InitReadNames(); // throws on error
VersionInfo * minfo = d->d->offset_descriptor;
OffsetGroup *OG_Creatures = minfo->getGroup("Creatures");
@ -148,12 +149,16 @@ Creatures::~Creatures()
}
bool Creatures::Start( uint32_t &numcreatures )
{
if(d->Ft_basic)
{
d->p_cre = new DfVector <uint32_t> (d->owner, d->creatures.vector);
d->Started = true;
numcreatures = d->p_cre->size();
return true;
}
return false;
}
bool Creatures::Finish()
{