From d0606d2dc9e34687597dcb829e471a8ca140a2c9 Mon Sep 17 00:00:00 2001 From: Ivan Savenko <saven.ivan@gmail.com> Date: Mon, 7 Oct 2024 13:25:39 +0000 Subject: [PATCH] Fix scripting build --- CCallback.cpp | 8 ++++---- scripting/lua/api/ServerCb.cpp | 4 ++-- server/CGameHandler.cpp | 4 ++-- test/scripting/LuaSpellEffectAPITest.cpp | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CCallback.cpp b/CCallback.cpp index 77bf4d72c..02f6d7a2d 100644 --- a/CCallback.cpp +++ b/CCallback.cpp @@ -195,19 +195,19 @@ void CCallback::scrollBackpackArtifacts(ObjectInstanceID hero, bool left) void CCallback::sortBackpackArtifactsBySlot(const ObjectInstanceID hero) { ManageBackpackArtifacts mba(hero, ManageBackpackArtifacts::ManageCmd::SORT_BY_SLOT); - sendRequest(&mba); + sendRequest(mba); } void CCallback::sortBackpackArtifactsByCost(const ObjectInstanceID hero) { ManageBackpackArtifacts mba(hero, ManageBackpackArtifacts::ManageCmd::SORT_BY_COST); - sendRequest(&mba); + sendRequest(mba); } void CCallback::sortBackpackArtifactsByClass(const ObjectInstanceID hero) { ManageBackpackArtifacts mba(hero, ManageBackpackArtifacts::ManageCmd::SORT_BY_CLASS); - sendRequest(&mba); + sendRequest(mba); } void CCallback::manageHeroCostume(ObjectInstanceID hero, size_t costumeIndex, bool saveCostume) @@ -270,7 +270,7 @@ int CBattleCallback::sendRequest(const CPackForServer & request) void CCallback::spellResearch( const CGTownInstance *town, SpellID spellAtSlot, bool accepted ) { SpellResearch pack(town->id, spellAtSlot, accepted); - sendRequest(&pack); + sendRequest(pack); } void CCallback::swapGarrisonHero( const CGTownInstance *town ) diff --git a/scripting/lua/api/ServerCb.cpp b/scripting/lua/api/ServerCb.cpp index aa257c6e9..445f19a0b 100644 --- a/scripting/lua/api/ServerCb.cpp +++ b/scripting/lua/api/ServerCb.cpp @@ -74,7 +74,7 @@ int ServerCbProxy::commitPackage(lua_State * L) auto * pack = static_cast<CPackForClient *>(lua_touserdata(L, 1)); - object->apply(pack); + object->apply(*pack); return S.retVoid(); } @@ -96,7 +96,7 @@ int ServerCbProxy::apply(lua_State * L) if(!S.tryGet(1, pack)) return S.retVoid(); - object->apply(pack.get()); + object->apply(*pack); return S.retVoid(); } diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 3afbcb779..c2505b29e 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -452,7 +452,7 @@ void CGameHandler::handleClientDisconnection(std::shared_ptr<CConnection> c) out.text.appendTextID("vcmi.server.errors.playerLeft"); out.text.replaceName(playerId); out.components.emplace_back(ComponentType::FLAG, playerId); - sendAndApply(&out); + sendAndApply(out); } } } @@ -1259,7 +1259,7 @@ void CGameHandler::setResearchedSpells(const CGTownInstance * town, int level, c cs.spells = spells; cs.level = level; cs.accepted = accepted; - sendAndApply(&cs); + sendAndApply(cs); } void CGameHandler::giveHeroBonus(GiveBonus * bonus) diff --git a/test/scripting/LuaSpellEffectAPITest.cpp b/test/scripting/LuaSpellEffectAPITest.cpp index a144485a3..f9c4a1b7d 100644 --- a/test/scripting/LuaSpellEffectAPITest.cpp +++ b/test/scripting/LuaSpellEffectAPITest.cpp @@ -157,18 +157,18 @@ TEST_F(LuaSpellEffectAPITest, DISABLED_ApplyMoveUnit) BattleStackMoved expected; BattleStackMoved actual; - auto checkMove = [&](BattleStackMoved * pack) + auto checkMove = [&](BattleStackMoved & pack) { - EXPECT_EQ(pack->stack, 42); - EXPECT_EQ(pack->teleporting, true); - EXPECT_EQ(pack->distance, 0); + EXPECT_EQ(pack.stack, 42); + EXPECT_EQ(pack.teleporting, true); + EXPECT_EQ(pack.distance, 0); std::vector<BattleHex> toMove(1, hex2); - EXPECT_EQ(pack->tilesToMove, toMove); + EXPECT_EQ(pack.tilesToMove, toMove); }; - EXPECT_CALL(serverMock, apply(Matcher<BattleStackMoved *>(_))).WillOnce(Invoke(checkMove)); + EXPECT_CALL(serverMock, apply(Matcher<BattleStackMoved &>(_))).WillOnce(Invoke(checkMove)); context->callGlobal(&serverMock, "apply", params); }