mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Use own resources when buying boat in allied shipyard
This commit is contained in:
@ -5698,7 +5698,7 @@ void CGameHandler::objectVisitEnded(const CObjectVisitQuery & query)
|
|||||||
ObjectVisitEnded::defaultExecute(serverEventBus.get(), endVisit, query.players.front(), query.visitingHero->id);
|
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));
|
const IShipyard *obj = IShipyard::castFrom(getObj(objid));
|
||||||
|
|
||||||
@ -5714,7 +5714,6 @@ bool CGameHandler::buildBoat(ObjectInstanceID objid)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PlayerColor playerID = obj->o->tempOwner;
|
|
||||||
TResources boatCost;
|
TResources boatCost;
|
||||||
obj->getBoatCost(boatCost);
|
obj->getBoatCost(boatCost);
|
||||||
TResources aviable = getPlayerState(playerID)->resources;
|
TResources aviable = getPlayerState(playerID)->resources;
|
||||||
|
@ -238,7 +238,7 @@ public:
|
|||||||
void removeObstacle(const CObstacleInstance &obstacle);
|
void removeObstacle(const CObstacleInstance &obstacle);
|
||||||
bool queryReply( QueryID qid, const JsonNode & answer, PlayerColor player );
|
bool queryReply( QueryID qid, const JsonNode & answer, PlayerColor player );
|
||||||
bool hireHero( const CGObjectInstance *obj, ui8 hid, 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 setFormation( ObjectInstanceID hid, ui8 formation );
|
||||||
bool tradeResources(const IMarket *market, ui32 val, PlayerColor player, ui32 id1, ui32 id2);
|
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);
|
bool sacrificeCreatures(const IMarket * market, const CGHeroInstance * hero, const std::vector<SlotID> & slot, const std::vector<ui32> & count);
|
||||||
|
@ -253,7 +253,7 @@ void ApplyGhNetPackVisitor::visitBuildBoat(BuildBoat & pack)
|
|||||||
if(gh.getPlayerRelations(gh.getOwner(pack.objid), gh.getPlayerAt(pack.c)) == PlayerRelations::ENEMIES)
|
if(gh.getPlayerRelations(gh.getOwner(pack.objid), gh.getPlayerAt(pack.c)) == PlayerRelations::ENEMIES)
|
||||||
gh.throwAndComplain(&pack, "Can't build boat at enemy shipyard");
|
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)
|
void ApplyGhNetPackVisitor::visitQueryReply(QueryReply & pack)
|
||||||
|
Reference in New Issue
Block a user