aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp
diff options
context:
space:
mode:
authorqwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com>2026-03-05 17:17:45 -0600
committerGitHub <noreply@github.com>2026-03-05 17:17:45 -0600
commit0666959d312dc74903f55d1071488a90239330f1 (patch)
tree5c6886f7ec65a7828bc6e34a469514e418bcf78b /Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp
parent9370cbc7d878df1615d8ce76bc459e8b414d0f19 (diff)
parenteed770b121aa4ce38f002db042d0137c24c6d344 (diff)
Merge branch 'smartcmd:main' into main
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