1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-20 03:29:32 +02:00

Replace more usages of pointers to packs with references

This commit is contained in:
Ivan Savenko 2024-10-04 14:01:10 +00:00
parent ee831c06e7
commit 786f80871e
9 changed files with 68 additions and 68 deletions

View File

@ -29,20 +29,20 @@
bool CCallback::teleportHero(const CGHeroInstance *who, const CGTownInstance *where) bool CCallback::teleportHero(const CGHeroInstance *who, const CGTownInstance *where)
{ {
CastleTeleportHero pack(who->id, where->id, 1); CastleTeleportHero pack(who->id, where->id, 1);
sendRequest(&pack); sendRequest(pack);
return true; return true;
} }
void CCallback::moveHero(const CGHeroInstance *h, const int3 & destination, bool transit) void CCallback::moveHero(const CGHeroInstance *h, const int3 & destination, bool transit)
{ {
MoveHero pack({destination}, h->id, transit); MoveHero pack({destination}, h->id, transit);
sendRequest(&pack); sendRequest(pack);
} }
void CCallback::moveHero(const CGHeroInstance *h, const std::vector<int3> & path, bool transit) void CCallback::moveHero(const CGHeroInstance *h, const std::vector<int3> & path, bool transit)
{ {
MoveHero pack(path, h->id, transit); MoveHero pack(path, h->id, transit);
sendRequest(&pack); sendRequest(pack);
} }
int CCallback::selectionMade(int selection, QueryID queryID) int CCallback::selectionMade(int selection, QueryID queryID)
@ -61,7 +61,7 @@ int CCallback::sendQueryReply(std::optional<int32_t> reply, QueryID queryID)
QueryReply pack(queryID, reply); QueryReply pack(queryID, reply);
pack.player = *player; pack.player = *player;
return sendRequest(&pack); return sendRequest(pack);
} }
void CCallback::recruitCreatures(const CGDwelling * obj, const CArmedInstance * dst, CreatureID ID, ui32 amount, si32 level) void CCallback::recruitCreatures(const CGDwelling * obj, const CArmedInstance * dst, CreatureID ID, ui32 amount, si32 level)
@ -71,7 +71,7 @@ void CCallback::recruitCreatures(const CGDwelling * obj, const CArmedInstance *
return; return;
RecruitCreatures pack(obj->id, dst->id, ID, amount, level); RecruitCreatures pack(obj->id, dst->id, ID, amount, level);
sendRequest(&pack); sendRequest(pack);
} }
bool CCallback::dismissCreature(const CArmedInstance *obj, SlotID stackPos) bool CCallback::dismissCreature(const CArmedInstance *obj, SlotID stackPos)
@ -80,14 +80,14 @@ bool CCallback::dismissCreature(const CArmedInstance *obj, SlotID stackPos)
return false; return false;
DisbandCreature pack(stackPos,obj->id); DisbandCreature pack(stackPos,obj->id);
sendRequest(&pack); sendRequest(pack);
return true; return true;
} }
bool CCallback::upgradeCreature(const CArmedInstance *obj, SlotID stackPos, CreatureID newID) bool CCallback::upgradeCreature(const CArmedInstance *obj, SlotID stackPos, CreatureID newID)
{ {
UpgradeCreature pack(stackPos,obj->id,newID); UpgradeCreature pack(stackPos,obj->id,newID);
sendRequest(&pack); sendRequest(pack);
return false; return false;
} }
@ -95,54 +95,54 @@ void CCallback::endTurn()
{ {
logGlobal->trace("Player %d ended his turn.", player->getNum()); logGlobal->trace("Player %d ended his turn.", player->getNum());
EndTurn pack; EndTurn pack;
sendRequest(&pack); sendRequest(pack);
} }
int CCallback::swapCreatures(const CArmedInstance *s1, const CArmedInstance *s2, SlotID p1, SlotID p2) int CCallback::swapCreatures(const CArmedInstance *s1, const CArmedInstance *s2, SlotID p1, SlotID p2)
{ {
ArrangeStacks pack(1,p1,p2,s1->id,s2->id,0); ArrangeStacks pack(1,p1,p2,s1->id,s2->id,0);
sendRequest(&pack); sendRequest(pack);
return 0; return 0;
} }
int CCallback::mergeStacks(const CArmedInstance *s1, const CArmedInstance *s2, SlotID p1, SlotID p2) int CCallback::mergeStacks(const CArmedInstance *s1, const CArmedInstance *s2, SlotID p1, SlotID p2)
{ {
ArrangeStacks pack(2,p1,p2,s1->id,s2->id,0); ArrangeStacks pack(2,p1,p2,s1->id,s2->id,0);
sendRequest(&pack); sendRequest(pack);
return 0; return 0;
} }
int CCallback::splitStack(const CArmedInstance *s1, const CArmedInstance *s2, SlotID p1, SlotID p2, int val) int CCallback::splitStack(const CArmedInstance *s1, const CArmedInstance *s2, SlotID p1, SlotID p2, int val)
{ {
ArrangeStacks pack(3,p1,p2,s1->id,s2->id,val); ArrangeStacks pack(3,p1,p2,s1->id,s2->id,val);
sendRequest(&pack); sendRequest(pack);
return 0; return 0;
} }
int CCallback::bulkMoveArmy(ObjectInstanceID srcArmy, ObjectInstanceID destArmy, SlotID srcSlot) int CCallback::bulkMoveArmy(ObjectInstanceID srcArmy, ObjectInstanceID destArmy, SlotID srcSlot)
{ {
BulkMoveArmy pack(srcArmy, destArmy, srcSlot); BulkMoveArmy pack(srcArmy, destArmy, srcSlot);
sendRequest(&pack); sendRequest(pack);
return 0; return 0;
} }
int CCallback::bulkSplitStack(ObjectInstanceID armyId, SlotID srcSlot, int howMany) int CCallback::bulkSplitStack(ObjectInstanceID armyId, SlotID srcSlot, int howMany)
{ {
BulkSplitStack pack(armyId, srcSlot, howMany); BulkSplitStack pack(armyId, srcSlot, howMany);
sendRequest(&pack); sendRequest(pack);
return 0; return 0;
} }
int CCallback::bulkSmartSplitStack(ObjectInstanceID armyId, SlotID srcSlot) int CCallback::bulkSmartSplitStack(ObjectInstanceID armyId, SlotID srcSlot)
{ {
BulkSmartSplitStack pack(armyId, srcSlot); BulkSmartSplitStack pack(armyId, srcSlot);
sendRequest(&pack); sendRequest(pack);
return 0; return 0;
} }
int CCallback::bulkMergeStacks(ObjectInstanceID armyId, SlotID srcSlot) int CCallback::bulkMergeStacks(ObjectInstanceID armyId, SlotID srcSlot)
{ {
BulkMergeStacks pack(armyId, srcSlot); BulkMergeStacks pack(armyId, srcSlot);
sendRequest(&pack); sendRequest(pack);
return 0; return 0;
} }
@ -151,7 +151,7 @@ bool CCallback::dismissHero(const CGHeroInstance *hero)
if(player!=hero->tempOwner) return false; if(player!=hero->tempOwner) return false;
DismissHero pack(hero->id); DismissHero pack(hero->id);
sendRequest(&pack); sendRequest(pack);
return true; return true;
} }
@ -160,7 +160,7 @@ bool CCallback::swapArtifacts(const ArtifactLocation &l1, const ArtifactLocation
ExchangeArtifacts ea; ExchangeArtifacts ea;
ea.src = l1; ea.src = l1;
ea.dst = l2; ea.dst = l2;
sendRequest(&ea); sendRequest(ea);
return true; return true;
} }
@ -175,13 +175,13 @@ bool CCallback::swapArtifacts(const ArtifactLocation &l1, const ArtifactLocation
void CCallback::assembleArtifacts(const ObjectInstanceID & heroID, ArtifactPosition artifactSlot, bool assemble, ArtifactID assembleTo) void CCallback::assembleArtifacts(const ObjectInstanceID & heroID, ArtifactPosition artifactSlot, bool assemble, ArtifactID assembleTo)
{ {
AssembleArtifacts aa(heroID, artifactSlot, assemble, assembleTo); AssembleArtifacts aa(heroID, artifactSlot, assemble, assembleTo);
sendRequest(&aa); sendRequest(aa);
} }
void CCallback::bulkMoveArtifacts(ObjectInstanceID srcHero, ObjectInstanceID dstHero, bool swap, bool equipped, bool backpack) void CCallback::bulkMoveArtifacts(ObjectInstanceID srcHero, ObjectInstanceID dstHero, bool swap, bool equipped, bool backpack)
{ {
BulkExchangeArtifacts bma(srcHero, dstHero, swap, equipped, backpack); BulkExchangeArtifacts bma(srcHero, dstHero, swap, equipped, backpack);
sendRequest(&bma); sendRequest(bma);
} }
void CCallback::scrollBackpackArtifacts(ObjectInstanceID hero, bool left) void CCallback::scrollBackpackArtifacts(ObjectInstanceID hero, bool left)
@ -189,7 +189,7 @@ void CCallback::scrollBackpackArtifacts(ObjectInstanceID hero, bool left)
ManageBackpackArtifacts mba(hero, ManageBackpackArtifacts::ManageCmd::SCROLL_RIGHT); ManageBackpackArtifacts mba(hero, ManageBackpackArtifacts::ManageCmd::SCROLL_RIGHT);
if(left) if(left)
mba.cmd = ManageBackpackArtifacts::ManageCmd::SCROLL_LEFT; mba.cmd = ManageBackpackArtifacts::ManageCmd::SCROLL_LEFT;
sendRequest(&mba); sendRequest(mba);
} }
void CCallback::sortBackpackArtifactsBySlot(const ObjectInstanceID hero) void CCallback::sortBackpackArtifactsBySlot(const ObjectInstanceID hero)
@ -213,13 +213,13 @@ void CCallback::sortBackpackArtifactsByClass(const ObjectInstanceID hero)
void CCallback::manageHeroCostume(ObjectInstanceID hero, size_t costumeIndex, bool saveCostume) void CCallback::manageHeroCostume(ObjectInstanceID hero, size_t costumeIndex, bool saveCostume)
{ {
ManageEquippedArtifacts mea(hero, costumeIndex, saveCostume); ManageEquippedArtifacts mea(hero, costumeIndex, saveCostume);
sendRequest(&mea); sendRequest(mea);
} }
void CCallback::eraseArtifactByClient(const ArtifactLocation & al) void CCallback::eraseArtifactByClient(const ArtifactLocation & al)
{ {
EraseArtifactByClient ea(al); EraseArtifactByClient ea(al);
sendRequest(&ea); sendRequest(ea);
} }
bool CCallback::buildBuilding(const CGTownInstance *town, BuildingID buildingID) bool CCallback::buildBuilding(const CGTownInstance *town, BuildingID buildingID)
@ -231,7 +231,7 @@ bool CCallback::buildBuilding(const CGTownInstance *town, BuildingID buildingID)
return false; return false;
BuildStructure pack(town->id,buildingID); BuildStructure pack(town->id,buildingID);
sendRequest(&pack); sendRequest(pack);
return true; return true;
} }
@ -241,7 +241,7 @@ bool CCallback::visitTownBuilding(const CGTownInstance *town, BuildingID buildin
return false; return false;
VisitTownBuilding pack(town->id, buildingID); VisitTownBuilding pack(town->id, buildingID);
sendRequest(&pack); sendRequest(pack);
return true; return true;
} }
@ -250,10 +250,10 @@ void CBattleCallback::battleMakeSpellAction(const BattleID & battleID, const Bat
assert(action.actionType == EActionType::HERO_SPELL); assert(action.actionType == EActionType::HERO_SPELL);
MakeAction mca(action); MakeAction mca(action);
mca.battleID = battleID; mca.battleID = battleID;
sendRequest(&mca); sendRequest(mca);
} }
int CBattleCallback::sendRequest(const CPackForServer * request) int CBattleCallback::sendRequest(const CPackForServer & request)
{ {
int requestID = cl->sendRequest(request, *getPlayerID()); int requestID = cl->sendRequest(request, *getPlayerID());
if(waitTillRealize) if(waitTillRealize)
@ -278,7 +278,7 @@ void CCallback::swapGarrisonHero( const CGTownInstance *town )
if(town->tempOwner == *player || (town->garrisonHero && town->garrisonHero->tempOwner == *player )) if(town->tempOwner == *player || (town->garrisonHero && town->garrisonHero->tempOwner == *player ))
{ {
GarrisonHeroSwap pack(town->id); GarrisonHeroSwap pack(town->id);
sendRequest(&pack); sendRequest(pack);
} }
} }
@ -287,7 +287,7 @@ void CCallback::buyArtifact(const CGHeroInstance *hero, ArtifactID aid)
if(hero->tempOwner != *player) return; if(hero->tempOwner != *player) return;
BuyArtifact pack(hero->id,aid); BuyArtifact pack(hero->id,aid);
sendRequest(&pack); sendRequest(pack);
} }
void CCallback::trade(const ObjectInstanceID marketId, EMarketMode mode, TradeItemSell id1, TradeItemBuy id2, ui32 val1, const CGHeroInstance * hero) void CCallback::trade(const ObjectInstanceID marketId, EMarketMode mode, TradeItemSell id1, TradeItemBuy id2, ui32 val1, const CGHeroInstance * hero)
@ -304,13 +304,13 @@ void CCallback::trade(const ObjectInstanceID marketId, EMarketMode mode, const s
pack.r1 = id1; pack.r1 = id1;
pack.r2 = id2; pack.r2 = id2;
pack.val = val1; pack.val = val1;
sendRequest(&pack); sendRequest(pack);
} }
void CCallback::setFormation(const CGHeroInstance * hero, EArmyFormation mode) void CCallback::setFormation(const CGHeroInstance * hero, EArmyFormation mode)
{ {
SetFormation pack(hero->id, mode); SetFormation pack(hero->id, mode);
sendRequest(&pack); sendRequest(pack);
} }
void CCallback::recruitHero(const CGObjectInstance *townOrTavern, const CGHeroInstance *hero, const HeroTypeID & nextHero) void CCallback::recruitHero(const CGObjectInstance *townOrTavern, const CGHeroInstance *hero, const HeroTypeID & nextHero)
@ -320,7 +320,7 @@ void CCallback::recruitHero(const CGObjectInstance *townOrTavern, const CGHeroIn
HireHero pack(hero->getHeroType(), townOrTavern->id, nextHero); HireHero pack(hero->getHeroType(), townOrTavern->id, nextHero);
pack.player = *player; pack.player = *player;
sendRequest(&pack); sendRequest(pack);
} }
void CCallback::save( const std::string &fname ) void CCallback::save( const std::string &fname )
@ -334,7 +334,7 @@ void CCallback::gamePause(bool pause)
{ {
GamePause pack; GamePause pack;
pack.player = *player; pack.player = *player;
sendRequest(&pack); sendRequest(pack);
} }
else else
{ {
@ -348,14 +348,14 @@ void CCallback::sendMessage(const std::string &mess, const CGObjectInstance * cu
PlayerMessage pm(mess, currentObject? currentObject->id : ObjectInstanceID(-1)); PlayerMessage pm(mess, currentObject? currentObject->id : ObjectInstanceID(-1));
if(player) if(player)
pm.player = *player; pm.player = *player;
sendRequest(&pm); sendRequest(pm);
} }
void CCallback::buildBoat( const IShipyard *obj ) void CCallback::buildBoat( const IShipyard *obj )
{ {
BuildBoat bb; BuildBoat bb;
bb.objid = dynamic_cast<const CGObjectInstance*>(obj)->id; bb.objid = dynamic_cast<const CGObjectInstance*>(obj)->id;
sendRequest(&bb); sendRequest(bb);
} }
CCallback::CCallback(CGameState * GS, std::optional<PlayerColor> Player, CClient * C) CCallback::CCallback(CGameState * GS, std::optional<PlayerColor> Player, CClient * C)
@ -397,7 +397,7 @@ void CCallback::dig( const CGObjectInstance *hero )
{ {
DigWithHero dwh; DigWithHero dwh;
dwh.id = hero->id; dwh.id = hero->id;
sendRequest(&dwh); sendRequest(dwh);
} }
void CCallback::castSpell(const CGHeroInstance *hero, SpellID spellID, const int3 &pos) void CCallback::castSpell(const CGHeroInstance *hero, SpellID spellID, const int3 &pos)
@ -406,7 +406,7 @@ void CCallback::castSpell(const CGHeroInstance *hero, SpellID spellID, const int
cas.hid = hero->id; cas.hid = hero->id;
cas.sid = spellID; cas.sid = spellID;
cas.pos = pos; cas.pos = pos;
sendRequest(&cas); sendRequest(cas);
} }
int CCallback::mergeOrSwapStacks(const CArmedInstance *s1, const CArmedInstance *s2, SlotID p1, SlotID p2) int CCallback::mergeOrSwapStacks(const CArmedInstance *s1, const CArmedInstance *s2, SlotID p1, SlotID p2)
@ -439,7 +439,7 @@ void CBattleCallback::battleMakeUnitAction(const BattleID & battleID, const Batt
MakeAction ma; MakeAction ma;
ma.ba = action; ma.ba = action;
ma.battleID = battleID; ma.battleID = battleID;
sendRequest(&ma); sendRequest(ma);
} }
void CBattleCallback::battleMakeTacticAction(const BattleID & battleID, const BattleAction & action ) void CBattleCallback::battleMakeTacticAction(const BattleID & battleID, const BattleAction & action )
@ -448,7 +448,7 @@ void CBattleCallback::battleMakeTacticAction(const BattleID & battleID, const Ba
MakeAction ma; MakeAction ma;
ma.ba = action; ma.ba = action;
ma.battleID = battleID; ma.battleID = battleID;
sendRequest(&ma); sendRequest(ma);
} }
std::optional<BattleAction> CBattleCallback::makeSurrenderRetreatDecision(const BattleID & battleID, const BattleStateInfoForRetreat & battleState) std::optional<BattleAction> CBattleCallback::makeSurrenderRetreatDecision(const BattleID & battleID, const BattleStateInfoForRetreat & battleState)

