mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
- one more crash at map loading
This commit is contained in:
parent
4e92859cee
commit
828d9e70d2
@ -646,11 +646,21 @@ std::pair<int,int> CGameState::pickObject (CGObjectInstance *obj)
|
||||
std::pair<int,int> result(-1, -1);
|
||||
int cid = VLC->townh->towns[faction].basicCreatures[level];
|
||||
|
||||
//golem factory is not in list of cregens but can be placed as random object
|
||||
static const int factoryCreatures[] = {32, 33, 116, 117};
|
||||
std::vector<int> factory(std::begin(factoryCreatures), std::end(factoryCreatures));
|
||||
if (vstd::contains(factory, cid))
|
||||
result = std::pair<int,int>(20, 1);
|
||||
|
||||
//NOTE: this will pick last dwelling with this creature (Mantis #900)
|
||||
//check for block map equality is better but more complex solution
|
||||
BOOST_FOREACH(auto &iter, VLC->objh->cregens)
|
||||
if (iter.second == cid)
|
||||
result = std::pair<int,int>(17, iter.first);
|
||||
|
||||
if (result.first == -1)
|
||||
tlog0 << "Error: failed to find creature for dwelling of "<< int(faction) << " of level " << int(level) << "\n";
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -897,7 +897,7 @@ CGObjectInstance * Mapa::loadHero(const ui8 * bufor, int &i, int idToBeGiven)
|
||||
{
|
||||
bool areSpells = bufor[i]; ++i;
|
||||
|
||||
if(areSpells) //TODO: sprawdziæ //seems to be ok - tow
|
||||
if(areSpells) //TODO: sprawdzi //seems to be ok - tow
|
||||
{
|
||||
nhi->spells.insert(0xffffffff); //placeholder "preset spells"
|
||||
int ist = i;
|
||||
@ -2209,4 +2209,4 @@ bool TerrainTile::hasFavourableWinds() const
|
||||
bool TerrainTile::isWater() const
|
||||
{
|
||||
return tertype == water;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user