aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp
diff options
context:
space:
mode:
authorvoid_17 <61356189+void2012@users.noreply.github.com>2026-03-06 02:11:18 +0700
committerGitHub <noreply@github.com>2026-03-06 02:11:18 +0700
commit55231bb8d3e1a4e2752ac3d444c4287eb0ca4e8b (patch)
tree953c537a5c66e328e9f4ab29626cf738112d53c0 /Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp
parent7d6658fe5b3095f35093701b5ab669ffc291e875 (diff)
Remove AUTO_VAR macro and _toString function (#592)
Diffstat (limited to 'Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp')
-rw-r--r--Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp
index 0481a54b..395b4eeb 100644
--- a/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp
+++ b/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp
@@ -11,17 +11,17 @@ CompoundGameRuleDefinition::CompoundGameRuleDefinition()
CompoundGameRuleDefinition::~CompoundGameRuleDefinition()
{
- for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
+ for (auto it : m_children )
{
- delete (*it);
+ delete it;
}
}
void CompoundGameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
{
GameRuleDefinition::getChildren(children);
- for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); it++)
- children->push_back(*it);
+ for (auto& it : m_children )
+ children->push_back(it);
}
GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -40,7 +40,7 @@ GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGame
rule = new UseTileRuleDefinition();
}
else if(ruleType == ConsoleGameRules::eGameRuleType_UpdatePlayerRule)
- {
+ {
rule = new UpdatePlayerRuleDefinition();
}
else
@@ -57,17 +57,17 @@ void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesI
{
GameRule *newRule = NULL;
int i = 0;
- for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
+ for (auto& it : m_children )
{
- newRule = new GameRule(*it, rule->getConnection() );
- (*it)->populateGameRule(type,newRule);
+ newRule = new GameRule(it, rule->getConnection() );
+ it->populateGameRule(type,newRule);
GameRule::ValueType value;
value.gr = newRule;
value.isPointer = true;
// Somehow add the newRule to the current rule
- rule->setParameter(L"rule" + _toString<int>(i),value);
+ rule->setParameter(L"rule" + std::to_wstring(i),value);
++i;
}
GameRuleDefinition::populateGameRule(type, rule);
@@ -76,14 +76,14 @@ void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesI
bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int y, int z)
{
bool statusChanged = false;
- for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
+ for (auto& it : rule->m_parameters )
{
- if(it->second.isPointer)
+ if(it.second.isPointer)
{
- bool changed = it->second.gr->getGameRuleDefinition()->onUseTile(it->second.gr,tileId,x,y,z);
+ bool changed = it.second.gr->getGameRuleDefinition()->onUseTile(it.second.gr,tileId,x,y,z);
if(!statusChanged && changed)
{
- m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition();
+ m_lastRuleStatusChanged = it.second.gr->getGameRuleDefinition();
statusChanged = true;
}
}
@@ -94,14 +94,14 @@ bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, in
bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
{
bool statusChanged = false;
- for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
+ for (auto& it : rule->m_parameters )
{
- if(it->second.isPointer)
+ if(it.second.isPointer)
{
- bool changed = it->second.gr->getGameRuleDefinition()->onCollectItem(it->second.gr,item);
+ bool changed = it.second.gr->getGameRuleDefinition()->onCollectItem(it.second.gr,item);
if(!statusChanged && changed)
- {
- m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition();
+ {
+ m_lastRuleStatusChanged = it.second.gr->getGameRuleDefinition();
statusChanged = true;
}
}
@@ -111,8 +111,8 @@ bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIn
void CompoundGameRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
{
- for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
+ for (auto it : m_children )
{
- (*it)->postProcessPlayer(player);
+ it->postProcessPlayer(player);
}
} \ No newline at end of file