2018-06-15 14:07:34 +02:00
|
|
|
/*****************************************************************************
|
2023-01-01 11:58:01 +01:00
|
|
|
* Copyright (c) 2014-2023 OpenRCT2 developers
|
2018-06-15 14:07:34 +02:00
|
|
|
*
|
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
|
|
|
*
|
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2018-06-22 22:29:03 +02:00
|
|
|
#include "TestData.h"
|
|
|
|
|
2017-06-21 18:39:10 +02:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <openrct2/Context.h>
|
2018-06-22 22:29:03 +02:00
|
|
|
#include <openrct2/Game.h>
|
2017-08-27 22:40:56 +02:00
|
|
|
#include <openrct2/GameState.h>
|
2017-06-21 18:39:10 +02:00
|
|
|
#include <openrct2/OpenRCT2.h>
|
2017-08-02 23:48:10 +02:00
|
|
|
#include <openrct2/ParkImporter.h>
|
2018-06-22 22:29:03 +02:00
|
|
|
#include <openrct2/audio/AudioContext.h>
|
|
|
|
#include <openrct2/core/File.h>
|
|
|
|
#include <openrct2/core/Path.hpp>
|
|
|
|
#include <openrct2/core/String.hpp>
|
2022-02-18 21:57:00 +01:00
|
|
|
#include <openrct2/platform/Platform.h>
|
2018-06-22 22:29:03 +02:00
|
|
|
#include <openrct2/ride/Ride.h>
|
|
|
|
#include <string>
|
2017-06-21 18:39:10 +02:00
|
|
|
|
|
|
|
using namespace OpenRCT2;
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
constexpr int32_t updatesToTest = 10;
|
2017-08-27 22:40:56 +02:00
|
|
|
|
2017-06-21 18:39:10 +02:00
|
|
|
TEST(MultiLaunchTest, all)
|
|
|
|
{
|
|
|
|
std::string path = TestData::GetParkPath("bpb.sv6");
|
|
|
|
|
|
|
|
gOpenRCT2Headless = true;
|
2018-04-10 13:33:37 +02:00
|
|
|
gOpenRCT2NoGraphics = true;
|
2017-06-21 18:39:10 +02:00
|
|
|
|
2017-06-24 09:54:24 +02:00
|
|
|
for (int i = 0; i < 3; i++)
|
2017-06-21 18:39:10 +02:00
|
|
|
{
|
|
|
|
auto context = CreateContext();
|
|
|
|
bool initialised = context->Initialise();
|
|
|
|
ASSERT_TRUE(initialised);
|
|
|
|
|
2022-10-08 19:27:47 +02:00
|
|
|
GetContext()->LoadParkFromFile(path);
|
2023-01-17 13:24:51 +01:00
|
|
|
GameLoadInit();
|
2017-06-21 18:39:10 +02:00
|
|
|
|
|
|
|
// Check ride count to check load was successful
|
2023-01-17 01:32:54 +01:00
|
|
|
ASSERT_EQ(RideGetCount(), 134);
|
2017-08-27 22:40:56 +02:00
|
|
|
auto gs = context->GetGameState();
|
|
|
|
ASSERT_NE(gs, nullptr);
|
2023-04-02 10:25:41 +02:00
|
|
|
|
2018-05-30 14:06:39 +02:00
|
|
|
auto& date = gs->GetDate();
|
2023-04-02 10:25:41 +02:00
|
|
|
// NOTE: This value is saved in the SV6 file, after the import this will be the current state.
|
|
|
|
// In case the save file gets replaced this needs to be adjusted.
|
|
|
|
ASSERT_EQ(date.GetMonthTicks(), 0x1e98);
|
2017-06-21 18:39:10 +02:00
|
|
|
|
2017-08-27 22:40:56 +02:00
|
|
|
for (int j = 0; j < updatesToTest; j++)
|
2017-08-02 00:52:33 +02:00
|
|
|
{
|
2017-08-27 22:40:56 +02:00
|
|
|
gs->UpdateLogic();
|
2017-08-02 00:52:33 +02:00
|
|
|
}
|
|
|
|
|
2018-05-30 14:06:39 +02:00
|
|
|
ASSERT_EQ(date.GetMonthTicks(), 7862 + updatesToTest);
|
2017-08-27 22:40:56 +02:00
|
|
|
|
2017-08-02 23:50:49 +02:00
|
|
|
// Check ride count again
|
2023-01-17 01:32:54 +01:00
|
|
|
ASSERT_EQ(RideGetCount(), 134);
|
2017-06-21 18:39:10 +02:00
|
|
|
}
|
|
|
|
SUCCEED();
|
|
|
|
}
|