|
|
|
@ -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;
|
|
|
|
|