mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-19 09:47:13 +00:00
Remove UINT from game rule manager sizes
This commit is contained in:
parent
29edda1cc7
commit
bfa2fd6715
|
|
@ -142,7 +142,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, UINT dSize)
|
LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, unsigned int dSize)
|
||||||
{
|
{
|
||||||
LevelGenerationOptions *lgo = new LevelGenerationOptions();
|
LevelGenerationOptions *lgo = new LevelGenerationOptions();
|
||||||
lgo->setGrSource( new JustGrSource() );
|
lgo->setGrSource( new JustGrSource() );
|
||||||
|
|
@ -153,7 +153,7 @@ LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, UINT dSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J-JEV: Reverse of saveGameRules.
|
// 4J-JEV: Reverse of saveGameRules.
|
||||||
void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize)
|
void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("GameRuleManager::LoadingGameRules:\n");
|
app.DebugPrintf("GameRuleManager::LoadingGameRules:\n");
|
||||||
|
|
||||||
|
|
@ -174,7 +174,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, U
|
||||||
|
|
||||||
app.DebugPrintf("\tcompressionType=%d.\n", compression_type);
|
app.DebugPrintf("\tcompressionType=%d.\n", compression_type);
|
||||||
|
|
||||||
UINT compr_len, decomp_len;
|
unsigned int compr_len, decomp_len;
|
||||||
compr_len = dis.readInt();
|
compr_len = dis.readInt();
|
||||||
decomp_len = dis.readInt();
|
decomp_len = dis.readInt();
|
||||||
|
|
||||||
|
|
@ -240,7 +240,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, U
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J-JEV: Reverse of loadGameRules.
|
// 4J-JEV: Reverse of loadGameRules.
|
||||||
void GameRuleManager::saveGameRules(uint8_t **dOut, UINT *dSize)
|
void GameRuleManager::saveGameRules(uint8_t **dOut, unsigned int *dSize)
|
||||||
{
|
{
|
||||||
if (m_currentGameRuleDefinitions == NULL &&
|
if (m_currentGameRuleDefinitions == NULL &&
|
||||||
m_currentLevelGenerationOptions == NULL)
|
m_currentLevelGenerationOptions == NULL)
|
||||||
|
|
@ -264,7 +264,7 @@ void GameRuleManager::saveGameRules(uint8_t **dOut, UINT *dSize)
|
||||||
|
|
||||||
// Write 8 bytes of empty space in case we need them later.
|
// Write 8 bytes of empty space in case we need them later.
|
||||||
// Mainly useful for the ones we save embedded in game saves.
|
// Mainly useful for the ones we save embedded in game saves.
|
||||||
for (UINT i = 0; i < 8; i++)
|
for (unsigned int i = 0; i < 8; i++)
|
||||||
dos.writeByte(0x0);
|
dos.writeByte(0x0);
|
||||||
|
|
||||||
dos.writeByte(APPROPRIATE_COMPRESSION_TYPE); // m_compressionType
|
dos.writeByte(APPROPRIATE_COMPRESSION_TYPE); // m_compressionType
|
||||||
|
|
@ -373,7 +373,7 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos)
|
||||||
m_currentGameRuleDefinitions->write(dos);
|
m_currentGameRuleDefinitions->write(dos);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize, StringTable *strings) //(DLCGameRulesFile *dlcFile, StringTable *strings)
|
bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize, StringTable *strings) //(DLCGameRulesFile *dlcFile, StringTable *strings)
|
||||||
{
|
{
|
||||||
bool levelGenAdded = false;
|
bool levelGenAdded = false;
|
||||||
bool gameRulesAdded = false;
|
bool gameRulesAdded = false;
|
||||||
|
|
@ -469,15 +469,15 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI
|
||||||
}
|
}
|
||||||
|
|
||||||
// string lookup.
|
// string lookup.
|
||||||
UINT numStrings = contentDis->readInt();
|
unsigned int numStrings = contentDis->readInt();
|
||||||
std::vector<std::wstring> tagsAndAtts;
|
std::vector<std::wstring> tagsAndAtts;
|
||||||
for (UINT i = 0; i < numStrings; i++)
|
for (unsigned int i = 0; i < numStrings; i++)
|
||||||
tagsAndAtts.push_back( contentDis->readUTF() );
|
tagsAndAtts.push_back( contentDis->readUTF() );
|
||||||
|
|
||||||
std::unordered_map<int, ConsoleGameRules::EGameRuleType> tagIdMap;
|
std::unordered_map<int, ConsoleGameRules::EGameRuleType> tagIdMap;
|
||||||
for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < (int)ConsoleGameRules::eGameRuleType_Count; ++type)
|
for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < (int)ConsoleGameRules::eGameRuleType_Count; ++type)
|
||||||
{
|
{
|
||||||
for(UINT i = 0; i < numStrings; ++i)
|
for(unsigned int i = 0; i < numStrings; ++i)
|
||||||
{
|
{
|
||||||
if(tagsAndAtts[i].compare(wchTagNameA[type]) == 0)
|
if(tagsAndAtts[i].compare(wchTagNameA[type]) == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -492,7 +492,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI
|
||||||
std::unordered_map<int, ConsoleGameRules::EGameRuleAttr> attrIdMap;
|
std::unordered_map<int, ConsoleGameRules::EGameRuleAttr> attrIdMap;
|
||||||
for(int attr = (int)ConsoleGameRules::eGameRuleAttr_descriptionName; attr < (int)ConsoleGameRules::eGameRuleAttr_Count; ++attr)
|
for(int attr = (int)ConsoleGameRules::eGameRuleAttr_descriptionName; attr < (int)ConsoleGameRules::eGameRuleAttr_Count; ++attr)
|
||||||
{
|
{
|
||||||
for (UINT i = 0; i < numStrings; i++)
|
for (unsigned int i = 0; i < numStrings; i++)
|
||||||
{
|
{
|
||||||
if (tagsAndAtts[i].compare(wchAttrNameA[attr]) == 0)
|
if (tagsAndAtts[i].compare(wchAttrNameA[attr]) == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -503,8 +503,8 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// subfile
|
// subfile
|
||||||
UINT numFiles = contentDis->readInt();
|
unsigned int numFiles = contentDis->readInt();
|
||||||
for (UINT i = 0; i < numFiles; i++)
|
for (unsigned int i = 0; i < numFiles; i++)
|
||||||
{
|
{
|
||||||
std::wstring sFilename = contentDis->readUTF();
|
std::wstring sFilename = contentDis->readUTF();
|
||||||
int length = contentDis->readInt();
|
int length = contentDis->readInt();
|
||||||
|
|
@ -519,8 +519,8 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UI
|
||||||
LEVEL_GEN_ID lgoID = LEVEL_GEN_ID_NULL;
|
LEVEL_GEN_ID lgoID = LEVEL_GEN_ID_NULL;
|
||||||
|
|
||||||
// xml objects
|
// xml objects
|
||||||
UINT numObjects = contentDis->readInt();
|
unsigned int numObjects = contentDis->readInt();
|
||||||
for(UINT i = 0; i < numObjects; ++i)
|
for(unsigned int i = 0; i < numObjects; ++i)
|
||||||
{
|
{
|
||||||
int tagId = contentDis->readInt();
|
int tagId = contentDis->readInt();
|
||||||
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
|
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
|
||||||
|
|
@ -584,7 +584,7 @@ LevelGenerationOptions *GameRuleManager::readHeader(DLCGameRulesHeader *grh)
|
||||||
void GameRuleManager::readAttributes(DataInputStream *dis, std::vector<std::wstring> *tagsAndAtts, GameRuleDefinition *rule)
|
void GameRuleManager::readAttributes(DataInputStream *dis, std::vector<std::wstring> *tagsAndAtts, GameRuleDefinition *rule)
|
||||||
{
|
{
|
||||||
int numAttrs = dis->readInt();
|
int numAttrs = dis->readInt();
|
||||||
for (UINT att = 0; att < numAttrs; ++att)
|
for (unsigned int att = 0; att < static_cast<unsigned int>(numAttrs); ++att)
|
||||||
{
|
{
|
||||||
int attID = dis->readInt();
|
int attID = dis->readInt();
|
||||||
std::wstring value = dis->readUTF();
|
std::wstring value = dis->readUTF();
|
||||||
|
|
@ -596,7 +596,7 @@ void GameRuleManager::readAttributes(DataInputStream *dis, std::vector<std::wstr
|
||||||
void GameRuleManager::readChildren(DataInputStream *dis, std::vector<std::wstring> *tagsAndAtts, std::unordered_map<int, ConsoleGameRules::EGameRuleType> *tagIdMap, GameRuleDefinition *rule)
|
void GameRuleManager::readChildren(DataInputStream *dis, std::vector<std::wstring> *tagsAndAtts, std::unordered_map<int, ConsoleGameRules::EGameRuleType> *tagIdMap, GameRuleDefinition *rule)
|
||||||
{
|
{
|
||||||
int numChildren = dis->readInt();
|
int numChildren = dis->readInt();
|
||||||
for(UINT child = 0; child < numChildren; ++child)
|
for(unsigned int child = 0; child < static_cast<unsigned int>(numChildren); ++child)
|
||||||
{
|
{
|
||||||
int tagId = dis->readInt();
|
int tagId = dis->readInt();
|
||||||
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
|
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,10 @@ public:
|
||||||
|
|
||||||
void loadGameRules(DLCPack *);
|
void loadGameRules(DLCPack *);
|
||||||
|
|
||||||
LevelGenerationOptions *loadGameRules(uint8_t *dIn, UINT dSize);
|
LevelGenerationOptions *loadGameRules(uint8_t *dIn, unsigned int dSize);
|
||||||
void loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize);
|
void loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize);
|
||||||
|
|
||||||
void saveGameRules(uint8_t **dOut, UINT *dSize);
|
void saveGameRules(uint8_t **dOut, unsigned int *dSize);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LevelGenerationOptions *readHeader(DLCGameRulesHeader *grh);
|
LevelGenerationOptions *readHeader(DLCGameRulesHeader *grh);
|
||||||
|
|
@ -51,7 +51,7 @@ private:
|
||||||
void writeRuleFile(DataOutputStream *dos);
|
void writeRuleFile(DataOutputStream *dos);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings);
|
bool readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, unsigned int dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void readAttributes(DataInputStream *dis, std::vector<std::wstring> *tagsAndAtts, GameRuleDefinition *rule);
|
void readAttributes(DataInputStream *dis, std::vector<std::wstring> *tagsAndAtts, GameRuleDefinition *rule);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue