Fix hero retreating handling & code cleanup

This commit is contained in:
Ivan Savenko committed 2023-07-15 19:55:30 +03:00
1 parent cb16636fce
commit 463efea7bb
12 files changed
+79 -62

No files matched your search

+3 -5
View File
@@ -248,12 +248,10 @@ void ApplyGhNetPackVisitor::visitSetFormation(SetFormation & pack)
void ApplyGhNetPackVisitor::visitHireHero(HireHero & pack)
{
const CGObjectInstance * obj = gh.getObj(pack.tid);
const CGTownInstance * town = dynamic_ptr_cast<CGTownInstance>(obj);
if(town && PlayerRelations::ENEMIES == gh.getPlayerRelations(obj->tempOwner, gh.getPlayerAt(pack.c)))
gh.throwAndComplain(&pack, "Can't buy hero in enemy town!");
if (!gh.hasPlayerAt(pack.player, pack.c))
gh.throwAndComplain(&pack, "No such pack.player!");
result = gh.heroPool->hireHero(obj, pack.hid, pack.player);
result = gh.heroPool->hireHero(pack.tid, pack.hid, pack.player);
}
void ApplyGhNetPackVisitor::visitBuildBoat(BuildBoat & pack)