MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / compareGameStates

Function compareGameStates

src/OpenLoco/src/GameSaveCompare.cpp:391–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389 }
390
391 static bool compareGameStates(S5::GameState& gameState1, S5::GameState& gameState2, bool displayAllDivergences)
392 {
393 if (displayAllDivergences)
394 {
395 Logging::info("display all divergences!");
396 }
397
398 bool foundDivergence = false;
399
400 foundDivergence |= isLoggedDivergence("rng", gameState1.general.rng, gameState2.general.rng, 2, displayAllDivergences);
401 foundDivergence |= isLoggedDivergence("unkRng", gameState1.general.unkRng, gameState2.general.unkRng, 2, displayAllDivergences);
402 foundDivergence |= isLoggedDivergentGameStateFlag("flags", gameState1.general.flags, gameState2.general.flags);
403 foundDivergence |= isLoggedDivergentGameStateField("currentDay", 0, gameState1.general.currentDay, gameState2.general.currentDay);
404 foundDivergence |= isLoggedDivergentGameStateField("dayCounter", 0, gameState1.general.dayCounter, gameState2.general.dayCounter);
405 foundDivergence |= isLoggedDivergentGameStateField("currentYear", 0, gameState1.general.currentYear, gameState2.general.currentYear);
406 foundDivergence |= isLoggedDivergentGameStateField("currentMonth", 0, gameState1.general.currentMonth, gameState2.general.currentMonth);
407 foundDivergence |= isLoggedDivergentGameStateField("currentDayOfMonth", 0, gameState1.general.currentDayOfMonth, gameState2.general.currentDayOfMonth);
408 foundDivergence |= isLoggedDivergentGameStateField("savedViewX", 0, gameState1.general.savedViewX, gameState2.general.savedViewX);
409 foundDivergence |= isLoggedDivergentGameStateField("savedViewY", 0, gameState1.general.savedViewY, gameState2.general.savedViewY);
410 foundDivergence |= isLoggedDivergentGameStateField("savedViewZoom", 0, gameState1.general.savedViewZoom, gameState2.general.savedViewZoom);
411 foundDivergence |= isLoggedDivergentGameStateField("savedViewRotation", 0, gameState1.general.savedViewRotation, gameState2.general.savedViewRotation);
412 foundDivergence |= isLoggedDivergence("playerCompanies", gameState1.general.playerCompanies, gameState2.general.playerCompanies, 2, displayAllDivergences);
413 foundDivergence |= isLoggedDivergence("entityListHeads", gameState1.general.entityListHeads, gameState2.general.entityListHeads, Limits::kNumEntityLists, displayAllDivergences);
414 foundDivergence |= isLoggedDivergence("entityListCounts", gameState1.general.entityListCounts, gameState2.general.entityListCounts, Limits::kNumEntityLists, displayAllDivergences);
415 foundDivergence |= isLoggedDivergence("pad_0042", gameState1.general.pad_0042, gameState2.general.pad_0042, 0x046 - 0x042, displayAllDivergences);
416 foundDivergence |= isLoggedDivergence("currencyMultiplicationFactor", gameState1.general.currencyMultiplicationFactor, gameState2.general.currencyMultiplicationFactor, 32, displayAllDivergences);
417 foundDivergence |= isLoggedDivergence("unusedCurrencyMultiplicationFactor[", gameState1.general.unusedCurrencyMultiplicationFactor, gameState2.general.unusedCurrencyMultiplicationFactor, 32, displayAllDivergences);
418 foundDivergence |= isLoggedDivergentGameStateField("scenarioTicks", 0, gameState1.general.scenarioTicks, gameState2.general.scenarioTicks);
419 foundDivergence |= isLoggedDivergentGameStateField("var_014A", 0, gameState1.general.var_014A, gameState2.general.var_014A);
420 foundDivergence |= isLoggedDivergentGameStateField("scenarioTicks2", 0, gameState1.general.scenarioTicks2, gameState2.general.scenarioTicks2);
421 foundDivergence |= isLoggedDivergentGameStateField("magicNumber", 0, gameState1.general.magicNumber, gameState2.general.magicNumber);
422 foundDivergence |= isLoggedDivergentGameStateField("numMapAnimations", 0, gameState1.general.numMapAnimations, gameState2.general.numMapAnimations);
423 foundDivergence |= isLoggedDivergence("tileUpdateStartLocation", reinterpret_cast<uint16_t(&)[2]>(gameState1.general.tileUpdateStartLocation), reinterpret_cast<uint16_t(&)[2]>(gameState2.general.tileUpdateStartLocation), 2, displayAllDivergences);
424 foundDivergence |= isLoggedDivergence("scenarioConstruction.signals", gameState1.general.scenarioConstruction.signals, gameState2.general.scenarioConstruction.signals, 8, displayAllDivergences);
425 foundDivergence |= isLoggedDivergence("scenarioConstruction.bridges", gameState1.general.scenarioConstruction.bridges, gameState2.general.scenarioConstruction.bridges, 8, displayAllDivergences);
426 foundDivergence |= isLoggedDivergence("scenarioConstruction.trainStations", gameState1.general.scenarioConstruction.trainStations, gameState2.general.scenarioConstruction.trainStations, 8, displayAllDivergences);
427 foundDivergence |= isLoggedDivergence("scenarioConstruction.trackMods", gameState1.general.scenarioConstruction.trackMods, gameState2.general.scenarioConstruction.trackMods, 8, displayAllDivergences);
428 foundDivergence |= isLoggedDivergence("scenarioConstruction.var_17A", gameState1.general.scenarioConstruction.var_17A, gameState2.general.scenarioConstruction.var_17A, 8, displayAllDivergences);
429 foundDivergence |= isLoggedDivergence("scenarioConstruction.roadStations", gameState1.general.scenarioConstruction.roadStations, gameState2.general.scenarioConstruction.roadStations, 8, displayAllDivergences);
430 foundDivergence |= isLoggedDivergence("scenarioConstruction.roadMods", gameState1.general.scenarioConstruction.roadMods, gameState2.general.scenarioConstruction.roadMods, 8, displayAllDivergences);
431 foundDivergence |= isLoggedDivergentGameStateField("lastRailroadOption", 0, gameState1.general.lastRailroadOption, gameState2.general.lastRailroadOption);
432 foundDivergence |= isLoggedDivergentGameStateField("lastRoadOption", 0, gameState1.general.lastRoadOption, gameState2.general.lastRoadOption);
433 foundDivergence |= isLoggedDivergentGameStateField("lastAirport", 0, gameState1.general.lastAirport, gameState2.general.lastAirport);
434 foundDivergence |= isLoggedDivergentGameStateField("lastShipPort", 0, gameState1.general.lastShipPort, gameState2.general.lastShipPort);
435 foundDivergence |= isLoggedDivergentGameStateField("trafficHandedness", 0, gameState1.general.trafficHandedness, gameState2.general.trafficHandedness);
436 foundDivergence |= isLoggedDivergentGameStateField("lastVehicleType", 0, gameState1.general.lastVehicleType, gameState2.general.lastVehicleType);
437 foundDivergence |= isLoggedDivergentGameStateField("pickupDirection", 0, gameState1.general.pickupDirection, gameState2.general.pickupDirection);
438 foundDivergence |= isLoggedDivergentGameStateField("lastTreeOption", 0, gameState1.general.lastTreeOption, gameState2.general.lastTreeOption);
439 foundDivergence |= isLoggedDivergentGameStateField("seaLevel", 0, gameState1.general.seaLevel, gameState2.general.seaLevel);
440 foundDivergence |= isLoggedDivergentGameStateField("currentSnowLine", 0, gameState1.general.currentSnowLine, gameState2.general.currentSnowLine);
441 foundDivergence |= isLoggedDivergentGameStateField("currentSeason", 0, gameState1.general.currentSeason, gameState2.general.currentSeason);
442 foundDivergence |= isLoggedDivergentGameStateField("lastLandOption", 0, gameState1.general.lastLandOption, gameState2.general.lastLandOption);
443 foundDivergence |= isLoggedDivergentGameStateField("maxCompetingCompanies", 0, gameState1.general.maxCompetingCompanies, gameState2.general.maxCompetingCompanies);
444 foundDivergence |= isLoggedDivergentGameStateField("orderTableLength", 0, gameState1.general.orderTableLength, gameState2.general.orderTableLength);
445 foundDivergence |= isLoggedDivergentGameStateField("roadObjectIdIsAnyRoadTypeCompatible", 0, gameState1.general.roadObjectIdIsAnyRoadTypeCompatible, gameState2.general.roadObjectIdIsAnyRoadTypeCompatible);
446 foundDivergence |= isLoggedDivergentGameStateField("roadObjectIdIsUsableByAllCompanies", 0, gameState1.general.roadObjectIdIsUsableByAllCompanies, gameState2.general.roadObjectIdIsUsableByAllCompanies);
447 foundDivergence |= isLoggedDivergentGameStateField("currentDefaultLevelCrossingType", 0, gameState1.general.currentDefaultLevelCrossingType, gameState2.general.currentDefaultLevelCrossingType);
448 foundDivergence |= isLoggedDivergentGameStateField("lastTrackTypeOption", 0, gameState1.general.lastTrackTypeOption, gameState2.general.lastTrackTypeOption);

Callers 2

simulateFunction · 0.85
compareFunction · 0.85

Calls 12

infoFunction · 0.85
isLoggedDivergenceFunction · 0.85
logDivergentEntityFunction · 0.85
exportGameStateToFileFunction · 0.85
errorFunction · 0.85
loadSaveFunction · 0.85
compareElementsFunction · 0.85
setPositionMethod · 0.45

Tested by

no test coverage detected