View File

@ -127,7 +127,7 @@ class CBattleCallback : public IBattleCallback
std::optional<PlayerColor> player; std::optional<PlayerColor> player;
protected: protected:
int sendRequest(const CPackForServer * request); //returns requestID (that'll be matched to requestID in PackageApplied) int sendRequest(const CPackForServer & request); //returns requestID (that'll be matched to requestID in PackageApplied)
CClient *cl; CClient *cl;
public: public:

View File

@ -938,7 +938,7 @@ void CServerHandler::visitForLobby(CPackForLobby & lobbyPack)
void CServerHandler::visitForClient(CPackForClient & clientPack) void CServerHandler::visitForClient(CPackForClient & clientPack)
{ {
client->handlePack(&clientPack); client->handlePack(clientPack);
} }

View File

@ -163,7 +163,7 @@ void CClient::save(const std::string & fname)
} }
SaveGame save_game(fname); SaveGame save_game(fname);
sendRequest(&save_game, PlayerColor::NEUTRAL); sendRequest(save_game, PlayerColor::NEUTRAL);
} }
void CClient::endNetwork() void CClient::endNetwork()
@ -348,35 +348,35 @@ void CClient::installNewBattleInterface(std::shared_ptr<CBattleGameInterface> ba
} }
} }
void CClient::handlePack(CPackForClient * pack) void CClient::handlePack(CPackForClient & pack)
{ {
ApplyClientNetPackVisitor afterVisitor(*this, *gameState()); ApplyClientNetPackVisitor afterVisitor(*this, *gameState());
ApplyFirstClientNetPackVisitor beforeVisitor(*this, *gameState()); ApplyFirstClientNetPackVisitor beforeVisitor(*this, *gameState());
pack->visit(beforeVisitor); pack.visit(beforeVisitor);
logNetwork->trace("\tMade first apply on cl: %s", typeid(*pack).name()); logNetwork->trace("\tMade first apply on cl: %s", typeid(pack).name());
{ {
boost::unique_lock lock(CGameState::mutex); boost::unique_lock lock(CGameState::mutex);
gs->apply(pack); gs->apply(pack);
} }
logNetwork->trace("\tApplied on gs: %s", typeid(*pack).name()); logNetwork->trace("\tApplied on gs: %s", typeid(pack).name());
pack->visit(afterVisitor); pack.visit(afterVisitor);
logNetwork->trace("\tMade second apply on cl: %s", typeid(*pack).name()); logNetwork->trace("\tMade second apply on cl: %s", typeid(pack).name());
} }
int CClient::sendRequest(const CPackForServer * request, PlayerColor player) int CClient::sendRequest(const CPackForServer & request, PlayerColor player)
{ {
static ui32 requestCounter = 1; static ui32 requestCounter = 1;
ui32 requestID = requestCounter++; ui32 requestID = requestCounter++;
logNetwork->trace("Sending a request \"%s\". It'll have an ID=%d.", typeid(*request).name(), requestID); logNetwork->trace("Sending a request \"%s\". It'll have an ID=%d.", typeid(request).name(), requestID);
waitingRequest.pushBack(requestID); waitingRequest.pushBack(requestID);
request->requestID = requestID; request.requestID = requestID;
request->player = player; request.player = player;
CSH->logicConnection->sendPack(*request); CSH->logicConnection->sendPack(request);
if(vstd::contains(playerint, player)) if(vstd::contains(playerint, player))
playerint[player]->requestSent(request, requestID); playerint[player]->requestSent(&request, requestID);
return requestID; return requestID;
} }

