mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-03 18:45:01 +00:00
chore: format Minecraft.World
This commit is contained in:
@@ -3,33 +3,59 @@
|
||||
#include "../../Util/Reference.h"
|
||||
#include "../../IO/Files/File.h"
|
||||
|
||||
class RegionFileCache
|
||||
{
|
||||
friend class ConsoleSaveFileOriginal;
|
||||
class RegionFileCache {
|
||||
friend class ConsoleSaveFileOriginal;
|
||||
|
||||
private:
|
||||
static const int MAX_CACHE_SIZE = 256;
|
||||
static const int MAX_CACHE_SIZE = 256;
|
||||
|
||||
std::unordered_map<File, RegionFile *, FileKeyHash, FileKeyEq> cache;
|
||||
std::unordered_map<File, RegionFile*, FileKeyHash, FileKeyEq> cache;
|
||||
|
||||
static RegionFileCache s_defaultCache;
|
||||
static RegionFileCache s_defaultCache;
|
||||
|
||||
public:
|
||||
// Made public and non-static so we can have a cache for input and output files
|
||||
RegionFileCache() {}
|
||||
// Made public and non-static so we can have a cache for input and output
|
||||
// files
|
||||
RegionFileCache() {}
|
||||
|
||||
RegionFile *_getRegionFile(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ); // 4J - TODO was synchronized
|
||||
void _clear(); // 4J - TODO was synchronized
|
||||
int _getSizeDelta(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ);
|
||||
DataInputStream *_getChunkDataInputStream(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ);
|
||||
DataOutputStream *_getChunkDataOutputStream(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ);
|
||||
RegionFile* _getRegionFile(ConsoleSaveFile* saveFile,
|
||||
const std::wstring& prefix, int chunkX,
|
||||
int chunkZ); // 4J - TODO was synchronized
|
||||
void _clear(); // 4J - TODO was synchronized
|
||||
int _getSizeDelta(ConsoleSaveFile* saveFile, const std::wstring& prefix,
|
||||
int chunkX, int chunkZ);
|
||||
DataInputStream* _getChunkDataInputStream(ConsoleSaveFile* saveFile,
|
||||
const std::wstring& prefix,
|
||||
int chunkX, int chunkZ);
|
||||
DataOutputStream* _getChunkDataOutputStream(ConsoleSaveFile* saveFile,
|
||||
const std::wstring& prefix,
|
||||
int chunkX, int chunkZ);
|
||||
|
||||
// Keep static version for general game usage
|
||||
static RegionFile *getRegionFile(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getRegionFile(saveFile, prefix, chunkX, chunkZ); }
|
||||
static void clear() { s_defaultCache._clear(); }
|
||||
static int getSizeDelta(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getSizeDelta(saveFile, prefix, chunkX, chunkZ); }
|
||||
static DataInputStream *getChunkDataInputStream(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getChunkDataInputStream(saveFile, prefix, chunkX, chunkZ); }
|
||||
static DataOutputStream *getChunkDataOutputStream(ConsoleSaveFile *saveFile, const std::wstring &prefix, int chunkX, int chunkZ) { return s_defaultCache._getChunkDataOutputStream(saveFile, prefix, chunkX, chunkZ); }
|
||||
// Keep static version for general game usage
|
||||
static RegionFile* getRegionFile(ConsoleSaveFile* saveFile,
|
||||
const std::wstring& prefix, int chunkX,
|
||||
int chunkZ) {
|
||||
return s_defaultCache._getRegionFile(saveFile, prefix, chunkX, chunkZ);
|
||||
}
|
||||
static void clear() { s_defaultCache._clear(); }
|
||||
static int getSizeDelta(ConsoleSaveFile* saveFile,
|
||||
const std::wstring& prefix, int chunkX,
|
||||
int chunkZ) {
|
||||
return s_defaultCache._getSizeDelta(saveFile, prefix, chunkX, chunkZ);
|
||||
}
|
||||
static DataInputStream* getChunkDataInputStream(ConsoleSaveFile* saveFile,
|
||||
const std::wstring& prefix,
|
||||
int chunkX, int chunkZ) {
|
||||
return s_defaultCache._getChunkDataInputStream(saveFile, prefix, chunkX,
|
||||
chunkZ);
|
||||
}
|
||||
static DataOutputStream* getChunkDataOutputStream(
|
||||
ConsoleSaveFile* saveFile, const std::wstring& prefix, int chunkX,
|
||||
int chunkZ) {
|
||||
return s_defaultCache._getChunkDataOutputStream(saveFile, prefix,
|
||||
chunkX, chunkZ);
|
||||
}
|
||||
|
||||
private:
|
||||
bool useSplitSaves(ESavePlatform platform);
|
||||
bool useSplitSaves(ESavePlatform platform);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user