Compare commits

...
Author SHA1 Message Date
admin 804bb0b059 fix build 2025-07-15 06:41:05 -07:00
admin 833c6a5cf6 remove one mutation 2025-07-14 17:36:17 -07:00
5 changed files with 7 additions and 7 deletions
@@ -97,7 +97,7 @@ void ShardokEngine::ApplyAndAddActionResults(const vector<ActionResultProto> &re
}
void ShardokEngine::ApplyAndAddActionResult(const ActionResultProto &result) {
MutatingApplyResult(gameState, result, settingsGetter);
gameState = ApplyResult(std::move(gameState), result, settingsGetter);
if (trackHistory) {
actionHistory.emplace_back();
@@ -168,13 +168,11 @@ void MutatingAddUnits(GameStateW &mutatingState, const ActionResultProto &result
}
auto ApplyResult(
const GameStateW &startingState,
GameStateW startingState,
const ActionResultProto &result,
const SettingsGetter &settings) -> GameStateW {
auto endGS = startingState;
MutatingApplyResult(endGS, result, settings);
return endGS;
MutatingApplyResult(startingState, result, settings);
return startingState;
}
void MutatingApplyResult(
@@ -26,7 +26,7 @@ void MutatingApplyResult(
const ActionResultProto& actionResult,
const SettingsGetter& settings);
auto ApplyResult(
const GameStateW& startingState,
GameStateW startingState,
const ActionResultProto& actionResult,
const SettingsGetter& settings) -> GameStateW;
auto ApplyResults(
@@ -425,6 +425,7 @@ cc_library(
deps = [
"//src/main/cpp/net/eagle0/shardok/library:battalion_type",
"//src/main/cpp/net/eagle0/shardok/library:shardok_command",
"//src/main/cpp/net/eagle0/shardok/library/action_result_applier",
"//src/main/cpp/net/eagle0/shardok/library/actions:defensive_ambush_action",
"//src/main/cpp/net/eagle0/shardok/library/settings:game_settings",
"//src/main/cpp/net/eagle0/shardok/library/unit",
@@ -6,6 +6,7 @@
#include <utility>
#include "src/main/cpp/net/eagle0/shardok/library/action_result_applier/ActionResultApplier.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/actions/DefensiveAmbushAction.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/unit/Unit.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/util/ActionResultFlatbufferHelpers.hpp"