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