1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00

Refactor code base to allow easy addition of new object types

This commit is contained in:
Ted John
2018-05-14 12:27:25 +01:00
parent fcf507e051
commit f8271e93b0
8 changed files with 192 additions and 164 deletions

View File

@@ -306,6 +306,30 @@ namespace ObjectJsonHelpers
}
}
}
else if (String::StartsWith(s, "$G1"))
{
auto range = ParseRange(s.substr(3));
if (range.size() > 0)
{
for (auto i : range)
{
auto og1 = gfx_get_g1_element(i);
if (og1 == nullptr)
{
rct_g1_element g1{};
result.push_back(g1);
}
else
{
auto length = g1_calculate_data_size(og1);
auto g1 = *og1;
g1.offset = (uint8 *)std::malloc(length);
std::memcpy(g1.offset, og1->offset, length);
result.push_back(g1);
}
}
}
}
else if (String::StartsWith(s, "$RCT2:OBJDATA/"))
{
auto name = s.substr(14);