aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/GameRules/GameRuleManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.Client/Common/GameRules/GameRuleManager.cpp')
-rw-r--r--Minecraft.Client/Common/GameRules/GameRuleManager.cpp68
1 files changed, 34 insertions, 34 deletions
diff --git a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp
index ff294a65..0606808c 100644
--- a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp
+++ b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp
@@ -85,24 +85,24 @@ const WCHAR *GameRuleManager::wchAttrNameA[] =
GameRuleManager::GameRuleManager()
{
- m_currentGameRuleDefinitions = nullptr;
- m_currentLevelGenerationOptions = nullptr;
+ m_currentGameRuleDefinitions = NULL;
+ m_currentLevelGenerationOptions = NULL;
}
void GameRuleManager::loadGameRules(DLCPack *pack)
{
- StringTable *strings = nullptr;
+ StringTable *strings = NULL;
if(pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,L"languages.loc"))
{
- DLCLocalisationFile *localisationFile = static_cast<DLCLocalisationFile *>(pack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"));
+ DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)pack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc");
strings = localisationFile->getStringTable();
}
int gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader);
for(int i = 0; i < gameRulesCount; ++i)
{
- DLCGameRulesHeader *dlcHeader = static_cast<DLCGameRulesHeader *>(pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i));
+ DLCGameRulesHeader *dlcHeader = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i);
DWORD dSize;
byte *dData = dlcHeader->getData(dSize);
@@ -120,7 +120,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRules);
for (int i = 0; i < gameRulesCount; ++i)
{
- DLCGameRulesFile *dlcFile = static_cast<DLCGameRulesFile *>(pack->getFile(DLCManager::e_DLCType_GameRules, i));
+ DLCGameRulesFile *dlcFile = (DLCGameRulesFile *)pack->getFile(DLCManager::e_DLCType_GameRules, i);
DWORD dSize;
byte *dData = dlcFile->getData(dSize);
@@ -182,7 +182,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
compr_content(new BYTE[compr_len], compr_len);
dis.read(compr_content);
- Compression::getCompression()->SetDecompressionType( static_cast<Compression::ECompressionTypes>(compression_type) );
+ Compression::getCompression()->SetDecompressionType( (Compression::ECompressionTypes)compression_type );
Compression::getCompression()->DecompressLZXRLE( content.data, &content.length,
compr_content.data, compr_content.length);
Compression::getCompression()->SetDecompressionType( SAVE_FILE_PLATFORM_LOCAL );
@@ -237,11 +237,11 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
// 4J-JEV: Reverse of loadGameRules.
void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
{
- if (m_currentGameRuleDefinitions == nullptr &&
- m_currentLevelGenerationOptions == nullptr)
+ if (m_currentGameRuleDefinitions == NULL &&
+ m_currentLevelGenerationOptions == NULL)
{
app.DebugPrintf("GameRuleManager:: Nothing here to save.");
- *dOut = nullptr;
+ *dOut = NULL;
*dSize = 0;
return;
}
@@ -268,7 +268,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
ByteArrayOutputStream compr_baos;
DataOutputStream compr_dos(&compr_baos);
- if (m_currentGameRuleDefinitions == nullptr)
+ if (m_currentGameRuleDefinitions == NULL)
{
compr_dos.writeInt( 0 ); // numStrings for StringTable
compr_dos.writeInt( version_number );
@@ -282,9 +282,9 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
{
StringTable *st = m_currentGameRuleDefinitions->getStringTable();
- if (st == nullptr)
+ if (st == NULL)
{
- app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == nullptr!");
+ app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == NULL!");
}
else
{
@@ -322,7 +322,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
*dSize = baos.buf.length;
*dOut = baos.buf.data;
- baos.buf.data = nullptr;
+ baos.buf.data = NULL;
dos.close(); baos.close();
}
@@ -399,8 +399,8 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
for(int i = 0; i < 8; ++i) dis.readBoolean();
}
- ByteArrayInputStream *contentBais = nullptr;
- DataInputStream *contentDis = nullptr;
+ ByteArrayInputStream *contentBais = NULL;
+ DataInputStream *contentDis = NULL;
if(compressionType == Compression::eCompressionType_None)
{
@@ -469,13 +469,13 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
tagsAndAtts.push_back( contentDis->readUTF() );
unordered_map<int, ConsoleGameRules::EGameRuleType> tagIdMap;
- for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < static_cast<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)
{
if(tagsAndAtts[i].compare(wchTagNameA[type]) == 0)
{
- tagIdMap.insert( unordered_map<int, ConsoleGameRules::EGameRuleType>::value_type(i, static_cast<ConsoleGameRules::EGameRuleType>(type)) );
+ tagIdMap.insert( unordered_map<int, ConsoleGameRules::EGameRuleType>::value_type(i, (ConsoleGameRules::EGameRuleType)type) );
break;
}
}
@@ -521,7 +521,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
auto it = tagIdMap.find(tagId);
if(it != tagIdMap.end()) tagVal = it->second;
- GameRuleDefinition *rule = nullptr;
+ GameRuleDefinition *rule = NULL;
if(tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions)
{
@@ -548,14 +548,14 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
{
// Not default
contentDis->close();
- if(contentBais != nullptr) delete contentBais;
+ if(contentBais != NULL) delete contentBais;
delete contentDis;
}
dis.close();
bais.reset();
- //if(!levelGenAdded) { delete levelGenerator; levelGenerator = nullptr; }
+ //if(!levelGenAdded) { delete levelGenerator; levelGenerator = NULL; }
if(!gameRulesAdded) delete gameRules;
return true;
@@ -583,7 +583,7 @@ void GameRuleManager::readAttributes(DataInputStream *dis, vector<wstring> *tags
int attID = dis->readInt();
wstring value = dis->readUTF();
- if(rule != nullptr) rule->addAttribute(tagsAndAtts->at(attID),value);
+ if(rule != NULL) rule->addAttribute(tagsAndAtts->at(attID),value);
}
}
@@ -597,8 +597,8 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
auto it = tagIdMap->find(tagId);
if(it != tagIdMap->end()) tagVal = it->second;
- GameRuleDefinition *childRule = nullptr;
- if(rule != nullptr) childRule = rule->addChild(tagVal);
+ GameRuleDefinition *childRule = NULL;
+ if(rule != NULL) childRule = rule->addChild(tagVal);
readAttributes(dis,tagsAndAtts,childRule);
readChildren(dis,tagsAndAtts,tagIdMap,childRule);
@@ -607,7 +607,7 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
void GameRuleManager::processSchematics(LevelChunk *levelChunk)
{
- if(getLevelGenerationOptions() != nullptr)
+ if(getLevelGenerationOptions() != NULL)
{
LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions();
levelGenOptions->processSchematics(levelChunk);
@@ -616,7 +616,7 @@ void GameRuleManager::processSchematics(LevelChunk *levelChunk)
void GameRuleManager::processSchematicsLighting(LevelChunk *levelChunk)
{
- if(getLevelGenerationOptions() != nullptr)
+ if(getLevelGenerationOptions() != NULL)
{
LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions();
levelGenOptions->processSchematicsLighting(levelChunk);
@@ -701,21 +701,21 @@ void GameRuleManager::setLevelGenerationOptions(LevelGenerationOptions *levelGen
{
unloadCurrentGameRules();
- m_currentGameRuleDefinitions = nullptr;
+ m_currentGameRuleDefinitions = NULL;
m_currentLevelGenerationOptions = levelGen;
- if(m_currentLevelGenerationOptions != nullptr && m_currentLevelGenerationOptions->requiresGameRules() )
+ if(m_currentLevelGenerationOptions != NULL && m_currentLevelGenerationOptions->requiresGameRules() )
{
m_currentGameRuleDefinitions = m_currentLevelGenerationOptions->getRequiredGameRules();
}
- if(m_currentLevelGenerationOptions != nullptr)
+ if(m_currentLevelGenerationOptions != NULL)
m_currentLevelGenerationOptions->reset_start();
}
LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key)
{
- if(m_currentGameRuleDefinitions != nullptr && !key.empty() )
+ if(m_currentGameRuleDefinitions != NULL && !key.empty() )
{
return m_currentGameRuleDefinitions->getString(key);
}
@@ -739,9 +739,9 @@ LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions *
void GameRuleManager::unloadCurrentGameRules()
{
- if (m_currentLevelGenerationOptions != nullptr)
+ if (m_currentLevelGenerationOptions != NULL)
{
- if (m_currentGameRuleDefinitions != nullptr
+ if (m_currentGameRuleDefinitions != NULL
&& m_currentLevelGenerationOptions->isFromSave())
m_levelRules.removeLevelRule( m_currentGameRuleDefinitions );
@@ -757,6 +757,6 @@ void GameRuleManager::unloadCurrentGameRules()
}
}
- m_currentGameRuleDefinitions = nullptr;
- m_currentLevelGenerationOptions = nullptr;
+ m_currentGameRuleDefinitions = NULL;
+ m_currentLevelGenerationOptions = NULL;
}