1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-05 15:05:40 +02:00

- fixed crash on loading of some maps

- minor fixes
This commit is contained in:
Ivan Savenko 2012-05-30 18:37:21 +00:00
parent 247fabc3a6
commit 4e92859cee
3 changed files with 15 additions and 19 deletions

View File

@ -10,19 +10,19 @@ class CEmptyAI : public CGlobalAI
CCallback *cb;
public:
void init(CCallback * CB);
void yourTurn();
void heroKilled(const CGHeroInstance *);
void heroCreated(const CGHeroInstance *);
void heroMoved(const TryMoveHero&);
void heroPrimarySkillChanged(const CGHeroInstance * hero, int which, int val) {};
void showSelDialog(std::string text, std::vector<CSelectableComponent*> & components, int askID){};
void tileRevealed(int3 pos){};
void tileHidden(int3 pos){};
void showBlockingDialog(const std::string &text, const std::vector<Component> &components, ui32 askID, int soundID, bool selection, bool cancel){};
void showGarrisonDialog(const CArmedInstance *up, const CGHeroInstance *down, bool removableUnits, boost::function<void()> &onEnd) {};
void heroGotLevel(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback);
void commanderGotLevel (const CCommanderInstance * commander, std::vector<ui32> skills, boost::function<void(ui32)> &callback) {}; //TODO
void init(CCallback * CB) override;
void yourTurn() override;
void heroKilled(const CGHeroInstance *) override;
void heroCreated(const CGHeroInstance *) override;
void heroMoved(const TryMoveHero&) override;
void heroPrimarySkillChanged(const CGHeroInstance * hero, int which, si64 val) override {};
void showSelDialog(std::string text, std::vector<CSelectableComponent*> & components, int askID) override {};
void tileRevealed(const boost::unordered_set<int3, ShashInt3> &pos) override {};
void tileHidden(const boost::unordered_set<int3, ShashInt3> &pos) override {};
void showBlockingDialog(const std::string &text, const std::vector<Component> &components, ui32 askID, int soundID, bool selection, bool cancel) override {};
void showGarrisonDialog(const CArmedInstance *up, const CGHeroInstance *down, bool removableUnits, boost::function<void()> &onEnd) override {};
void heroGotLevel(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback) override;
void commanderGotLevel (const CCommanderInstance * commander, std::vector<ui32> skills, boost::function<void(ui32)> &callback) override {}; //TODO
};
#define NAME "EmptyAI 0.1"

View File

@ -651,8 +651,6 @@ std::pair<int,int> CGameState::pickObject (CGObjectInstance *obj)
BOOST_FOREACH(auto &iter, VLC->objh->cregens)
if (iter.second == cid)
result = std::pair<int,int>(17, iter.first);
tlog3 << "Cannot find a dwelling for creature "<< cid << std::endl;
return result;
}
}

View File

@ -1260,7 +1260,7 @@ void Mapa::readObjects( const ui8 * bufor, int &i)
int defnum = read_le_u32(bufor + i); i+=4;
int idToBeGiven = objects.size();
CGDefInfo * defInfo = defy[defnum];
CGDefInfo * defInfo = defy.at(defnum);
i+=5;
switch(defInfo->id)
@ -1705,8 +1705,6 @@ void Mapa::readObjects( const ui8 * bufor, int &i)
castleSpec->asCastle = true;
}
}
else
i+=3; //only for 218
//216 and 218
if (auto lvlSpec = dynamic_cast<CCreGenLeveledInfo*>(spec))
@ -2211,4 +2209,4 @@ bool TerrainTile::hasFavourableWinds() const
bool TerrainTile::isWater() const
{
return tertype == water;
}
}