|
|
|
@ -57,6 +57,8 @@ struct Maps::Private
|
|
|
|
|
OffsetGroup *OG_vector;
|
|
|
|
|
bool Inited;
|
|
|
|
|
bool Started;
|
|
|
|
|
bool hasGeology;
|
|
|
|
|
bool hasFeatures;
|
|
|
|
|
|
|
|
|
|
// map between feature address and the read object
|
|
|
|
|
map <uint32_t, t_feature> local_feature_store;
|
|
|
|
@ -74,6 +76,7 @@ Maps::Maps(DFContextShared* _d)
|
|
|
|
|
|
|
|
|
|
DFHack::VersionInfo * mem = p->getDescriptor();
|
|
|
|
|
Server::Maps::maps_offsets &off = d->offsets;
|
|
|
|
|
d->hasFeatures = d->hasGeology = true;
|
|
|
|
|
|
|
|
|
|
// get the offsets once here
|
|
|
|
|
OffsetGroup *OG_Maps = mem->getGroup("Maps");
|
|
|
|
@ -87,7 +90,6 @@ Maps::Maps(DFContextShared* _d)
|
|
|
|
|
off.region_z_offset = OG_Maps->getAddress ("region_z");
|
|
|
|
|
off.world_size_x = OG_Maps->getAddress ("world_size_x");
|
|
|
|
|
off.world_size_y = OG_Maps->getAddress ("world_size_y");
|
|
|
|
|
|
|
|
|
|
OffsetGroup *OG_MapBlock = OG_Maps->getGroup("block");
|
|
|
|
|
{
|
|
|
|
|
off.tile_type_offset = OG_MapBlock->getOffset ("type");
|
|
|
|
@ -100,7 +102,8 @@ Maps::Maps(DFContextShared* _d)
|
|
|
|
|
off.temperature1_offset = OG_MapBlock->getOffset ("temperature1");
|
|
|
|
|
off.temperature2_offset = OG_MapBlock->getOffset ("temperature2");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
OffsetGroup *OG_Geology = OG_Maps->getGroup("geology");
|
|
|
|
|
{
|
|
|
|
|
off.world_regions = OG_Geology->getAddress ("ptr2_region_array");
|
|
|
|
@ -110,9 +113,21 @@ Maps::Maps(DFContextShared* _d)
|
|
|
|
|
off.world_geoblocks_vector = OG_Geology->getAddress ("geoblock_vector");
|
|
|
|
|
off.type_inside_geolayer = OG_Geology->getOffset ("type_inside_geolayer");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch(Error::AllMemdef &)
|
|
|
|
|
{
|
|
|
|
|
d->hasGeology = false;
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
d->OG_global_features = OG_Maps->getGroup("features")->getGroup("global");
|
|
|
|
|
d->OG_local_features = OG_Maps->getGroup("features")->getGroup("local");
|
|
|
|
|
}
|
|
|
|
|
catch(Error::AllMemdef &)
|
|
|
|
|
{
|
|
|
|
|
d->hasFeatures = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d->OG_vector = mem->getGroup("vector");
|
|
|
|
|
|
|
|
|
|
// these can (will) fail and will be found when looking at the actual veins later
|
|
|
|
@ -661,6 +676,7 @@ __int16 __userpurge GetGeologicalRegion<ax>(__int16 block_X<cx>, int X<ebx>, __i
|
|
|
|
|
bool Maps::ReadGeology (vector < vector <uint16_t> >& assign)
|
|
|
|
|
{
|
|
|
|
|
MAPS_GUARD
|
|
|
|
|
if(!d->hasGeology) return false;
|
|
|
|
|
Process *p = d->owner;
|
|
|
|
|
// get needed addresses and offsets. Now this is what I call crazy.
|
|
|
|
|
uint16_t worldSizeX, worldSizeY;
|
|
|
|
@ -730,6 +746,7 @@ bool Maps::ReadGeology (vector < vector <uint16_t> >& assign)
|
|
|
|
|
bool Maps::ReadLocalFeatures( std::map <planecoord, std::vector<t_feature *> > & local_features )
|
|
|
|
|
{
|
|
|
|
|
MAPS_GUARD
|
|
|
|
|
if(!d->hasFeatures) return false;
|
|
|
|
|
// can't be used without a map!
|
|
|
|
|
if(!d->block)
|
|
|
|
|
return false;
|
|
|
|
@ -822,6 +839,7 @@ bool Maps::ReadLocalFeatures( std::map <planecoord, std::vector<t_feature *> > &
|
|
|
|
|
bool Maps::ReadGlobalFeatures( std::vector <t_feature> & features)
|
|
|
|
|
{
|
|
|
|
|
MAPS_GUARD
|
|
|
|
|
if(!d->hasGeology) return false;
|
|
|
|
|
// can't be used without a map!
|
|
|
|
|
if(!d->block)
|
|
|
|
|
return false;
|
|
|
|
|