mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-22 12:47:53 -05:00
Save scriptstrings per zone and not per asset since that solves all problems with multiple assets of the same zone referencing the same struct in memory that has scriptstring indices
This commit is contained in:
@ -1,28 +1,21 @@
|
||||
#include "Zone.h"
|
||||
|
||||
Zone::Zone(std::string name, const zone_priority_t priority, IZoneAssetPools* pools, IGame* game)
|
||||
Zone::Zone(std::string name, const zone_priority_t priority, IGame* game)
|
||||
: m_memory(std::make_unique<ZoneMemory>()),
|
||||
m_registered(false),
|
||||
m_name(std::move(name)),
|
||||
m_priority(priority),
|
||||
m_language(GameLanguage::LANGUAGE_NONE),
|
||||
m_game(game)
|
||||
{
|
||||
m_name = std::move(name);
|
||||
m_priority = priority;
|
||||
m_pools = pools;
|
||||
m_game = game;
|
||||
m_language = GameLanguage::LANGUAGE_NONE;
|
||||
m_memory = new ZoneMemory();
|
||||
m_registered = false;
|
||||
}
|
||||
|
||||
Zone::~Zone()
|
||||
{
|
||||
if(m_registered)
|
||||
if (m_registered)
|
||||
{
|
||||
m_game->RemoveZone(this);
|
||||
}
|
||||
|
||||
delete m_pools;
|
||||
m_pools = nullptr;
|
||||
|
||||
delete m_memory;
|
||||
m_memory = nullptr;
|
||||
}
|
||||
|
||||
void Zone::Register()
|
||||
@ -34,12 +27,7 @@ void Zone::Register()
|
||||
}
|
||||
}
|
||||
|
||||
IZoneAssetPools* Zone::GetPools() const
|
||||
{
|
||||
return m_pools;
|
||||
}
|
||||
|
||||
ZoneMemory* Zone::GetMemory() const
|
||||
{
|
||||
return m_memory;
|
||||
return m_memory.get();
|
||||
}
|
||||
|
@ -1,19 +1,22 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
#include "ZoneTypes.h"
|
||||
#include "Pool/IZoneAssetPools.h"
|
||||
#include "Pool/ZoneAssetPools.h"
|
||||
#include "Game/IGame.h"
|
||||
#include "Game/GameLanguage.h"
|
||||
#include "Zone/XBlock.h"
|
||||
#include "ZoneMemory.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class IGame;
|
||||
class ZoneAssetPools;
|
||||
|
||||
class Zone
|
||||
{
|
||||
IZoneAssetPools* m_pools;
|
||||
std::vector<XBlock*> m_blocks;
|
||||
ZoneMemory* m_memory;
|
||||
std::unique_ptr<ZoneMemory> m_memory;
|
||||
|
||||
bool m_registered;
|
||||
|
||||
@ -22,12 +25,13 @@ public:
|
||||
zone_priority_t m_priority;
|
||||
GameLanguage m_language;
|
||||
IGame* m_game;
|
||||
std::vector<std::string> m_script_strings;
|
||||
std::unique_ptr<ZoneAssetPools> m_pools;
|
||||
|
||||
Zone(std::string name, zone_priority_t priority, IZoneAssetPools* pools, IGame* game);
|
||||
Zone(std::string name, zone_priority_t priority, IGame* game);
|
||||
~Zone();
|
||||
|
||||
void Register();
|
||||
|
||||
IZoneAssetPools* GetPools() const;
|
||||
ZoneMemory* GetMemory() const;
|
||||
};
|
||||
|
@ -12,11 +12,15 @@ typedef uint32_t scr_string_t;
|
||||
typedef uint64_t xchunk_size_t;
|
||||
typedef uint64_t xblock_size_t;
|
||||
typedef uint64_t zone_pointer_t;
|
||||
|
||||
constexpr uint16_t SCR_STRING_MAX = UINT32_MAX;
|
||||
#elif _WIN32
|
||||
typedef uint16_t scr_string_t;
|
||||
typedef uint32_t xchunk_size_t;
|
||||
typedef uint32_t xblock_size_t;
|
||||
typedef uint32_t zone_pointer_t;
|
||||
|
||||
constexpr uint16_t SCR_STRING_MAX = UINT16_MAX;
|
||||
#endif
|
||||
|
||||
typedef int block_t;
|
||||
|
Reference in New Issue
Block a user