mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix formatting
This commit is contained in:
parent
edaebd5163
commit
0ba233efa4
|
@ -301,8 +301,8 @@ static void visible_list_refresh(rct_window* w)
|
||||||
uint8_t selectionFlags = _objectSelectionFlags[i];
|
uint8_t selectionFlags = _objectSelectionFlags[i];
|
||||||
const ObjectRepositoryItem* item = &items[i];
|
const ObjectRepositoryItem* item = &items[i];
|
||||||
uint8_t objectType = item->ObjectEntry.flags & 0x0F;
|
uint8_t objectType = item->ObjectEntry.flags & 0x0F;
|
||||||
if (objectType == get_selected_object_type(w) && !(selectionFlags & OBJECT_SELECTION_FLAG_6)
|
if (objectType == get_selected_object_type(w) && !(selectionFlags & OBJECT_SELECTION_FLAG_6) && filter_source(item)
|
||||||
&& filter_source(item) && filter_string(item) && filter_chunks(item) && filter_selected(selectionFlags))
|
&& filter_string(item) && filter_chunks(item) && filter_selected(selectionFlags))
|
||||||
{
|
{
|
||||||
rct_object_filters* filter = new rct_object_filters;
|
rct_object_filters* filter = new rct_object_filters;
|
||||||
filter->ride.category[0] = 0;
|
filter->ride.category[0] = 0;
|
||||||
|
@ -1426,12 +1426,12 @@ static bool sources_match(uint8_t source)
|
||||||
// clang-format on
|
// clang-format on
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool filter_source(const ObjectRepositoryItem * item)
|
static bool filter_source(const ObjectRepositoryItem* item)
|
||||||
{
|
{
|
||||||
if (_FILTER_ALL)
|
if (_FILTER_ALL)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (auto source: item->Sources)
|
for (auto source : item->Sources)
|
||||||
{
|
{
|
||||||
if (sources_match(source))
|
if (sources_match(source))
|
||||||
return true;
|
return true;
|
||||||
|
@ -1475,8 +1475,9 @@ static void filter_update_counts()
|
||||||
|
|
||||||
size_t numObjects = object_repository_get_items_count();
|
size_t numObjects = object_repository_get_items_count();
|
||||||
const ObjectRepositoryItem* items = object_repository_get_items();
|
const ObjectRepositoryItem* items = object_repository_get_items();
|
||||||
for (size_t i = 0; i < numObjects; i++) {
|
for (size_t i = 0; i < numObjects; i++)
|
||||||
const ObjectRepositoryItem * item = &items[i];
|
{
|
||||||
|
const ObjectRepositoryItem* item = &items[i];
|
||||||
if (filter_source(item) && filter_string(item) && filter_chunks(item) && filter_selected(selectionFlags[i]))
|
if (filter_source(item) && filter_string(item) && filter_chunks(item) && filter_selected(selectionFlags[i]))
|
||||||
{
|
{
|
||||||
uint8_t objectType = item->ObjectEntry.flags & 0xF;
|
uint8_t objectType = item->ObjectEntry.flags & 0xF;
|
||||||
|
|
|
@ -330,7 +330,7 @@ static void window_object_load_error_scrollpaint(rct_window* w, rct_drawpixelinf
|
||||||
|
|
||||||
// ... source game ...
|
// ... source game ...
|
||||||
rct_string_id sourceStringId = object_manager_get_source_game_string(
|
rct_string_id sourceStringId = object_manager_get_source_game_string(
|
||||||
object_entry_get_source_game_legacy(&_invalid_entries[i]));
|
object_entry_get_source_game_legacy(&_invalid_entries[i]));
|
||||||
gfx_draw_string_left(dpi, sourceStringId, nullptr, COLOUR_DARK_GREEN, SOURCE_COL_LEFT - 3, y);
|
gfx_draw_string_left(dpi, sourceStringId, nullptr, COLOUR_DARK_GREEN, SOURCE_COL_LEFT - 3, y);
|
||||||
|
|
||||||
// ... and type
|
// ... and type
|
||||||
|
|
|
@ -48,8 +48,7 @@ void BannerObject::ReadLegacy(IReadObjectContext* context, IStream* stream)
|
||||||
if (item != nullptr)
|
if (item != nullptr)
|
||||||
{
|
{
|
||||||
auto sourceGame = item->GetFirstSourceGame();
|
auto sourceGame = item->GetFirstSourceGame();
|
||||||
if (sourceGame == OBJECT_SOURCE_WACKY_WORLDS
|
if (sourceGame == OBJECT_SOURCE_WACKY_WORLDS || sourceGame == OBJECT_SOURCE_TIME_TWISTER
|
||||||
|| sourceGame == OBJECT_SOURCE_TIME_TWISTER
|
|
||||||
|| sourceGame == OBJECT_SOURCE_CUSTOM)
|
|| sourceGame == OBJECT_SOURCE_CUSTOM)
|
||||||
{
|
{
|
||||||
auto scgPathX = Object::GetScgPathXHeader();
|
auto scgPathX = Object::GetScgPathXHeader();
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "StexObject.h"
|
#include "StexObject.h"
|
||||||
#include "WallObject.h"
|
#include "WallObject.h"
|
||||||
#include "WaterObject.h"
|
#include "WaterObject.h"
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
interface IFileDataRetriever
|
interface IFileDataRetriever
|
||||||
|
@ -154,26 +155,23 @@ namespace ObjectFactory
|
||||||
static Object* CreateObjectFromJson(
|
static Object* CreateObjectFromJson(
|
||||||
IObjectRepository& objectRepository, const json_t* jRoot, const IFileDataRetriever* fileRetriever);
|
IObjectRepository& objectRepository, const json_t* jRoot, const IFileDataRetriever* fileRetriever);
|
||||||
|
|
||||||
static uint8_t ParseSourceGame(const std::string &s)
|
static uint8_t ParseSourceGame(const std::string& s)
|
||||||
{
|
{
|
||||||
static const std::unordered_map<std::string, uint8_t> LookupTable
|
static const std::unordered_map<std::string, uint8_t> LookupTable{
|
||||||
{
|
{ "rct1", OBJECT_SOURCE_RCT1 },
|
||||||
{ "rct1", OBJECT_SOURCE_RCT1 },
|
{ "rct1aa", OBJECT_SOURCE_ADDED_ATTRACTIONS },
|
||||||
{ "rct1aa", OBJECT_SOURCE_ADDED_ATTRACTIONS },
|
{ "rct1ll", OBJECT_SOURCE_LOOPY_LANDSCAPES },
|
||||||
{ "rct1ll", OBJECT_SOURCE_LOOPY_LANDSCAPES },
|
{ "rct2", OBJECT_SOURCE_RCT2 },
|
||||||
{ "rct2", OBJECT_SOURCE_RCT2 },
|
{ "rct2ww", OBJECT_SOURCE_WACKY_WORLDS },
|
||||||
{ "rct2ww", OBJECT_SOURCE_WACKY_WORLDS },
|
{ "rct2tt", OBJECT_SOURCE_TIME_TWISTER },
|
||||||
{ "rct2tt", OBJECT_SOURCE_TIME_TWISTER },
|
{ "official", OBJECT_SOURCE_OPENRCT2_OFFICIAL },
|
||||||
{ "official", OBJECT_SOURCE_OPENRCT2_OFFICIAL },
|
{ "custom", OBJECT_SOURCE_CUSTOM },
|
||||||
{ "custom", OBJECT_SOURCE_CUSTOM },
|
|
||||||
};
|
};
|
||||||
auto result = LookupTable.find(s);
|
auto result = LookupTable.find(s);
|
||||||
return (result != LookupTable.end()) ?
|
return (result != LookupTable.end()) ? result->second : OBJECT_SOURCE_CUSTOM;
|
||||||
result->second :
|
|
||||||
OBJECT_SOURCE_CUSTOM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ReadObjectLegacy(Object * object, IReadObjectContext* context, IStream* stream)
|
static void ReadObjectLegacy(Object* object, IReadObjectContext* context, IStream* stream)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -419,8 +417,7 @@ namespace ObjectFactory
|
||||||
std::vector<uint8_t> sourceGameVector;
|
std::vector<uint8_t> sourceGameVector;
|
||||||
for (size_t j = 0; j < json_array_size(sourceGames); j++)
|
for (size_t j = 0; j < json_array_size(sourceGames); j++)
|
||||||
{
|
{
|
||||||
sourceGameVector.push_back(
|
sourceGameVector.push_back(ParseSourceGame(json_string_value(json_array_get(sourceGames, j))));
|
||||||
ParseSourceGame(json_string_value(json_array_get(sourceGames, j))));
|
|
||||||
}
|
}
|
||||||
result->SetSourceGames(sourceGameVector);
|
result->SetSourceGames(sourceGameVector);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue