1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Use own resources when buying boat in allied shipyard

This commit is contained in:
Ivan Savenko 2023-03-31 20:02:09 +03:00
parent 839172cd30
commit 820c9be61b
3 changed files with 3 additions and 4 deletions

View File

@ -5698,7 +5698,7 @@ void CGameHandler::objectVisitEnded(const CObjectVisitQuery & query)
ObjectVisitEnded::defaultExecute(serverEventBus.get(), endVisit, query.players.front(), query.visitingHero->id);
}
bool CGameHandler::buildBoat(ObjectInstanceID objid)
bool CGameHandler::buildBoat(ObjectInstanceID objid, PlayerColor playerID)
{
const IShipyard *obj = IShipyard::castFrom(getObj(objid));
@ -5714,7 +5714,6 @@ bool CGameHandler::buildBoat(ObjectInstanceID objid)
return false;
}
const PlayerColor playerID = obj->o->tempOwner;
TResources boatCost;
obj->getBoatCost(boatCost);
TResources aviable = getPlayerState(playerID)->resources;

View File

@ -238,7 +238,7 @@ public:
void removeObstacle(const CObstacleInstance &obstacle);
bool queryReply( QueryID qid, const JsonNode & answer, PlayerColor player );
bool hireHero( const CGObjectInstance *obj, ui8 hid, PlayerColor player );
bool buildBoat( ObjectInstanceID objid );
bool buildBoat( ObjectInstanceID objid, PlayerColor player );
bool setFormation( ObjectInstanceID hid, ui8 formation );
bool tradeResources(const IMarket *market, ui32 val, PlayerColor player, ui32 id1, ui32 id2);
bool sacrificeCreatures(const IMarket * market, const CGHeroInstance * hero, const std::vector<SlotID> & slot, const std::vector<ui32> & count);

View File

@ -253,7 +253,7 @@ void ApplyGhNetPackVisitor::visitBuildBoat(BuildBoat & pack)
if(gh.getPlayerRelations(gh.getOwner(pack.objid), gh.getPlayerAt(pack.c)) == PlayerRelations::ENEMIES)
gh.throwAndComplain(&pack, "Can't build boat at enemy shipyard");
result = gh.buildBoat(pack.objid);
result = gh.buildBoat(pack.objid, gh.getPlayerAt(pack.c));
}
void ApplyGhNetPackVisitor::visitQueryReply(QueryReply & pack)