Merge branch 'smartcmd:main' into main

This commit is contained in:
qwasdrizzel
2026-03-05 17:17:45 -06:00
committed by GitHub
343 changed files with 6746 additions and 6110 deletions
+18
View File
@@ -0,0 +1,18 @@
---
# Enable all modernize checks, but explicitly exclude trailing return types
Checks: >
-*,
modernize-*,
google-readability-casting,
cppcoreguidelines-pro-type-cstyle-cast,
-modernize-use-trailing-return-type
# Pass the C++14 flag to the internal Clang compiler
ExtraArgs: ['-std=c++14']
CheckOptions:
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-use-auto.MinTypeNameLength
value: 5
...
+78
View File
@@ -0,0 +1,78 @@
name: Bug Report
description: File a bug report.
title: "[Bug] "
labels: ["bug"]
body:
- type: textarea
id: bug-description
attributes:
label: Bug description
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
id: steps
attributes:
label: To Reproduce
description: Steps to reproduce the behavior
placeholder: |
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain your problem.
validations:
required: false
- type: textarea
id: video
attributes:
label: Videos
description: If applicable, add videos to help explain your problem.
validations:
required: false
- type: input
id: version
attributes:
label: Version
placeholder: e.g. 55a86b8
validations:
required: true
- type: checkboxes
id: build
attributes:
label: Build Type
options:
- label: Release
- label: Debug
validations:
required: true
- type: textarea
id: additional
attributes:
label: Additional context
description: A clear and concise description of what the bug is.
validations:
required: false
@@ -0,0 +1,34 @@
name: Suggestion
description: Suggest an idea for this project
title: "[Suggestion] "
labels: ["enhancement"]
body:
- type: textarea
id: solution
attributes:
label: Describe the solution you'd like
description: What would you like to see happen?
placeholder: |
A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
id: problem
attributes:
label: Is your suggestion related to a problem?
description: Describe the problem you are experiencing.
placeholder: |
A clear and concise description of what the problem is.
Example: I'm always frustrated when [...]
validations:
required: false
- type: textarea
id: additional
attributes:
label: Additional context
description: Add any other context, mockups, or screenshots here.
validations:
required: false
+19 -1
View File
@@ -1,5 +1,20 @@
<!--
Note: IF YOUR PR CHANGES THE GAME BEHAVIOR VISIBLY, REMEMBER TO ATTACH A GAMEPLAY FOOTAGE (or at least a screenshot) OF YOU *ACTUALLY* PLAYING THE GAME WITH YOUR CHANGES. Untested PRs are *NOT* welcome. Please don't forget to describe what did you do in each commit in your PR.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
IF YOUR PR CHANGES THE GAME BEHAVIOR VISIBLY, REMEMBER TO ATTACH A GAMEPLAY FOOTAGE (or at least a screenshot) OF YOU *ACTUALLY* PLAYING THE GAME WITH YOUR CHANGES. Untested PRs are *NOT* welcome. Please don't forget to describe what did you do in each commit in your PR.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
We will NOT accept PRs with code authored by AI. If your code
was written by an AI, your PR will be closed. Do not submit
vibe coded PRs.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
PRs that do not fulfill the informational intent of this PR template will be closed. Please do your best to use this template as written.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
-->
## Description
@@ -19,6 +34,9 @@ Note: IF YOUR PR CHANGES THE GAME BEHAVIOR VISIBLY, REMEMBER TO ATTACH A GAMEPLA
### Fix Implementation
<!-- Detail exactly how the issue was resolved (specific code changes, algorithms, logic flows). -->
### AI Use Disclosure
<!-- Explain, if any, AI was used to solve this problem. Note that we do not accept code written by any LLM in this repo. -->
## Related Issues
- Fixes #[issue-number]
- Related to #[issue-number]
+32
View File
@@ -0,0 +1,32 @@
name: MSBuild Debug Test
on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize]
paths-ignore:
- '.gitignore'
- '*.md'
- '.github/*.md'
push:
branches:
- 'main'
paths-ignore:
- '.gitignore'
- '*.md'
- '.github/*.md'
jobs:
build:
name: Build Windows64 (DEBUG)
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup msbuild
uses: microsoft/setup-msbuild@v2
- name: Build
run: MSBuild.exe MinecraftConsoles.sln /p:Configuration=Debug /p:Platform="Windows64"
+5 -1
View File
@@ -36,7 +36,11 @@ jobs:
with:
tag_name: nightly
name: Nightly Release
body: Requires at least Windows 7 and DirectX 11 compatible GPU to run. Compiled with MSVC v14.44.35207 in Release mode with Whole Program Optimization, as well as `/O2 /Ot /Oi /Ob3 /GF /fp:precise`.
body: |
Requires at least Windows 7 and DirectX 11 compatible GPU to run. Compiled with MSVC v14.44.35207 in Release mode with Whole Program Optimization, as well as `/O2 /Ot /Oi /Ob3 /GF /fp:precise`.
# 🚨 First time here? 🚨
If you've never downloaded the game before, you need to download `LCEWindows64.zip` and extract it to the folder where you'd like to keep the game. The other files are included in this `.zip` file!
files: |
LCEWindows64.zip
./x64/Release/Minecraft.Client.exe
+53 -7
View File
@@ -89,13 +89,59 @@ target_link_libraries(MinecraftClient PRIVATE
>
)
add_custom_command(TARGET MinecraftClient POST_BUILD
COMMAND "${CMAKE_COMMAND}"
-DPROJECT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
-DOUTPUT_DIR="$<TARGET_FILE_DIR:MinecraftClient>"
-DCONFIGURATION=$<CONFIG>
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyAssets.cmake"
VERBATIM
if(WIN32)
message(STATUS "Starting redist copy...")
execute_process(
COMMAND robocopy.exe
"${CMAKE_CURRENT_SOURCE_DIR}/x64/Release"
"${CMAKE_CURRENT_BINARY_DIR}"
/S /MT /R:0 /W:0 /NP
)
message(STATUS "Starting asset copy...")
execute_process(
COMMAND robocopy.exe
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client"
"${CMAKE_CURRENT_BINARY_DIR}"
/S /MT /R:0 /W:0 /NP
/XF "*.cpp" "*.c" "*.h" "*.hpp" "*.asm"
"*.xml" "*.lang" "*.vcxproj" "*.vcxproj.*" "*.sln"
"*.docx" "*.xls"
"*.bat" "*.cmd" "*.ps1" "*.py"
"*Test*"
/XD "Durango*" "Orbis*" "PS*" "Xbox"
)
message(STATUS "Patching Windows64Media...")
execute_process(
COMMAND robocopy.exe
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/DurangoMedia"
"${CMAKE_CURRENT_BINARY_DIR}/Windows64Media"
/S /MT /R:0 /W:0 /NP
/XF "*.h" "*.xml" "*.lang" "*.bat"
)
elseif(UNIX)
message(STATUS "Starting redist copy...")
execute_process(
COMMAND rsync -av "${CMAKE_CURRENT_SOURCE_DIR}/x64/Release/" "${CMAKE_CURRENT_BINARY_DIR}/"
)
message(STATUS "Starting asset copy...")
execute_process(
COMMAND rsync -av
"--exclude=*.cpp" "--exclude=*.c" "--exclude=*.h" "--exclude=*.hpp" "--exclude=*.asm"
"--exclude=*.xml" "--exclude=*.lang" "--exclude=*.vcxproj" "--exclude=*.vcxproj.*" "--exclude=*.sln"
"--exclude=*.docx" "--exclude=*.xls"
"--exclude=*.bat" "--exclude=*.cmd" "--exclude=*.ps1" "--exclude=*.py"
"--exclude=*Test*"
"--exclude=Durango*" "--exclude=Orbis*" "--exclude=PS*" "--exclude=Xbox"
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/" "${CMAKE_CURRENT_BINARY_DIR}/"
)
message(STATUS "Patching Windows64Media...")
execute_process(
COMMAND rsync -av
"--exclude=*.h" "--exclude=*.xml" "--exclude=*.lang" "--exclude=*.bat"
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/DurangoMedia/" "${CMAKE_CURRENT_BINARY_DIR}/Windows64Media/"
)
else()
message(FATAL_ERROR "Redist and asset copying is only supported on Windows (Robocopy) and Unix systems (rsync).")
endif()
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT MinecraftClient)
+25
View File
@@ -0,0 +1,25 @@
# Scope of Project
At the moment, this project's scope is generally limited outside of adding new content to the game (blocks, mobs, items). We are currently prioritizing stability, quality of life, and platform support over these things.
## Current Goals
- Being a robust Desktop version of LCE
- Having proper controller support across all types, brands on Desktop or Desktop-like platforms (Steam Deck)
- Improving stability as much as possible
- Fixing as many bugs as possible
- Enabling Desktop multiplayer options
- LAN P2P Multiplayer
- Splitscreen Multiplayer
- WAN Servers (IP:Port connectivity)
- Platform-based P2P Connectivity
- Steam Networking
- GameDate?
- Maybe more?
- Refining rendering settings, renderer options, as well as reaching rendering parity with true LCE
- Having workable multi-platform compilation for ARM, Consoles, Linux
- Being a good base for further expansion and modding of LCE, such as backports and "modpacks".
# Use of AI and LLMs
We currently do not accept any new code into the project that was written largely, entirely, or even noticably by an LLM. All contributions should be made by humans that understand the codebase.
# Pull Request Template
We request that all PRs made for this repo use our PR template to the fullest extent possible. Completely wiping it out to write minimal information will likely get your PR closed.
+30
View File
@@ -0,0 +1,30 @@
CompileFlags:
Add: [-std=c++14,
-m64,
-Wno-unused-includes
]
Remove: [-W*]
Index:
StandardLibrary: true
Diagnostics:
Suppress: unused-includes
UnusedIncludes: None
ClangTidy:
Add: [modernize-loop-convert]
Completion:
AllScopes: Yes
ArgumentLists: Delimiters
HeaderInsertion: Never
InlayHints:
BlockEnd: true
ParameterNames: false
DeducedTypes: false
Designators: false
DefaultArguments: false
Hover:
ShowAKA: true
+2 -7
View File
@@ -53,11 +53,8 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
Slot *hoveredSlot = NULL;
AUTO_VAR(itEnd, menu->slots->end());
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
for ( Slot *slot : *menu->slots )
{
Slot *slot = *it; //menu->slots->at(i);
renderSlot(slot);
if (isHovering(slot, xm, ym))
@@ -150,10 +147,8 @@ void AbstractContainerScreen::renderSlot(Slot *slot)
Slot *AbstractContainerScreen::findSlot(int x, int y)
{
AUTO_VAR(itEnd, menu->slots->end());
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
for (Slot* slot : menu->slots )
{
Slot *slot = *it; //menu->slots->at(i);
if (isHovering(slot, x, y)) return slot;
}
return NULL;
+3 -8
View File
@@ -262,11 +262,9 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
glDisable(GL_TEXTURE_2D);
AUTO_VAR(itEnd, Achievements::achievements->end());
for (AUTO_VAR(it, Achievements::achievements->begin()); it != itEnd; it++)
for ( Achievement *ach : *Achievements::achievements )
{
Achievement *ach = *it; //Achievements::achievements->at(i);
if (ach->requires == NULL) continue;
if ( ach == nullptr || ach->requires == nullptr) continue;
int x1 = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll + 11 + xBigMap;
int y1 = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll + 11 + yBigMap;
@@ -299,11 +297,8 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
glEnable(GL_RESCALE_NORMAL);
glEnable(GL_COLOR_MATERIAL);
itEnd = Achievements::achievements->end();
for (AUTO_VAR(it, Achievements::achievements->begin()); it != itEnd; it++)
for ( Achievement *ach : *Achievements::achievements )
{
Achievement *ach = *it; //Achievements::achievements->at(i);
int x = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll;
int y = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll;
+3 -6
View File
@@ -78,11 +78,8 @@ vector<wstring> *ArchiveFile::getFileList()
{
vector<wstring> *out = new vector<wstring>();
for ( AUTO_VAR(it, m_index.begin());
it != m_index.end();
it++ )
out->push_back( it->first );
for ( const auto& it : m_index )
out->push_back( it.first );
return out;
}
@@ -100,7 +97,7 @@ int ArchiveFile::getFileSize(const wstring &filename)
byteArray ArchiveFile::getFile(const wstring &filename)
{
byteArray out;
AUTO_VAR(it,m_index.find(filename));
auto it = m_index.find(filename);
if(it == m_index.end())
{
+2 -2
View File
@@ -149,7 +149,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
wstring mipMapPath = L"";
if( l != 0 )
{
mipMapPath = L"MipMapLevel" + _toString<int>(l+1);
mipMapPath = L"MipMapLevel" + std::to_wstring(l+1);
}
if( filenameHasExtension )
{
@@ -207,7 +207,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
wstring mipMapPath = L"";
if( l != 0 )
{
mipMapPath = L"MipMapLevel" + _toString<int>(l+1);
mipMapPath = L"MipMapLevel" + std::to_wstring(l+1);
}
if( filenameHasExtension )
{
+18 -19
View File
@@ -484,7 +484,6 @@ void Chunk::rebuild()
PIXEndNamedEvent();
PIXBeginNamedEvent(0,"Rebuild section D");
// 4J - have rewritten the way that tile entities are stored globally to make it work more easily with split screen. Chunks are now
// stored globally in the levelrenderer, in a hashmap with a special key made up from the dimension and chunk position (using same index
// as is used for global flags)
@@ -493,25 +492,25 @@ void Chunk::rebuild()
EnterCriticalSection(globalRenderableTileEntities_cs);
if( renderableTileEntities.size() )
{
AUTO_VAR(it, globalRenderableTileEntities->find(key));
auto it = globalRenderableTileEntities->find(key);
if( it != globalRenderableTileEntities->end() )
{
// We've got some renderable tile entities that we want associated with this chunk, and an existing list of things that used to be.
// We need to flag any that we don't need any more to be removed, keep those that we do, and add any new ones
// First pass - flag everything already existing to be removed
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++ )
for(auto& it2 : it->second)
{
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
it2->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
}
// Now go through the current list. If these are already in the list, then unflag the remove flag. If they aren't, then add
for( int i = 0; i < renderableTileEntities.size(); i++ )
for(const auto& it3 : renderableTileEntities)
{
AUTO_VAR(it2, find( it->second.begin(), it->second.end(), renderableTileEntities[i] ));
auto it2 = find(it->second.begin(), it->second.end(), it3);
if( it2 == it->second.end() )
{
(*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]);
(*globalRenderableTileEntities)[key].push_back(it3);
}
else
{
@@ -531,12 +530,12 @@ void Chunk::rebuild()
else
{
// Another easy case - we don't want any renderable tile entities associated with this chunk. Flag all to be removed.
AUTO_VAR(it, globalRenderableTileEntities->find(key));
auto it = globalRenderableTileEntities->find(key);
if( it != globalRenderableTileEntities->end() )
{
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++ )
for(auto& it2 : it->second)
{
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
it2->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
}
}
}
@@ -559,7 +558,7 @@ void Chunk::rebuild()
unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
AUTO_VAR(endIt, oldTileEntities.end());
auto endIt = oldTileEntities.end();
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
{
newTileEntities.erase(*it);
@@ -576,7 +575,7 @@ void Chunk::rebuild()
// 4J - All these new things added to globalRenderableTileEntities
AUTO_VAR(endItRTE, renderableTileEntities.end());
auto endItRTE = renderableTileEntities.end();
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
{
oldTileEntities.erase(*it);
@@ -814,14 +813,14 @@ void Chunk::rebuild_SPU()
EnterCriticalSection(globalRenderableTileEntities_cs);
if( renderableTileEntities.size() )
{
AUTO_VAR(it, globalRenderableTileEntities->find(key));
auto it = globalRenderableTileEntities->find(key);
if( it != globalRenderableTileEntities->end() )
{
// We've got some renderable tile entities that we want associated with this chunk, and an existing list of things that used to be.
// We need to flag any that we don't need any more to be removed, keep those that we do, and add any new ones
// First pass - flag everything already existing to be removed
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++ )
for( auto it2 = it->second.begin(); it2 != it->second.end(); it2++ )
{
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
}
@@ -829,7 +828,7 @@ void Chunk::rebuild_SPU()
// Now go through the current list. If these are already in the list, then unflag the remove flag. If they aren't, then add
for( int i = 0; i < renderableTileEntities.size(); i++ )
{
AUTO_VAR(it2, find( it->second.begin(), it->second.end(), renderableTileEntities[i] ));
auto it2 = find( it->second.begin(), it->second.end(), renderableTileEntities[i] );
if( it2 == it->second.end() )
{
(*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]);
@@ -852,10 +851,10 @@ void Chunk::rebuild_SPU()
else
{
// Another easy case - we don't want any renderable tile entities associated with this chunk. Flag all to be removed.
AUTO_VAR(it, globalRenderableTileEntities->find(key));
auto it = globalRenderableTileEntities->find(key);
if( it != globalRenderableTileEntities->end() )
{
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++ )
for( auto it2 = it->second.begin(); it2 != it->second.end(); it2++ )
{
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
}
@@ -879,7 +878,7 @@ void Chunk::rebuild_SPU()
unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
AUTO_VAR(endIt, oldTileEntities.end());
auto endIt = oldTileEntities.end();
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
{
newTileEntities.erase(*it);
@@ -896,7 +895,7 @@ void Chunk::rebuild_SPU()
// 4J - All these new things added to globalRenderableTileEntities
AUTO_VAR(endItRTE, renderableTileEntities.end());
auto endItRTE = renderableTileEntities.end();
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
{
oldTileEntities.erase(*it);
+17 -18
View File
@@ -627,15 +627,12 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
}
vector<shared_ptr<Entity> > *subEntities = e->getSubEntities();
if (subEntities != NULL)
if (subEntities)
{
int offs = packet->id - e->entityId;
//for (int i = 0; i < subEntities.length; i++)
for(AUTO_VAR(it, subEntities->begin()); it != subEntities->end(); ++it)
for ( auto it : *subEntities )
{
(*it)->entityId += offs;
//subEntities[i].entityId += offs;
//System.out.println(subEntities[i].entityId);
it->entityId += offs;
}
}
@@ -2345,14 +2342,12 @@ void ClientConnection::handleAddMob(shared_ptr<AddMobPacket> packet)
mob->xRotp = packet->xRot;
vector<shared_ptr<Entity> > *subEntities = mob->getSubEntities();
if (subEntities != NULL)
if (subEntities)
{
int offs = packet->id - mob->entityId;
//for (int i = 0; i < subEntities.length; i++)
for(AUTO_VAR(it, subEntities->begin()); it != subEntities->end(); ++it)
for (auto& it : *subEntities )
{
//subEntities[i].entityId += offs;
(*it)->entityId += offs;
it->entityId += offs;
}
}
@@ -2694,6 +2689,10 @@ void ClientConnection::handleRespawn(shared_ptr<RespawnPacket> packet)
int oldDimension = minecraft->localplayers[m_userIndex]->dimension;
started = false;
// Stop any streaming music (e.g. jukebox) when changing dimensions
// so it doesn't leak into the new dimension
level->playStreamingMusic(L"", 0, 0, 0);
// Remove client connection from this level
level->removeClientConnection(this, false);
@@ -3893,29 +3892,29 @@ void ClientConnection::handleUpdateAttributes(shared_ptr<UpdateAttributesPacket>
BaseAttributeMap *attributes = (dynamic_pointer_cast<LivingEntity>(entity))->getAttributes();
unordered_set<UpdateAttributesPacket::AttributeSnapshot *> attributeSnapshots = packet->getValues();
for (AUTO_VAR(it,attributeSnapshots.begin()); it != attributeSnapshots.end(); ++it)
for ( UpdateAttributesPacket::AttributeSnapshot *attribute : attributeSnapshots )
{
UpdateAttributesPacket::AttributeSnapshot *attribute = *it;
AttributeInstance *instance = attributes->getInstance(attribute->getId());
if (instance == NULL)
if (instance)
{
// 4J - TODO: revisit, not familiar with the attribute system, why are we passing in MIN_NORMAL (Java's smallest non-zero value conforming to IEEE Standard 754 (?)) and MAX_VALUE
instance = attributes->registerAttribute(new RangedAttribute(attribute->getId(), 0, Double::MIN_NORMAL, Double::MAX_VALUE));
}
instance->setBaseValue(attribute->getBase());
instance->removeModifiers();
unordered_set<AttributeModifier *> *modifiers = attribute->getModifiers();
for (AUTO_VAR(it2,modifiers->begin()); it2 != modifiers->end(); ++it2)
if ( modifiers )
{
for ( AttributeModifier* modifier : *modifiers )
{
AttributeModifier* modifier = *it2;
instance->addModifier(new AttributeModifier(modifier->getId(), modifier->getAmount(), modifier->getOperation()));
}
}
}
}
}
// 4J: Check for deferred entity link packets related to this entity ID and handle them
void ClientConnection::checkDeferredEntityLinkPackets(int newEntityId)
@@ -42,7 +42,7 @@ void ConsoleSoundEngine::tick()
return;
}
for(AUTO_VAR(it,scheduledSounds.begin()); it != scheduledSounds.end();)
for (auto it = scheduledSounds.begin(); it != scheduledSounds.end();)
{
SoundEngine::ScheduledSound *next = *it;
next->delay--;
@@ -355,7 +355,7 @@ void ColourTable::loadColoursFromData(PBYTE pbData, DWORD dwLength)
wstring colourId = dis.readUTF();
int colourValue = dis.readInt();
setColour(colourId, colourValue);
AUTO_VAR(it,s_colourNamesMap.find(colourId));
auto it = s_colourNamesMap.find(colourId); // ?
}
bais.reset();
@@ -363,7 +363,7 @@ void ColourTable::loadColoursFromData(PBYTE pbData, DWORD dwLength)
void ColourTable::setColour(const wstring &colourName, int value)
{
AUTO_VAR(it,s_colourNamesMap.find(colourName));
auto it = s_colourNamesMap.find(colourName);
if(it != s_colourNamesMap.end())
{
m_colourValues[(int)it->second] = value;
+56 -88
View File
@@ -1,5 +1,4 @@

#include "stdafx.h"
#include "stdafx.h"
#include "..\..\Minecraft.World\net.minecraft.world.entity.item.h"
#include "..\..\Minecraft.World\net.minecraft.world.entity.player.h"
#include "..\..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
@@ -1475,9 +1474,8 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
app.SetXuiServerAction(iPad,eXuiServerAction_ServerSettingChanged_Gamertags);
PlayerList *players = MinecraftServer::getInstance()->getPlayerList();
for(AUTO_VAR(it3, players->players.begin()); it3 != players->players.end(); ++it3)
for( auto& decorationPlayer : players->players )
{
shared_ptr<ServerPlayer> decorationPlayer = *it3;
decorationPlayer->setShowOnMaps((app.GetGameHostOption(eGameHostOption_Gamertags)!=0)?true:false);
}
}
@@ -5641,7 +5639,7 @@ bool CMinecraftApp::isXuidNotch(PlayerUID xuid)
bool CMinecraftApp::isXuidDeadmau5(PlayerUID xuid)
{
AUTO_VAR(it, MojangData.find( xuid )); // 4J Stu - The .at and [] accessors insert elements if they don't exist
auto it = MojangData.find(xuid); // 4J Stu - The .at and [] accessors insert elements if they don't exist
if (it != MojangData.end() )
{
MOJANG_DATA *pMojangData=MojangData[xuid];
@@ -5659,7 +5657,7 @@ void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD
EnterCriticalSection(&csMemFilesLock);
// check it's not already in
PMEMDATA pData=NULL;
AUTO_VAR(it, m_MEM_Files.find(wName));
auto it = m_MEM_Files.find(wName);
if(it != m_MEM_Files.end())
{
#ifndef _CONTENT_PACKAGE
@@ -5704,7 +5702,7 @@ void CMinecraftApp::RemoveMemoryTextureFile(const wstring &wName)
{
EnterCriticalSection(&csMemFilesLock);
AUTO_VAR(it, m_MEM_Files.find(wName));
auto it = m_MEM_Files.find(wName);
if(it != m_MEM_Files.end())
{
#ifndef _CONTENT_PACKAGE
@@ -5730,7 +5728,7 @@ bool CMinecraftApp::DefaultCapeExists()
bool val = false;
EnterCriticalSection(&csMemFilesLock);
AUTO_VAR(it, m_MEM_Files.find(wTex));
auto it = m_MEM_Files.find(wTex);
if(it != m_MEM_Files.end()) val = true;
LeaveCriticalSection(&csMemFilesLock);
@@ -5742,7 +5740,7 @@ bool CMinecraftApp::IsFileInMemoryTextures(const wstring &wName)
bool val = false;
EnterCriticalSection(&csMemFilesLock);
AUTO_VAR(it, m_MEM_Files.find(wName));
auto it = m_MEM_Files.find(wName);
if(it != m_MEM_Files.end()) val = true;
LeaveCriticalSection(&csMemFilesLock);
@@ -5752,7 +5750,7 @@ bool CMinecraftApp::IsFileInMemoryTextures(const wstring &wName)
void CMinecraftApp::GetMemFileDetails(const wstring &wName,PBYTE *ppbData,DWORD *pdwBytes)
{
EnterCriticalSection(&csMemFilesLock);
AUTO_VAR(it, m_MEM_Files.find(wName));
auto it = m_MEM_Files.find(wName);
if(it != m_MEM_Files.end())
{
PMEMDATA pData = (*it).second;
@@ -5767,7 +5765,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes)
EnterCriticalSection(&csMemTPDLock);
// check it's not already in
PMEMDATA pData=NULL;
AUTO_VAR(it, m_MEM_TPD.find(iConfig));
auto it = m_MEM_TPD.find(iConfig);
if(it == m_MEM_TPD.end())
{
pData = (PMEMDATA)new BYTE[sizeof(MEMDATA)];
@@ -5787,7 +5785,7 @@ void CMinecraftApp::RemoveMemoryTPDFile(int iConfig)
EnterCriticalSection(&csMemTPDLock);
// check it's not already in
PMEMDATA pData=NULL;
AUTO_VAR(it, m_MEM_TPD.find(iConfig));
auto it = m_MEM_TPD.find(iConfig);
if(it != m_MEM_TPD.end())
{
pData=m_MEM_TPD[iConfig];
@@ -5844,7 +5842,7 @@ bool CMinecraftApp::IsFileInTPD(int iConfig)
bool val = false;
EnterCriticalSection(&csMemTPDLock);
AUTO_VAR(it, m_MEM_TPD.find(iConfig));
auto it = m_MEM_TPD.find(iConfig);
if(it != m_MEM_TPD.end()) val = true;
LeaveCriticalSection(&csMemTPDLock);
@@ -5854,7 +5852,7 @@ bool CMinecraftApp::IsFileInTPD(int iConfig)
void CMinecraftApp::GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes)
{
EnterCriticalSection(&csMemTPDLock);
AUTO_VAR(it, m_MEM_TPD.find(iConfig));
auto it = m_MEM_TPD.find(iConfig);
if(it != m_MEM_TPD.end())
{
PMEMDATA pData = (*it).second;
@@ -6989,7 +6987,7 @@ HRESULT CMinecraftApp::RegisterDLCData(eDLCContentType eType, WCHAR *pwchBannerN
// check if we already have this info from the local DLC file
wstring wsTemp=wchUppercaseProductID;
AUTO_VAR(it, DLCInfo_Full.find(wsTemp));
auto it = DLCInfo_Full.find(wsTemp);
if( it == DLCInfo_Full.end() )
{
// Not found
@@ -7097,7 +7095,7 @@ HRESULT CMinecraftApp::RegisterDLCData(char *pchDLCName, unsigned int uiSortInde
#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal)
{
AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin));
auto it = DLCInfo_SkinName.find(FirstSkin);
if( it == DLCInfo_SkinName.end() )
{
return false;
@@ -7110,7 +7108,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLON
}
bool CMinecraftApp::GetDLCNameForPackID(const int iPackID,char **ppchKeyID)
{
AUTO_VAR(it, DLCTextures_PackID.find(iPackID));
auto it = DLCTextures_PackID.find(iPackID);
if( it == DLCTextures_PackID.end() )
{
*ppchKeyID=NULL;
@@ -7128,7 +7126,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfo(char *pchDLCName)
if(DLCInfo.size()>0)
{
AUTO_VAR(it, DLCInfo.find(tempString));
auto it = DLCInfo.find(tempString);
if( it == DLCInfo.end() )
{
@@ -7185,7 +7183,7 @@ char *CMinecraftApp::GetDLCInfoTextures(int iIndex)
#elif defined _XBOX_ONE
bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,wstring &ProductId)
{
AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin));
auto it = DLCInfo_SkinName.find(FirstSkin);
if( it == DLCInfo_SkinName.end() )
{
return false;
@@ -7198,7 +7196,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,wstring
}
bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,wstring &ProductId)
{
AUTO_VAR(it, DLCTextures_PackID.find(iPackID));
auto it = DLCTextures_PackID.find(iPackID);
if( it == DLCTextures_PackID.end() )
{
return false;
@@ -7243,7 +7241,7 @@ wstring CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex)
#else
bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal)
{
AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin));
auto it = DLCInfo_SkinName.find(FirstSkin);
if( it == DLCInfo_SkinName.end() )
{
return false;
@@ -7256,15 +7254,15 @@ bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLON
}
bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,ULONGLONG *pullVal)
{
AUTO_VAR(it, DLCTextures_PackID.find(iPackID));
auto it = DLCTextures_PackID.find(iPackID);
if( it == DLCTextures_PackID.end() )
{
*pullVal=(ULONGLONG)0;
*pullVal=0ULL;
return false;
}
else
{
*pullVal=(ULONGLONG)it->second;
*pullVal=it->second;
return true;
}
}
@@ -7273,7 +7271,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial)
//DLC_INFO *pDLCInfo=NULL;
if(DLCInfo_Trial.size()>0)
{
AUTO_VAR(it, DLCInfo_Trial.find(ullOfferID_Trial));
auto it = DLCInfo_Trial.find(ullOfferID_Trial);
if( it == DLCInfo_Trial.end() )
{
@@ -7330,7 +7328,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(WCHAR *pwchProductID)
wstring wsTemp = pwchProductID;
if(DLCInfo_Full.size()>0)
{
AUTO_VAR(it, DLCInfo_Full.find(wsTemp));
auto it = DLCInfo_Full.find(wsTemp);
if( it == DLCInfo_Full.end() )
{
@@ -7370,7 +7368,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full)
if(DLCInfo_Full.size()>0)
{
AUTO_VAR(it, DLCInfo_Full.find(ullOfferID_Full));
auto it = DLCInfo_Full.find(ullOfferID_Full);
if( it == DLCInfo_Full.end() )
{
@@ -7570,9 +7568,8 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps
DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size());
PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new CHAR [dwDataBytes]);
int iCount=0;
for(AUTO_VAR(it, m_vBannedListA[iPad]->begin()); it != m_vBannedListA[iPad]->end(); ++it)
for (PBANNEDLISTDATA pData : *m_vBannedListA[iPad] )
{
PBANNEDLISTDATA pData=*it;
memcpy(&pBannedList[iCount++],pData,sizeof(BANNEDLISTDATA));
}
@@ -7590,9 +7587,8 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps
bool CMinecraftApp::IsInBannedLevelList(int iPad, PlayerUID xuid, char *pszLevelName)
{
for(AUTO_VAR(it, m_vBannedListA[iPad]->begin()); it != m_vBannedListA[iPad]->end(); ++it)
for( PBANNEDLISTDATA pData : *m_vBannedListA[iPad] )
{
PBANNEDLISTDATA pData=*it;
#ifdef _XBOX_ONE
PlayerUID bannedPlayerUID = pData->wchPlayerUID;
if(IsEqualXUID (bannedPlayerUID,xuid) && (strcmp(pData->pszLevelName,pszLevelName)==0))
@@ -7613,7 +7609,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha
//bool bRes;
// we will have retrieved the banned level list from TMS, so remove this one from it and write it back to TMS
for(AUTO_VAR(it, m_vBannedListA[iPad]->begin()); it != m_vBannedListA[iPad]->end(); )
for (auto it = m_vBannedListA[iPad]->begin(); it != m_vBannedListA[iPad]->end(); )
{
PBANNEDLISTDATA pBannedListData = *it;
@@ -8321,10 +8317,8 @@ unsigned int CMinecraftApp::CreateImageTextData(PBYTE bTextMetadata, __int64 see
void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType,int x,int z)
{
// check we don't already have this in
for(AUTO_VAR(it, m_vTerrainFeatures.begin()); it < m_vTerrainFeatures.end(); ++it)
for( FEATURE_DATA *pFeatureData : m_vTerrainFeatures )
{
FEATURE_DATA *pFeatureData=*it;
if((pFeatureData->eTerrainFeature==eFeatureType) &&(pFeatureData->x==x) && (pFeatureData->z==z)) return;
}
@@ -8338,10 +8332,8 @@ void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType,
_eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x,int z)
{
for(AUTO_VAR(it, m_vTerrainFeatures.begin()); it < m_vTerrainFeatures.end(); ++it)
for(FEATURE_DATA *pFeatureData : m_vTerrainFeatures )
{
FEATURE_DATA *pFeatureData=*it;
if((pFeatureData->x==x) && (pFeatureData->z==z)) return pFeatureData->eTerrainFeature;
}
@@ -8350,10 +8342,8 @@ _eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x,int z)
bool CMinecraftApp::GetTerrainFeaturePosition(_eTerrainFeatureType eType,int *pX, int *pZ)
{
for(AUTO_VAR(it, m_vTerrainFeatures.begin()); it < m_vTerrainFeatures.end(); ++it)
for ( const FEATURE_DATA *pFeatureData : m_vTerrainFeatures )
{
FEATURE_DATA *pFeatureData=*it;
if(pFeatureData->eTerrainFeature==eType)
{
*pX=pFeatureData->x;
@@ -8489,10 +8479,8 @@ unsigned int CMinecraftApp::AddDLCRequest(eDLCMarketplaceType eType, bool bPromo
// If it's already in there, promote it to the top of the list
int iPosition=0;
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it)
for( DLCRequest *pCurrent : m_DLCDownloadQueue )
{
DLCRequest *pCurrent = *it;
if(pCurrent->dwType==m_dwContentTypeA[eType])
{
// already got this in the list
@@ -8543,7 +8531,7 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
bool bPromoted=false;
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
for ( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{
TMSPPRequest *pCurrent = *it;
@@ -8601,10 +8589,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
// this may already be present in the vector because of a previous trial/full offer
bool bAlreadyInQueue=false;
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{
TMSPPRequest *pCurrent = *it;
if(wcscmp(pDLC->wchDataFile,pCurrent->wchFilename)==0)
{
bAlreadyInQueue=true;
@@ -8664,10 +8650,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
if(!bPresent) // retrieve it from TMSPP
{
bool bAlreadyInQueue=false;
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{
TMSPPRequest *pCurrent = *it;
if(wcscmp(pDLC->wchBanner,pCurrent->wchFilename)==0)
{
bAlreadyInQueue=true;
@@ -8721,10 +8705,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
// this may already be present in the vector because of a previous trial/full offer
bool bAlreadyInQueue=false;
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{
TMSPPRequest *pCurrent = *it;
if(wcscmp(pDLC->wchBanner,pCurrent->wchFilename)==0)
{
bAlreadyInQueue=true;
@@ -8767,10 +8749,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
bool CMinecraftApp::CheckTMSDLCCanStop()
{
EnterCriticalSection(&csTMSPPDownloadQueue);
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{
TMSPPRequest *pCurrent = *it;
if(pCurrent->eState==e_TMS_ContentState_Retrieving)
{
LeaveCriticalSection(&csTMSPPDownloadQueue);
@@ -8796,10 +8776,8 @@ bool CMinecraftApp::RetrieveNextDLCContent()
}
EnterCriticalSection(&csDLCDownloadQueue);
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it)
for( const DLCRequest* pCurrent : m_DLCDownloadQueue )
{
DLCRequest *pCurrent = *it;
if(pCurrent->eState==e_DLC_ContentState_Retrieving)
{
LeaveCriticalSection(&csDLCDownloadQueue);
@@ -8808,10 +8786,8 @@ bool CMinecraftApp::RetrieveNextDLCContent()
}
// Now look for the next retrieval
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it)
for( DLCRequest *pCurrent : m_DLCDownloadQueue )
{
DLCRequest *pCurrent = *it;
if(pCurrent->eState==e_DLC_ContentState_Idle)
{
#ifdef _DEBUG
@@ -8853,9 +8829,8 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto
// find the right one in the vector
EnterCriticalSection(&pClass->csTMSPPDownloadQueue);
for(AUTO_VAR(it, pClass->m_TMSPPDownloadQueue.begin()); it != pClass->m_TMSPPDownloadQueue.end(); ++it)
for( TMSPPRequest *pCurrent : pClass->m_TMSPPDownloadQueue )
{
TMSPPRequest *pCurrent = *it;
#if defined(_XBOX) || defined(_WINDOWS64)
char szFile[MAX_TMSFILENAME_SIZE];
wcstombs(szFile,pCurrent->wchFilename,MAX_TMSFILENAME_SIZE);
@@ -8956,8 +8931,7 @@ bool CMinecraftApp::RetrieveNextTMSPPContent()
if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())==false) return false;
EnterCriticalSection(&csTMSPPDownloadQueue);
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{
TMSPPRequest *pCurrent = *it;
@@ -8970,7 +8944,7 @@ bool CMinecraftApp::RetrieveNextTMSPPContent()
}
// Now look for the next retrieval
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{
TMSPPRequest *pCurrent = *it;
@@ -9074,10 +9048,9 @@ void CMinecraftApp::ClearAndResetDLCDownloadQueue()
int iPosition=0;
EnterCriticalSection(&csTMSPPDownloadQueue);
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it)
for( DLCRequest *pCurrent : m_DLCDownloadQueue )
{
DLCRequest *pCurrent = *it;
if ( pCurrent )
delete pCurrent;
iPosition++;
}
@@ -9100,10 +9073,9 @@ void CMinecraftApp::ClearTMSPPFilesRetrieved()
{
int iPosition=0;
EnterCriticalSection(&csTMSPPDownloadQueue);
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
for ( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{
TMSPPRequest *pCurrent = *it;
if ( pCurrent )
delete pCurrent;
iPosition++;
}
@@ -9118,10 +9090,8 @@ int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, in
// find the right one in the vector
EnterCriticalSection(&pClass->csTMSPPDownloadQueue);
for(AUTO_VAR(it, pClass->m_DLCDownloadQueue.begin()); it != pClass->m_DLCDownloadQueue.end(); ++it)
for( DLCRequest *pCurrent : pClass->m_DLCDownloadQueue )
{
DLCRequest *pCurrent = *it;
// avatar items are coming back as type Content, so we can't trust the type setting
if(pCurrent->dwType==dwType)
{
@@ -9151,10 +9121,8 @@ bool CMinecraftApp::DLCContentRetrieved(eDLCMarketplaceType eType)
// If there's already a retrieve in progress, quit
// we may have re-ordered the list, so need to check every item
EnterCriticalSection(&csDLCDownloadQueue);
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it)
for( DLCRequest *pCurrent : m_DLCDownloadQueue )
{
DLCRequest *pCurrent = *it;
if((pCurrent->dwType==m_dwContentTypeA[eType]) && (pCurrent->eState==e_DLC_ContentState_Retrieved))
{
LeaveCriticalSection(&csDLCDownloadQueue);
@@ -9208,17 +9176,17 @@ vector<ModelPart *> * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vect
app.DebugPrintf("*** SetAdditionalSkinBoxes - Inserting model parts for skin %d from array of Skin Boxes\n",dwSkinID&0x0FFFFFFF);
// convert the skin boxes into model parts, and add to the humanoid model
for(AUTO_VAR(it, pvSkinBoxA->begin());it != pvSkinBoxA->end(); ++it)
for( auto& it : *pvSkinBoxA )
{
if(pModel)
{
ModelPart *pModelPart=pModel->AddOrRetrievePart(*it);
ModelPart *pModelPart=pModel->AddOrRetrievePart(it);
pvModelPart->push_back(pModelPart);
}
}
m_AdditionalModelParts.insert( std::pair<DWORD, vector<ModelPart *> *>(dwSkinID, pvModelPart) );
m_AdditionalSkinBoxes.insert( std::pair<DWORD, vector<SKIN_BOX *> *>(dwSkinID, pvSkinBoxA) );
m_AdditionalModelParts.emplace(dwSkinID, pvModelPart);
m_AdditionalSkinBoxes.emplace(dwSkinID, pvSkinBoxA);
LeaveCriticalSection( &csAdditionalSkinBoxes );
LeaveCriticalSection( &csAdditionalModelParts );
@@ -9232,7 +9200,7 @@ vector<ModelPart *> *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID)
vector<ModelPart *> *pvModelParts=NULL;
if(m_AdditionalModelParts.size()>0)
{
AUTO_VAR(it, m_AdditionalModelParts.find(dwSkinID));
auto it = m_AdditionalModelParts.find(dwSkinID);
if(it!=m_AdditionalModelParts.end())
{
pvModelParts = (*it).second;
@@ -9249,7 +9217,7 @@ vector<SKIN_BOX *> *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID)
vector<SKIN_BOX *> *pvSkinBoxes=NULL;
if(m_AdditionalSkinBoxes.size()>0)
{
AUTO_VAR(it,m_AdditionalSkinBoxes.find(dwSkinID));
auto it = m_AdditionalSkinBoxes.find(dwSkinID);
if(it!=m_AdditionalSkinBoxes.end())
{
pvSkinBoxes = (*it).second;
@@ -9267,7 +9235,7 @@ unsigned int CMinecraftApp::GetAnimOverrideBitmask(DWORD dwSkinID)
if(m_AnimOverrides.size()>0)
{
AUTO_VAR(it, m_AnimOverrides.find(dwSkinID));
auto it = m_AnimOverrides.find(dwSkinID);
if(it!=m_AnimOverrides.end())
{
uiAnimOverrideBitmask = (*it).second;
@@ -9285,7 +9253,7 @@ void CMinecraftApp::SetAnimOverrideBitmask(DWORD dwSkinID,unsigned int uiAnimOve
if(m_AnimOverrides.size()>0)
{
AUTO_VAR(it, m_AnimOverrides.find(dwSkinID));
auto it = m_AnimOverrides.find(dwSkinID);
if(it!=m_AnimOverrides.end())
{
LeaveCriticalSection( &csAnimOverrideBitmask );
+1 -1
View File
@@ -178,7 +178,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
{
//EAudioParameterType paramType = e_AudioParamType_Invalid;
AUTO_VAR(it, parameterMapping.find( pParams->dwType ));
auto it = parameterMapping.find(pParams->dwType);
if(it != parameterMapping.end() )
{
+19 -36
View File
@@ -32,9 +32,9 @@ DLCManager::DLCManager()
DLCManager::~DLCManager()
{
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for ( DLCPack *pack : m_packs )
{
DLCPack *pack = *it;
if ( pack )
delete pack;
}
}
@@ -60,10 +60,9 @@ DWORD DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/)
DWORD packCount = 0;
if( type != e_DLCType_All )
{
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack *pack : m_packs )
{
DLCPack *pack = *it;
if( pack->getDLCItemsCount(type) > 0 )
if( pack && pack->getDLCItemsCount(type) > 0 )
{
++packCount;
}
@@ -85,7 +84,7 @@ void DLCManager::removePack(DLCPack *pack)
{
if(pack != NULL)
{
AUTO_VAR(it, find(m_packs.begin(),m_packs.end(),pack));
auto it = find(m_packs.begin(), m_packs.end(), pack);
if(it != m_packs.end() ) m_packs.erase(it);
delete pack;
}
@@ -93,9 +92,9 @@ void DLCManager::removePack(DLCPack *pack)
void DLCManager::removeAllPacks(void)
{
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack *pack : m_packs )
{
DLCPack *pack = (DLCPack *)*it;
if ( pack )
delete pack;
}
@@ -104,23 +103,19 @@ void DLCManager::removeAllPacks(void)
void DLCManager::LanguageChanged(void)
{
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack *pack : m_packs )
{
DLCPack *pack = (DLCPack *)*it;
// update the language
pack->UpdateLanguage();
}
}
DLCPack *DLCManager::getPack(const wstring &name)
{
DLCPack *pack = NULL;
//DWORD currentIndex = 0;
DLCPack *currentPack = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack * currentPack : m_packs )
{
currentPack = *it;
wstring wsName=currentPack->getName();
if(wsName.compare(name) == 0)
@@ -136,11 +131,8 @@ DLCPack *DLCManager::getPack(const wstring &name)
DLCPack *DLCManager::getPackFromProductID(const wstring &productID)
{
DLCPack *pack = NULL;
//DWORD currentIndex = 0;
DLCPack *currentPack = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack *currentPack : m_packs )
{
currentPack = *it;
wstring wsName=currentPack->getPurchaseOfferId();
if(wsName.compare(productID) == 0)
@@ -159,10 +151,8 @@ DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/)
if( type != e_DLCType_All )
{
DWORD currentIndex = 0;
DLCPack *currentPack = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack *currentPack : m_packs )
{
currentPack = *it;
if(currentPack->getDLCItemsCount(type)>0)
{
if(currentIndex == index)
@@ -200,9 +190,8 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
if( type != e_DLCType_All )
{
DWORD index = 0;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack *thisPack : m_packs )
{
DLCPack *thisPack = *it;
if(thisPack->getDLCItemsCount(type)>0)
{
if(thisPack == pack)
@@ -218,9 +207,8 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
else
{
DWORD index = 0;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack *thisPack : m_packs )
{
DLCPack *thisPack = *it;
if(thisPack == pack)
{
found = true;
@@ -238,9 +226,8 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found)
DWORD foundIndex = 0;
found = false;
DWORD index = 0;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack *pack : m_packs )
{
DLCPack *pack = *it;
if(pack->getDLCItemsCount(e_DLCType_Skin)>0)
{
if(pack->doesPackContainSkin(path))
@@ -258,9 +245,8 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found)
DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
{
DLCPack *foundPack = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack *pack : m_packs )
{
DLCPack *pack = *it;
if(pack->getDLCItemsCount(e_DLCType_Skin)>0)
{
if(pack->doesPackContainSkin(path))
@@ -276,9 +262,8 @@ DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
{
DLCSkinFile *foundSkinfile = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack *pack : m_packs )
{
DLCPack *pack = *it;
foundSkinfile=pack->getSkinFile(path);
if(foundSkinfile!=NULL)
{
@@ -291,12 +276,10 @@ DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
{
DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount;
DLCPack *pack = NULL;
DLCPack *firstCorruptPack = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack *pack : m_packs )
{
pack = *it;
if( pack->IsCorrupt() )
{
++corruptDLCCount;
@@ -468,7 +451,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
{
//DLCManager::EDLCParameterType paramType = DLCManager::e_DLCParamType_Invalid;
AUTO_VAR(it, parameterMapping.find( pParams->dwType ));
auto it = parameterMapping.find(pParams->dwType);
if(it != parameterMapping.end() )
{
@@ -658,7 +641,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp;
for(unsigned int j=0;j<uiParameterCount;j++)
{
AUTO_VAR(it, parameterMapping.find( pParams->dwType ));
auto it = parameterMapping.find(pParams->dwType);
if(it != parameterMapping.end() )
{
+11 -9
View File
@@ -54,16 +54,18 @@ DLCPack::DLCPack(const wstring &name,const wstring &productID,DWORD dwLicenseMas
DLCPack::~DLCPack()
{
for(AUTO_VAR(it, m_childPacks.begin()); it != m_childPacks.end(); ++it)
for( auto& it : m_childPacks )
{
delete *it;
if ( it )
delete it;
}
for(unsigned int i = 0; i < DLCManager::e_DLCType_Max; ++i)
{
for(AUTO_VAR(it,m_files[i].begin()); it != m_files[i].end(); ++it)
for (auto& it : m_files[i] )
{
delete *it;
if ( it )
delete it;
}
}
@@ -161,7 +163,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const wstring &va
bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned int &param)
{
AUTO_VAR(it,m_parameters.find((int)type));
auto it = m_parameters.find((int)type);
if(it != m_parameters.end())
{
switch(type)
@@ -270,7 +272,7 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path
else
{
g_pathCmpString = &path;
AUTO_VAR(it, find_if( m_files[type].begin(), m_files[type].end(), pathCmp ));
auto it = find_if(m_files[type].begin(), m_files[type].end(), pathCmp);
hasFile = it != m_files[type].end();
if(!hasFile && m_parentPack )
{
@@ -316,7 +318,7 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path)
else
{
g_pathCmpString = &path;
AUTO_VAR(it, find_if( m_files[type].begin(), m_files[type].end(), pathCmp ));
auto it = find_if(m_files[type].begin(), m_files[type].end(), pathCmp);
if(it == m_files[type].end())
{
@@ -368,9 +370,9 @@ DWORD DLCPack::getFileIndexAt(DLCManager::EDLCType type, const wstring &path, bo
DWORD foundIndex = 0;
found = false;
DWORD index = 0;
for(AUTO_VAR(it, m_files[type].begin()); it != m_files[type].end(); ++it)
for( auto& it : m_files[type] )
{
if(path.compare((*it)->getPath()) == 0)
if(path.compare(it->getPath()) == 0)
{
foundIndex = index;
found = true;
@@ -14,10 +14,10 @@ void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream *dos, UINT n
GameRuleDefinition::writeAttributes(dos, numAttributes + 2);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentId);
dos->writeUTF( _toString( m_enchantmentId ) );
dos->writeUTF( std::to_wstring( m_enchantmentId ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentLevel);
dos->writeUTF( _toString( m_enchantmentLevel ) );
dos->writeUTF( std::to_wstring( m_enchantmentLevel ) );
}
void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -17,26 +17,26 @@ void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
dos->writeUTF( _toString( m_itemId ) );
dos->writeUTF( std::to_wstring( m_itemId ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
dos->writeUTF( _toString( m_quantity ) );
dos->writeUTF( std::to_wstring( m_quantity ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
dos->writeUTF( _toString( m_auxValue ) );
dos->writeUTF( std::to_wstring( m_auxValue ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
dos->writeUTF( _toString( m_dataTag ) );
dos->writeUTF( std::to_wstring( m_dataTag ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_slot);
dos->writeUTF( _toString( m_slot ) );
dos->writeUTF( std::to_wstring( m_slot ) );
}
void AddItemRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
{
GameRuleDefinition::getChildren( children );
for (AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); it++)
children->push_back( *it );
for ( const auto& it : m_enchantments )
children->push_back( it );
}
GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -99,13 +99,13 @@ bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container,
bool added = false;
if(Item::items[m_itemId] != NULL)
{
int quantity = min(m_quantity, Item::items[m_itemId]->getMaxStackSize());
int quantity = std::min<int>(m_quantity, Item::items[m_itemId]->getMaxStackSize());
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
newItem->set4JData(m_dataTag);
for(AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); ++it)
for( auto& it : m_enchantments )
{
(*it)->enchantItem(newItem);
it->enchantItem(newItem);
}
if(m_slot >= 0 && m_slot < container->getContainerSize() )
@@ -37,19 +37,19 @@ void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, UINT n
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_filename);
dos->writeUTF(m_schematicName);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
dos->writeUTF(_toString(m_location->x));
dos->writeUTF(std::to_wstring(m_location->x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
dos->writeUTF(_toString(m_location->y));
dos->writeUTF(std::to_wstring(m_location->y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
dos->writeUTF(_toString(m_location->z));
dos->writeUTF(std::to_wstring(m_location->z));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_rot);
switch (m_rotation)
{
case ConsoleSchematicFile::eSchematicRot_0: dos->writeUTF(_toString( 0 )); break;
case ConsoleSchematicFile::eSchematicRot_90: dos->writeUTF(_toString( 90 )); break;
case ConsoleSchematicFile::eSchematicRot_180: dos->writeUTF(_toString( 180 )); break;
case ConsoleSchematicFile::eSchematicRot_270: dos->writeUTF(_toString( 270 )); break;
case ConsoleSchematicFile::eSchematicRot_0: dos->writeUTF(L"0"); break;
case ConsoleSchematicFile::eSchematicRot_90: dos->writeUTF(L"90"); break;
case ConsoleSchematicFile::eSchematicRot_180: dos->writeUTF(L"180"); break;
case ConsoleSchematicFile::eSchematicRot_270: dos->writeUTF(L"270"); break;
}
}
@@ -14,11 +14,11 @@ void BiomeOverride::writeAttributes(DataOutputStream *dos, UINT numAttrs)
GameRuleDefinition::writeAttributes(dos, numAttrs + 3);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_biomeId);
dos->writeUTF(_toString(m_biomeId));
dos->writeUTF(std::to_wstring(m_biomeId));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
dos->writeUTF(_toString(m_tile));
dos->writeUTF(std::to_wstring(m_tile));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_topTileId);
dos->writeUTF(_toString(m_topTile));
dos->writeUTF(std::to_wstring(m_topTile));
}
void BiomeOverride::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -22,13 +22,13 @@ void CollectItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numA
GameRuleDefinition::writeAttributes(dos, numAttributes + 3);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
dos->writeUTF( _toString( m_itemId ) );
dos->writeUTF( std::to_wstring( m_itemId ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
dos->writeUTF( _toString( m_auxValue ) );
dos->writeUTF( std::to_wstring( m_auxValue ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
dos->writeUTF( _toString( m_quantity ) );
dos->writeUTF( std::to_wstring( m_quantity ) );
}
void CollectItemRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -108,9 +108,9 @@ wstring CollectItemRuleDefinition::generateXml(shared_ptr<ItemInstance> item)
wstring xml = L"";
if(item != NULL)
{
xml = L"<CollectItemRule itemId=\"" + _toString<int>(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\"";
if(item->getAuxValue() != 0) xml += L" auxValue=\"" + _toString<int>(item->getAuxValue()) + L"\"";
if(item->get4JData() != 0) xml += L" dataTag=\"" + _toString<int>(item->get4JData()) + L"\"";
xml = L"<CollectItemRule itemId=\"" + std::to_wstring(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\"";
if(item->getAuxValue() != 0) xml += L" auxValue=\"" + std::to_wstring(item->getAuxValue()) + L"\"";
if(item->get4JData() != 0) xml += L" dataTag=\"" + std::to_wstring(item->get4JData()) + L"\"";
xml += L"/>\n";
}
return xml;
@@ -28,12 +28,12 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
{
int goal = 0;
int progress = 0;
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)
{
goal += it->second.gr->getGameRuleDefinition()->getGoal();
progress += it->second.gr->getGameRuleDefinition()->getProgress(it->second.gr);
goal += it.second.gr->getGameRuleDefinition()->getGoal();
progress += it.second.gr->getGameRuleDefinition()->getProgress(it.second.gr);
}
}
if(rule->getConnection() != NULL)
@@ -60,7 +60,7 @@ wstring CompleteAllRuleDefinition::generateDescriptionString(const wstring &desc
{
PacketData *values = (PacketData *)data;
wstring newDesc = description;
newDesc = replaceAll(newDesc,L"{*progress*}",_toString<int>(values->progress));
newDesc = replaceAll(newDesc,L"{*goal*}",_toString<int>(values->goal));
newDesc = replaceAll(newDesc,L"{*progress*}",std::to_wstring(values->progress));
newDesc = replaceAll(newDesc,L"{*goal*}",std::to_wstring(values->goal));
return newDesc;
}
@@ -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)
@@ -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);
}
}
@@ -19,8 +19,8 @@ void ConsoleGenerateStructure::getChildren(vector<GameRuleDefinition *> *childre
{
GameRuleDefinition::getChildren(children);
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); it++)
children->push_back( *it );
for ( auto& action : m_actions )
children->push_back( action );
}
GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -60,16 +60,16 @@ void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, UINT numAt
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
dos->writeUTF(_toString(m_x));
dos->writeUTF(std::to_wstring(m_x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
dos->writeUTF(_toString(m_y));
dos->writeUTF(std::to_wstring(m_y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
dos->writeUTF(_toString(m_z));
dos->writeUTF(std::to_wstring(m_z));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
dos->writeUTF(_toString(orientation));
dos->writeUTF(std::to_wstring(orientation));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dimension);
dos->writeUTF(_toString(m_dimension));
dos->writeUTF(std::to_wstring(m_dimension));
}
void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -117,12 +117,11 @@ BoundingBox* ConsoleGenerateStructure::getBoundingBox()
// Find the max bounds
int maxX, maxY, maxZ;
maxX = maxY = maxZ = 1;
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it)
for( ConsoleGenerateStructureAction *action : m_actions )
{
ConsoleGenerateStructureAction *action = *it;
maxX = max(maxX,action->getEndX());
maxY = max(maxY,action->getEndY());
maxZ = max(maxZ,action->getEndZ());
maxX = std::max<int>(maxX,action->getEndX());
maxY = std::max<int>(maxY,action->getEndY());
maxZ = std::max<int>(maxZ,action->getEndZ());
}
boundingBox = new BoundingBox(m_x, m_y, m_z, m_x + maxX, m_y + maxY, m_z + maxZ);
@@ -134,10 +133,8 @@ bool ConsoleGenerateStructure::postProcess(Level *level, Random *random, Boundin
{
if(level->dimension->id != m_dimension) return false;
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it)
for( ConsoleGenerateStructureAction *action : m_actions )
{
ConsoleGenerateStructureAction *action = *it;
switch(action->getActionType())
{
case ConsoleGameRules::eGameRuleType_GenerateBox:
@@ -167,18 +167,18 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
ListTag<CompoundTag> *tileEntityTags = new ListTag<CompoundTag>();
tag->put(L"TileEntities", tileEntityTags);
for (AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end(); it++)
for ( auto& it : m_tileEntities )
{
CompoundTag *cTag = new CompoundTag();
(*it)->save(cTag);
it->save(cTag);
tileEntityTags->add(cTag);
}
ListTag<CompoundTag> *entityTags = new ListTag<CompoundTag>();
tag->put(L"Entities", entityTags);
for (AUTO_VAR(it, m_entities.begin()); it != m_entities.end(); it++)
entityTags->add( (CompoundTag *)(*it).second->copy() );
for (auto& it : m_entities )
entityTags->add( (CompoundTag *)(it).second->copy() );
NbtIo::write(tag,dos);
delete tag;
@@ -186,15 +186,15 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
__int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
{
int xStart = max(destinationBox->x0, (double)chunk->x*16);
int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16);
int xStart = static_cast<int>(std::fmax<double>(destinationBox->x0, (double)chunk->x*16));
int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, (double)((xStart >> 4) << 4) + 16));
int yStart = destinationBox->y0;
int yEnd = destinationBox->y1;
if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight;
int zStart = max(destinationBox->z0, (double)chunk->z*16);
int zEnd = min(destinationBox->z1, (double)((zStart>>4)<<4) + 16);
int zStart = static_cast<int>(std::fmax<double>(destinationBox->z0, (double)chunk->z * 16));
int zEnd = static_cast<int>(std::fmin<double>(destinationBox->z1, (double)((zStart >> 4) << 4) + 16));
#ifdef _DEBUG
app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n",xStart,yStart,zStart,xEnd-1,yEnd-1,zEnd-1);
@@ -431,10 +431,8 @@ void ConsoleSchematicFile::schematicCoordToChunkCoord(AABB *destinationBox, doub
void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
{
for(AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end();++it)
for (auto& te : m_tileEntities )
{
shared_ptr<TileEntity> te = *it;
double targetX = te->x;
double targetY = te->y + destinationBox->y0;
double targetZ = te->z;
@@ -477,7 +475,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
teCopy->setChanged();
}
}
for(AUTO_VAR(it, m_entities.begin()); it != m_entities.end();)
for (auto it = m_entities.begin(); it != m_entities.end();)
{
Vec3 *source = it->first;
@@ -679,9 +677,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
for (int zc = zc0; zc <= zc1; zc++)
{
vector<shared_ptr<TileEntity> > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize);
for(AUTO_VAR(it, tileEntities->begin()); it != tileEntities->end(); ++it)
for( auto& te : *tileEntities )
{
shared_ptr<TileEntity> te = *it;
CompoundTag *teTag = new CompoundTag();
shared_ptr<TileEntity> teCopy = te->clone();
@@ -701,10 +698,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
vector<shared_ptr<Entity> > *entities = level->getEntities(nullptr, bb);
ListTag<CompoundTag> *entitiesTag = new ListTag<CompoundTag>(L"entities");
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
for (auto& e : *entities )
{
shared_ptr<Entity> e = *it;
bool mobCanBeSaved = false;
if (bSaveMobs)
{
@@ -1012,13 +1007,16 @@ void ConsoleSchematicFile::setBlocksAndData(LevelChunk *chunk, byteArray blockDa
vector<shared_ptr<TileEntity> > *ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1)
{
vector<shared_ptr<TileEntity> > *result = new vector<shared_ptr<TileEntity> >;
for (AUTO_VAR(it, chunk->tileEntities.begin()); it != chunk->tileEntities.end(); ++it)
if ( result )
{
shared_ptr<TileEntity> te = it->second;
for ( auto& it : chunk->tileEntities )
{
shared_ptr<TileEntity> te = it.second;
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1)
{
result->push_back(te);
}
}
}
return result;
}
@@ -9,11 +9,11 @@ GameRule::GameRule(GameRuleDefinition *definition, Connection *connection)
GameRule::~GameRule()
{
for(AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); ++it)
for(auto& it : m_parameters )
{
if(it->second.isPointer)
if(it.second.isPointer)
{
delete it->second.gr;
delete it.second.gr;
}
}
}
@@ -59,12 +59,12 @@ void GameRule::write(DataOutputStream *dos)
{
// Find required parameters.
dos->writeInt(m_parameters.size());
for (AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); it++)
for ( const auto& parameter : m_parameters )
{
wstring pName = (*it).first;
ValueType vType = (*it).second;
wstring pName = parameter.first;
ValueType vType = parameter.second;
dos->writeUTF( (*it).first );
dos->writeUTF( parameter.first );
dos->writeBoolean( vType.isPointer );
if (vType.isPointer)
@@ -25,8 +25,8 @@ void GameRuleDefinition::write(DataOutputStream *dos)
// Write children.
dos->writeInt( children->size() );
for (AUTO_VAR(it, children->begin()); it != children->end(); it++)
(*it)->write(dos);
for ( auto& it : *children )
it->write(dos);
}
void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
@@ -40,7 +40,7 @@ void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttribut
dos->writeUTF(m_promptId);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
dos->writeUTF(_toString(m_4JDataValue));
dos->writeUTF(std::to_wstring(m_4JDataValue));
}
void GameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children) {}
@@ -121,8 +121,8 @@ unordered_map<GameRuleDefinition *, int> *GameRuleDefinition::enumerateMap()
int i = 0;
vector<GameRuleDefinition *> *gRules = enumerate();
for (AUTO_VAR(it, gRules->begin()); it != gRules->end(); it++)
out->insert( pair<GameRuleDefinition *, int>( *it, i++ ) );
for ( auto& it : *gRules )
out->emplace(it, i++);
return out;
}
@@ -344,11 +344,10 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos)
// Write schematic files.
unordered_map<wstring, ConsoleSchematicFile *> *files;
files = getLevelGenerationOptions()->getUnfinishedSchematicFiles();
dos->writeInt( files->size() );
for (AUTO_VAR(it, files->begin()); it != files->end(); it++)
for ( auto& it : *files )
{
wstring filename = it->first;
ConsoleSchematicFile *file = it->second;
const wstring& filename = it.first;
ConsoleSchematicFile *file = it.second;
ByteArrayOutputStream fileBaos;
DataOutputStream fileDos(&fileBaos);
@@ -519,7 +518,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
{
int tagId = contentDis->readInt();
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
AUTO_VAR(it,tagIdMap.find(tagId));
auto it = tagIdMap.find(tagId);
if(it != tagIdMap.end()) tagVal = it->second;
GameRuleDefinition *rule = NULL;
@@ -595,7 +594,7 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
{
int tagId = dis->readInt();
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
AUTO_VAR(it,tagIdMap->find(tagId));
auto it = tagIdMap->find(tagId);
if(it != tagIdMap->end()) tagVal = it->second;
GameRuleDefinition *childRule = NULL;
@@ -640,18 +639,6 @@ void GameRuleManager::loadDefaultGameRules()
m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME));
}
#ifndef _CONTENT_PACKAGE
// 4J Stu - Remove these just now
//File testRulesPath(L"GAME:\\GameRules");
//vector<File *> *packFiles = testRulesPath.listFiles();
//for(AUTO_VAR(it,packFiles->begin()); it != packFiles->end(); ++it)
//{
// loadGameRulesPack(*it);
//}
//delete packFiles;
#endif
#else // _XBOX
#ifdef _WINDOWS64
@@ -67,23 +67,24 @@ LevelGenerationOptions::~LevelGenerationOptions()
{
clearSchematics();
if(m_spawnPos != NULL) delete m_spawnPos;
for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); ++it)
for (auto& it : m_schematicRules )
{
delete *it;
}
for(AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); ++it)
{
delete *it;
delete it;
}
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
for (auto& it : m_structureRules )
{
delete *it;
delete it;
}
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
for (auto& it : m_biomeOverrides )
{
delete *it;
delete it;
}
for (auto& it : m_features )
{
delete it;
}
if (m_stringTable)
@@ -100,16 +101,16 @@ void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, UINT numAttr
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
dos->writeUTF(_toString(m_spawnPos->x));
dos->writeUTF(std::to_wstring(m_spawnPos->x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
dos->writeUTF(_toString(m_spawnPos->y));
dos->writeUTF(std::to_wstring(m_spawnPos->y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ);
dos->writeUTF(_toString(m_spawnPos->z));
dos->writeUTF(std::to_wstring(m_spawnPos->z));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_seed);
dos->writeUTF(_toString(m_seed));
dos->writeUTF(std::to_wstring(m_seed));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_flatworld);
dos->writeUTF(_toString(m_useFlatWorld));
dos->writeUTF(std::to_wstring(m_useFlatWorld));
}
void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
@@ -117,18 +118,25 @@ void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
GameRuleDefinition::getChildren(children);
vector<ApplySchematicRuleDefinition *> used_schematics;
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); it++)
if ( !(*it)->isComplete() )
used_schematics.push_back( *it );
for (auto& it : m_schematicRules )
if ( it && !it->isComplete() )
used_schematics.push_back( it );
for(AUTO_VAR(it, m_structureRules.begin()); it!=m_structureRules.end(); it++)
children->push_back( *it );
for(AUTO_VAR(it, used_schematics.begin()); it!=used_schematics.end(); it++)
children->push_back( *it );
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
children->push_back( *it );
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
children->push_back( *it );
for (auto& it : m_structureRules)
if ( it )
children->push_back( it );
for (auto& it : used_schematics)
if ( it )
children->push_back( it );
for (auto& it : m_biomeOverrides)
if ( it )
children->push_back( it );
for (auto& it : m_features)
if ( it )
children->push_back( it );
}
GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -249,19 +257,14 @@ void LevelGenerationOptions::processSchematics(LevelChunk *chunk)
{
PIXBeginNamedEvent(0,"Processing schematics for chunk (%d,%d)", chunk->x, chunk->z);
AABB *chunkBox = AABB::newTemp(chunk->x*16,0,chunk->z*16,chunk->x*16 + 16,Level::maxBuildHeight,chunk->z*16 + 16);
for( AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
{
ApplySchematicRuleDefinition *rule = *it;
for( ApplySchematicRuleDefinition *rule : m_schematicRules )
rule->processSchematic(chunkBox, chunk);
}
int cx = (chunk->x << 4);
int cz = (chunk->z << 4);
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
for ( ConsoleGenerateStructure *structureStart : m_structureRules )
{
ConsoleGenerateStructure *structureStart = *it;
if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15, cz + 15))
{
BoundingBox *bb = new BoundingBox(cx, cz, cx + 15, cz + 15);
@@ -276,9 +279,8 @@ void LevelGenerationOptions::processSchematicsLighting(LevelChunk *chunk)
{
PIXBeginNamedEvent(0,"Processing schematics (lighting) for chunk (%d,%d)", chunk->x, chunk->z);
AABB *chunkBox = AABB::newTemp(chunk->x*16,0,chunk->z*16,chunk->x*16 + 16,Level::maxBuildHeight,chunk->z*16 + 16);
for( AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
for ( ApplySchematicRuleDefinition *rule : m_schematicRules )
{
ApplySchematicRuleDefinition *rule = *it;
rule->processSchematicLighting(chunkBox, chunk);
}
PIXEndNamedEvent();
@@ -292,16 +294,14 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
// a) ores generally being below ground/sea level and b) tutorial world additions generally being above ground/sea level
if(!m_bHaveMinY)
{
for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
for ( ApplySchematicRuleDefinition *rule : m_schematicRules )
{
ApplySchematicRuleDefinition *rule = *it;
int minY = rule->getMinY();
if(minY < m_minY) m_minY = minY;
}
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
for ( ConsoleGenerateStructure *structureStart : m_structureRules )
{
ConsoleGenerateStructure *structureStart = *it;
int minY = structureStart->getMinY();
if(minY < m_minY) m_minY = minY;
}
@@ -313,18 +313,16 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
if( y1 < m_minY ) return false;
bool intersects = false;
for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
for( ApplySchematicRuleDefinition *rule : m_schematicRules )
{
ApplySchematicRuleDefinition *rule = *it;
intersects = rule->checkIntersects(x0,y0,z0,x1,y1,z1);
if(intersects) break;
}
if(!intersects)
{
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
for( ConsoleGenerateStructure *structureStart : m_structureRules )
{
ConsoleGenerateStructure *structureStart = *it;
intersects = structureStart->checkIntersects(x0,y0,z0,x1,y1,z1);
if(intersects) break;
}
@@ -335,9 +333,9 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
void LevelGenerationOptions::clearSchematics()
{
for(AUTO_VAR(it, m_schematics.begin()); it != m_schematics.end(); ++it)
for ( auto& it : m_schematics )
{
delete it->second;
delete it.second;
}
m_schematics.clear();
}
@@ -345,7 +343,7 @@ void LevelGenerationOptions::clearSchematics()
ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen)
{
// If we have already loaded this, just return
AUTO_VAR(it, m_schematics.find(filename));
auto it = m_schematics.find(filename);
if(it != m_schematics.end())
{
#ifndef _CONTENT_PACKAGE
@@ -370,7 +368,7 @@ ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &fi
{
ConsoleSchematicFile *schematic = NULL;
// If we have already loaded this, just return
AUTO_VAR(it, m_schematics.find(filename));
auto it = m_schematics.find(filename);
if(it != m_schematics.end())
{
schematic = it->second;
@@ -381,7 +379,7 @@ ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &fi
void LevelGenerationOptions::releaseSchematicFile(const wstring &filename)
{
// 4J Stu - We don't want to delete them when done, but probably want to keep a set of active schematics for the current world
//AUTO_VAR(it, m_schematics.find(filename));
// auto it = m_schematics.find(filename);
//if(it != m_schematics.end())
//{
// ConsoleSchematicFile *schematic = it->second;
@@ -413,10 +411,9 @@ LPCWSTR LevelGenerationOptions::getString(const wstring &key)
void LevelGenerationOptions::getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile)
{
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
for ( BiomeOverride *bo : m_biomeOverrides )
{
BiomeOverride *bo = *it;
if(bo->isBiome(biomeId))
if ( bo && bo->isBiome(biomeId) )
{
bo->getTileValues(tile,topTile);
break;
@@ -428,9 +425,8 @@ bool LevelGenerationOptions::isFeatureChunk(int chunkX, int chunkZ, StructureFea
{
bool isFeature = false;
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
for( StartFeature *sf : m_features )
{
StartFeature *sf = *it;
if(sf->isFeatureChunk(chunkX, chunkZ, feature, orientation))
{
isFeature = true;
@@ -444,15 +440,15 @@ unordered_map<wstring, ConsoleSchematicFile *> *LevelGenerationOptions::getUnfin
{
// Clean schematic rules.
unordered_set<wstring> usedFiles = unordered_set<wstring>();
for (AUTO_VAR(it, m_schematicRules.begin()); it!=m_schematicRules.end(); it++)
if ( !(*it)->isComplete() )
usedFiles.insert( (*it)->getSchematicName() );
for ( auto& it : m_schematicRules )
if ( !it->isComplete() )
usedFiles.insert( it->getSchematicName() );
// Clean schematic files.
unordered_map<wstring, ConsoleSchematicFile *> *out
= new unordered_map<wstring, ConsoleSchematicFile *>();
for (AUTO_VAR(it, usedFiles.begin()); it!=usedFiles.end(); it++)
out->insert( pair<wstring, ConsoleSchematicFile *>(*it, getSchematicFile(*it)) );
for ( auto& it : usedFiles )
out->insert( pair<wstring, ConsoleSchematicFile *>(it, getSchematicFile(it)) );
return out;
}
@@ -619,11 +615,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
void LevelGenerationOptions::reset_start()
{
for ( AUTO_VAR( it, m_schematicRules.begin());
it != m_schematicRules.end();
it++ )
for ( auto& it : m_schematicRules )
{
(*it)->reset();
if ( it )
it->reset();
}
}
@@ -11,7 +11,7 @@ LevelRuleset::LevelRuleset()
LevelRuleset::~LevelRuleset()
{
for(AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it)
for (auto it = m_areas.begin(); it != m_areas.end(); ++it)
{
delete *it;
}
@@ -20,8 +20,8 @@ LevelRuleset::~LevelRuleset()
void LevelRuleset::getChildren(vector<GameRuleDefinition *> *children)
{
CompoundGameRuleDefinition::getChildren(children);
for (AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); it++)
children->push_back(*it);
for (const auto& area : m_areas)
children->push_back(area);
}
GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -58,12 +58,12 @@ LPCWSTR LevelRuleset::getString(const wstring &key)
AABB *LevelRuleset::getNamedArea(const wstring &areaName)
{
AABB *area = NULL;
for(AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it)
AABB *area = nullptr;
for(auto& it : m_areas)
{
if( (*it)->getName().compare(areaName) == 0 )
if( it->getName().compare(areaName) == 0 )
{
area = (*it)->getArea();
area = it->getArea();
break;
}
}
@@ -22,18 +22,18 @@ void NamedAreaRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAtt
dos->writeUTF(m_name);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
dos->writeUTF(_toString(m_area->x0));
dos->writeUTF(std::to_wstring(m_area->x0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
dos->writeUTF(_toString(m_area->y0));
dos->writeUTF(std::to_wstring(m_area->y0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
dos->writeUTF(_toString(m_area->z0));
dos->writeUTF(std::to_wstring(m_area->z0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
dos->writeUTF(_toString(m_area->x1));
dos->writeUTF(std::to_wstring(m_area->x1));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
dos->writeUTF(_toString(m_area->y1));
dos->writeUTF(std::to_wstring(m_area->y1));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
dos->writeUTF(_toString(m_area->z1));
dos->writeUTF(std::to_wstring(m_area->z1));
}
void NamedAreaRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -15,13 +15,13 @@ void StartFeature::writeAttributes(DataOutputStream *dos, UINT numAttrs)
GameRuleDefinition::writeAttributes(dos, numAttrs + 4);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkX);
dos->writeUTF(_toString(m_chunkX));
dos->writeUTF(std::to_wstring(m_chunkX));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkZ);
dos->writeUTF(_toString(m_chunkZ));
dos->writeUTF(std::to_wstring(m_chunkZ));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_feature);
dos->writeUTF(_toString((int)m_feature));
dos->writeUTF(std::to_wstring((int)m_feature));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
dos->writeUTF(_toString(m_orientation));
dos->writeUTF(std::to_wstring(m_orientation));
}
void StartFeature::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -18,9 +18,9 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition()
UpdatePlayerRuleDefinition::~UpdatePlayerRuleDefinition()
{
for(AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it)
for(auto& item : m_items)
{
delete *it;
delete item;
}
}
@@ -33,34 +33,34 @@ void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream *dos, UINT num
GameRuleDefinition::writeAttributes(dos, numAttributes + attrCount );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
dos->writeUTF(_toString(m_spawnPos->x));
dos->writeUTF(std::to_wstring(m_spawnPos->x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
dos->writeUTF(_toString(m_spawnPos->y));
dos->writeUTF(std::to_wstring(m_spawnPos->y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ);
dos->writeUTF(_toString(m_spawnPos->z));
dos->writeUTF(std::to_wstring(m_spawnPos->z));
if(m_bUpdateYRot)
{
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_yRot);
dos->writeUTF(_toString(m_yRot));
dos->writeUTF(std::to_wstring(m_yRot));
}
if(m_bUpdateHealth)
{
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_food);
dos->writeUTF(_toString(m_health));
dos->writeUTF(std::to_wstring(m_health));
}
if(m_bUpdateFood)
{
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_health);
dos->writeUTF(_toString(m_food));
dos->writeUTF(std::to_wstring(m_food));
}
}
void UpdatePlayerRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
{
GameRuleDefinition::getChildren(children);
for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++)
children->push_back(*it);
for(auto& item : m_items)
children->push_back(item);
}
GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -162,10 +162,8 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
if(m_spawnPos != NULL || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot);
for(AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it)
for(auto& addItem : m_items)
{
AddItemRuleDefinition *addItem = *it;
addItem->addItemToContainer(player->inventory, -1);
}
}
@@ -13,19 +13,19 @@ void UseTileRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttri
GameRuleDefinition::writeAttributes(dos, numAttributes + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
dos->writeUTF(_toString(m_tileId));
dos->writeUTF(std::to_wstring(m_tileId));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_useCoords);
dos->writeUTF(_toString(m_useCoords));
dos->writeUTF(std::to_wstring(m_useCoords));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
dos->writeUTF(_toString(m_coordinates.x));
dos->writeUTF(std::to_wstring(m_coordinates.x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
dos->writeUTF(_toString(m_coordinates.y));
dos->writeUTF(std::to_wstring(m_coordinates.y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
dos->writeUTF(_toString(m_coordinates.z));
dos->writeUTF(std::to_wstring(m_coordinates.z));
}
void UseTileRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -14,25 +14,25 @@ void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, UINT
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
dos->writeUTF(_toString(m_x0));
dos->writeUTF(std::to_wstring(m_x0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
dos->writeUTF(_toString(m_y0));
dos->writeUTF(std::to_wstring(m_y0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
dos->writeUTF(_toString(m_z0));
dos->writeUTF(std::to_wstring(m_z0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
dos->writeUTF(_toString(m_x1));
dos->writeUTF(std::to_wstring(m_x1));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
dos->writeUTF(_toString(m_y1));
dos->writeUTF(std::to_wstring(m_y1));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
dos->writeUTF(_toString(m_z1));
dos->writeUTF(std::to_wstring(m_z1));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_edgeTile);
dos->writeUTF(_toString(m_edgeTile));
dos->writeUTF(std::to_wstring(m_edgeTile));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_fillTile);
dos->writeUTF(_toString(m_fillTile));
dos->writeUTF(std::to_wstring(m_fillTile));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_skipAir);
dos->writeUTF(_toString(m_skipAir));
dos->writeUTF(std::to_wstring(m_skipAir));
}
void XboxStructureActionGenerateBox::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -13,16 +13,16 @@ void XboxStructureActionPlaceBlock::writeAttributes(DataOutputStream *dos, UINT
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
dos->writeUTF(_toString(m_x));
dos->writeUTF(std::to_wstring(m_x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
dos->writeUTF(_toString(m_y));
dos->writeUTF(std::to_wstring(m_y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
dos->writeUTF(_toString(m_z));
dos->writeUTF(std::to_wstring(m_z));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_data);
dos->writeUTF(_toString(m_data));
dos->writeUTF(std::to_wstring(m_data));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_block);
dos->writeUTF(_toString(m_tile));
dos->writeUTF(std::to_wstring(m_tile));
}
@@ -14,9 +14,9 @@ XboxStructureActionPlaceContainer::XboxStructureActionPlaceContainer()
XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer()
{
for(AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it)
for(auto& item : m_items)
{
delete *it;
delete item;
}
}
@@ -27,8 +27,8 @@ XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer()
void XboxStructureActionPlaceContainer::getChildren(vector<GameRuleDefinition *> *children)
{
XboxStructureActionPlaceBlock::getChildren(children);
for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++)
children->push_back( *it );
for(auto & item : m_items)
children->push_back( item );
}
GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -86,7 +86,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS);
// Add items
int slotId = 0;
for(AUTO_VAR(it, m_items.begin()); it != m_items.end() && (slotId < container->getContainerSize()); ++it, ++slotId )
for (auto it = m_items.begin(); it != m_items.end() && (slotId < container->getContainerSize()); ++it, ++slotId)
{
AddItemRuleDefinition *addItem = *it;
Binary file not shown.
@@ -492,9 +492,10 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
do
{
// We need to keep ticking the connections for players that already logged in
for(AUTO_VAR(it, createdConnections.begin()); it < createdConnections.end(); ++it)
for (auto& it : createdConnections )
{
(*it)->tick();
if ( it )
it->tick();
}
// 4J Stu - We were ticking this way too fast which could cause the connection to time out
@@ -522,7 +523,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
else
{
connection->close();
AUTO_VAR(it, find( createdConnections.begin(), createdConnections.end(), connection ));
auto it = find(createdConnections.begin(), createdConnections.end(), connection);
if(it != createdConnections.end() ) createdConnections.erase( it );
}
}
@@ -539,9 +540,9 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
if(g_NetworkManager.IsLeavingGame() || !IsInSession() )
{
for(AUTO_VAR(it, createdConnections.begin()); it < createdConnections.end(); ++it)
for (auto& it : createdConnections)
{
(*it)->close();
it->close();
}
// assert(false);
MinecraftServer::HaltServer();
@@ -1218,9 +1219,8 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
if( pServer != NULL )
{
PlayerList *players = pServer->getPlayers();
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it)
for(auto& servPlayer : players->players)
{
shared_ptr<ServerPlayer> servPlayer = *it;
if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() )
{
servPlayer->connection->connection->getSocket()->setPlayer(NULL);
@@ -1286,9 +1286,8 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid();
PlayerList *players = pServer->getPlayers();
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it)
for(auto& servPlayer : players->players)
{
shared_ptr<ServerPlayer> servPlayer = *it;
if( servPlayer->getXuid() == localPlayerXuid )
{
servPlayer->connection->connection->getSocket()->setPlayer( g_NetworkManager.GetLocalPlayerByUserIndex(index) );
@@ -7,6 +7,7 @@
#include "..\..\Windows64\Network\WinsockNetLayer.h"
#include "..\..\Minecraft.h"
#include "..\..\User.h"
#include <iostream>
#endif
CPlatformNetworkManagerStub *g_pPlatformNetworkManager;
@@ -63,9 +64,8 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer )
{
// Do we already have a primary player for this system?
bool systemHasPrimaryPlayer = false;
for(AUTO_VAR(it, m_machineQNetPrimaryPlayers.begin()); it < m_machineQNetPrimaryPlayers.end(); ++it)
for (auto& pQNetPrimaryPlayer : m_machineQNetPrimaryPlayers)
{
IQNetPlayer *pQNetPrimaryPlayer = *it;
if( pQNetPlayer->IsSameSystem(pQNetPrimaryPlayer) )
{
systemHasPrimaryPlayer = true;
@@ -317,8 +317,8 @@ bool CPlatformNetworkManagerStub::LeaveGame(bool bMigrateHost)
m_pIQNet->EndGame();
}
for (AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++)
delete* it;
for (auto & it : currentNetworkPlayers)
delete it;
currentNetworkPlayers.clear();
m_machineQNetPrimaryPlayers.clear();
SystemFlagReset();
@@ -700,6 +700,7 @@ void CPlatformNetworkManagerStub::SearchForGames()
#ifdef _WINDOWS64
std::vector<Win64LANSession> lanSessions = WinsockNetLayer::GetDiscoveredSessions();
//THEY GET DELETED HERE DAMMIT
for (size_t i = 0; i < friendsSessions[0].size(); i++)
delete friendsSessions[0][i];
friendsSessions[0].clear();
@@ -730,6 +731,55 @@ void CPlatformNetworkManagerStub::SearchForGames()
friendsSessions[0].push_back(info);
}
std::FILE* file = std::fopen("servers.txt", "r");
if (file) {
wstring wline;
int phase = 0;
string ip;
wstring port;
wstring name;
char buffer[512];
while (std::fgets(buffer, sizeof(buffer), file)) {
if (phase == 0) {
ip = buffer;
if (!ip.empty() && (ip.back() == '\n' || ip.back() == '\r'))
ip.pop_back();
phase = 1;
}
else if (phase == 1) {
wline = convStringToWstring(buffer);
port = wline;
phase = 2;
}
else if (phase == 2) {
wline = convStringToWstring(buffer);
name = wline;
phase = 0;
//THEY GET DELETED AFTER USE LIKE 30 LINES UP!!
FriendSessionInfo* info = new FriendSessionInfo();
wchar_t label[128];
wcsncpy_s(label, sizeof(label)/sizeof(wchar_t), name.c_str(), _TRUNCATE);
size_t nameLen = wcslen(label);
info->displayLabel = new wchar_t[nameLen+1];
wcscpy_s(info->displayLabel, nameLen + 1, label);
info->displayLabelLength = (unsigned char)nameLen;
info->displayLabelViewableStartIndex = 0;
info->data.isReadyToJoin = true;
info->data.isJoinable = true;
strncpy_s(info->data.hostIP, sizeof(info->data.hostIP), ip.c_str(), _TRUNCATE);
info->data.hostPort = stoi(port);
info->sessionId = (SessionID)(static_cast<uint64_t>(inet_addr(ip.c_str())) | (static_cast<uint64_t>(stoi(port)) << 32));
friendsSessions[0].push_back(info);
}
}
std::fclose(file);
}
m_searchResultsCount[0] = (int)friendsSessions[0].size();
if (m_SessionsUpdatedCallback != NULL)
@@ -795,7 +845,7 @@ INetworkPlayer *CPlatformNetworkManagerStub::addNetworkPlayer(IQNetPlayer *pQNet
void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *pQNetPlayer)
{
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pQNetPlayer);
for( AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++ )
for (auto it = currentNetworkPlayers.begin(); it != currentNetworkPlayers.end(); it++)
{
if( *it == pNetworkPlayer )
{
@@ -188,9 +188,8 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer *
{
// Do we already have a primary player for this system?
bool systemHasPrimaryPlayer = false;
for(AUTO_VAR(it, m_machineSQRPrimaryPlayers.begin()); it < m_machineSQRPrimaryPlayers.end(); ++it)
for( SQRNetworkPlayer *pQNetPrimaryPlayer : m_machineSQRPrimaryPlayers )
{
SQRNetworkPlayer *pQNetPrimaryPlayer = *it;
if( pSQRPlayer->IsSameSystem(pQNetPrimaryPlayer) )
{
systemHasPrimaryPlayer = true;
@@ -293,7 +292,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
break;
}
}
AUTO_VAR(it, find( m_machineSQRPrimaryPlayers.begin(), m_machineSQRPrimaryPlayers.end(), pSQRPlayer));
auto it = find( m_machineSQRPrimaryPlayers.begin(), m_machineSQRPrimaryPlayers.end(), pSQRPlayer);
if( it != m_machineSQRPrimaryPlayers.end() )
{
m_machineSQRPrimaryPlayers.erase( it );
@@ -529,9 +528,8 @@ int CPlatformNetworkManagerSony::CorrectErrorIDS(int IDS)
bool CPlatformNetworkManagerSony::isSystemPrimaryPlayer(SQRNetworkPlayer *pSQRPlayer)
{
bool playerIsSystemPrimary = false;
for(AUTO_VAR(it, m_machineSQRPrimaryPlayers.begin()); it < m_machineSQRPrimaryPlayers.end(); ++it)
for( SQRNetworkPlayer *pSQRPrimaryPlayer : m_machineSQRPrimaryPlayers )
{
SQRNetworkPlayer *pSQRPrimaryPlayer = *it;
if( pSQRPrimaryPlayer == pSQRPlayer )
{
playerIsSystemPrimary = true;
@@ -1066,8 +1064,8 @@ bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer,
wstring CPlatformNetworkManagerSony::GatherStats()
{
#if 0
return L"Queue messages: " + _toString(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) )
+ L" Queue bytes: " + _toString( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) );
return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) )
+ L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) );
#else
return L"";
#endif
@@ -1192,7 +1190,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session
bool foundSession = false;
FriendSessionInfo *sessionInfo = NULL;
AUTO_VAR(itFriendSession, friendsSessions[iPad].begin());
auto itFriendSession = friendsSessions[iPad].begin();
for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession)
{
sessionInfo = *itFriendSession;
@@ -1283,7 +1281,7 @@ INetworkPlayer *CPlatformNetworkManagerSony::addNetworkPlayer(SQRNetworkPlayer *
void CPlatformNetworkManagerSony::removeNetworkPlayer(SQRNetworkPlayer *pSQRPlayer)
{
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer);
for( AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++ )
for( auto it = currentNetworkPlayers.begin(); it != currentNetworkPlayers.end(); it++ )
{
if( *it == pNetworkPlayer )
{
+57
View File
@@ -0,0 +1,57 @@
#pragma once
#include <d3d11.h>
class PostProcesser
{
public:
static PostProcesser& GetInstance()
{
static PostProcesser instance;
return instance;
}
void Init();
void Apply() const;
void SetViewport(const D3D11_VIEWPORT& viewport);
void ResetViewport();
void CopyBackbuffer(); // Copy backbuffer once before multi-pass gamma
void ApplyFromCopied() const; // Apply gamma using already-copied offscreen texture
void Cleanup();
void SetGamma(float gamma);
float GetGamma() const { return m_gamma; }
PostProcesser(const PostProcesser&) = delete;
PostProcesser& operator=(const PostProcesser&) = delete;
private:
PostProcesser();
~PostProcesser();
static bool IsRunningUnderWine();
ID3D11Texture2D* m_pGammaOffscreenTex = nullptr;
ID3D11ShaderResourceView* m_pGammaOffscreenSRV = nullptr;
ID3D11RenderTargetView* m_pGammaOffscreenRTV = nullptr;
ID3D11VertexShader* m_pGammaVS = nullptr;
ID3D11PixelShader* m_pGammaPS = nullptr;
ID3D11Buffer* m_pGammaCB = nullptr;
ID3D11SamplerState* m_pGammaSampler = nullptr;
ID3D11RasterizerState* m_pGammaRastState = nullptr;
ID3D11DepthStencilState* m_pGammaDepthState = nullptr;
ID3D11BlendState* m_pGammaBlendState = nullptr;
bool m_initialized = false;
float m_gamma = 1.0f;
bool m_wineMode = false;
D3D11_VIEWPORT m_customViewport;
bool m_useCustomViewport = false;
struct GammaCBData
{
float gamma;
float pad[3];
};
static const char* g_gammaVSCode;
static const char* g_gammaPSCode;
};
@@ -23,9 +23,8 @@ bool AreaTask::isCompleted()
case eAreaTaskCompletion_CompleteOnConstraintsSatisfied:
{
bool allSatisfied = true;
for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it)
for( auto& constraint : constraints )
{
TutorialConstraint *constraint = *it;
if(!constraint->isConstraintSatisfied(tutorial->getPad()))
{
allSatisfied = false;
@@ -53,15 +53,15 @@ bool ControllerTask::isCompleted()
if(m_bHasSouthpaw && app.GetGameSettings(pMinecraft->player->GetXboxPad(),eGameSetting_ControlSouthPaw))
{
for(AUTO_VAR(it, southpawCompletedMappings.begin()); it != southpawCompletedMappings.end(); ++it)
for (auto& it : southpawCompletedMappings )
{
bool current = (*it).second;
bool current = it.second;
if(!current)
{
// TODO Use a different pad
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 )
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0 )
{
(*it).second = true;
it.second = true;
m_uiCompletionMask|=1<<iCurrent;
}
else
@@ -78,15 +78,15 @@ bool ControllerTask::isCompleted()
}
else
{
for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it)
for (auto& it : completedMappings )
{
bool current = (*it).second;
bool current = it.second;
if(!current)
{
// TODO Use a different pad
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 )
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0 )
{
(*it).second = true;
it.second = true;
m_uiCompletionMask|=1<<iCurrent;
}
else
+10 -10
View File
@@ -47,9 +47,9 @@ bool InfoTask::isCompleted()
{
// If a menu is displayed, then we use the handleUIInput to complete the task
bAllComplete = true;
for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it)
for( auto& it : completedMappings )
{
bool current = (*it).second;
bool current = it.second;
if(!current)
{
bAllComplete = false;
@@ -61,18 +61,18 @@ bool InfoTask::isCompleted()
{
int iCurrent=0;
for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it)
for( auto& it : completedMappings )
{
bool current = (*it).second;
bool current = it.second;
if(!current)
{
#ifdef _WINDOWS64
if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 || g_KBMInput.IsKeyDown(VK_SPACE))
if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0 || g_KBMInput.IsKeyDown(VK_SPACE))
#else
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0)
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0)
#endif
{
(*it).second = true;
it.second = true;
bAllComplete=true;
}
else
@@ -111,11 +111,11 @@ void InfoTask::handleUIInput(int iAction)
{
if(bHasBeenActivated)
{
for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it)
for( auto& it : completedMappings )
{
if( iAction == (*it).first )
if( iAction == it.first )
{
(*it).second = true;
it.second = true;
}
}
}
@@ -3,7 +3,7 @@
ProcedureCompoundTask::~ProcedureCompoundTask()
{
for(AUTO_VAR(it, m_taskSequence.begin()); it < m_taskSequence.end(); ++it)
for (auto it = m_taskSequence.begin(); it < m_taskSequence.end(); ++it)
{
delete (*it);
}
@@ -24,10 +24,8 @@ int ProcedureCompoundTask::getDescriptionId()
// Return the id of the first task not completed
int descriptionId = -1;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for (auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(!task->isCompleted())
{
task->setAsCurrentTask(true);
@@ -50,10 +48,8 @@ int ProcedureCompoundTask::getPromptId()
// Return the id of the first task not completed
int promptId = -1;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(!task->isCompleted())
{
promptId = task->getPromptId();
@@ -69,11 +65,8 @@ bool ProcedureCompoundTask::isCompleted()
bool allCompleted = true;
bool isCurrentTask = true;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(allCompleted && isCurrentTask)
{
if(task->isCompleted())
@@ -100,10 +93,8 @@ bool ProcedureCompoundTask::isCompleted()
if(allCompleted)
{
// Disable all constraints
itEnd = m_taskSequence.end();
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
task->enableConstraints(false);
}
}
@@ -113,20 +104,16 @@ bool ProcedureCompoundTask::isCompleted()
void ProcedureCompoundTask::onCrafted(shared_ptr<ItemInstance> item)
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
task->onCrafted(item);
}
}
void ProcedureCompoundTask::handleUIInput(int iAction)
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto task : m_taskSequence)
{
TutorialTask *task = *it;
task->handleUIInput(iAction);
}
}
@@ -135,10 +122,8 @@ void ProcedureCompoundTask::handleUIInput(int iAction)
void ProcedureCompoundTask::setAsCurrentTask(bool active /*= true*/)
{
bool allCompleted = true;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(allCompleted && !task->isCompleted())
{
task->setAsCurrentTask(true);
@@ -157,10 +142,8 @@ bool ProcedureCompoundTask::ShowMinimumTime()
return false;
bool showMinimumTime = false;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(!task->isCompleted())
{
showMinimumTime = task->ShowMinimumTime();
@@ -176,10 +159,8 @@ bool ProcedureCompoundTask::hasBeenActivated()
return true;
bool hasBeenActivated = false;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(!task->isCompleted())
{
hasBeenActivated = task->hasBeenActivated();
@@ -191,10 +172,8 @@ bool ProcedureCompoundTask::hasBeenActivated()
void ProcedureCompoundTask::setShownForMinimumTime()
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(!task->isCompleted())
{
task->setShownForMinimumTime();
@@ -209,10 +188,8 @@ bool ProcedureCompoundTask::AllowFade()
return true;
bool allowFade = true;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(!task->isCompleted())
{
allowFade = task->AllowFade();
@@ -224,40 +201,32 @@ bool ProcedureCompoundTask::AllowFade()
void ProcedureCompoundTask::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
task->useItemOn(level, item, x, y, z, bTestUseOnly);
}
}
void ProcedureCompoundTask::useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly)
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
task->useItem(item, bTestUseOnly);
}
}
void ProcedureCompoundTask::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
task->onTake(item, invItemCountAnyAux, invItemCountThisAux);
}
}
void ProcedureCompoundTask::onStateChange(eTutorial_State newState)
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
task->onStateChange(newState);
}
}
+58 -87
View File
@@ -1144,23 +1144,23 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
Tutorial::~Tutorial()
{
for(AUTO_VAR(it, m_globalConstraints.begin()); it != m_globalConstraints.end(); ++it)
for(auto& it : m_globalConstraints)
{
delete (*it);
delete it;
}
for(unordered_map<int, TutorialMessage *>::iterator it = messages.begin(); it != messages.end(); ++it)
for(auto& message : messages)
{
delete (*it).second;
delete message.second;
}
for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i)
{
for(AUTO_VAR(it, activeTasks[i].begin()); it < activeTasks[i].end(); ++it)
for(auto& it : activeTasks[i])
{
delete (*it);
delete it;
}
for(AUTO_VAR(it, hints[i].begin()); it < hints[i].end(); ++it)
for(auto& it : hints[i])
{
delete (*it);
delete it;
}
currentTask[i] = NULL;
@@ -1188,10 +1188,10 @@ void Tutorial::setCompleted( int completableId )
int completableIndex = -1;
for( AUTO_VAR(it, s_completableTasks.begin()); it < s_completableTasks.end(); ++it)
for (int task : s_completableTasks)
{
++completableIndex;
if( *it == completableId )
if( task == completableId )
{
break;
}
@@ -1220,10 +1220,10 @@ bool Tutorial::getCompleted( int completableId )
//}
int completableIndex = -1;
for( AUTO_VAR(it, s_completableTasks.begin()); it < s_completableTasks.end(); ++it)
for (int it : s_completableTasks)
{
++completableIndex;
if( *it == completableId )
if( it == completableId )
{
break;
}
@@ -1318,8 +1318,8 @@ void Tutorial::tick()
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
{
AUTO_VAR(it, constraintsToRemove[state].begin());
while(it < constraintsToRemove[state].end() )
auto it = constraintsToRemove[state].begin();
while(it != constraintsToRemove[state].end() )
{
++(*it).second;
if( (*it).second > m_iTutorialConstraintDelayRemoveTicks )
@@ -1427,9 +1427,8 @@ void Tutorial::tick()
}
// Check constraints
for(AUTO_VAR(it, m_globalConstraints.begin()); it < m_globalConstraints.end(); ++it)
for (auto& constraint : m_globalConstraints)
{
TutorialConstraint *constraint = *it;
constraint->tick(m_iPad);
}
@@ -1443,9 +1442,8 @@ void Tutorial::tick()
if(hintsOn)
{
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
for (auto& hint : hints[m_CurrentState])
{
TutorialHint *hint = *it;
hintNeeded = hint->tick();
if(hintNeeded >= 0)
{
@@ -1469,9 +1467,8 @@ void Tutorial::tick()
constraintChanged = true;
currentFailedConstraint[m_CurrentState] = NULL;
}
for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it)
for (auto& constraint : constraints[m_CurrentState])
{
TutorialConstraint *constraint = *it;
if( !constraint->isConstraintSatisfied(m_iPad) && constraint->isConstraintRestrictive(m_iPad) )
{
constraintChanged = true;
@@ -1484,8 +1481,8 @@ void Tutorial::tick()
{
// Update tasks
bool isCurrentTask = true;
AUTO_VAR(it, activeTasks[m_CurrentState].begin());
while(activeTasks[m_CurrentState].size() > 0 && it < activeTasks[m_CurrentState].end())
auto it = activeTasks[m_CurrentState].begin();
while(activeTasks[m_CurrentState].size() > 0 && it != activeTasks[m_CurrentState].end())
{
TutorialTask *task = *it;
if( isCurrentTask || task->isPreCompletionEnabled() )
@@ -1509,7 +1506,7 @@ void Tutorial::tick()
{
// 4J Stu - Move the delayed constraints to the gameplay state so that they are in
// effect for a bit longer
AUTO_VAR(itCon, constraintsToRemove[m_CurrentState].begin());
auto itCon = constraintsToRemove[m_CurrentState].begin();
while(itCon != constraintsToRemove[m_CurrentState].end() )
{
constraints[e_Tutorial_State_Gameplay].push_back(itCon->first);
@@ -1521,9 +1518,9 @@ void Tutorial::tick()
}
// Fall through the the normal complete state
case e_Tutorial_Completion_Complete_State:
for(AUTO_VAR(itRem, activeTasks[m_CurrentState].begin()); itRem < activeTasks[m_CurrentState].end(); ++itRem)
for (auto& itRem : activeTasks[m_CurrentState])
{
delete (*itRem);
delete itRem;
}
activeTasks[m_CurrentState].clear();
break;
@@ -1531,9 +1528,9 @@ void Tutorial::tick()
{
TutorialTask *lastTask = activeTasks[m_CurrentState].at( activeTasks[m_CurrentState].size() - 1 );
activeTasks[m_CurrentState].pop_back();
for(AUTO_VAR(itRem, activeTasks[m_CurrentState].begin()); itRem < activeTasks[m_CurrentState].end(); ++itRem)
for(auto& itRem : activeTasks[m_CurrentState])
{
delete (*itRem);
delete itRem;
}
activeTasks[m_CurrentState].clear();
activeTasks[m_CurrentState].push_back( lastTask );
@@ -1697,7 +1694,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
}
else
{
AUTO_VAR(it, messages.find(message->m_messageId));
auto it = messages.find(message->m_messageId);
if( it != messages.end() && it->second != NULL )
{
TutorialMessage *messageString = it->second;
@@ -1727,7 +1724,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
}
else if(message->m_promptId >= 0)
{
AUTO_VAR(it, messages.find(message->m_promptId));
auto it = messages.find(message->m_promptId);
if(it != messages.end() && it->second != NULL)
{
TutorialMessage *prompt = it->second;
@@ -1828,36 +1825,32 @@ void Tutorial::showTutorialPopup(bool show)
void Tutorial::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly)
{
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
for(auto& task : activeTasks[m_CurrentState])
{
TutorialTask *task = *it;
task->useItemOn(level, item, x, y, z, bTestUseOnly);
}
}
void Tutorial::useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly)
{
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
for(auto& task : activeTasks[m_CurrentState])
{
TutorialTask *task = *it;
task->useItem(item, bTestUseOnly);
}
}
void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item)
{
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
for(auto task : activeTasks[m_CurrentState])
{
TutorialTask *task = *it;
task->completeUsingItem(item);
}
// Fix for #46922 - TU5: UI: Player receives a reminder that he is hungry while "hunger bar" is full (triggered in split-screen mode)
if(m_CurrentState != e_Tutorial_State_Gameplay)
{
for(AUTO_VAR(it, activeTasks[e_Tutorial_State_Gameplay].begin()); it < activeTasks[e_Tutorial_State_Gameplay].end(); ++it)
for(auto task : activeTasks[e_Tutorial_State_Gameplay])
{
TutorialTask *task = *it;
task->completeUsingItem(item);
}
}
@@ -1866,9 +1859,8 @@ void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item)
void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
{
int hintNeeded = -1;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
for(auto& hint : hints[m_CurrentState])
{
TutorialHint *hint = *it;
hintNeeded = hint->startDestroyBlock(item, tile);
if(hintNeeded >= 0)
{
@@ -1877,16 +1869,14 @@ void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
setMessage( hint, message );
break;
}
}
}
void Tutorial::destroyBlock(Tile *tile)
{
int hintNeeded = -1;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
for(auto& hint : hints[m_CurrentState])
{
TutorialHint *hint = *it;
hintNeeded = hint->destroyBlock(tile);
if(hintNeeded >= 0)
{
@@ -1895,16 +1885,14 @@ void Tutorial::destroyBlock(Tile *tile)
setMessage( hint, message );
break;
}
}
}
void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
{
int hintNeeded = -1;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
for(auto& hint : hints[m_CurrentState])
{
TutorialHint *hint = *it;
hintNeeded = hint->attack(player->inventory->getSelected(), entity);
if(hintNeeded >= 0)
{
@@ -1920,9 +1908,8 @@ void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
void Tutorial::itemDamaged(shared_ptr<ItemInstance> item)
{
int hintNeeded = -1;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
for(auto& hint : hints[m_CurrentState])
{
TutorialHint *hint = *it;
hintNeeded = hint->itemDamaged(item);
if(hintNeeded >= 0)
{
@@ -1939,11 +1926,6 @@ void Tutorial::handleUIInput(int iAction)
{
if( m_hintDisplayed ) return;
//for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
//{
// TutorialTask *task = *it;
// task->handleUIInput(iAction);
//}
if(currentTask[m_CurrentState] != NULL)
currentTask[m_CurrentState]->handleUIInput(iAction);
}
@@ -1951,9 +1933,8 @@ void Tutorial::handleUIInput(int iAction)
void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
{
int hintNeeded = -1;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
for(auto& hint : hints[m_CurrentState])
{
TutorialHint *hint = *it;
hintNeeded = hint->createItemSelected(item, canMake);
if(hintNeeded >= 0)
{
@@ -1968,11 +1949,10 @@ void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
void Tutorial::onCrafted(shared_ptr<ItemInstance> item)
{
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
for(auto& subtasks : activeTasks)
{
for(AUTO_VAR(it, activeTasks[state].begin()); it < activeTasks[state].end(); ++it)
for(auto& task : subtasks)
{
TutorialTask *task = *it;
task->onCrafted(item);
}
}
@@ -1983,23 +1963,20 @@ void Tutorial::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAn
if( !m_hintDisplayed )
{
bool hintNeeded = false;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
for(auto hint : hints[m_CurrentState])
{
TutorialHint *hint = *it;
hintNeeded = hint->onTake(item);
if(hintNeeded)
{
break;
}
}
}
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
for(auto& subtasks : activeTasks)
{
for(AUTO_VAR(it, activeTasks[state].begin()); it < activeTasks[state].end(); ++it)
for(auto& task : subtasks)
{
TutorialTask *task = *it;
task->onTake(item, invItemCountAnyAux, invItemCountThisAux);
}
}
@@ -2035,9 +2012,8 @@ void Tutorial::onLookAt(int id, int iData)
if( m_hintDisplayed ) return;
bool hintNeeded = false;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
for(auto& hint : hints[m_CurrentState])
{
TutorialHint *hint = *it;
hintNeeded = hint->onLookAt(id, iData);
if(hintNeeded)
{
@@ -2066,9 +2042,8 @@ void Tutorial::onLookAtEntity(shared_ptr<Entity> entity)
if( m_hintDisplayed ) return;
bool hintNeeded = false;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
for(auto& hint : hints[m_CurrentState])
{
TutorialHint *hint = *it;
hintNeeded = hint->onLookAtEntity(entity->GetType());
if(hintNeeded)
{
@@ -2081,9 +2056,9 @@ void Tutorial::onLookAtEntity(shared_ptr<Entity> entity)
changeTutorialState(e_Tutorial_State_Horse);
}
for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it != activeTasks[m_CurrentState].end(); ++it)
for (auto& it : activeTasks[m_CurrentState])
{
(*it)->onLookAtEntity(entity);
it->onLookAtEntity(entity);
}
}
@@ -2098,17 +2073,16 @@ void Tutorial::onRideEntity(shared_ptr<Entity> entity)
}
}
for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it != activeTasks[m_CurrentState].end(); ++it)
for (auto& it : activeTasks[m_CurrentState])
{
(*it)->onRideEntity(entity);
it->onRideEntity(entity);
}
}
void Tutorial::onEffectChanged(MobEffect *effect, bool bRemoved)
{
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
for(auto& task : activeTasks[m_CurrentState])
{
TutorialTask *task = *it;
task->onEffectChanged(effect,bRemoved);
}
}
@@ -2116,9 +2090,8 @@ void Tutorial::onEffectChanged(MobEffect *effect, bool bRemoved)
bool Tutorial::canMoveToPosition(double xo, double yo, double zo, double xt, double yt, double zt)
{
bool allowed = true;
for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it)
for(auto& constraint : constraints[m_CurrentState])
{
TutorialConstraint *constraint = *it;
if( !constraint->isConstraintSatisfied(m_iPad) && !constraint->canMoveToPosition(xo,yo,zo,xt,yt,zt) )
{
allowed = false;
@@ -2136,9 +2109,8 @@ bool Tutorial::isInputAllowed(int mapping)
if( Minecraft::GetInstance()->localplayers[m_iPad]->isUnderLiquid(Material::water) ) return true;
bool allowed = true;
for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it)
for(auto& constraint : constraints[m_CurrentState])
{
TutorialConstraint *constraint = *it;
if( constraint->isMappingConstrained( m_iPad, mapping ) )
{
allowed = false;
@@ -2156,9 +2128,9 @@ vector<TutorialTask *> *Tutorial::getTasks()
unsigned int Tutorial::getCurrentTaskIndex()
{
unsigned int index = 0;
for(AUTO_VAR(it, tasks.begin()); it < tasks.end(); ++it)
for(const auto& task : tasks)
{
if(*it == currentTask[e_Tutorial_State_Gameplay])
if(task == currentTask[e_Tutorial_State_Gameplay])
break;
++index;
@@ -2184,11 +2156,11 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa
if( c->getQueuedForRemoval() )
{
// If it is already queued for removal, remove it on the next tick
/*for(AUTO_VAR(it, constraintsToRemove[m_CurrentState].begin()); it < constraintsToRemove[m_CurrentState].end(); ++it)
/*for(auto& it : constraintsToRemove[m_CurrentState])
{
if( it->first == c )
if( it.first == c )
{
it->second = m_iTutorialConstraintDelayRemoveTicks;
it.second = m_iTutorialConstraintDelayRemoveTicks;
break;
}
}*/
@@ -2196,11 +2168,11 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa
else if(delayedRemove)
{
c->setQueuedForRemoval(true);
constraintsToRemove[m_CurrentState].push_back( pair<TutorialConstraint *, unsigned char>(c, 0) );
constraintsToRemove[m_CurrentState].emplace_back(c, 0);
}
else
{
for( AUTO_VAR(it, constraintsToRemove[m_CurrentState].begin()); it < constraintsToRemove[m_CurrentState].end(); ++it)
for (auto it = constraintsToRemove[m_CurrentState].begin(); it != constraintsToRemove[m_CurrentState].end(); ++it)
{
if( it->first == c )
{
@@ -2209,7 +2181,7 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa
}
}
AUTO_VAR(it, find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c));
auto it = find(constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c);
if( it != constraints[m_CurrentState].end() ) constraints[m_CurrentState].erase( find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c) );
// It may be in the gameplay list, so remove it from there if it is
@@ -2304,9 +2276,8 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*=
if( m_CurrentState != newState )
{
for(AUTO_VAR(it, activeTasks[newState].begin()); it < activeTasks[newState].end(); ++it)
for (auto& task : activeTasks[newState] )
{
TutorialTask *task = *it;
task->onStateChange(newState);
}
m_CurrentState = newState;
@@ -11,9 +11,8 @@ TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePre
{
if(inConstraints != NULL)
{
for(AUTO_VAR(it, inConstraints->begin()); it < inConstraints->end(); ++it)
for(auto& constraint : *inConstraints)
{
TutorialConstraint *constraint = *it;
constraints.push_back( constraint );
}
delete inConstraints;
@@ -26,10 +25,8 @@ TutorialTask::~TutorialTask()
{
enableConstraints(false);
for(AUTO_VAR(it, constraints.begin()); it < constraints.end(); ++it)
for(auto& constraint : constraints)
{
TutorialConstraint *constraint = *it;
if( constraint->getQueuedForRemoval() )
{
constraint->setDeleteOnDeactivate(true);
@@ -52,9 +49,8 @@ void TutorialTask::enableConstraints(bool enable, bool delayRemove /*= false*/)
if( !enable && (areConstraintsEnabled || !delayRemove) )
{
// Remove
for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it)
for(auto& constraint : constraints)
{
TutorialConstraint *constraint = *it;
//app.DebugPrintf(">>>>>>>> %i\n", constraints.size());
tutorial->RemoveConstraint( constraint, delayRemove );
}
@@ -63,9 +59,8 @@ void TutorialTask::enableConstraints(bool enable, bool delayRemove /*= false*/)
else if( !areConstraintsEnabled && enable )
{
// Add
for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it)
for(auto& constraint : constraints)
{
TutorialConstraint *constraint = *it;
tutorial->AddConstraint( constraint );
}
areConstraintsEnabled = true;
@@ -387,9 +387,11 @@ vector<HtmlString> *IUIScene_BeaconMenu::GetSectionHoverText(ESceneSection eSect
desc = new vector<HtmlString>();
if (effectId < MobEffect::e_MobEffectIcon_COUNT && MobEffect::effects[effectId]) {
HtmlString string( app.GetString(MobEffect::effects[effectId]->getDescriptionId()), eHTMLColor_White );
desc->push_back( string );
}
}
break;
}
return desc;
@@ -621,7 +621,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
int iRecipeC=(int)recipes->size();
AUTO_VAR(itRecipe, recipes->begin());
auto itRecipe = recipes->begin();
// dump out the recipe products
@@ -828,7 +828,7 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, i
// Fill the dynamic group
if(m_dynamicGroupsCount > 0 && m_dynamicGroupsA != NULL)
{
for(AUTO_VAR(it, categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin()); it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() && lastSlotIndex < MAX_SIZE; ++it)
for (auto it = categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin(); it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() && lastSlotIndex < MAX_SIZE; ++it)
{
Slot *slot = menu->getSlot(++lastSlotIndex);
slot->set( *it );
@@ -78,7 +78,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
int buyBMatches = player->inventory->countMatches(buyBItem);
if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) )
{
// 4J-JEV: Fix for PS4 #7111: [PATCH 1.12] Trading Librarian villagers for multiple Enchanted Books will cause the title to crash.
// 4J-JEV: Fix for PS4 #7111: [PATCH 1.12] Trading Librarian villagers for multiple Enchanted Books will cause the title to crash.
int actualShopItem = m_activeOffers.at(selectedShopItem).second;
m_merchant->notifyTrade(activeRecipe);
@@ -186,13 +186,12 @@ void IUIScene_TradingMenu::updateDisplay()
m_activeOffers.clear();
int unfilteredIndex = 0;
int firstValidTrade = INT_MAX;
for(AUTO_VAR(it, unfilteredOffers->begin()); it != unfilteredOffers->end(); ++it)
for(auto& recipe : *unfilteredOffers)
{
MerchantRecipe *recipe = *it;
if(!recipe->isDeprecated())
{
m_activeOffers.push_back( pair<MerchantRecipe *,int>(recipe,unfilteredIndex));
firstValidTrade = min(firstValidTrade,unfilteredIndex);
m_activeOffers.emplace_back(recipe,unfilteredIndex);
firstValidTrade = std::min<int>(firstValidTrade, unfilteredIndex);
}
++unfilteredIndex;
}
@@ -101,7 +101,7 @@ void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region)
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.1f);
Minecraft *pMinecraft = Minecraft::GetInstance();
wstring line = _toString<int>(cost);
wstring line = std::to_wstring(cost);
Font *font = pMinecraft->altFont;
//int col = 0x685E4A;
unsigned int col = m_textColour;
@@ -165,7 +165,7 @@ void UIControl_EnchantmentButton::updateState()
if(cost != m_lastCost)
{
setLabel( _toString<int>(cost) );
setLabel( std::to_wstring(cost) );
m_lastCost = cost;
m_enchantmentString = EnchantmentNames::instance.getRandomName();
}
@@ -225,10 +225,8 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
{
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it)
for(auto& pModelPart : *m_pvAdditionalModelParts)
{
ModelPart *pModelPart=*it;
pModelPart->visible=true;
}
}
@@ -239,10 +237,8 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
// hide the additional parts
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
{
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it)
for(auto& pModelPart : *m_pvAdditionalModelParts)
{
ModelPart *pModelPart=*it;
pModelPart->visible=false;
}
}
+12 -20
View File
@@ -500,7 +500,7 @@ void UIController::tick()
// Clear out the cached movie file data
__int64 currentTime = System::currentTimeMillis();
for(AUTO_VAR(it, m_cachedMovieData.begin()); it != m_cachedMovieData.end();)
for (auto it = m_cachedMovieData.begin(); it != m_cachedMovieData.end();)
{
if(it->second.m_expiry < currentTime)
{
@@ -738,9 +738,8 @@ void UIController::CleanUpSkinReload()
}
}
for(AUTO_VAR(it,m_queuedMessageBoxData.begin()); it != m_queuedMessageBoxData.end(); ++it)
for(auto queuedData : m_queuedMessageBoxData)
{
QueuedMessageBoxData *queuedData = *it;
ui.NavigateToScene(queuedData->iPad, eUIScene_MessageBox, &queuedData->info, queuedData->layer, eUIGroup_Fullscreen);
delete queuedData->info.uiOptionA;
delete queuedData;
@@ -752,7 +751,7 @@ byteArray UIController::getMovieData(const wstring &filename)
{
// Cache everything we load in the current tick
__int64 targetTime = System::currentTimeMillis() + (1000LL * 60);
AUTO_VAR(it,m_cachedMovieData.find(filename));
auto it = m_cachedMovieData.find(filename);
if(it == m_cachedMovieData.end() )
{
byteArray baFile = app.getArchiveFile(filename);
@@ -1645,12 +1644,12 @@ void RADLINK UIController::CustomDrawCallback(void *user_callback_data, Iggy *pl
//If your texture includes an alpha channel, you must use a premultiplied alpha (where the R,G, and B channels have been multiplied by the alpha value); all Iggy shaders assume premultiplied alpha (and it looks better anyway).
GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * user_callback_data , IggyUTF16 * texture_name , S32 * width , S32 * height , void * * destroy_callback_data )
{
UIController *uiController = (UIController *)user_callback_data;
AUTO_VAR(it,uiController->m_substitutionTextures.find((wchar_t *)texture_name));
UIController *uiController = static_cast<UIController *>(user_callback_data);
auto it = uiController->m_substitutionTextures.find(texture_name);
if(it != uiController->m_substitutionTextures.end())
{
app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", (wchar_t *)texture_name,it->second.length);
app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", texture_name,it->second.length);
BufferedImage image(it->second.data, it->second.length);
if( image.getData() != NULL )
@@ -1711,7 +1710,7 @@ void UIController::registerSubstitutionTexture(const wstring &textureName, PBYTE
void UIController::unregisterSubstitutionTexture(const wstring &textureName, bool deleteData)
{
AUTO_VAR(it,m_substitutionTextures.find(textureName));
auto it = m_substitutionTextures.find(textureName);
if(it != m_substitutionTextures.end())
{
@@ -1953,7 +1952,7 @@ size_t UIController::RegisterForCallbackId(UIScene *scene)
void UIController::UnregisterCallbackId(size_t id)
{
EnterCriticalSection(&m_registeredCallbackScenesCS);
AUTO_VAR(it, m_registeredCallbackScenes.find(id) );
auto it = m_registeredCallbackScenes.find(id);
if(it != m_registeredCallbackScenes.end() )
{
m_registeredCallbackScenes.erase(it);
@@ -1964,7 +1963,7 @@ void UIController::UnregisterCallbackId(size_t id)
UIScene *UIController::GetSceneFromCallbackId(size_t id)
{
UIScene *scene = NULL;
AUTO_VAR(it, m_registeredCallbackScenes.find(id) );
auto it = m_registeredCallbackScenes.find(id);
if(it != m_registeredCallbackScenes.end() )
{
scene = it->second;
@@ -3002,11 +3001,8 @@ void UIController::TouchBoxRebuild(UIScene *pUIScene)
ui.TouchBoxesClear(pUIScene);
// rebuild boxes
AUTO_VAR(itEnd, pUIScene->GetControls()->end());
for (AUTO_VAR(it, pUIScene->GetControls()->begin()); it != itEnd; it++)
for ( UIControl *control : *pUIScene->GetControls() )
{
UIControl *control=(UIControl *)*it;
if(control->getControlType() == UIControl::eButton ||
control->getControlType() == UIControl::eSlider ||
control->getControlType() == UIControl::eCheckBox ||
@@ -3035,10 +3031,8 @@ void UIController::TouchBoxesClear(UIScene *pUIScene)
EUILayer eUILayer=pUIScene->GetParentLayer()->m_iLayer;
EUIScene eUIscene=pUIScene->getSceneType();
AUTO_VAR(itEnd, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].end());
for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++)
for ( UIELEMENT *element : m_TouchBoxes[eUIGroup][eUILayer][eUIscene] )
{
UIELEMENT *element=(UIELEMENT *)*it;
delete element;
}
m_TouchBoxes[eUIGroup][eUILayer][eUIscene].clear();
@@ -3056,10 +3050,8 @@ bool UIController::TouchBoxHit(UIScene *pUIScene,S32 x, S32 y)
if(m_TouchBoxes[eUIGroup][eUILayer][eUIscene].size()>0)
{
AUTO_VAR(itEnd, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].end());
for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++)
for ( UIELEMENT *element : m_TouchBoxes[eUIGroup][eUILayer][eUIscene] )
{
UIELEMENT *element=(UIELEMENT *)*it;
if(element->pControl->getHidden() == false && element->pControl->getVisible()) // ignore removed controls
{
if((x>=element->x1) &&(x<=element->x2) && (y>=element->y1) && (y<=element->y2))
+46 -50
View File
@@ -18,18 +18,16 @@ void UILayer::tick()
{
// Delete old scenes - deleting a scene can cause a new scene to be deleted, so we need to make a copy of the scenes that we are going to try and destroy this tick
vector<UIScene *>scenesToDeleteCopy;
for( AUTO_VAR(it,m_scenesToDelete.begin()); it != m_scenesToDelete.end(); it++)
for(auto& scene : m_scenesToDelete)
{
UIScene *scene = (*it);
scenesToDeleteCopy.push_back(scene);
}
m_scenesToDelete.clear();
// Delete the scenes in our copy if they are ready to delete, otherwise add back to the ones that are still to be deleted. Actually deleting a scene might also add something back into m_scenesToDelete.
for( AUTO_VAR(it,scenesToDeleteCopy.begin()); it != scenesToDeleteCopy.end(); it++)
for(auto& scene : scenesToDeleteCopy)
{
UIScene *scene = (*it);
if( scene->isReadyToDelete())
if( scene && scene->isReadyToDelete())
{
delete scene;
}
@@ -47,13 +45,12 @@ void UILayer::tick()
}
m_scenesToDestroy.clear();
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it)
for(auto & component : m_components)
{
(*it)->tick();
component->tick();
}
// Note: reverse iterator, the last element is the top of the stack
int sceneIndex = m_sceneStack.size() - 1;
//for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
while( sceneIndex >= 0 && sceneIndex < m_sceneStack.size() )
{
//(*it)->tick();
@@ -68,15 +65,15 @@ void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport)
{
if(!ui.IsExpectingOrReloadingSkin())
{
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it)
for(auto& it : m_components)
{
AUTO_VAR(itRef,m_componentRefCount.find((*it)->getSceneType()));
auto itRef = m_componentRefCount.find(it->getSceneType());
if(itRef != m_componentRefCount.end() && itRef->second.second)
{
if((*it)->isVisible() )
if(it->isVisible() )
{
PIXBeginNamedEvent(0, "Rendering component %d", (*it)->getSceneType() );
(*it)->render(width, height,viewport);
PIXBeginNamedEvent(0, "Rendering component %d", it->getSceneType() );
it->render(width, height,viewport);
PIXEndNamedEvent();
}
}
@@ -139,9 +136,9 @@ bool UILayer::HasFocus(int iPad)
bool UILayer::hidesLowerScenes()
{
bool hidesScenes = false;
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it)
for(auto& it : m_components)
{
if((*it)->hidesLowerScenes())
if(it->hidesLowerScenes())
{
hidesScenes = true;
break;
@@ -168,28 +165,27 @@ void UILayer::getRenderDimensions(S32 &width, S32 &height)
void UILayer::DestroyAll()
{
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it)
for(auto& it : m_components)
{
(*it)->destroyMovie();
it->destroyMovie();
}
for(AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it)
for(auto& it : m_sceneStack)
{
(*it)->destroyMovie();
it->destroyMovie();
}
}
void UILayer::ReloadAll(bool force)
{
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it)
for(auto& it : m_components)
{
(*it)->reloadMovie(force);
it->reloadMovie(force);
}
if(!m_sceneStack.empty())
{
int lowestRenderable = 0;
for(;lowestRenderable < m_sceneStack.size(); ++lowestRenderable)
for(auto& lowestRenderable : m_sceneStack)
{
m_sceneStack[lowestRenderable]->reloadMovie(force);
lowestRenderable->reloadMovie(force);
}
}
}
@@ -493,7 +489,7 @@ bool UILayer::NavigateBack(int iPad, EUIScene eScene)
void UILayer::showComponent(int iPad, EUIScene scene, bool show)
{
AUTO_VAR(it,m_componentRefCount.find(scene));
auto it = m_componentRefCount.find(scene);
if(it != m_componentRefCount.end())
{
it->second.second = show;
@@ -505,7 +501,7 @@ void UILayer::showComponent(int iPad, EUIScene scene, bool show)
bool UILayer::isComponentVisible(EUIScene scene)
{
bool visible = false;
AUTO_VAR(it,m_componentRefCount.find(scene));
auto it = m_componentRefCount.find(scene);
if(it != m_componentRefCount.end())
{
visible = it->second.second;
@@ -515,16 +511,16 @@ bool UILayer::isComponentVisible(EUIScene scene)
UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData)
{
AUTO_VAR(it,m_componentRefCount.find(scene));
auto it = m_componentRefCount.find(scene);
if(it != m_componentRefCount.end())
{
++it->second.first;
for(AUTO_VAR(itComp,m_components.begin()); itComp != m_components.end(); ++itComp)
for(auto& itComp : m_components)
{
if( (*itComp)->getSceneType() == scene )
if( itComp->getSceneType() == scene )
{
return *itComp;
return itComp;
}
}
return NULL;
@@ -586,7 +582,7 @@ UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData)
void UILayer::removeComponent(EUIScene scene)
{
AUTO_VAR(it,m_componentRefCount.find(scene));
auto it = m_componentRefCount.find(scene);
if(it != m_componentRefCount.end())
{
--it->second.first;
@@ -594,7 +590,7 @@ void UILayer::removeComponent(EUIScene scene)
if(it->second.first <= 0)
{
m_componentRefCount.erase(it);
for(AUTO_VAR(compIt, m_components.begin()) ; compIt != m_components.end(); )
for (auto compIt = m_components.begin(); compIt != m_components.end();)
{
if( (*compIt)->getSceneType() == scene)
{
@@ -622,7 +618,7 @@ void UILayer::removeScene(UIScene *scene)
ui.TouchBoxesClear(scene);
#endif
AUTO_VAR(newEnd, std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene) );
auto newEnd = std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene);
m_sceneStack.erase(newEnd, m_sceneStack.end());
m_scenesToDelete.push_back(scene);
@@ -645,14 +641,14 @@ void UILayer::closeAllScenes()
vector<UIScene *> temp;
temp.insert(temp.end(), m_sceneStack.begin(), m_sceneStack.end());
m_sceneStack.clear();
for(AUTO_VAR(it, temp.begin()); it != temp.end(); ++it)
for(auto& it : temp)
{
#ifdef __PSVITA__
// remove any touchboxes
ui.TouchBoxesClear(*it);
ui.TouchBoxesClear(it);
#endif
m_scenesToDelete.push_back(*it);
(*it)->handleDestroy(); // For anything that might require the pointer be valid
m_scenesToDelete.push_back(it);
it->handleDestroy(); // For anything that might require the pointer be valid
}
updateFocusState();
@@ -696,7 +692,7 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */)
m_bIgnorePlayerJoinMenuDisplayed = false;
bool layerFocusSet = false;
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{
UIScene *scene = *it;
@@ -783,7 +779,7 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */)
UIScene *UILayer::getCurrentScene()
{
// Note: reverse iterator, the last element is the top of the stack
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
for( auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{
UIScene *scene = *it;
// 4J-PB - only used on Vita, so iPad 0 is fine
@@ -800,7 +796,7 @@ UIScene *UILayer::getCurrentScene()
void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{
// Note: reverse iterator, the last element is the top of the stack
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{
UIScene *scene = *it;
if(scene->hasFocus(iPad) && scene->canHandleInput())
@@ -825,7 +821,7 @@ void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool rel
void UILayer::HandleDLCMountingComplete()
{
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{
UIScene *topScene = *it;
app.DebugPrintf("UILayer::HandleDLCMountingComplete - topScene\n");
@@ -835,7 +831,7 @@ void UILayer::HandleDLCMountingComplete()
void UILayer::HandleDLCInstalled()
{
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{
UIScene *topScene = *it;
topScene->HandleDLCInstalled();
@@ -845,7 +841,7 @@ void UILayer::HandleDLCInstalled()
#ifdef _XBOX_ONE
void UILayer::HandleDLCLicenseChange()
{
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
for( auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{
UIScene *topScene = *it;
topScene->HandleDLCLicenseChange();
@@ -855,7 +851,7 @@ void UILayer::HandleDLCLicenseChange()
void UILayer::HandleMessage(EUIMessage message, void *data)
{
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{
UIScene *topScene = *it;
topScene->HandleMessage(message, data);
@@ -875,9 +871,9 @@ C4JRender::eViewportType UILayer::getViewport()
void UILayer::handleUnlockFullVersion()
{
for(AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it)
for(auto& it : m_sceneStack)
{
(*it)->handleUnlockFullVersion();
it->handleUnlockFullVersion();
}
}
@@ -885,13 +881,13 @@ void UILayer::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
{
__int64 layerStatic = 0;
__int64 layerDynamic = 0;
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it)
for(auto& it : m_components)
{
(*it)->PrintTotalMemoryUsage(layerStatic, layerDynamic);
it->PrintTotalMemoryUsage(layerStatic, layerDynamic);
}
for(AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it)
for(auto& it : m_sceneStack)
{
(*it)->PrintTotalMemoryUsage(layerStatic, layerDynamic);
it->PrintTotalMemoryUsage(layerStatic, layerDynamic);
}
app.DebugPrintf(app.USER_SR, " \\- Layer static: %d , Layer dynamic: %d\n", layerStatic, layerDynamic);
totalStatic += layerStatic;
+12 -15
View File
@@ -39,9 +39,9 @@ UIScene::~UIScene()
/* Destroy the Iggy player. */
IggyPlayerDestroy( swf );
for(AUTO_VAR(it,m_registeredTextures.begin()); it != m_registeredTextures.end(); ++it)
for(auto & it : m_registeredTextures)
{
ui.unregisterSubstitutionTexture( it->first, it->second );
ui.unregisterSubstitutionTexture( it.first, it.second );
}
if(m_callbackUniqueId != 0)
@@ -88,9 +88,9 @@ void UIScene::reloadMovie(bool force)
handlePreReload();
// Reload controls
for(AUTO_VAR(it, m_controls.begin()); it != m_controls.end(); ++it)
for(auto & it : m_controls)
{
(*it)->ReInit();
it->ReInit();
}
updateComponents();
@@ -440,9 +440,9 @@ void UIScene::tick()
while(IggyPlayerReadyToTick( swf ))
{
tickTimers();
for(AUTO_VAR(it, m_controls.begin()); it != m_controls.end(); ++it)
for(auto & it : m_controls)
{
(*it)->tick();
it->tick();
}
IggyPlayerTickRS( swf );
m_hasTickedOnce = true;
@@ -468,7 +468,7 @@ void UIScene::addTimer(int id, int ms)
void UIScene::killTimer(int id)
{
AUTO_VAR(it, m_timers.find(id));
auto it = m_timers.find(id);
if(it != m_timers.end())
{
it->second.running = false;
@@ -478,7 +478,7 @@ void UIScene::killTimer(int id)
void UIScene::tickTimers()
{
int currentTime = System::currentTimeMillis();
for(AUTO_VAR(it, m_timers.begin()); it != m_timers.end();)
for (auto it = m_timers.begin(); it != m_timers.end();)
{
if(!it->second.running)
{
@@ -501,7 +501,7 @@ void UIScene::tickTimers()
IggyName UIScene::registerFastName(const wstring &name)
{
IggyName var;
AUTO_VAR(it,m_fastNames.find(name));
auto it = m_fastNames.find(name);
if(it != m_fastNames.end())
{
var = it->second;
@@ -642,9 +642,8 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
PIXBeginNamedEvent(0,"Draw all cache");
// Draw all the cached slots
for(AUTO_VAR(it, m_cachedSlotDraw.begin()); it != m_cachedSlotDraw.end(); ++it)
for(auto& drawData : m_cachedSlotDraw)
{
CachedSlotDrawData *drawData = *it;
ui.setupCustomDrawMatrices(this, drawData->customDrawRegion);
_customDrawSlotControl(drawData->customDrawRegion, iPad, drawData->item, drawData->fAlpha, drawData->isFoil, drawData->bDecorations, useCommandBuffers);
delete drawData->customDrawRegion;
@@ -1185,7 +1184,7 @@ void UIScene::registerSubstitutionTexture(const wstring &textureName, PBYTE pbDa
bool UIScene::hasRegisteredSubstitutionTexture(const wstring &textureName)
{
AUTO_VAR(it, m_registeredTextures.find( textureName ) );
auto it = m_registeredTextures.find(textureName);
return it != m_registeredTextures.end();
}
@@ -1240,10 +1239,8 @@ UIScene *UIScene::getBackScene()
#ifdef __PSVITA__
void UIScene::UpdateSceneControls()
{
AUTO_VAR(itEnd, GetControls()->end());
for (AUTO_VAR(it, GetControls()->begin()); it != itEnd; it++)
for ( UIControl *control : *GetControls() )
{
UIControl *control=(UIControl *)*it;
control->UpdateControl();
}
}
@@ -84,6 +84,10 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
m_iGameModeId = GameType::SURVIVAL->getId();
m_pDLCPack = NULL;
m_bRebuildTouchBoxes = false;
#ifdef _WINDOWS64
m_bDirectEditing = false;
m_iDirectEditCooldown = 0;
#endif
m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
// 4J-PB - read the settings for the online flag. We'll only save this setting if the user changed it.
@@ -289,6 +293,54 @@ void UIScene_CreateWorldMenu::tick()
{
UIScene::tick();
#ifdef _WINDOWS64
if (m_iDirectEditCooldown > 0)
m_iDirectEditCooldown--;
if (m_bDirectEditing)
{
wchar_t ch;
bool changed = false;
while (g_KBMInput.ConsumeChar(ch))
{
if (ch == 0x08) // backspace
{
if (!m_worldName.empty())
{
m_worldName.pop_back();
changed = true;
}
}
else if (ch == 0x0D) // enter - confirm
{
m_bDirectEditing = false;
m_iDirectEditCooldown = 4; // absorb the matching ACTION_MENU_OK that follows
m_editWorldName.setLabel(m_worldName.c_str());
}
else if ((int)m_worldName.length() < 25)
{
m_worldName += ch;
changed = true;
}
}
// Escape cancels and restores the original name
if (m_bDirectEditing && g_KBMInput.IsKeyPressed(VK_ESCAPE))
{
m_worldName = m_worldNameBeforeEdit;
m_bDirectEditing = false;
m_iDirectEditCooldown = 4;
m_editWorldName.setLabel(m_worldName.c_str());
m_buttonCreateWorld.setEnable(!m_worldName.empty());
}
else if (changed)
{
m_editWorldName.setLabel(m_worldName.c_str());
m_buttonCreateWorld.setEnable(!m_worldName.empty());
}
}
#endif
if(m_iSetTexturePackDescription >= 0 )
{
UpdateTexturePackDescription( m_iSetTexturePackDescription );
@@ -354,6 +406,9 @@ int UIScene_CreateWorldMenu::ContinueOffline(void *pParam,int iPad,C4JStorage::E
void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{
if(m_bIgnoreInput) return;
#ifdef _WINDOWS64
if (m_bDirectEditing || m_iDirectEditCooldown > 0) { handled = true; return; }
#endif
ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);
@@ -408,6 +463,9 @@ void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool p
void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
{
if(m_bIgnoreInput) return;
#ifdef _WINDOWS64
if (m_bDirectEditing || m_iDirectEditCooldown > 0) return;
#endif
//CD - Added for audio
ui.PlayUISFX(eSFX_Press);
@@ -417,7 +475,28 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
case eControl_EditWorldName:
{
m_bIgnoreInput=true;
#ifdef _WINDOWS64
if (Win64_IsControllerConnected())
{
UIKeyboardInitData kbData;
kbData.title = app.GetString(IDS_CREATE_NEW_WORLD);
kbData.defaultText = m_editWorldName.getLabel();
kbData.maxChars = 25;
kbData.callback = &UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback;
kbData.lpParam = this;
ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData);
}
else
{
// PC without controller: edit the name field directly in-place.
m_bIgnoreInput = false; // Don't block input - m_bDirectEditing is the guard
m_worldNameBeforeEdit = m_worldName;
m_bDirectEditing = true;
g_KBMInput.ClearCharBuffer();
}
#else
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD),m_editWorldName.getLabel(),(DWORD)0,25,&UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback,this,C_4JInput::EKeyboardMode_Default);
#endif
}
break;
case eControl_GameModeToggle:
@@ -729,7 +808,11 @@ int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bo
{
uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t) );
#ifdef _WINDOWS64
Win64_GetKeyboardText(pchText, 128);
#else
InputManager.GetText(pchText);
#endif
if(pchText[0]!=0)
{
@@ -51,6 +51,12 @@ private:
DLCPack * m_pDLCPack;
bool m_bRebuildTouchBoxes;
#ifdef _WINDOWS64
bool m_bDirectEditing;
wstring m_worldNameBeforeEdit;
int m_iDirectEditCooldown;
#endif
public:
UIScene_CreateWorldMenu(int iPad, void *initData, UILayer *parentLayer);
virtual ~UIScene_CreateWorldMenu();
@@ -191,13 +191,13 @@ void UIScene_DLCOffersMenu::handleInput(int iPad, int key, bool repeat, bool pre
switch(iTextC)
{
case 0:
m_labelHTMLSellText.init("Voici un fantastique mini-pack de 24 apparences pour personnaliser votre personnage Minecraft et vous mettre dans l'ambiance des fêtes de fin d'année.<br><br>1-4 joueurs<br>2-8 joueurs en réseau<br><br> Cet article fait lobjet dune licence ou dune sous-licence de Sony Computer Entertainment America, et est soumis aux conditions générales du service du réseau, au contrat dutilisateur, aux restrictions dutilisation de cet article et aux autres conditions applicables, disponibles sur le site www.us.playstation.com/support/useragreements. Si vous ne souhaitez pas accepter ces conditions, ne téléchargez pas ce produit. Cet article peut être utilisé avec un maximum de deux systèmes PlayStation®3 activés associés à ce compte Sony Entertainment Network. <br><br>'Minecraft' est une marque commerciale de Notch Development AB.");
m_labelHTMLSellText.init("Voici un fantastique mini-pack de 24 apparences pour personnaliser votre personnage Minecraft et vous mettre dans l'ambiance des ftes de fin d'anne.<br><br>1-4 joueurs<br>2-8 joueurs en rseau<br><br> Cet article fait lobjet dune licence ou dune sous-licence de Sony Computer Entertainment America, et est soumis aux conditions gnrales du service du rseau, au contrat dutilisateur, aux restrictions dutilisation de cet article et aux autres conditions applicables, disponibles sur le site www.us.playstation.com/support/useragreements. Si vous ne souhaitez pas accepter ces conditions, ne tlchargez pas ce produit. Cet article peut tre utilis avec un maximum de deux systmes PlayStation3 activs associs ce compte Sony Entertainment Network.<br><br>'Minecraft' est une marque commerciale de Notch Development AB.");
break;
case 1:
m_labelHTMLSellText.init("Un fabuloso minipack de 24 aspectos para personalizar tu personaje de Minecraft y ponerte a tono con las fiestas.<br><br>1-4 jugadores<br>2-8 jugadores en red<br><br> Sony Computer Entertainment America le concede la licencia o sublicencia de este artículo, que está sujeto a los términos de servicio y al acuerdo de usuario de la red. Las restricciones de uso de este artículo, así como otros términos aplicables, se encuentran en www.us.playstation.com/support/useragreements. Si no desea aceptar todos estos términos, no descargue este artículo. Este artículo puede usarse en hasta dos sistemas PlayStation®3 activados asociados con esta cuenta de Sony Entertainment Network. <br><br>'Minecraft' es una marca comercial de Notch Development AB.");
m_labelHTMLSellText.init("Un fabuloso minipack de 24 aspectos para personalizar tu personaje de Minecraft y ponerte a tono con las fiestas.<br><br>1-4 jugadores<br>2-8 jugadores en red<br><br> Sony Computer Entertainment America le concede la licencia o sublicencia de este artculo, que est sujeto a los trminos de servicio y al acuerdo de usuario de la red. Las restricciones de uso de este artculo, as como otros trminos aplicables, se encuentran en www.us.playstation.com/support/useragreements. Si no desea aceptar todos estos trminos, no descargue este artculo. Este artculo puede usarse en hasta dos sistemas PlayStation3 activados asociados con esta cuenta de Sony Entertainment Network.<br><br>'Minecraft' es una marca comercial de Notch Development AB.");
break;
case 2:
m_labelHTMLSellText.init("Este é um incrível pacote com 24 capas para personalizar seu personagem no Minecraft e entrar no clima de final de ano.<br><br>1-4 Jogadores<br>Jogadores em rede 2-8<br><br> Este item está sendo licenciado ou sublicenciado para você pela Sony Computer Entertainment America e está sujeito aos Termos de Serviço da Rede e Acordo do Usuário, as restrições de uso deste item e outros termos aplicáveis estão localizados em www.us.playstation.com/support/useragreements. Caso não queira aceitar todos esses termos, não baixe este item. Este item pode ser usado com até 2 sistemas PlayStation®3 ativados associados a esta Conta de Rede Sony Entertainment. <br><br>'Minecraft' é uma marca registrada da Notch Development AB");
m_labelHTMLSellText.init("Este um incrvel pacote com 24 capas para personalizar seu personagem no Minecraft e entrar no clima de final de ano.<br><br>1-4 Jogadores<br>Jogadores em rede 2-8<br><br> Este item est sendo licenciado ou sublicenciado para voc pela Sony Computer Entertainment America e est sujeito aos Termos de Servio da Rede e Acordo do Usurio, as restries de uso deste item e outros termos aplicveis esto localizados em www.us.playstation.com/support/useragreements. Caso no queira aceitar todos esses termos, no baixe este item. Este item pode ser usado com at 2 sistemas PlayStation3 ativados associados a esta Conta de Rede Sony Entertainment.<br><br>'Minecraft' uma marca registrada da Notch Development AB");
break;
}
iTextC++;
@@ -660,25 +660,6 @@ void UIScene_DLCOffersMenu::tick()
}
}
}
// if(m_bBitmapOfferIconDisplayed==false)
// {
// // do we have it yet?
// if
// }
// retrieve the icons for the DLC
// if(m_vIconRetrieval.size()>0)
// {
// // for each icon, request it, and remove it from the list
// // the callback for the retrieval will update the display if needed
//
// AUTO_VAR(itEnd, m_vIconRetrieval.end());
// for (AUTO_VAR(it, m_vIconRetrieval.begin()); it != itEnd; it++)
// {
//
// }
//
// }
#endif
}
@@ -80,7 +80,7 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa
for(unsigned int level = ench->getMinLevel(); level <= ench->getMaxLevel(); ++level)
{
m_enchantmentIdAndLevels.push_back(pair<int,int>(ench->id,level));
m_buttonListEnchantments.addItem(app.GetString( ench->getDescriptionId() ) + _toString<int>(level) );
m_buttonListEnchantments.addItem(app.GetString( ench->getDescriptionId() ) + std::to_wstring(level) );
}
}
@@ -61,13 +61,13 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer)
noNoiseString = replaceAll(noNoiseString,L"{*PLAYER*}",playerName);
Random random(8124371);
int found=(int)noNoiseString.find(L"{*NOISE*}");
size_t found=noNoiseString.find(L"{*NOISE*}");
int length;
while (found!=string::npos)
{
length = random.nextInt(4) + 3;
m_noiseLengths.push_back(length);
found=(int)noNoiseString.find(L"{*NOISE*}",found+1);
found=noNoiseString.find(L"{*NOISE*}",found+1);
}
updateNoise();
@@ -209,8 +209,8 @@ void UIScene_EndPoem::updateNoise()
wstring tag = L"{*NOISE*}";
AUTO_VAR(it, m_noiseLengths.begin());
int found=(int)noiseString.find(tag);
auto it = m_noiseLengths.begin();
size_t found= noiseString.find(tag);
while (found!=string::npos && it != m_noiseLengths.end() )
{
length = *it;
@@ -275,6 +275,6 @@ void UIScene_EndPoem::updateNoise()
//ib.put(listPos + 256 + random->nextInt(2) + 8 + (darken ? 16 : 0));
//ib.put(listPos + pos + 32);
found=(int)noiseString.find(tag,found+1);
found=noiseString.find(tag,found+1);
}
}
@@ -261,10 +261,8 @@ void UIScene_InventoryMenu::updateEffectsDisplay()
int iValue = 0;
IggyDataValue *UpdateValue = new IggyDataValue[activeEffects->size()*2];
for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it)
for(auto& effect : *activeEffects)
{
MobEffectInstance *effect = *it;
if(effect->getDuration() >= m_bEffectTime[effect->getId()])
{
wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim();
+154 -6
View File
@@ -2,6 +2,12 @@
#include "UI.h"
#include "UIScene_Keyboard.h"
#ifdef _WINDOWS64
// Global buffer that stores the text entered in the native keyboard scene.
// Callbacks retrieve it via Win64_GetKeyboardText() declared in UIStructs.h.
wchar_t g_Win64KeyboardResult[256] = {};
#endif
#define KEYBOARD_DONE_TIMER_ID 0
#define KEYBOARD_DONE_TIMER_TIME 100
@@ -10,20 +16,56 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLaye
// Setup all the Iggy references we need for this scene
initialiseMovie();
#ifdef _WINDOWS64
m_win64Callback = NULL;
m_win64CallbackParam = NULL;
m_win64TextBuffer = L"";
m_win64MaxChars = 25;
const wchar_t* titleText = L"Enter text";
const wchar_t* defaultText = L"";
m_bPCMode = false;
if (initData)
{
UIKeyboardInitData* kbData = (UIKeyboardInitData*)initData;
m_win64Callback = kbData->callback;
m_win64CallbackParam = kbData->lpParam;
if (kbData->title) titleText = kbData->title;
if (kbData->defaultText) defaultText = kbData->defaultText;
m_win64MaxChars = kbData->maxChars;
m_bPCMode = kbData->pcMode;
}
m_win64TextBuffer = defaultText;
m_EnterTextLabel.init(titleText);
m_KeyboardTextInput.init(defaultText, -1);
m_KeyboardTextInput.SetCharLimit(m_win64MaxChars);
// Clear any leftover typed characters from a previous keyboard session
g_KBMInput.ClearCharBuffer();
g_Win64KeyboardResult[0] = L'\0';
#else
m_EnterTextLabel.init(L"Enter Sign Text");
m_KeyboardTextInput.init(L"", -1);
m_KeyboardTextInput.SetCharLimit(15);
#endif
m_ButtonSpace.init(L"Space", -1);
m_ButtonCursorLeft.init(L"Cursor Left", -1);
m_ButtonCursorRight.init(L"Cursor Right", -1);
m_ButtonCursorLeft.init(L"Cur L", -1);
m_ButtonCursorRight.init(L"Cur R", -1);
m_ButtonCaps.init(L"Caps", -1);
m_ButtonDone.init(L"Done", 0); // only the done button needs an id, the others will never call back!
m_ButtonSymbols.init(L"Symbols", -1);
m_ButtonBackspace.init(L"Backspace", -1);
// Initialise function keyboard Buttons and set alternative symbol button string
#ifdef _WINDOWS64
if (!m_bPCMode)
#endif
{
wstring label = L"Abc";
IggyStringUTF16 stringVal;
stringVal.string = (IggyUTF16*)label.c_str();
@@ -34,7 +76,43 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLaye
value[0].type = IGGY_DATATYPE_string_UTF16;
value[0].string16 = stringVal;
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcInitFunctionButtons , 1 , value );
IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcInitFunctionButtons , 1 , value );
}
#ifdef _WINDOWS64
if (m_bPCMode)
{
// PC text-input mode: hide all on-screen buttons, user types with physical keyboard
// Hide the mapped function-row buttons
m_ButtonSpace.setVisible(false);
m_ButtonCursorLeft.setVisible(false);
m_ButtonCursorRight.setVisible(false);
m_ButtonCaps.setVisible(false);
m_ButtonSymbols.setVisible(false);
m_ButtonBackspace.setVisible(false);
// Hide the letter/number key grid (Flash-baked, not mapped as UIControls)
static const char* s_keyNames[] = {
"Button_q", "Button_w", "Button_e", "Button_r", "Button_t",
"Button_y", "Button_u", "Button_i", "Button_o", "Button_p",
"Button_a", "Button_s", "Button_d", "Button_f", "Button_g",
"Button_h", "Button_j", "Button_k", "Button_l", "Button_apostraphy",
"Button_z", "Button_x", "Button_c", "Button_v", "Button_b",
"Button_n", "Button_m", "Button_comma", "Button_stop", "Button_qmark",
"Button_0", "Button_1", "Button_2", "Button_3", "Button_4",
"Button_5", "Button_6", "Button_7", "Button_8", "Button_9"
};
IggyName nameVisible = registerFastName(L"visible");
IggyValuePath* root = IggyPlayerRootPath(getMovie());
for (int i = 0; i < (int)(sizeof(s_keyNames) / sizeof(s_keyNames[0])); ++i)
{
IggyValuePath keyPath;
if (IggyValuePathMakeNameRef(&keyPath, root, s_keyNames[i]))
IggyValueSetBooleanRS(&keyPath, nameVisible, NULL, false);
}
}
#endif
m_bKeyboardDonePressed = false;
@@ -80,6 +158,46 @@ bool UIScene_Keyboard::allowRepeat(int key)
return true;
}
#ifdef _WINDOWS64
void UIScene_Keyboard::tick()
{
UIScene::tick();
// Accumulate physical keyboard chars into our own buffer, then push to Flash via setLabel.
// This bypasses Iggy's focus system (char events only route to the focused element).
// The char buffer is cleared on open so Enter/clicks from the triggering action don't leak in.
wchar_t ch;
bool changed = false;
while (g_KBMInput.ConsumeChar(ch))
{
if (ch == 0x08) // backspace
{
if (!m_win64TextBuffer.empty())
{
m_win64TextBuffer.pop_back();
changed = true;
}
}
else if (ch == 0x0D) // enter - confirm
{
if (!m_bKeyboardDonePressed)
{
addTimer(KEYBOARD_DONE_TIMER_ID, KEYBOARD_DONE_TIMER_TIME);
m_bKeyboardDonePressed = true;
}
}
else if ((int)m_win64TextBuffer.length() < m_win64MaxChars)
{
m_win64TextBuffer += ch;
changed = true;
}
}
if (changed)
m_KeyboardTextInput.setLabel(m_win64TextBuffer.c_str(), true /*instant*/);
}
#endif
void UIScene_Keyboard::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{
IggyDataValue result;
@@ -90,7 +208,18 @@ void UIScene_Keyboard::handleInput(int iPad, int key, bool repeat, bool pressed,
switch(key)
{
case ACTION_MENU_CANCEL:
#ifdef _WINDOWS64
{
// Cache before navigateBack() destroys this scene
int(*cb)(LPVOID, const bool) = m_win64Callback;
LPVOID cbParam = m_win64CallbackParam;
navigateBack();
if (cb)
cb(cbParam, false);
}
#else
navigateBack();
#endif
handled = true;
break;
case ACTION_MENU_X: // X
@@ -173,9 +302,28 @@ void UIScene_Keyboard::handleTimerComplete(int id)
void UIScene_Keyboard::KeyboardDonePressed()
{
// Debug
app.DebugPrintf("UI Keyboard - DONE - [%ls]\n", m_KeyboardTextInput.getLabel());
#ifdef _WINDOWS64
// Use getLabel() here — this is a timer callback (not an Iggy callback) so it's safe.
// getLabel() reflects both physical keyboard input (pushed via setLabel) and
// on-screen button input (set directly by Flash ActionScript).
const wchar_t* finalText = m_KeyboardTextInput.getLabel();
app.DebugPrintf("UI Keyboard - DONE - [%ls]\n", finalText);
// ToDo: Keyboard can now pass on its final string value and close itself down
// Store the typed text so callbacks can retrieve it via Win64_GetKeyboardText()
wcsncpy_s(g_Win64KeyboardResult, 256, finalText, _TRUNCATE);
// Cache callback and param before navigateBack() which destroys this scene
int(*cb)(LPVOID, const bool) = m_win64Callback;
LPVOID cbParam = m_win64CallbackParam;
// Navigate back so the scene stack is restored before the callback runs
navigateBack();
// Fire callback: bRes=true means confirmed
if (cb)
cb(cbParam, true);
#else
app.DebugPrintf("UI Keyboard - DONE - [%ls]\n", m_KeyboardTextInput.getLabel());
navigateBack();
#endif
}
@@ -7,6 +7,14 @@ class UIScene_Keyboard : public UIScene
private:
bool m_bKeyboardDonePressed;
#ifdef _WINDOWS64
int(*m_win64Callback)(LPVOID, const bool);
LPVOID m_win64CallbackParam;
wstring m_win64TextBuffer;
int m_win64MaxChars;
bool m_bPCMode; // Hides on-screen keyboard buttons; physical keyboard only
#endif
protected:
UIControl_Label m_EnterTextLabel;
UIControl_TextInput m_KeyboardTextInput;
@@ -49,6 +57,10 @@ public:
// INPUT
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
#ifdef _WINDOWS64
virtual void tick();
#endif
virtual void handleTimerComplete(int id);
protected:
@@ -75,5 +87,9 @@ public:
#endif
// Returns true if lower scenes in this scenes layer, or in any layer below this scenes layers should be hidden
#ifdef _WINDOWS64
virtual bool hidesLowerScenes() { return true; }
#else
virtual bool hidesLowerScenes() { return false; }
#endif
};
@@ -2,6 +2,7 @@
#include "UI.h"
#include "UIScene_LoadMenu.h"
#include "..\..\Minecraft.h"
#include "..\..\User.h"
#include "..\..\TexturePackRepository.h"
#include "..\..\Options.h"
#include "..\..\MinecraftServer.h"
@@ -273,7 +274,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye
m_bIgnoreInput = false;
Minecraft *pMinecraft = Minecraft::GetInstance();
int texturePacksCount = pMinecraft->skins->getTexturePackCount();
unsigned int texturePacksCount = (unsigned int)pMinecraft->skins->getTexturePackCount();
for(unsigned int i = 0; i < texturePacksCount; ++i)
{
TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i);
@@ -1629,6 +1630,12 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal
param->settings = app.GetGameHostOption( eGameHostOption_All );
#ifdef _WINDOWS64
{
extern wchar_t g_Win64UsernameW[17];
Minecraft::GetInstance()->user->name = g_Win64UsernameW;
}
#endif
#ifndef _XBOX
g_NetworkManager.FakeLocalPlayerJoined();
#endif
@@ -31,6 +31,32 @@
static wstring ReadLevelNameFromSaveFile(const wstring& filePath)
{
// Check for a worldname.txt sidecar written by the rename feature first
size_t slashPos = filePath.rfind(L'\\');
if (slashPos != wstring::npos)
{
wstring sidecarPath = filePath.substr(0, slashPos + 1) + L"worldname.txt";
FILE *fr = NULL;
if (_wfopen_s(&fr, sidecarPath.c_str(), L"r") == 0 && fr)
{
char buf[128] = {};
if (fgets(buf, sizeof(buf), fr))
{
int len = (int)strlen(buf);
while (len > 0 && (buf[len-1] == '\n' || buf[len-1] == '\r' || buf[len-1] == ' '))
buf[--len] = '\0';
fclose(fr);
if (len > 0)
{
wchar_t wbuf[128] = {};
mbstowcs(wbuf, buf, 127);
return wstring(wbuf);
}
}
else fclose(fr);
}
}
HANDLE hFile = CreateFileW(filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hFile == INVALID_HANDLE_VALUE) return L"";
@@ -110,8 +136,8 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath)
if (freeSaveData) delete[] saveData;
delete[] rawData;
// "world" is the engine default it means no real name was ever set, so
// return empty to let the caller fall back to the save filename (timestamp).
// "world" is the engine default - it means no real name was ever set,
// so return empty to let the caller fall back to the save filename (timestamp).
if (result == L"world") result = L"";
return result;
}
@@ -644,8 +670,6 @@ void UIScene_LoadOrJoinMenu::tick()
{
UIScene::tick();
#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined _WINDOWS64 || defined __PSVITA__)
if(m_bExitScene) // navigate forward or back
{
@@ -1054,10 +1078,8 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons()
int i = 0;
for(AUTO_VAR(it, app.getLevelGenerators()->begin()); it != app.getLevelGenerators()->end(); ++it)
for ( LevelGenerationOptions *levelGen : *app.getLevelGenerators() )
{
LevelGenerationOptions *levelGen = *it;
// retrieve the save icon from the texture pack, if there is one
unsigned int uiTexturePackID=levelGen->getRequiredTexturePackId();
@@ -1337,7 +1359,11 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo
{
uint16_t ui16Text[128];
ZeroMemory(ui16Text, 128 * sizeof(uint16_t) );
#ifdef _WINDOWS64
Win64_GetKeyboardText(ui16Text, 128);
#else
InputManager.GetText(ui16Text);
#endif
// check the name is valid
if(ui16Text[0]!=0)
@@ -1345,6 +1371,38 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo
#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined(__PSVITA__))
// open the save and overwrite the metadata
StorageManager.RenameSaveData(pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC, ui16Text,&UIScene_LoadOrJoinMenu::RenameSaveDataReturned,pClass);
#elif defined(_WINDOWS64)
{
int listPos = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC;
// Convert the ui16Text input to a wide string
wchar_t wNewName[128] = {};
for (int k = 0; k < 127 && ui16Text[k]; k++)
wNewName[k] = (wchar_t)ui16Text[k];
// Convert to narrow for storage and in-memory update
char narrowName[128] = {};
wcstombs(narrowName, wNewName, 127);
// Build the sidecar path: Windows64\GameHDD\{folder}\worldname.txt
wchar_t wFilename[MAX_SAVEFILENAME_LENGTH] = {};
mbstowcs(wFilename, pClass->m_saveDetails[listPos].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1);
wstring sidecarPath = wstring(L"Windows64\\GameHDD\\") + wstring(wFilename) + wstring(L"\\worldname.txt");
FILE *fw = NULL;
if (_wfopen_s(&fw, sidecarPath.c_str(), L"w") == 0 && fw)
{
fputs(narrowName, fw);
fclose(fw);
}
// Update the in-memory display name so the list reflects it immediately
strncpy_s(pClass->m_saveDetails[listPos].UTF8SaveName, narrowName, 127);
pClass->m_saveDetails[listPos].UTF8SaveName[127] = '\0';
// Reuse the existing callback to trigger the list repopulate
UIScene_LoadOrJoinMenu::RenameSaveDataReturned(pClass, true);
}
#endif
}
else
@@ -1859,10 +1917,8 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList()
unsigned int sessionIndex = 0;
m_buttonListGames.setCurrentSelection(0);
for( AUTO_VAR(it, m_currentSessions->begin()); it < m_currentSessions->end(); ++it)
for( FriendSessionInfo *sessionInfo : *m_currentSessions )
{
FriendSessionInfo *sessionInfo = *it;
wchar_t textureName[64] = L"\0";
// Is this a default game or a texture pack game?
@@ -2193,6 +2249,31 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromCloud()
#endif //SONY_REMOTE_STORAGE_DOWNLOAD
#ifdef _WINDOWS64
static bool Win64_DeleteSaveDirectory(const wchar_t* wPath)
{
wchar_t wSearch[MAX_PATH];
swprintf_s(wSearch, MAX_PATH, L"%s\\*", wPath);
WIN32_FIND_DATAW fd;
HANDLE hFind = FindFirstFileW(wSearch, &fd);
if (hFind != INVALID_HANDLE_VALUE)
{
do
{
if (wcscmp(fd.cFileName, L".") == 0 || wcscmp(fd.cFileName, L"..") == 0) continue;
wchar_t wChild[MAX_PATH];
swprintf_s(wChild, MAX_PATH, L"%s\\%s", wPath, fd.cFileName);
if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
Win64_DeleteSaveDirectory(wChild);
else
DeleteFileW(wChild);
} while (FindNextFileW(hFind, &fd));
FindClose(hFind);
}
return RemoveDirectoryW(wPath) != 0;
}
#endif // _WINDOWS64
int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam;
@@ -2209,7 +2290,24 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JSt
}
else
{
#ifdef _WINDOWS64
{
// Use m_saveDetails (sorted display order) so the correct folder is targeted
int displayIdx = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC;
bool bSuccess = false;
if (pClass->m_saveDetails && displayIdx >= 0 && pClass->m_saveDetails[displayIdx].UTF8SaveFilename[0])
{
wchar_t wFilename[MAX_SAVEFILENAME_LENGTH] = {};
mbstowcs_s(NULL, wFilename, MAX_SAVEFILENAME_LENGTH, pClass->m_saveDetails[displayIdx].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1);
wchar_t wFolderPath[MAX_PATH] = {};
swprintf_s(wFolderPath, MAX_PATH, L"Windows64\\GameHDD\\%s", wFilename);
bSuccess = Win64_DeleteSaveDirectory(wFolderPath);
}
UIScene_LoadOrJoinMenu::DeleteSaveDataReturned((LPVOID)pClass->GetCallbackUniqueId(), bSuccess);
}
#else
StorageManager.DeleteSaveData(&pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC], UIScene_LoadOrJoinMenu::DeleteSaveDataReturned, (LPVOID)pClass->GetCallbackUniqueId());
#endif
pClass->m_controlSavesTimer.setVisible( true );
}
}
@@ -2285,7 +2383,21 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS
case C4JStorage::EMessage_ResultDecline: // rename
{
pClass->m_bIgnoreInput=true;
#ifdef _DURANGO
#ifdef _WINDOWS64
{
wchar_t wSaveName[128];
ZeroMemory(wSaveName, 128 * sizeof(wchar_t));
mbstowcs_s(NULL, wSaveName, 128, pClass->m_saveDetails[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC].UTF8SaveName, _TRUNCATE);
UIKeyboardInitData kbData;
kbData.title = app.GetString(IDS_RENAME_WORLD_TITLE);
kbData.defaultText = wSaveName;
kbData.maxChars = 25;
kbData.callback = &UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback;
kbData.lpParam = pClass;
kbData.pcMode = !Win64_IsControllerConnected();
ui.NavigateToScene(pClass->m_iPad, eUIScene_Keyboard, &kbData);
}
#elif defined _DURANGO
// bring up a keyboard
InputManager.RequestKeyboard(app.GetString(IDS_RENAME_WORLD_TITLE), (pClass->m_saveDetails[pClass->m_iSaveListIndex-pClass->m_iDefaultButtonsC]).UTF16SaveName,(DWORD)0,25,&UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback,pClass,C_4JInput::EKeyboardMode_Default);
#else
+38
View File
@@ -282,6 +282,44 @@ typedef struct _JoinMenuInitData
int iPad;
} JoinMenuInitData;
// Native keyboard (Windows64 replacement for InputManager.RequestKeyboard WinAPI dialog)
#ifdef _WINDOWS64
typedef struct _UIKeyboardInitData
{
const wchar_t* title;
const wchar_t* defaultText;
int maxChars;
int(*callback)(LPVOID, const bool);
LPVOID lpParam;
bool pcMode; // When true, disables on-screen keyboard buttons (PC keyboard users only need the text field)
_UIKeyboardInitData() : title(nullptr), defaultText(nullptr), maxChars(25), callback(nullptr), lpParam(nullptr), pcMode(false) {}
} UIKeyboardInitData;
// Stores the text typed in UIScene_Keyboard so callbacks can retrieve it
// without calling InputManager.GetText (which shows the WinAPI dialog result).
extern wchar_t g_Win64KeyboardResult[256];
inline void Win64_GetKeyboardText(uint16_t* outBuf, int maxChars)
{
wcsncpy_s((wchar_t*)outBuf, maxChars, g_Win64KeyboardResult, _TRUNCATE);
}
// Returns true if any XInput controller is currently connected.
// Used to decide whether to show the in-game keyboard UI or fall back to PC input.
#include <Xinput.h>
inline bool Win64_IsControllerConnected()
{
XINPUT_STATE state;
for (DWORD i = 0; i < XUSER_MAX_COUNT; i++)
{
memset(&state, 0, sizeof(state));
if (XInputGetState(i, &state) == ERROR_SUCCESS)
return true;
}
return false;
}
#endif // _WINDOWS64
// More Options
typedef struct _LaunchMoreOptionsMenuInitData
{
@@ -74,7 +74,7 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom
#ifdef _DEBUG
int iCount=0;
for (AUTO_VAR(it, m_vListData.begin()); it != m_vListData.end(); it++)
for ( auto it : m_vListData )
{
PLIST_ITEM_INFO pInfo=(PLIST_ITEM_INFO)*it;
app.DebugPrintf("%d. ",iCount++);
@@ -103,18 +103,6 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom
}
}
LeaveCriticalSection(&m_AccessListData);
// #ifdef _DEBUG
//
// iCount=0;
// for (AUTO_VAR(it, m_vListData.begin()); it != m_vListData.end(); it++)
// {
// PLIST_ITEM_INFO pInfo=(PLIST_ITEM_INFO)*it;
// app.DebugPrintf("After Sort - %d. ",iCount++);
// OutputDebugStringW(pInfo->pwszText);
// app.DebugPrintf(" - %d\n",pInfo->iSortIndex);
//
// }
// #endif
InsertItems( 0, 1 );
}
@@ -69,7 +69,7 @@ HRESULT CXuiCtrlEnchantmentButton::OnGetSourceDataText(XUIMessageGetSourceText *
// Light background and focus background
SetEnable(TRUE);
}
m_costString = _toString<int>(cost);
m_costString = std::to_wstring(cost);
m_lastCost = cost;
}
if(cost == 0)
@@ -124,7 +124,7 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnRender(XUIMessageRender *pRenderData, B
glColor4f(1, 1, 1, 1);
if (cost != 0)
{
wstring line = _toString<int>(cost);
wstring line = std::to_wstring(cost);
Font *font = pMinecraft->altFont;
//int col = 0x685E4A;
unsigned int col = m_textColour;
@@ -256,10 +256,8 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
{
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it)
for(auto& pModelPart : *m_pvAdditionalModelParts)
{
ModelPart *pModelPart=*it;
pModelPart->visible=true;
}
}
@@ -270,10 +268,8 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO
// hide the additional parts
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
{
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it)
for(auto& pModelPart : *m_pvAdditionalModelParts)
{
ModelPart *pModelPart=*it;
pModelPart->visible=false;
}
}
@@ -137,9 +137,8 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector<wstri
wstring desc = L"";
vector<wstring> *strings = pUserDataContainer->slot->getItem()->getHoverText(Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad], false, unformattedStrings);
bool firstLine = true;
for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it)
for ( wstring& thisString : *strings )
{
wstring thisString = *it;
if(!firstLine)
{
desc.append( L"<br />" );
@@ -25,10 +25,10 @@ HRESULT CScene_DebugItemEditor::OnInit( XUIMessageInit *pInitData, BOOL &bHandle
m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil());
m_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) );
m_itemId .SetText( _toString<int>(m_item->id).c_str() );
m_itemAuxValue .SetText( _toString<int>(m_item->getAuxValue()).c_str() );
m_itemCount .SetText( _toString<int>(m_item->count).c_str() );
m_item4JData .SetText( _toString<int>(m_item->get4JData()).c_str() );
m_itemId .SetText( std::to_wstring(m_item->id).c_str() );
m_itemAuxValue .SetText( std::to_wstring(m_item->getAuxValue()).c_str() );
m_itemCount .SetText( std::to_wstring(m_item->count).c_str() );
m_item4JData .SetText( std::to_wstring(m_item->get4JData()).c_str() );
}
m_itemId .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
@@ -365,10 +365,10 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius)
RegionFile *CScene_DebugOverlay::getRegionFile(unordered_map<File, RegionFile *, FileKeyHash, FileKeyEq> &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) // 4J - TODO was synchronized
{
File file( prefix + wstring(L"r.") + _toString(chunkX>>5) + L"." + _toString(chunkZ>>5) + L".mcr" );
File file( prefix + wstring(L"r.") + std::to_wstring(chunkX>>5) + L"." + std::to_wstring(chunkZ>>5) + L".mcr" );
RegionFile *ref = NULL;
AUTO_VAR(it, newFileCache.find(file));
auto it = newFileCache.find(file);
if( it != newFileCache.end() )
ref = it->second;
@@ -43,12 +43,12 @@ HRESULT CScene_DebugSetCamera::OnInit( XUIMessageInit *pInitData, BOOL &bHandled
m_yRot.SetKeyboardType(C_4JInput::EKeyboardMode_Full);
m_elevation.SetKeyboardType(C_4JInput::EKeyboardMode_Full);
m_camX.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camX).c_str());
m_camY.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camY + 1.62).c_str());
m_camZ.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camZ).c_str());
m_camX.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camX).c_str());
m_camY.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camY + 1.62).c_str());
m_camZ.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camZ).c_str());
m_yRot.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_yRot).c_str());
m_elevation.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_elev).c_str());
m_yRot.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_yRot).c_str());
m_elevation.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_elev).c_str());
//fpp = new FreezePlayerParam();
//fpp->player = playerNo;
@@ -267,9 +267,8 @@ void CScene_MultiGameJoinLoad::AddDefaultButtons()
int iGeneratorIndex = 0;
m_iMashUpButtonsC=0;
for(AUTO_VAR(it, m_generators->begin()); it != m_generators->end(); ++it)
for (LevelGenerationOptions *levelGen : *m_generators )
{
LevelGenerationOptions *levelGen = *it;
ListInfo.pwszText = levelGen->getWorldName();
ListInfo.fEnabled = TRUE;
ListInfo.iData = iGeneratorIndex++; // used to index into the list of generators
@@ -387,9 +386,9 @@ HRESULT CScene_MultiGameJoinLoad::OnDestroy()
{
g_NetworkManager.SetSessionsUpdatedCallback( NULL, NULL );
for(AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it)
for (auto& it : currentSessions )
{
delete (*it);
delete it;
}
if(m_bSaveTransferInProgress)
@@ -1145,9 +1144,9 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
if( pSelectedSession != NULL )selectedSessionId = pSelectedSession->sessionId;
pSelectedSession = NULL;
for(AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it)
for (auto& it : currentSessions )
{
delete (*it);
delete it;
}
currentSessions.clear();
@@ -1248,9 +1247,8 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
unsigned int sessionIndex = 0;
m_pGamesList->SetCurSel(0);
for( AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it)
for ( FriendSessionInfo *sessionInfo : currentSessions )
{
FriendSessionInfo *sessionInfo = *it;
HXUIBRUSH hXuiBrush;
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
@@ -1390,7 +1388,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear
FriendSessionInfo *sessionInfo = NULL;
bool foundSession = false;
for(AUTO_VAR(it, friendsSessions.begin()); it < friendsSessions.end(); ++it)
for( auto it = friendsSessions.begin(); it != friendsSessions.end(); ++it)
{
sessionInfo = *it;
if(memcmp( &pSearchResult->info.sessionID, &sessionInfo->sessionId, sizeof(SessionID) ) == 0)
@@ -388,15 +388,15 @@ void CXuiSceneAbstractContainer::SetPointerText(const wstring &description, vect
}
bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen());
wstring desc = L"<font size=\"" + _toString<int>(smallPointer ? 12 :14) + L"\">" + description + L"</font>";
wstring desc = L"<font size=\"" + std::to_wstring(smallPointer ? 12 :14) + L"\">" + description + L"</font>";
XUIRect tempXuiRect, xuiRect;
HRESULT hr;
xuiRect.right = 0;
for(AUTO_VAR(it, unformattedStrings.begin()); it != unformattedStrings.end(); ++it)
for (auto& it : unformattedStrings )
{
XuiTextPresenterMeasureText(m_hPointerTextMeasurer, parseXMLSpecials((*it)).c_str(), &tempXuiRect);
XuiTextPresenterMeasureText(m_hPointerTextMeasurer, parseXMLSpecials(it).c_str(), &tempXuiRect);
if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect;
}
@@ -176,7 +176,7 @@ void CXuiSceneInventory::updateEffectsDisplay()
// Fill out details for display
D3DXVECTOR3 position;
m_hEffectDisplayA[0]->GetPosition(&position);
AUTO_VAR(it, activeEffects->begin());
auto it = activeEffects->begin();
for(unsigned int i = 0; i < MAX_EFFECTS; ++i)
{
if(it != activeEffects->end())
@@ -270,15 +270,15 @@ void CXuiSceneTrading::setOfferDescription(const wstring &name, vector<wstring>
}
bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen());
wstring desc = L"<font size=\"" + _toString<int>(smallPointer ? 12 :14) + L"\">" + name + L"</font>";
wstring desc = L"<font size=\"" + std::to_wstring(smallPointer ? 12 :14) + L"\">" + name + L"</font>";
XUIRect tempXuiRect, xuiRect;
HRESULT hr;
xuiRect.right = 0;
for(AUTO_VAR(it, unformattedStrings.begin()); it != unformattedStrings.end(); ++it)
for (auto& it : unformattedStrings )
{
XuiTextPresenterMeasureText(m_hOfferInfoTextMeasurer, (*it).c_str(), &tempXuiRect);
XuiTextPresenterMeasureText(m_hOfferInfoTextMeasurer, it.c_str(), &tempXuiRect);
if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect;
}
@@ -195,7 +195,7 @@ void CScene_Win::updateNoise()
Minecraft *pMinecraft = Minecraft::GetInstance();
noiseString = noNoiseString;
int length = 0;
size_t length = 0;
wchar_t replacements[64];
wstring replaceString = L"";
wchar_t randomChar = L'a';
@@ -205,17 +205,17 @@ void CScene_Win::updateNoise()
wstring tag = L"{*NOISE*}";
AUTO_VAR(it, m_noiseLengths.begin());
int found=(int)noiseString.find_first_of(L"{");
auto it = m_noiseLengths.begin();
size_t found = noiseString.find_first_of(L"{");
while (found!=string::npos && it != m_noiseLengths.end() )
{
length = *it;
++it;
replaceString = L"";
for(int i = 0; i < length; ++i)
for(size_t i = 0; i < length; ++i)
{
randomChar = SharedConstants::acceptableLetters[random->nextInt((int)SharedConstants::acceptableLetters.length())];
randomChar = SharedConstants::acceptableLetters[random->nextInt(SharedConstants::acceptableLetters.length())];
wstring randomCharStr = L"";
randomCharStr.push_back(randomChar);
@@ -262,7 +262,7 @@ void CScene_Win::updateNoise()
//ib.put(listPos + 256 + random->nextInt(2) + 8 + (darken ? 16 : 0));
//ib.put(listPos + pos + 32);
found=(int)noiseString.find_first_of(L"{",found+1);
found = noiseString.find_first_of(L"{",found+1);
}
}
@@ -113,7 +113,7 @@ HRESULT CScene_TextEntry::InterpretString(wstring &wsText)
swscanf_s(wsText.c_str(), L"%s", wchCommand,40);
#endif
AUTO_VAR(it, m_CommandSet.find(wchCommand));
auto it = m_CommandSet.find(wchCommand);
if(it != m_CommandSet.end())
{
// found it
+7 -9
View File
@@ -6,35 +6,33 @@
// 4J - added
void CreeperModel::_init(float g)
{
int yo = 4;
head = new ModelPart(this, 0, 0);
head->addBox(-4, - 8, -4, 8, 8, 8, g); // Head
head->setPos(0, (float)(yo), 0);
head->setPos(0, 6, 0);
hair = new ModelPart(this, 32, 0);
hair->addBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Head
hair->setPos(0, (float)(yo), 0);
hair->setPos(0, 6, 0);
body = new ModelPart(this, 16, 16);
body->addBox(-4, 0, -2, 8, 12, 4, g); // Body
body->setPos(0, (float)(yo), 0);
body->setPos(0, 6, 0);
leg0 = new ModelPart(this, 0, 16);
leg0->addBox(-2, 0, -2, 4, 6, 4, g); // Leg0
leg0->setPos(-2, (float)(12 + yo), 4);
leg0->setPos(-2, 18, 4);
leg1 = new ModelPart(this, 0, 16);
leg1->addBox(-2, 0, -2, 4, 6, 4, g); // Leg1
leg1->setPos(2, (float)(12 + yo), 4);
leg1->setPos(2, 18, 4);
leg2 = new ModelPart(this, 0, 16);
leg2->addBox(-2, 0, -2, 4, 6, 4, g); // Leg2
leg2->setPos(-2, (float)(12 + yo), -4);
leg2->setPos(-2, 18, -4);
leg3 = new ModelPart(this, 0, 16);
leg3->addBox(-2, 0, -2, 4, 6, 4, g); // Leg3
leg3->setPos(2, (float)(12 + yo), -4);
leg3->setPos(2, 18, -4);
// 4J added - compile now to avoid random performance hit first time cubes are rendered
head->compile(1.0f/16.0f);
+1 -1
View File
@@ -48,7 +48,7 @@ void DeathScreen::render(int xm, int ym, float a)
glScalef(2, 2, 2);
drawCenteredString(font, L"Game over!", width / 2 / 2, 60 / 2, 0xffffff);
glPopMatrix();
drawCenteredString(font, L"Score: &e" + _toString( minecraft->player->getScore() ), width / 2, 100, 0xffffff);
drawCenteredString(font, L"Score: &e" + std::to_wstring( minecraft->player->getScore() ), width / 2, 100, 0xffffff);
Screen::render(xm, ym, a);
+1 -1
View File
@@ -26,7 +26,7 @@ void DemoMode::tick()
{
if (day <= (DEMO_DAYS + 1))
{
minecraft->gui->displayClientMessage(L"demo.day." + _toString<__int64>(day));
minecraft->gui->displayClientMessage(L"demo.day." + std::to_wstring(day));
}
}
else if (day == 1)
+4 -4
View File
@@ -171,7 +171,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImages()
{
unordered_map<wstring,DLC_INFO * > *pDLCInfoA=app.GetDLCInfo();
// 4J-PB - Any local graphic files for the Minecraft Store?
for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ )
for (auto it = pDLCInfoA->begin(); it != pDLCInfoA->end(); it++)
{
DLC_INFO * pDLCInfo=(*it).second;
@@ -185,7 +185,7 @@ void CConsoleMinecraftApp::FreeLocalDLCImages()
// 4J-PB - Any local graphic files for the Minecraft Store?
unordered_map<wstring,DLC_INFO * > *pDLCInfoA=app.GetDLCInfo();
for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ )
for (auto it = pDLCInfoA->begin(); it != pDLCInfoA->end(); it++)
{
DLC_INFO * pDLCInfo=(*it).second;
@@ -567,8 +567,8 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad,
// dump out the file list
app.DebugPrintf("TMSPP filecount - %d\nFiles - \n",pvTmsFileDetails->size());
int iCount=0;
AUTO_VAR(itEnd, pvTmsFileDetails->end());
for( AUTO_VAR(it, pvTmsFileDetails->begin()); it != itEnd; it++ )
auto itEnd = pvTmsFileDetails->end();
for (auto it = pvTmsFileDetails->begin(); it != itEnd; it++)
{
C4JStorage::PTMSPP_FILE_DETAILS fd = *it;
app.DebugPrintf("%2d. %ls (size - %d)\n",iCount++,fd->wchFilename,fd->ulFileSize);
@@ -1102,12 +1102,12 @@ SIZE_T WINAPI XMemSize(
void DumpMem()
{
int totalLeak = 0;
for(AUTO_VAR(it, allocCounts.begin()); it != allocCounts.end(); it++ )
for( auto& it : allocCounts )
{
if(it->second > 0 )
if(it.second > 0 )
{
app.DebugPrintf("%d %d %d %d\n",( it->first >> 26 ) & 0x3f,it->first & 0x03ffffff, it->second, (it->first & 0x03ffffff) * it->second);
totalLeak += ( it->first & 0x03ffffff ) * it->second;
app.DebugPrintf("%d %d %d %d\n",( it.first >> 26 ) & 0x3f,it.first & 0x03ffffff, it.second, (it.first & 0x03ffffff) * it.second);
totalLeak += ( it.first & 0x03ffffff ) * it.second;
}
}
app.DebugPrintf("Total %d\n",totalLeak);
@@ -1150,13 +1150,13 @@ void MemPixStuff()
int totals[MAX_SECT] = {0};
for(AUTO_VAR(it, allocCounts.begin()); it != allocCounts.end(); it++ )
for ( auto& it : allocCounts )
{
if(it->second > 0 )
if ( it.second > 0 )
{
int sect = ( it->first >> 26 ) & 0x3f;
int bytes = it->first & 0x03ffffff;
totals[sect] += bytes * it->second;
int sect = ( it.first >> 26 ) & 0x3f;
int bytes = it.first & 0x03ffffff;
totals[sect] += bytes * it.second;
}
}
@@ -28,43 +28,43 @@ DurangoLeaderboardManager::DurangoLeaderboardManager()
for(unsigned int difficulty = 0; difficulty < 4; ++difficulty)
{
m_leaderboardNames[difficulty][eStatsType_Travelling] = L"LeaderboardTravelling" + _toString(difficulty);
m_leaderboardNames[difficulty][eStatsType_Mining] = L"LeaderboardMining" + _toString(difficulty);
m_leaderboardNames[difficulty][eStatsType_Farming] = L"LeaderboardFarming" + _toString(difficulty);
m_leaderboardNames[difficulty][eStatsType_Kills] = L"LeaderboardKills" + _toString(difficulty);
m_leaderboardNames[difficulty][eStatsType_Travelling] = L"LeaderboardTravelling" + std::to_wstring(difficulty);
m_leaderboardNames[difficulty][eStatsType_Mining] = L"LeaderboardMining" + std::to_wstring(difficulty);
m_leaderboardNames[difficulty][eStatsType_Farming] = L"LeaderboardFarming" + std::to_wstring(difficulty);
m_leaderboardNames[difficulty][eStatsType_Kills] = L"LeaderboardKills" + std::to_wstring(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Travelling] = L"Leaderboard.LeaderboardId.0.DifficultyLevelId." + _toString(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Mining] = L"Leaderboard.LeaderboardId.1.DifficultyLevelId." + _toString(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Farming] = L"Leaderboard.LeaderboardId.2.DifficultyLevelId." + _toString(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Kills] = L"Leaderboard.LeaderboardId.3.DifficultyLevelId." + _toString(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Travelling] = L"Leaderboard.LeaderboardId.0.DifficultyLevelId." + std::to_wstring(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Mining] = L"Leaderboard.LeaderboardId.1.DifficultyLevelId." + std::to_wstring(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Farming] = L"Leaderboard.LeaderboardId.2.DifficultyLevelId." + std::to_wstring(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Kills] = L"Leaderboard.LeaderboardId.3.DifficultyLevelId." + std::to_wstring(difficulty);
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + _toString(difficulty) + L".TravelMethodId.0"); // Walked
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + _toString(difficulty) + L".TravelMethodId.2"); // Fallen
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + _toString(difficulty) + L".TravelMethodId.4"); // Minecart
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + _toString(difficulty) + L".TravelMethodId.5"); // Boat
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + std::to_wstring(difficulty) + L".TravelMethodId.0"); // Walked
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + std::to_wstring(difficulty) + L".TravelMethodId.2"); // Fallen
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + std::to_wstring(difficulty) + L".TravelMethodId.4"); // Minecart
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + std::to_wstring(difficulty) + L".TravelMethodId.5"); // Boat
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.3"); // Dirt
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.4"); // Cobblestone
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.12"); // Sand
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.1"); // Stone
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.13"); // Gravel
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.82"); // Clay
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.49"); // Obsidian
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.3"); // Dirt
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.4"); // Cobblestone
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.12"); // Sand
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.1"); // Stone
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.13"); // Gravel
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.82"); // Clay
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.49"); // Obsidian
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + _toString(difficulty) + L".AcquisitionMethodId.1.ItemId.344"); // Eggs
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.59"); // Wheat
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.39"); // Mushroom
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.83"); // Sugarcane
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + _toString(difficulty) + L".AcquisitionMethodId.2.ItemId.335"); // Milk
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + _toString(difficulty) + L".AcquisitionMethodId.1.ItemId.86"); // Pumpkin
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + std::to_wstring(difficulty) + L".AcquisitionMethodId.1.ItemId.344"); // Eggs
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.59"); // Wheat
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.39"); // Mushroom
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.83"); // Sugarcane
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + std::to_wstring(difficulty) + L".AcquisitionMethodId.2.ItemId.335"); // Milk
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + std::to_wstring(difficulty) + L".AcquisitionMethodId.1.ItemId.86"); // Pumpkin
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.54"); // Zombie
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.51"); // Skeleton
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.50"); // Creeper
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.52"); // Spider
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.49"); // Spider Jockey
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.57"); // Zombie Pigman
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.55"); // Slime
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.54"); // Zombie
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.51"); // Skeleton
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.50"); // Creeper
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.52"); // Spider
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.49"); // Spider Jockey
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.57"); // Zombie Pigman
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.55"); // Slime
}
}
@@ -1460,7 +1460,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
{
PlayerSyncData *pNewPlayer = &pNewSyncData->players[i];
bool bAlreadyExisted = false;
for( AUTO_VAR(it, tempPlayers.begin()); it != tempPlayers.end(); it++ )
for (auto it = tempPlayers.begin(); it != tempPlayers.end(); it++)
{
if( pNewPlayer->m_smallId == (*it)->GetSmallId() )
{
@@ -131,9 +131,8 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl
{
// Do we already have a primary player for this system?
bool systemHasPrimaryPlayer = false;
for(AUTO_VAR(it, m_machineDQRPrimaryPlayers.begin()); it < m_machineDQRPrimaryPlayers.end(); ++it)
for ( DQRNetworkPlayer *pQNetPrimaryPlayer : m_machineDQRPrimaryPlayers )
{
DQRNetworkPlayer *pQNetPrimaryPlayer = *it;
if( pDQRPlayer->IsSameSystem(pQNetPrimaryPlayer) )
{
systemHasPrimaryPlayer = true;
@@ -233,7 +232,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP
break;
}
}
AUTO_VAR(it, find( m_machineDQRPrimaryPlayers.begin(), m_machineDQRPrimaryPlayers.end(), pDQRPlayer));
auto it = find(m_machineDQRPrimaryPlayers.begin(), m_machineDQRPrimaryPlayers.end(), pDQRPlayer);
if( it != m_machineDQRPrimaryPlayers.end() )
{
m_machineDQRPrimaryPlayers.erase( it );
@@ -847,7 +846,7 @@ INetworkPlayer *CPlatformNetworkManagerDurango::addNetworkPlayer(DQRNetworkPlaye
void CPlatformNetworkManagerDurango::removeNetworkPlayer(DQRNetworkPlayer *pDQRPlayer)
{
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pDQRPlayer);
for( AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++ )
for (auto it = currentNetworkPlayers.begin(); it != currentNetworkPlayers.end(); ++it)
{
if( *it == pNetworkPlayer )
{
@@ -974,11 +974,11 @@ DurangoStats *CDurangoTelemetryManager::durangoStats()
wstring CDurangoTelemetryManager::guid2str(LPCGUID guid)
{
wstring out = L"GUID<";
out += _toString<unsigned long>(guid->Data1);
out += std::to_wstring(guid->Data1);
out += L":";
out += _toString<unsigned short>(guid->Data2);
out += std::to_wstring(guid->Data2);
out += L":";
out += _toString<unsigned short>(guid->Data3);
out += std::to_wstring(guid->Data3);
//out += L":";
//out += convStringToWstring(string((char*)&guid->Data4,8));
out += L">";

Some files were not shown because too many files have changed in this diff Show More