mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 03:23:15 +01:00
Add method to look up source game
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../localisation/language.h"
|
||||
#include "../object.h"
|
||||
#include "../object_list.h"
|
||||
|
||||
void BannerObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
|
||||
{
|
||||
@@ -45,11 +46,11 @@ void BannerObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
|
||||
// Add banners to 'Signs and items for footpaths' group, rather than lumping them in the Miscellaneous tab.
|
||||
// Since this is already done the other way round for original items, avoid adding those to prevent duplicates.
|
||||
const std::string identifier = GetIdentifier();
|
||||
const rct_object_entry * objectEntry = object_list_find_by_name(identifier.c_str());
|
||||
uint8 source = (objectEntry->flags & 0xF0) >> 4;
|
||||
uint8 source = object_entry_get_source_game(object_list_find_by_name(identifier.c_str()));
|
||||
|
||||
static const rct_object_entry * scgPathX = object_list_find_by_name("SCGPATHX");
|
||||
|
||||
if (scgPathX != nullptr && source != 8)
|
||||
if (scgPathX != nullptr && source != OBJECT_SOURCE_RCT2)
|
||||
{
|
||||
SetPrimarySceneryGroup((rct_object_entry *)scgPathX);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../object.h"
|
||||
#include "../object_list.h"
|
||||
|
||||
void FootpathItemObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
|
||||
{
|
||||
@@ -46,11 +47,11 @@ void FootpathItemObject::ReadLegacy(IReadObjectContext * context, IStream * stre
|
||||
// Add path bits to 'Signs and items for footpaths' group, rather than lumping them in the Miscellaneous tab.
|
||||
// Since this is already done the other way round for original items, avoid adding those to prevent duplicates.
|
||||
const std::string identifier = GetIdentifier();
|
||||
const rct_object_entry * objectEntry = object_list_find_by_name(identifier.c_str());
|
||||
uint8 source = (objectEntry->flags & 0xF0) >> 4;
|
||||
uint8 source = object_entry_get_source_game(object_list_find_by_name(identifier.c_str()));
|
||||
|
||||
static const rct_object_entry * scgPathX = object_list_find_by_name("SCGPATHX");
|
||||
|
||||
if (scgPathX != nullptr && source != 8)
|
||||
if (scgPathX != nullptr && source != OBJECT_SOURCE_RCT2)
|
||||
{
|
||||
SetPrimarySceneryGroup((rct_object_entry *)scgPathX);
|
||||
}
|
||||
|
||||
@@ -118,6 +118,11 @@ bool object_entry_is_empty(const rct_object_entry *entry)
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8 object_entry_get_source_game(const rct_object_entry * objectEntry)
|
||||
{
|
||||
return (objectEntry->flags & 0xF0) >> 4;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006AB344
|
||||
|
||||
@@ -55,6 +55,7 @@ extern "C" {
|
||||
void get_type_entry_index(size_t index, uint8 * outObjectType, uint8 * outEntryIndex);
|
||||
const rct_object_entry * get_loaded_object_entry(size_t index);
|
||||
void * get_loaded_object_chunk(size_t index);
|
||||
uint8 object_entry_get_source_game(const rct_object_entry * objectEntry);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1803,8 +1803,11 @@ static bool filter_source(const ObjectRepositoryItem * item)
|
||||
if (_FILTER_ALL)
|
||||
return true;
|
||||
|
||||
uint8 source = (item->ObjectEntry.flags & 0xF0) >> 4;
|
||||
return (_FILTER_RCT2 && source == 8) || (_FILTER_WW && source == 1) || (_FILTER_TT && source == 2) || (_FILTER_CUSTOM && source != 8 && source != 1 && source != 2);
|
||||
uint8 source = object_entry_get_source_game(&item->ObjectEntry);
|
||||
return (_FILTER_RCT2 && source == OBJECT_SOURCE_RCT2) ||
|
||||
(_FILTER_WW && source == OBJECT_SOURCE_WACKY_WORLDS) ||
|
||||
(_FILTER_TT && source == OBJECT_SOURCE_TIME_TWISTER) ||
|
||||
(_FILTER_CUSTOM && source != OBJECT_SOURCE_RCT2 && source != OBJECT_SOURCE_WACKY_WORLDS && source != OBJECT_SOURCE_TIME_TWISTER);
|
||||
}
|
||||
|
||||
static bool filter_chunks(const ObjectRepositoryItem * item)
|
||||
|
||||
Reference in New Issue
Block a user