View File

@ -142,8 +142,8 @@ public:
static ThreadSafeVector<int> waitingRequest; //FIXME: make this normal field (need to join all threads before client destruction) static ThreadSafeVector<int> waitingRequest; //FIXME: make this normal field (need to join all threads before client destruction)
void handlePack(CPackForClient * pack); //applies the given pack and deletes it void handlePack(CPackForClient & pack); //applies the given pack and deletes it
int sendRequest(const CPackForServer * request, PlayerColor player); //returns ID given to that request int sendRequest(const CPackForServer & request, PlayerColor player); //returns ID given to that request
void battleStarted(const BattleInfo * info); void battleStarted(const BattleInfo * info);
void battleFinished(const BattleID & battleID); void battleFinished(const BattleID & battleID);

View File

@ -1143,9 +1143,9 @@ PlayerRelations CGameState::getPlayerRelations( PlayerColor color1, PlayerColor
return PlayerRelations::ENEMIES; return PlayerRelations::ENEMIES;
} }
void CGameState::apply(CPackForClient *pack) void CGameState::apply(CPackForClient & pack)
{ {
pack->applyGs(this); pack.applyGs(this);
} }
void CGameState::calculatePaths(const CGHeroInstance *hero, CPathsInfo &out) void CGameState::calculatePaths(const CGHeroInstance *hero, CPathsInfo &out)

View File

@ -98,7 +98,7 @@ public:
/// picks next free hero type of the H3 hero init sequence -> chosen starting hero, then unused hero type randomly /// picks next free hero type of the H3 hero init sequence -> chosen starting hero, then unused hero type randomly
HeroTypeID pickNextHeroType(const PlayerColor & owner); HeroTypeID pickNextHeroType(const PlayerColor & owner);
void apply(CPackForClient *pack); void apply(CPackForClient & pack);
BattleField battleGetBattlefieldType(int3 tile, vstd::RNG & rand); BattleField battleGetBattlefieldType(int3 tile, vstd::RNG & rand);
void fillUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out) const override; void fillUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out) const override;

View File

@ -1444,8 +1444,8 @@ void CGameHandler::sendToAllClients(CPackForClient * pack)
void CGameHandler::sendAndApply(CPackForClient * pack) void CGameHandler::sendAndApply(CPackForClient * pack)
{ {
sendToAllClients(pack); sendToAllClients(pack);
gs->apply(pack); gs->apply(*pack);
logNetwork->trace("\tApplied on gs: %s", typeid(*pack).name()); logNetwork->trace("\tApplied on gs: %s", typeid(pack).name());
} }
void CGameHandler::sendAndApply(CGarrisonOperationPack * pack) void CGameHandler::sendAndApply(CGarrisonOperationPack * pack)

