Add new source field to ORI struct

This commit is contained in:
Ted John 2018-06-30 10:55:59 +01:00 committed by Gymnasiast
parent 5ce76e1603
commit ec0d35bac7
5 changed files with 8 additions and 31 deletions

View File

@ -1435,34 +1435,7 @@ static bool filter_source(const ObjectRepositoryItem* item, bool selected)
if (_FILTER_ALL)
return true;
uint8_t source = object_entry_get_source_game(&item->ObjectEntry);
uint8_t secondSource = OBJECT_SOURCE_CUSTOM;
_loadedObject = item->LoadedObject;
if (_loadedObject == nullptr)
{
_loadedObject = object_manager_get_loaded_object(&item->ObjectEntry);
}
if (_loadedObject == nullptr)
{
_loadedObject = object_manager_load_object(&item->ObjectEntry);
}
if (_loadedObject != nullptr)
{
secondSource = ((Object*)_loadedObject)->GetSecondSourceGame();
}
if (!selected && _loadedObject != nullptr)
{
uint8_t objectType = object_entry_get_type(&item->ObjectEntry);
if (objectType != OBJECT_TYPE_PARK_ENTRANCE && objectType != OBJECT_TYPE_SCENARIO_TEXT && objectType != OBJECT_TYPE_WATER && objectType != OBJECT_TYPE_SCENERY_GROUP)
{
((Object*)_loadedObject)->Unload();
}
}
return sources_match(source) || (secondSource != OBJECT_SOURCE_CUSTOM && sources_match(secondSource));
return sources_match(item->Source);
}
static bool filter_chunks(const ObjectRepositoryItem* item)

View File

@ -91,7 +91,7 @@ void Object::SetSourceGame(const uint8_t sourceGame)
_objectEntry.flags |= (sourceGame << 4);*/
}
const uint8_t Object::GetSecondSourceGame()
uint8_t Object::GetSecondSourceGame()
{
return _secondSourceGame;
}

View File

@ -157,7 +157,7 @@ private:
rct_object_entry _objectEntry{};
StringTable _stringTable;
ImageTable _imageTable;
uint8_t _secondSourceGame;
uint8_t _secondSourceGame = OBJECT_SOURCE_CUSTOM;
protected:
StringTable& GetStringTable()
@ -216,7 +216,7 @@ public:
virtual void SetRepositoryItem(ObjectRepositoryItem* /*item*/) const
{
}
const uint8_t GetSecondSourceGame();
uint8_t GetSecondSourceGame();
void SetSecondSourceGame(uint8_t sourceGame);
const ImageTable& GetImageTable() const

View File

@ -112,6 +112,7 @@ public:
item.ObjectEntry = *object->GetObjectEntry();
item.Path = path;
item.Name = object->GetName();
item.Source = object->GetSecondSourceGame();
object->SetRepositoryItem(&item);
delete object;
return std::make_tuple(true, item);
@ -125,6 +126,7 @@ protected:
stream->WriteValue(item.ObjectEntry);
stream->WriteString(item.Path);
stream->WriteString(item.Name);
stream->WriteValue(item.Source);
switch (object_entry_get_type(&item.ObjectEntry))
{
@ -157,6 +159,7 @@ protected:
item.ObjectEntry = stream->ReadValue<rct_object_entry>();
item.Path = stream->ReadStdString();
item.Name = stream->ReadStdString();
item.Source = stream->ReadValue<uint8_t>();
switch (object_entry_get_type(&item.ObjectEntry))
{

View File

@ -36,6 +36,7 @@ struct ObjectRepositoryItem
rct_object_entry ObjectEntry;
std::string Path;
std::string Name;
uint8_t Source;
Object* LoadedObject{};
struct
{