diff --git a/server/NetPacksServer.cpp b/server/NetPacksServer.cpp index 1fc2596b2..7dc586ad9 100644 --- a/server/NetPacksServer.cpp +++ b/server/NetPacksServer.cpp @@ -209,10 +209,9 @@ bool SetFormation::applyGh( CGameHandler *gh ) bool HireHero::applyGh( CGameHandler *gh ) { const CGObjectInstance *obj = gh->getObj(tid); - - if(obj->ID == Obj::TOWN) - ERROR_IF_NOT_OWNS(tid); - //TODO check for visiting hero + const CGTownInstance *town = dynamic_cast(obj); + if(town && PlayerRelations::ENEMIES == gh->getPlayerRelations(obj->tempOwner, gh->getPlayerAt(c))) + COMPLAIN_AND_RETURN("Can't buy hero in enemy town!"); return gh->hireHero(obj, hid,player); }