View File

@ -65,42 +65,42 @@ public:
void apply(CPackForClient * pack) override void apply(CPackForClient * pack) override
{ {
gameState->apply(pack); gameState->apply(*pack);
} }
void apply(BattleLogMessage * pack) override void apply(BattleLogMessage * pack) override
{ {
gameState->apply(pack); gameState->apply(*pack);
} }
void apply(BattleStackMoved * pack) override void apply(BattleStackMoved * pack) override
{ {
gameState->apply(pack); gameState->apply(*pack);
} }
void apply(BattleUnitsChanged * pack) override void apply(BattleUnitsChanged * pack) override
{ {
gameState->apply(pack); gameState->apply(*pack);
} }
void apply(SetStackEffect * pack) override void apply(SetStackEffect * pack) override
{ {
gameState->apply(pack); gameState->apply(*pack);
} }
void apply(StacksInjured * pack) override void apply(StacksInjured * pack) override
{ {
gameState->apply(pack); gameState->apply(*pack);
} }
void apply(BattleObstaclesChanged * pack) override void apply(BattleObstaclesChanged * pack) override
{ {
gameState->apply(pack); gameState->apply(*pack);
} }
void apply(CatapultAttack * pack) override void apply(CatapultAttack * pack) override
{ {
gameState->apply(pack); gameState->apply(*pack);
} }
void complain(const std::string & problem) override void complain(const std::string & problem) override