Remove message spam, make sure the old methods act the same.

develop
Petr Mrázek 2011-03-24 04:20:34 +01:00
parent ce9aa514fb
commit 4090a378c1
3 changed files with 25 additions and 10 deletions

@ -527,10 +527,15 @@ namespace DFHack
@endcode
*/
bool ReadGeology( std::vector < std::vector <uint16_t> >& assign );
/**
* Initialize the map feature caches, if possible
*/
bool StartFeatures();
/**
* Free the feature cache
*/
bool StopFeatures();
/**
* Get a global feature with the given index.
*/

@ -278,6 +278,8 @@ Maps::Maps(DFContextShared* _d)
Maps::~Maps()
{
if(d->FeaturesStarted)
StopFeatures();
if(d->Started)
Finish();
delete d;
@ -357,10 +359,7 @@ bool Maps::Finish()
{
if(d->FeaturesStarted)
{
d->local_feature_store.clear();
d->v_global_feature.clear();
d->m_local_feature.clear();
d->FeaturesStarted = false;
StopFeatures();
}
if (d->block != NULL)
{
@ -604,6 +603,18 @@ bool Maps::ReadRegionOffsets (uint32_t x, uint32_t y, uint32_t z, biome_indices4
}
return false;
}
bool Maps::StopFeatures()
{
if(d->FeaturesStarted)
{
d->local_feature_store.clear();
d->v_global_feature.clear();
d->m_local_feature.clear();
d->FeaturesStarted = false;
return true;
}
return false;
}
bool Maps::StartFeatures()
{
@ -1092,8 +1103,8 @@ bool Maps::ReadGeology (vector < vector <uint16_t> >& assign)
bool Maps::ReadLocalFeatures( std::map <DFCoord, std::vector<t_feature *> > & local_features )
{
if(!d->FeaturesStarted)
StartFeatures();
StopFeatures();
StartFeatures();
if(d->FeaturesStarted)
{
local_features = d->m_local_feature;
@ -1104,8 +1115,8 @@ bool Maps::ReadLocalFeatures( std::map <DFCoord, std::vector<t_feature *> > & lo
bool Maps::ReadGlobalFeatures( std::vector <t_feature> & features)
{
if(!d->FeaturesStarted)
StartFeatures();
StopFeatures();
StartFeatures();
if(d->FeaturesStarted)
{
features = d->v_global_feature;

@ -73,12 +73,11 @@ int main (void)
DFHack::t_feature * glof = 0;
if (Mapz->ReadFeatures(x,y,z,&locf,&glof))
{
cout << "bleep" << endl;
// we're looking for addy tubes
if(!locf) continue;
if(locf->type != DFHack::feature_Adamantine_Tube) continue;
dirty=0;
cout << "bloop" << endl;
Mapz->ReadDesignations(x,y,z, &designations);
Mapz->ReadTileTypes(x,y,z, &tiles);