Minor fixing
This commit is contained in:
1 parent
6cfd47e80d
commit
24c963c0a5
11 files changed
+125
-67
No files matched your search
@@ -23,12 +23,12 @@ int main()
|
||||
const nlohmann::json original{
|
||||
{"schemaVersion", 2},
|
||||
{"campaignId", "battle_zone_multiplayer"},
|
||||
{"players", {{"player", {{"hp", 200.0}}}}},
|
||||
{"locations", {{"uni_exterior", {{"state", savedLocationState}}}}}
|
||||
{"players", {{"player1", {{"hp", 200.0}}}}},
|
||||
{"locations", {{"park_korea", {{"state", savedLocationState}}}}}
|
||||
};
|
||||
FRG::InitialStateMessage initial;
|
||||
initial.state = original;
|
||||
initial.assignedPlayerId = "player";
|
||||
initial.assignedPlayerId = "player1";
|
||||
initial.snapshotTick = 42;
|
||||
initial.compatibilityFingerprint = "lockstep-v2:battle_zone_multiplayer";
|
||||
const std::string message = FRG::makeInitialStateMessage(initial);
|
||||
@@ -40,11 +40,11 @@ int main()
|
||||
require(parsed.state == original, "state payload did not round trip");
|
||||
require(parsed.snapshotTick == 42, "snapshot tick did not round trip");
|
||||
require(
|
||||
parsed.assignedPlayerId == "player",
|
||||
parsed.assignedPlayerId == "player1",
|
||||
"assigned player did not round trip");
|
||||
require(
|
||||
!parsed.state["locations"]["uni_exterior"]["state"].contains("cameraAzimuth") &&
|
||||
!parsed.state["locations"]["uni_exterior"]["state"].contains("cameraInclination"),
|
||||
!parsed.state["locations"]["park_korea"]["state"].contains("cameraAzimuth") &&
|
||||
!parsed.state["locations"]["park_korea"]["state"].contains("cameraInclination"),
|
||||
"local camera state leaked into the network payload");
|
||||
|
||||
FRG::DestinationInputMessage input;
|
||||
@@ -87,11 +87,11 @@ int main()
|
||||
FRG::TickMessage tick;
|
||||
tick.tickId = 43;
|
||||
tick.commands.push_back(FRG::ScheduledDestinationCommand{
|
||||
1, "player", parsedInput.target});
|
||||
1, "player1", parsedInput.target});
|
||||
tick.commands.push_back(FRG::ScheduledCharacterEnabledCommand{
|
||||
2, "uni_exterior", "player2", true});
|
||||
2, "park_korea", "player2", true});
|
||||
tick.commands.push_back(FRG::ScheduledCharacterActionCommand{
|
||||
3, "player", "set_target", "hostile_npc"});
|
||||
3, "player1", "set_target", "hostile_npc"});
|
||||
tick.stateHash = "0123456789abcdef";
|
||||
FRG::TickMessage parsedTick;
|
||||
require(
|
||||
@@ -147,9 +147,9 @@ int main()
|
||||
|
||||
FRG::LockstepTimeline timeline(2);
|
||||
const std::uint64_t firstSequence =
|
||||
timeline.schedule("player", Eigen::Vector3f(1.f, 0.f, 1.f));
|
||||
timeline.schedule("player1", Eigen::Vector3f(1.f, 0.f, 1.f));
|
||||
const std::uint64_t secondSequence =
|
||||
timeline.schedule("player_2", Eigen::Vector3f(2.f, 0.f, 2.f));
|
||||
timeline.schedule("player2", Eigen::Vector3f(2.f, 0.f, 2.f));
|
||||
const FRG::TickMessage emptyTick = timeline.advance();
|
||||
require(
|
||||
emptyTick.tickId == 1 && emptyTick.commands.empty(),
|
||||
@@ -163,8 +163,8 @@ int main()
|
||||
commandTick.commands[1]).commandSequence == secondSequence,
|
||||
"scheduled commands were not finalized in stable order");
|
||||
|
||||
timeline.scheduleCharacterEnabled("uni_exterior", "player2", true);
|
||||
timeline.scheduleCharacterAction("player", "clear_attack_target");
|
||||
timeline.scheduleCharacterEnabled("park_korea", "player2", true);
|
||||
timeline.scheduleCharacterAction("player1", "clear_attack_target");
|
||||
const FRG::TickMessage presenceTick = timeline.advance();
|
||||
require(
|
||||
presenceTick.commands.size() == 1 &&
|
||||
|
||||
Reference in new issue
Block a user