mirror of https://github.com/OpenRCT2/OpenRCT2.git
commit
fc2773d68f
|
@ -1692,7 +1692,6 @@
|
|||
F76C838E1EC4E7CC00FA49E2 /* Nullable.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Nullable.hpp; sourceTree = "<group>"; };
|
||||
F76C838F1EC4E7CC00FA49E2 /* Path.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Path.cpp; sourceTree = "<group>"; };
|
||||
F76C83901EC4E7CC00FA49E2 /* Path.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Path.hpp; sourceTree = "<group>"; };
|
||||
F76C83911EC4E7CC00FA49E2 /* Registration.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Registration.hpp; sourceTree = "<group>"; };
|
||||
F76C83921EC4E7CC00FA49E2 /* String.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = String.cpp; sourceTree = "<group>"; };
|
||||
F76C83931EC4E7CC00FA49E2 /* String.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = String.hpp; sourceTree = "<group>"; };
|
||||
F76C83941EC4E7CC00FA49E2 /* StringBuilder.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = StringBuilder.hpp; sourceTree = "<group>"; };
|
||||
|
@ -2838,7 +2837,6 @@
|
|||
F76C838F1EC4E7CC00FA49E2 /* Path.cpp */,
|
||||
F76C83901EC4E7CC00FA49E2 /* Path.hpp */,
|
||||
2ADE2F21224418B1002598AF /* Random.hpp */,
|
||||
F76C83911EC4E7CC00FA49E2 /* Registration.hpp */,
|
||||
F76C83921EC4E7CC00FA49E2 /* String.cpp */,
|
||||
F76C83931EC4E7CC00FA49E2 /* String.hpp */,
|
||||
F76C83941EC4E7CC00FA49E2 /* StringBuilder.hpp */,
|
||||
|
|
|
@ -167,6 +167,5 @@ void keyboard_shortcuts_format_string(char* buffer, size_t bufferSize, int32_t s
|
|||
|
||||
void keyboard_shortcut_handle(int32_t key);
|
||||
void keyboard_shortcut_handle_command(OpenRCT2::Input::Shortcut shortcut);
|
||||
void keyboard_shortcut_format_string(char* buffer, size_t size, uint16_t shortcutKey);
|
||||
|
||||
ScreenCoordsXY get_keyboard_map_scroll(const uint8_t* keysState);
|
||||
|
|
|
@ -259,7 +259,6 @@ void context_force_close_window_by_class(rct_windowclass wc);
|
|||
void context_update_map_tooltip();
|
||||
void context_handle_input();
|
||||
void context_input_handle_keyboard(bool isTitle);
|
||||
bool context_read_bmp(void** outPixels, uint32_t* outWidth, uint32_t* outHeight, const utf8* path);
|
||||
void context_quit();
|
||||
const utf8* context_get_path_legacy(int32_t pathId);
|
||||
bool context_load_park_from_file(const utf8* path);
|
||||
|
|
|
@ -437,12 +437,12 @@ utf8* IIniReader::GetCString(const std::string& name, const utf8* defaultValue)
|
|||
return String::Duplicate(szValue.c_str());
|
||||
}
|
||||
|
||||
IIniReader* CreateIniReader(OpenRCT2::IStream* stream)
|
||||
std::unique_ptr<IIniReader> CreateIniReader(OpenRCT2::IStream* stream)
|
||||
{
|
||||
return new IniReader(stream);
|
||||
return std::make_unique<IniReader>(stream);
|
||||
}
|
||||
|
||||
IIniReader* CreateDefaultIniReader()
|
||||
std::unique_ptr<IIniReader> CreateDefaultIniReader()
|
||||
{
|
||||
return new DefaultIniReader();
|
||||
return std::make_unique<DefaultIniReader>();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace OpenRCT2
|
||||
|
@ -47,5 +48,5 @@ struct IIniReader
|
|||
utf8* GetCString(const std::string& name, const utf8* defaultValue) const;
|
||||
};
|
||||
|
||||
IIniReader* CreateIniReader(OpenRCT2::IStream* stream);
|
||||
IIniReader* CreateDefaultIniReader();
|
||||
std::unique_ptr<IIniReader> CreateIniReader(OpenRCT2::IStream* stream);
|
||||
std::unique_ptr<IIniReader> CreateDefaultIniReader();
|
||||
|
|
|
@ -103,7 +103,7 @@ void IIniWriter::WriteString(const std::string& name, const utf8* value)
|
|||
WriteString(name, String::ToStd(value));
|
||||
}
|
||||
|
||||
IIniWriter* CreateIniWriter(OpenRCT2::IStream* stream)
|
||||
std::unique_ptr<IIniWriter> CreateIniWriter(OpenRCT2::IStream* stream)
|
||||
{
|
||||
return new IniWriter(stream);
|
||||
return std::make_unique<IniWriter>(stream);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace OpenRCT2
|
||||
|
@ -51,4 +52,4 @@ struct IIniWriter
|
|||
void WriteString(const std::string& name, const utf8* value);
|
||||
};
|
||||
|
||||
IIniWriter* CreateIniWriter(OpenRCT2::IStream* stream);
|
||||
std::unique_ptr<IIniWriter> CreateIniWriter(OpenRCT2::IStream* stream);
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2020 OpenRCT2 developers
|
||||
*
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
/**
|
||||
* Represents a registration of some service which when deleted will be
|
||||
* unregistered.
|
||||
*/
|
||||
struct IRegistration
|
||||
{
|
||||
virtual ~IRegistration() = default;
|
||||
};
|
||||
|
||||
class Registration
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* Class which can wrap a function in an IRegistration.
|
||||
*/
|
||||
template<typename T> struct CallbackRegistration : public IRegistration
|
||||
{
|
||||
private:
|
||||
T _callback;
|
||||
|
||||
public:
|
||||
CallbackRegistration(T callback)
|
||||
: _callback(callback)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~CallbackRegistration() override
|
||||
{
|
||||
_callback();
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a new IRegistration which when deleted, calls the given
|
||||
* function.
|
||||
*/
|
||||
template<typename T> static IRegistration* Create(T unregisterCallback)
|
||||
{
|
||||
return new CallbackRegistration<T>(unregisterCallback);
|
||||
}
|
||||
};
|
||||
} // namespace OpenRCT2
|
|
@ -175,7 +175,6 @@
|
|||
<ClInclude Include="core\Numerics.hpp" />
|
||||
<ClInclude Include="core\Path.hpp" />
|
||||
<ClInclude Include="core\Random.hpp" />
|
||||
<ClInclude Include="core\Registration.hpp" />
|
||||
<ClInclude Include="core\String.hpp" />
|
||||
<ClInclude Include="core\StringBuilder.hpp" />
|
||||
<ClInclude Include="core\StringReader.hpp" />
|
||||
|
@ -771,4 +770,4 @@
|
|||
<ClCompile Include="world\Wall.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
</Project>
|
|
@ -246,8 +246,6 @@ namespace News
|
|||
uint16_t IncrementTicks();
|
||||
News::Item& Current();
|
||||
const News::Item& Current() const;
|
||||
News::Item& Oldest();
|
||||
const News::Item& Oldest() const;
|
||||
bool CurrentShouldBeArchived() const;
|
||||
void ArchiveCurrent();
|
||||
News::Item* FirstOpenOrNewSlot();
|
||||
|
@ -278,7 +276,6 @@ namespace News
|
|||
|
||||
private:
|
||||
int32_t RemoveTime() const;
|
||||
void AppendToArchive(News::Item& item);
|
||||
|
||||
News::ItemQueue<News::ItemHistoryStart> Recent;
|
||||
News::ItemQueue<News::MaxItemsArchive> Archived;
|
||||
|
|
|
@ -1046,8 +1046,6 @@ void peep_applause();
|
|||
void peep_thought_set_format_args(const rct_peep_thought* thought, Formatter& ft);
|
||||
int32_t get_peep_face_sprite_small(Peep* peep);
|
||||
int32_t get_peep_face_sprite_large(Peep* peep);
|
||||
void game_command_pickup_guest(
|
||||
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
|
||||
void peep_sprite_remove(Peep* peep);
|
||||
|
||||
void peep_window_state_update(Peep* peep);
|
||||
|
@ -1056,7 +1054,6 @@ void peep_decrement_num_riders(Peep* peep);
|
|||
void peep_set_map_tooltip(Peep* peep);
|
||||
int32_t peep_compare(const uint16_t sprite_index_a, const uint16_t sprite_index_b);
|
||||
|
||||
void SwitchToSpecialSprite(Peep* peep, uint8_t special_sprite_id);
|
||||
void peep_update_names(bool realNames);
|
||||
|
||||
void guest_set_name(uint16_t spriteIndex, const char* name);
|
||||
|
|
|
@ -1036,7 +1036,6 @@ ride_id_t GetNextFreeRideId();
|
|||
Ride* GetOrAllocateRide(ride_id_t index);
|
||||
rct_ride_entry* get_ride_entry(ObjectEntryIndex index);
|
||||
std::string_view get_ride_entry_name(ObjectEntryIndex index);
|
||||
RideMeasurement* get_ride_measurement(int32_t index);
|
||||
|
||||
extern money16 gTotalRideValueForMoney;
|
||||
|
||||
|
@ -1083,7 +1082,6 @@ extern bool gGotoStartPlacementMode;
|
|||
|
||||
extern uint8_t gLastEntranceStyle;
|
||||
|
||||
ride_id_t ride_get_empty_slot();
|
||||
int32_t ride_get_count();
|
||||
void ride_init_all();
|
||||
void reset_all_ride_build_dates();
|
||||
|
|
|
@ -452,15 +452,7 @@ bool scenario_create_ducks();
|
|||
|
||||
const random_engine_t::state_type& scenario_rand_state();
|
||||
void scenario_rand_seed(random_engine_t::result_type s0, random_engine_t::result_type s1);
|
||||
#ifdef DEBUG_DESYNC
|
||||
uint32_t dbg_scenario_rand(const char* file, const char* function, const uint32_t line, const void* data);
|
||||
# define scenario_rand() dbg_scenario_rand(__FILE__, __FUNCTION__, __LINE__, NULL)
|
||||
# define scenario_rand_data(data) dbg_scenario_rand(__FILE__, __FUNCTION__, __LINE__, data)
|
||||
void dbg_report_desync(uint32_t tick, uint32_t srand0, uint32_t server_srand0, const char* clientHash, const char* serverHash);
|
||||
#else
|
||||
random_engine_t::result_type scenario_rand();
|
||||
#endif
|
||||
|
||||
uint32_t scenario_rand_max(uint32_t max);
|
||||
|
||||
bool scenario_prepare_for_save();
|
||||
|
|
|
@ -178,8 +178,6 @@ extern const CoordsXY BinUseOffsets[NumOrthogonalDirections];
|
|||
extern const CoordsXY BenchUseOffsets[NumOrthogonalDirections * 2];
|
||||
|
||||
TileElement* map_get_footpath_element(const CoordsXYZ& coords);
|
||||
struct PathElement;
|
||||
PathElement* map_get_footpath_element_slope(const CoordsXYZ& footpathPos, int32_t slope);
|
||||
void footpath_interrupt_peeps(const CoordsXYZ& footpathPos);
|
||||
money32 footpath_remove(const CoordsXYZ& footpathLoc, int32_t flags);
|
||||
money32 footpath_provisional_set(int32_t type, const CoordsXYZ& footpathLoc, int32_t slope);
|
||||
|
|
|
@ -38,7 +38,6 @@ struct mapgen_settings
|
|||
|
||||
void mapgen_generate_blank(mapgen_settings* settings);
|
||||
void mapgen_generate(mapgen_settings* settings);
|
||||
void mapgen_generate_custom_simplex(mapgen_settings* settings);
|
||||
bool mapgen_load_heightmap(const utf8* path);
|
||||
void mapgen_unload_heightmap();
|
||||
void mapgen_generate_from_heightmap(mapgen_settings* settings);
|
||||
|
|
|
@ -255,7 +255,6 @@ void balloon_update(Balloon* balloon);
|
|||
// Duck
|
||||
///////////////////////////////////////////////////////////////
|
||||
void create_duck(const CoordsXY& pos);
|
||||
void duck_update(Duck* duck);
|
||||
void duck_press(Duck* duck);
|
||||
void duck_remove_all();
|
||||
|
||||
|
@ -263,9 +262,7 @@ void duck_remove_all();
|
|||
// Crash particles
|
||||
///////////////////////////////////////////////////////////////
|
||||
void crashed_vehicle_particle_create(rct_vehicle_colour colours, const CoordsXYZ& vehiclePos);
|
||||
void crashed_vehicle_particle_update(VehicleCrashParticle* particle);
|
||||
void crash_splash_create(const CoordsXYZ& splashPos);
|
||||
void crash_splash_update(CrashSplashParticle* splash);
|
||||
|
||||
rct_sprite_checksum sprite_checksum();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ TEST_F(IniReaderTest, create_empty)
|
|||
OpenRCT2::MemoryStream ms(0);
|
||||
ASSERT_EQ(ms.CanRead(), true);
|
||||
ASSERT_EQ(ms.CanWrite(), true);
|
||||
IIniReader* ir = CreateIniReader(&ms);
|
||||
auto ir = CreateIniReader(&ms);
|
||||
ASSERT_NE(ir, nullptr);
|
||||
ASSERT_EQ(ir->GetBoolean("nobody", true), true);
|
||||
ASSERT_EQ(ir->GetCString("expects", nullptr), nullptr);
|
||||
|
@ -41,7 +41,6 @@ TEST_F(IniReaderTest, create_empty)
|
|||
ASSERT_EQ(ir->GetInt32("universal_answer", 42), 42);
|
||||
ASSERT_EQ(
|
||||
ir->GetInt64("heat_death_of_the_universe", std::numeric_limits<int64_t>::max()), std::numeric_limits<int64_t>::max());
|
||||
delete ir;
|
||||
}
|
||||
|
||||
TEST_F(IniReaderTest, read_prepared)
|
||||
|
@ -49,7 +48,7 @@ TEST_F(IniReaderTest, read_prepared)
|
|||
OpenRCT2::MemoryStream ms(predefined.c_str(), predefined.size());
|
||||
ASSERT_EQ(ms.CanRead(), true);
|
||||
ASSERT_EQ(ms.CanWrite(), false);
|
||||
IIniReader* ir = CreateIniReader(&ms);
|
||||
auto ir = CreateIniReader(&ms);
|
||||
ASSERT_NE(ir, nullptr);
|
||||
ASSERT_EQ(ir->ReadSection("doesnt_exist"), false);
|
||||
ASSERT_EQ(ir->ReadSection("bool"), true);
|
||||
|
@ -71,7 +70,6 @@ TEST_F(IniReaderTest, read_prepared)
|
|||
// go back a section
|
||||
ASSERT_EQ(ir->ReadSection("int"), true);
|
||||
ASSERT_EQ(ir->GetInt32("one", 42), 1);
|
||||
delete ir;
|
||||
}
|
||||
|
||||
TEST_F(IniReaderTest, read_duplicate)
|
||||
|
@ -79,7 +77,7 @@ TEST_F(IniReaderTest, read_duplicate)
|
|||
OpenRCT2::MemoryStream ms(duplicate.c_str(), duplicate.size());
|
||||
ASSERT_EQ(ms.CanRead(), true);
|
||||
ASSERT_EQ(ms.CanWrite(), false);
|
||||
IIniReader* ir = CreateIniReader(&ms);
|
||||
auto ir = CreateIniReader(&ms);
|
||||
ASSERT_NE(ir, nullptr);
|
||||
// there should only be data from the last section
|
||||
ASSERT_EQ(ir->ReadSection("section"), true);
|
||||
|
@ -97,7 +95,6 @@ TEST_F(IniReaderTest, read_duplicate)
|
|||
ASSERT_EQ(ir->ReadSection("section"), true);
|
||||
// test 4 times, there are only 3 sections
|
||||
ASSERT_EQ(ir->ReadSection("section"), true);
|
||||
delete ir;
|
||||
}
|
||||
|
||||
TEST_F(IniReaderTest, read_untrimmed)
|
||||
|
@ -105,7 +102,7 @@ TEST_F(IniReaderTest, read_untrimmed)
|
|||
OpenRCT2::MemoryStream ms(untrimmed.c_str(), untrimmed.size());
|
||||
ASSERT_EQ(ms.CanRead(), true);
|
||||
ASSERT_EQ(ms.CanWrite(), false);
|
||||
IIniReader* ir = CreateIniReader(&ms);
|
||||
auto ir = CreateIniReader(&ms);
|
||||
ASSERT_NE(ir, nullptr);
|
||||
// there should only be data from the last section
|
||||
ASSERT_EQ(ir->ReadSection("section"), true);
|
||||
|
@ -115,7 +112,6 @@ TEST_F(IniReaderTest, read_untrimmed)
|
|||
Memory::Free(str);
|
||||
ASSERT_EQ(ir->GetString("str", "yyy"), " xxx ");
|
||||
ASSERT_EQ(ir->GetString("nosuchthing", " yyy "), " yyy ");
|
||||
delete ir;
|
||||
}
|
||||
|
||||
TEST_F(IniReaderTest, read_case_insensitive)
|
||||
|
@ -123,12 +119,11 @@ TEST_F(IniReaderTest, read_case_insensitive)
|
|||
OpenRCT2::MemoryStream ms(caseInsensitive.c_str(), caseInsensitive.size());
|
||||
ASSERT_EQ(ms.CanRead(), true);
|
||||
ASSERT_EQ(ms.CanWrite(), false);
|
||||
IIniReader* ir = CreateIniReader(&ms);
|
||||
auto ir = CreateIniReader(&ms);
|
||||
ASSERT_NE(ir, nullptr);
|
||||
ASSERT_EQ(ir->ReadSection("section"), true);
|
||||
ASSERT_EQ(ir->GetString("foo", "yyy"), "bar");
|
||||
ASSERT_EQ(ir->ReadSection("SeCtIoN"), true);
|
||||
delete ir;
|
||||
}
|
||||
|
||||
const std::string IniReaderTest::predefined = "[bool]\n"
|
||||
|
|
|
@ -29,15 +29,14 @@ TEST_F(IniWriterTest, create_empty)
|
|||
OpenRCT2::MemoryStream ms(0);
|
||||
ASSERT_EQ(ms.CanRead(), true);
|
||||
ASSERT_EQ(ms.CanWrite(), true);
|
||||
IIniWriter* iw = CreateIniWriter(&ms);
|
||||
auto iw = CreateIniWriter(&ms);
|
||||
ASSERT_NE(iw, nullptr);
|
||||
delete iw;
|
||||
}
|
||||
|
||||
TEST_F(IniWriterTest, create_one_section)
|
||||
{
|
||||
OpenRCT2::MemoryStream ms(1000);
|
||||
IIniWriter* iw = CreateIniWriter(&ms);
|
||||
auto iw = CreateIniWriter(&ms);
|
||||
ASSERT_NE(iw, nullptr);
|
||||
iw->WriteSection("OpenRCT2");
|
||||
uint8_t null_terminator = 0;
|
||||
|
@ -49,13 +48,12 @@ TEST_F(IniWriterTest, create_one_section)
|
|||
const char* ini = reinterpret_cast<const char*>(ms.ReadString());
|
||||
ASSERT_STREQ(ini, "[OpenRCT2]" PLATFORM_NEWLINE);
|
||||
Memory::Free(ini);
|
||||
delete iw;
|
||||
}
|
||||
|
||||
TEST_F(IniWriterTest, create_multiple_sections)
|
||||
{
|
||||
OpenRCT2::MemoryStream ms(1000);
|
||||
IIniWriter* iw = CreateIniWriter(&ms);
|
||||
auto iw = CreateIniWriter(&ms);
|
||||
ASSERT_NE(iw, nullptr);
|
||||
iw->WriteSection("OpenRCT1");
|
||||
iw->WriteSection("OpenRCT2");
|
||||
|
@ -73,13 +71,12 @@ TEST_F(IniWriterTest, create_multiple_sections)
|
|||
"[OpenRCT1]" PLATFORM_NEWLINE PLATFORM_NEWLINE "[OpenRCT2]" PLATFORM_NEWLINE PLATFORM_NEWLINE
|
||||
"[OpenRCT3]" PLATFORM_NEWLINE PLATFORM_NEWLINE "[OpenRCT4]" PLATFORM_NEWLINE);
|
||||
Memory::Free(ini);
|
||||
delete iw;
|
||||
}
|
||||
|
||||
TEST_F(IniWriterTest, create_loose_bool_entry)
|
||||
{
|
||||
OpenRCT2::MemoryStream ms(1000);
|
||||
IIniWriter* iw = CreateIniWriter(&ms);
|
||||
auto iw = CreateIniWriter(&ms);
|
||||
ASSERT_NE(iw, nullptr);
|
||||
iw->WriteBoolean("boolval", true);
|
||||
uint8_t null_terminator = 0;
|
||||
|
@ -91,13 +88,12 @@ TEST_F(IniWriterTest, create_loose_bool_entry)
|
|||
const char* ini = reinterpret_cast<const char*>(ms.ReadString());
|
||||
ASSERT_STREQ(ini, "boolval = true" PLATFORM_NEWLINE);
|
||||
Memory::Free(ini);
|
||||
delete iw;
|
||||
}
|
||||
|
||||
TEST_F(IniWriterTest, create_loose_enum_entry)
|
||||
{
|
||||
OpenRCT2::MemoryStream ms(1000);
|
||||
IIniWriter* iw = CreateIniWriter(&ms);
|
||||
auto iw = CreateIniWriter(&ms);
|
||||
ASSERT_NE(iw, nullptr);
|
||||
iw->WriteEnum("by_string", "stringval");
|
||||
iw->WriteEnum<int32_t>("int32_t", 0, Enum_Currency);
|
||||
|
@ -110,13 +106,12 @@ TEST_F(IniWriterTest, create_loose_enum_entry)
|
|||
const char* ini = reinterpret_cast<const char*>(ms.ReadString());
|
||||
ASSERT_STREQ(ini, "by_string = stringval" PLATFORM_NEWLINE "int32_t = 0" PLATFORM_NEWLINE);
|
||||
Memory::Free(ini);
|
||||
delete iw;
|
||||
}
|
||||
|
||||
TEST_F(IniWriterTest, create_loose_float_entry)
|
||||
{
|
||||
OpenRCT2::MemoryStream ms(1000);
|
||||
IIniWriter* iw = CreateIniWriter(&ms);
|
||||
auto iw = CreateIniWriter(&ms);
|
||||
ASSERT_NE(iw, nullptr);
|
||||
iw->WriteFloat("one", 1.);
|
||||
uint8_t null_terminator = 0;
|
||||
|
@ -129,13 +124,12 @@ TEST_F(IniWriterTest, create_loose_float_entry)
|
|||
// This will be non-fatal due to float.
|
||||
EXPECT_STREQ(ini, "one = 1.000000" PLATFORM_NEWLINE);
|
||||
Memory::Free(ini);
|
||||
delete iw;
|
||||
}
|
||||
|
||||
TEST_F(IniWriterTest, create_loose_int32_t_entry)
|
||||
{
|
||||
OpenRCT2::MemoryStream ms(1000);
|
||||
IIniWriter* iw = CreateIniWriter(&ms);
|
||||
auto iw = CreateIniWriter(&ms);
|
||||
ASSERT_NE(iw, nullptr);
|
||||
iw->WriteInt32("one", 1);
|
||||
iw->WriteInt32("zero", 0);
|
||||
|
@ -154,13 +148,12 @@ TEST_F(IniWriterTest, create_loose_int32_t_entry)
|
|||
"one = 1" PLATFORM_NEWLINE "zero = 0" PLATFORM_NEWLINE "minusone = -1" PLATFORM_NEWLINE
|
||||
"intmin = -2147483648" PLATFORM_NEWLINE "intmax = 2147483647" PLATFORM_NEWLINE);
|
||||
Memory::Free(ini);
|
||||
delete iw;
|
||||
}
|
||||
|
||||
TEST_F(IniWriterTest, create_loose_string_entry)
|
||||
{
|
||||
OpenRCT2::MemoryStream ms(1000);
|
||||
IIniWriter* iw = CreateIniWriter(&ms);
|
||||
auto iw = CreateIniWriter(&ms);
|
||||
ASSERT_NE(iw, nullptr);
|
||||
iw->WriteString("path", u8"C:'\\some/dir\\here/神鷹暢遊");
|
||||
uint8_t null_terminator = 0;
|
||||
|
@ -172,13 +165,12 @@ TEST_F(IniWriterTest, create_loose_string_entry)
|
|||
const char* ini = reinterpret_cast<const char*>(ms.ReadString());
|
||||
ASSERT_STREQ(ini, "path = \"C:'\\\\some/dir\\\\here/\xE7\xA5\x9E\xE9\xB7\xB9\xE6\x9A\xA2\xE9\x81\x8A\"" PLATFORM_NEWLINE);
|
||||
Memory::Free(ini);
|
||||
delete iw;
|
||||
}
|
||||
|
||||
TEST_F(IniWriterTest, create_multiple_section_with_values)
|
||||
{
|
||||
OpenRCT2::MemoryStream ms(1000);
|
||||
IIniWriter* iw = CreateIniWriter(&ms);
|
||||
auto iw = CreateIniWriter(&ms);
|
||||
ASSERT_NE(iw, nullptr);
|
||||
iw->WriteSection("bool");
|
||||
iw->WriteBoolean("boolval", true);
|
||||
|
@ -200,13 +192,12 @@ TEST_F(IniWriterTest, create_multiple_section_with_values)
|
|||
"one = 1" PLATFORM_NEWLINE "zero = 0" PLATFORM_NEWLINE PLATFORM_NEWLINE "[string]" PLATFORM_NEWLINE "path = "
|
||||
"\"C:'\\\\some/dir\\\\here/\xE7\xA5\x9E\xE9\xB7\xB9\xE6\x9A\xA2\xE9\x81\x8A\"" PLATFORM_NEWLINE);
|
||||
Memory::Free(ini);
|
||||
delete iw;
|
||||
}
|
||||
|
||||
TEST_F(IniWriterTest, create_duplicate_sections)
|
||||
{
|
||||
OpenRCT2::MemoryStream ms(1000);
|
||||
IIniWriter* iw = CreateIniWriter(&ms);
|
||||
auto iw = CreateIniWriter(&ms);
|
||||
ASSERT_NE(iw, nullptr);
|
||||
iw->WriteSection("section");
|
||||
iw->WriteSection("section");
|
||||
|
@ -223,5 +214,4 @@ TEST_F(IniWriterTest, create_duplicate_sections)
|
|||
"[section]" PLATFORM_NEWLINE PLATFORM_NEWLINE "[section]" PLATFORM_NEWLINE PLATFORM_NEWLINE
|
||||
"[section]" PLATFORM_NEWLINE);
|
||||
Memory::Free(ini);
|
||||
delete iw;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue