stockpiles: animals list still shown even when disabled

develop
Casey Link 2014-11-21 18:14:12 +01:00
parent 4f2851199e
commit f1ce575be3
1 changed files with 13 additions and 19 deletions

@ -1045,28 +1045,22 @@ private:
debug() << "animals:" << endl;
mPile->settings.animals.empty_cages = mBuffer.animals().empty_cages();
mPile->settings.animals.empty_traps = mBuffer.animals().empty_traps();
if ( mBuffer.animals().enabled_size() > 0 )
{
mPile->settings.animals.enabled.resize ( world->raws.creatures.all.size(), '\0' );
debug() << " pile has " << mPile->settings.animals.enabled.size() << endl;
for ( auto i = 0; i < mBuffer.animals().enabled_size(); ++i )
mPile->settings.animals.enabled.clear();
mPile->settings.animals.enabled.resize ( world->raws.creatures.all.size(), '\0' );
debug() << " pile has " << mPile->settings.animals.enabled.size() << endl;
for ( auto i = 0; i < mBuffer.animals().enabled_size(); ++i )
{
std::string id = mBuffer.animals().enabled ( i );
int idx = find_creature ( id );
debug() << id << " " << idx << endl;
if ( idx < 0 || idx >= mPile->settings.animals.enabled.size() )
{
std::string id = mBuffer.animals().enabled ( i );
int idx = find_creature ( id );
debug() << id << " " << idx << endl;
if ( idx < 0 || idx >= mPile->settings.animals.enabled.size() )
{
debug() << "WARNING: animal index invalid: " << idx << endl;
continue;
}
mPile->settings.animals.enabled.at ( idx ) = ( char ) 1;
debug() << "WARNING: animal index invalid: " << idx << endl;
continue;
}
mPile->settings.animals.enabled.at ( idx ) = ( char ) 1;
}
else
{
mPile->settings.animals.enabled.clear();
}
}
else
{