Remove AUTO_VAR macro and _toString function (#592)
This commit is contained in:
parent
7d6658fe5b
commit
55231bb8d3
18
.clang-tidy
Normal file
18
.clang-tidy
Normal 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
|
||||
...
|
||||
30
Minecraft.Client/.clangd
Normal file
30
Minecraft.Client/.clangd
Normal 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
|
||||
|
|
@ -52,12 +52,9 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
|||
glEnable(GL_RESCALE_NORMAL);
|
||||
|
||||
Slot *hoveredSlot = NULL;
|
||||
|
||||
AUTO_VAR(itEnd, menu->slots->end());
|
||||
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
|
||||
{
|
||||
Slot *slot = *it; //menu->slots->at(i);
|
||||
|
||||
for ( Slot *slot : *menu->slots )
|
||||
{
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -261,12 +261,10 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
|
|||
glDepthFunc(GL_LEQUAL);
|
||||
|
||||
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;
|
||||
|
|
@ -298,12 +296,9 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
|
|||
glDisable(GL_LIGHTING);
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
|
||||
itEnd = Achievements::achievements->end();
|
||||
for (AUTO_VAR(it, Achievements::achievements->begin()); it != itEnd; it++)
|
||||
{
|
||||
Achievement *ach = *it; //Achievements::achievements->at(i);
|
||||
|
||||
for ( Achievement *ach : *Achievements::achievements )
|
||||
{
|
||||
int x = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll;
|
||||
int y = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll;
|
||||
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "stdafx.h"
|
||||
#include "stdafx.h"
|
||||
#include "..\Minecraft.World\StringHelpers.h"
|
||||
#include "Textures.h"
|
||||
#include "..\Minecraft.World\ArrayWithLength.h"
|
||||
|
|
@ -46,7 +46,7 @@ void BufferedImage::ByteFlip4(unsigned int &data)
|
|||
}
|
||||
// Loads a bitmap into a buffered image - only currently supports the 2 types of 32-bit image that we've made so far
|
||||
// and determines which of these is which by the compression method. Compression method 3 is a 32-bit image with only
|
||||
// 24-bits used (ie no alpha channel) whereas method 0 is a full 32-bit image with a valid alpha channel.
|
||||
// 24-bits used (ie no alpha channel) whereas method 0 is a full 32-bit image with a valid alpha channel.
|
||||
BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
|
@ -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 )
|
||||
{
|
||||
|
|
@ -171,7 +171,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
|
|||
hr=RenderManager.LoadTextureData(pchTextureName,&ImageInfo,&data[l]);
|
||||
|
||||
|
||||
if(hr!=ERROR_SUCCESS)
|
||||
if(hr!=ERROR_SUCCESS)
|
||||
{
|
||||
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
||||
if( l == 0 )
|
||||
|
|
@ -179,7 +179,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
|
|||
app.FatalLoadError();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( l == 0 )
|
||||
{
|
||||
|
|
@ -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 )
|
||||
{
|
||||
|
|
@ -231,7 +231,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
|
|||
DLCFile *dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name);
|
||||
pbData = dlcFile->getData(dwBytes);
|
||||
if(pbData == NULL || dwBytes == 0)
|
||||
{
|
||||
{
|
||||
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
||||
if( l == 0 )
|
||||
{
|
||||
|
|
@ -245,7 +245,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
|
|||
hr=RenderManager.LoadTextureData(pbData,dwBytes,&ImageInfo,&data[l]);
|
||||
|
||||
|
||||
if(hr!=ERROR_SUCCESS)
|
||||
if(hr!=ERROR_SUCCESS)
|
||||
{
|
||||
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
||||
if( l == 0 )
|
||||
|
|
@ -253,7 +253,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
|
|||
app.FatalLoadError();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( l == 0 )
|
||||
{
|
||||
|
|
@ -276,7 +276,7 @@ BufferedImage::BufferedImage(BYTE *pbData, DWORD dwBytes)
|
|||
ZeroMemory(&ImageInfo,sizeof(D3DXIMAGE_INFO));
|
||||
HRESULT hr=RenderManager.LoadTextureData(pbData,dwBytes,&ImageInfo,&data[0]);
|
||||
|
||||
if(hr==ERROR_SUCCESS)
|
||||
if(hr==ERROR_SUCCESS)
|
||||
{
|
||||
width=ImageInfo.Width;
|
||||
height=ImageInfo.Height;
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ void Chunk::setPos(int x, int y, int z)
|
|||
{
|
||||
bb = shared_ptr<AABB>(AABB::newPermanent(-g, -g, -g, XZSIZE+g, SIZE+g, XZSIZE+g));
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// 4J MGH - bounds are relative to the position now, so the AABB will be setup already, either above, or from the tesselator bounds.
|
||||
// bb->set(-g, -g, -g, SIZE+g, SIZE+g, SIZE+g);
|
||||
|
|
@ -143,7 +143,7 @@ void Chunk::setPos(int x, int y, int z)
|
|||
|
||||
LeaveCriticalSection(&levelRenderer->m_csDirtyChunks);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Chunk::translateToPos()
|
||||
|
|
@ -176,7 +176,7 @@ void Chunk::makeCopyForRebuild(Chunk *source)
|
|||
this->clipChunk = NULL;
|
||||
this->id = source->id;
|
||||
this->globalRenderableTileEntities = source->globalRenderableTileEntities;
|
||||
this->globalRenderableTileEntities_cs = source->globalRenderableTileEntities_cs;
|
||||
this->globalRenderableTileEntities_cs = source->globalRenderableTileEntities_cs;
|
||||
}
|
||||
|
||||
void Chunk::rebuild()
|
||||
|
|
@ -189,7 +189,7 @@ void Chunk::rebuild()
|
|||
|
||||
// if (!dirty) return;
|
||||
PIXBeginNamedEvent(0,"Rebuild section A");
|
||||
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
Tesselator *t = Tesselator::getInstance();
|
||||
#else
|
||||
|
|
@ -226,7 +226,7 @@ void Chunk::rebuild()
|
|||
// Get the data for the level chunk that this render chunk is it (level chunk is 16 x 16 x 128,
|
||||
// render chunk is 16 x 16 x 16. We wouldn't have to actually get all of it if the data was ordered differently, but currently
|
||||
// it is ordered by x then z then y so just getting a small range of y out of it would involve getting the whole thing into
|
||||
// the cache anyway.
|
||||
// the cache anyway.
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
unsigned char *tileIds = GetTileIdsStorage();
|
||||
|
|
@ -240,9 +240,9 @@ void Chunk::rebuild()
|
|||
TileRenderer *tileRenderer = new TileRenderer(region, this->x, this->y, this->z, tileIds);
|
||||
|
||||
// AP - added a caching system for Chunk::rebuild to take advantage of
|
||||
// Basically we're storing of copy of the tileIDs array inside the region so that calls to Region::getTile can grab data
|
||||
// more quickly from this array rather than calling CompressedTileStorage. On the Vita the total thread time spent in
|
||||
// Region::getTile went from 20% to 4%.
|
||||
// Basically we're storing of copy of the tileIDs array inside the region so that calls to Region::getTile can grab data
|
||||
// more quickly from this array rather than calling CompressedTileStorage. On the Vita the total thread time spent in
|
||||
// Region::getTile went from 20% to 4%.
|
||||
#ifdef __PSVITA__
|
||||
int xc = x >> 4;
|
||||
int zc = z >> 4;
|
||||
|
|
@ -278,7 +278,7 @@ void Chunk::rebuild()
|
|||
if( yy == (Level::maxBuildHeight - 1) ) continue;
|
||||
if(( xx == 0 ) || ( xx == 15 )) continue;
|
||||
if(( zz == 0 ) || ( zz == 15 )) continue;
|
||||
|
||||
|
||||
// Establish whether this tile and its neighbours are all made of rock, dirt, unbreakable tiles, or have already
|
||||
// been determined to meet this criteria themselves and have a tile of 255 set.
|
||||
if( !( ( tileId == Tile::stone_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
|
||||
|
|
@ -340,7 +340,7 @@ void Chunk::rebuild()
|
|||
PIXBeginNamedEvent(0,"Rebuild section C");
|
||||
Tesselator::Bounds bounds; // 4J MGH - added
|
||||
{
|
||||
// this was the old default clip bounds for the chunk, set in Chunk::setPos.
|
||||
// this was the old default clip bounds for the chunk, set in Chunk::setPos.
|
||||
float g = 6.0f;
|
||||
bounds.boundingBox[0] = -g;
|
||||
bounds.boundingBox[1] = -g;
|
||||
|
|
@ -401,7 +401,7 @@ void Chunk::rebuild()
|
|||
t->begin();
|
||||
t->offset((float)(-this->x), (float)(-this->y), (float)(-this->z));
|
||||
}
|
||||
|
||||
|
||||
Tile *tile = Tile::tiles[tileId];
|
||||
if (currentLayer == 0 && tile->isEntityTile())
|
||||
{
|
||||
|
|
@ -468,7 +468,7 @@ void Chunk::rebuild()
|
|||
{
|
||||
levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY1);
|
||||
RenderManager.CBuffClear(lists + 1);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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));
|
||||
if( it != globalRenderableTileEntities->end() )
|
||||
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] ));
|
||||
if( it2 == it->second.end() )
|
||||
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));
|
||||
if( it != globalRenderableTileEntities->end() )
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -555,11 +554,11 @@ void Chunk::rebuild()
|
|||
oldTileEntities.removeAll(renderableTileEntities);
|
||||
globalRenderableTileEntities.removeAll(oldTileEntities);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
|
@ -680,13 +679,13 @@ void Chunk::rebuild_SPU()
|
|||
// Get the data for the level chunk that this render chunk is it (level chunk is 16 x 16 x 128,
|
||||
// render chunk is 16 x 16 x 16. We wouldn't have to actually get all of it if the data was ordered differently, but currently
|
||||
// it is ordered by x then z then y so just getting a small range of y out of it would involve getting the whole thing into
|
||||
// the cache anyway.
|
||||
// the cache anyway.
|
||||
ChunkRebuildData* pOutData = NULL;
|
||||
g_rebuildDataIn.buildForChunk(®ion, level, x0, y0, z0);
|
||||
|
||||
Tesselator::Bounds bounds;
|
||||
{
|
||||
// this was the old default clip bounds for the chunk, set in Chunk::setPos.
|
||||
// this was the old default clip bounds for the chunk, set in Chunk::setPos.
|
||||
float g = 6.0f;
|
||||
bounds.boundingBox[0] = -g;
|
||||
bounds.boundingBox[1] = -g;
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -875,11 +874,11 @@ void Chunk::rebuild_SPU()
|
|||
oldTileEntities.removeAll(renderableTileEntities);
|
||||
globalRenderableTileEntities.removeAll(oldTileEntities);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -168,9 +168,9 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
|||
PlayerUID OnlineXuid;
|
||||
ProfileManager.GetXUID(m_userIndex,&OnlineXuid,true); // online xuid
|
||||
MOJANG_DATA *pMojangData = NULL;
|
||||
|
||||
|
||||
if(!g_NetworkManager.IsLocalGame())
|
||||
{
|
||||
{
|
||||
pMojangData=app.GetMojangDataForXuid(OnlineXuid);
|
||||
}
|
||||
|
||||
|
|
@ -222,7 +222,7 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
|||
// check the file is not already in
|
||||
bRes=app.IsFileInMemoryTextures(wstr);
|
||||
if(!bRes)
|
||||
{
|
||||
{
|
||||
#ifdef _XBOX
|
||||
C4JStorage::ETMSStatus eTMSStatus;
|
||||
eTMSStatus=StorageManager.ReadTMSFile(iUserID,C4JStorage::eGlobalStorage_Title,C4JStorage::eTMS_FileType_Graphic,pMojangData->wchSkin,&pBuffer, &dwSize);
|
||||
|
|
@ -234,17 +234,17 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
|||
if(bRes)
|
||||
{
|
||||
app.AddMemoryTextureFile(wstr,pBuffer,dwSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// a cloak?
|
||||
if(pMojangData->wchCape[0]!=0L)
|
||||
{
|
||||
{
|
||||
wstring wstr=pMojangData->wchCape;
|
||||
// check the file is not already in
|
||||
bRes=app.IsFileInMemoryTextures(wstr);
|
||||
if(!bRes)
|
||||
{
|
||||
{
|
||||
#ifdef _XBOX
|
||||
C4JStorage::ETMSStatus eTMSStatus;
|
||||
eTMSStatus=StorageManager.ReadTMSFile(iUserID,C4JStorage::eGlobalStorage_Title,C4JStorage::eTMS_FileType_Graphic,pMojangData->wchCape,&pBuffer, &dwSize);
|
||||
|
|
@ -302,7 +302,7 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
|||
app.DebugPrintf("ClientConnection - DIFFICULTY --- %d\n",packet->difficulty);
|
||||
level->difficulty = packet->difficulty; // 4J Added
|
||||
level->isClientSide = true;
|
||||
minecraft->setLevel(level);
|
||||
minecraft->setLevel(level);
|
||||
}
|
||||
|
||||
minecraft->player->setPlayerIndex( packet->m_playerIndex );
|
||||
|
|
@ -362,7 +362,7 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
|||
// 4J Stu - At time of writing ProfileManager.GetGamertag() does not always return the correct name,
|
||||
// if sign-ins are turned off while the player signed in. Using the qnetPlayer instead.
|
||||
// need to have a level before create extra local player
|
||||
MultiPlayerLevel *levelpassedin=(MultiPlayerLevel *)level;
|
||||
MultiPlayerLevel *levelpassedin=(MultiPlayerLevel *)level;
|
||||
player = minecraft->createExtraLocalPlayer(m_userIndex, networkPlayer->GetOnlineName(), m_userIndex, packet->dimension, this,levelpassedin);
|
||||
|
||||
// need to have a player before the setlevel
|
||||
|
|
@ -384,7 +384,7 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
|||
player->setPlayerIndex( packet->m_playerIndex );
|
||||
player->setCustomSkin( app.GetPlayerSkinId(m_userIndex) );
|
||||
player->setCustomCape( app.GetPlayerCapeId(m_userIndex) );
|
||||
|
||||
|
||||
|
||||
BYTE networkSmallId = getSocket()->getSmallId();
|
||||
app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges);
|
||||
|
|
@ -396,21 +396,21 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
|||
|
||||
displayPrivilegeChanges(minecraft->localplayers[m_userIndex],startingPrivileges);
|
||||
}
|
||||
|
||||
|
||||
maxPlayers = packet->maxPlayers;
|
||||
|
||||
|
||||
// need to have a player before the setLocalCreativeMode
|
||||
shared_ptr<MultiplayerLocalPlayer> lastPlayer = minecraft->player;
|
||||
minecraft->player = minecraft->localplayers[m_userIndex];
|
||||
((MultiPlayerGameMode *)minecraft->localgameModes[m_userIndex])->setLocalMode(GameType::byId(packet->gameType));
|
||||
minecraft->player = lastPlayer;
|
||||
|
||||
|
||||
// make sure the UI offsets for this player are set correctly
|
||||
if(iUserID!=-1)
|
||||
{
|
||||
ui.UpdateSelectedItemPos(iUserID);
|
||||
}
|
||||
|
||||
|
||||
TelemetryManager->RecordLevelStart(m_userIndex, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->getLevel(packet->dimension)->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount());
|
||||
}
|
||||
|
||||
|
|
@ -448,7 +448,7 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (owner != NULL && owner->instanceof(eTYPE_PLAYER))
|
||||
{
|
||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(owner);
|
||||
|
|
@ -574,7 +574,7 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
|||
}
|
||||
packet->data = 0;
|
||||
}
|
||||
|
||||
|
||||
if (packet->type == AddEntityPacket::ARROW) e = shared_ptr<Entity>( new Arrow(level, x, y, z) );
|
||||
if (packet->type == AddEntityPacket::SNOWBALL) e = shared_ptr<Entity>( new Snowball(level, x, y, z) );
|
||||
if (packet->type == AddEntityPacket::THROWN_ENDERPEARL) e = shared_ptr<Entity>( new ThrownEnderpearl(level, x, y, z) );
|
||||
|
|
@ -620,22 +620,19 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
|||
e->yRotp = packet->yRot;
|
||||
e->xRotp = packet->xRot;
|
||||
|
||||
if (setRot)
|
||||
if (setRot)
|
||||
{
|
||||
e->yRot = 0.0f;
|
||||
e->xRot = 0.0f;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
(*it)->entityId += offs;
|
||||
//subEntities[i].entityId += offs;
|
||||
//System.out.println(subEntities[i].entityId);
|
||||
for ( auto it : *subEntities )
|
||||
{
|
||||
it->entityId += offs;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -685,10 +682,10 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
|||
}
|
||||
}
|
||||
|
||||
e->lerpMotion(packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0);
|
||||
e->lerpMotion(packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0);
|
||||
}
|
||||
|
||||
// 4J: Check our deferred entity link packets
|
||||
// 4J: Check our deferred entity link packets
|
||||
checkDeferredEntityLinkPackets(e->entityId);
|
||||
}
|
||||
}
|
||||
|
|
@ -839,7 +836,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
|||
player->setCustomSkin( packet->m_skinId );
|
||||
player->setCustomCape( packet->m_capeId );
|
||||
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges);
|
||||
|
||||
|
||||
if(!player->customTextureUrl.empty() && player->customTextureUrl.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl))
|
||||
{
|
||||
if( minecraft->addPendingClientTextureRequest(player->customTextureUrl) )
|
||||
|
|
@ -856,7 +853,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
|||
}
|
||||
|
||||
app.DebugPrintf("Custom skin for player %ls is %ls\n",player->name.c_str(),player->customTextureUrl.c_str());
|
||||
|
||||
|
||||
if(!player->customTextureUrl2.empty() && player->customTextureUrl2.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl2))
|
||||
{
|
||||
if( minecraft->addPendingClientTextureRequest(player->customTextureUrl2) )
|
||||
|
|
@ -1034,7 +1031,7 @@ void ClientConnection::handleMovePlayer(shared_ptr<MovePlayerPacket> packet)
|
|||
packet->yView = player->y;
|
||||
connection->send(packet);
|
||||
if (!started)
|
||||
{
|
||||
{
|
||||
|
||||
if(!g_NetworkManager.IsHost() )
|
||||
{
|
||||
|
|
@ -1050,7 +1047,7 @@ void ClientConnection::handleMovePlayer(shared_ptr<MovePlayerPacket> packet)
|
|||
|
||||
started = true;
|
||||
minecraft->setScreen(NULL);
|
||||
|
||||
|
||||
// Fix for #105852 - TU12: Content: Gameplay: Local splitscreen Players are spawned at incorrect places after re-joining previously saved and loaded "Mass Effect World".
|
||||
// Move this check from Minecraft::createExtraLocalPlayer
|
||||
// 4J-PB - can't call this when this function is called from the qnet thread (GetGameStarted will be false)
|
||||
|
|
@ -1124,7 +1121,7 @@ void ClientConnection::handleChunkTilesUpdate(shared_ptr<ChunkTilesUpdatePacket>
|
|||
// Don't bother setting this to dirty if it isn't going to visually change - we get a lot of
|
||||
// water changing from static to dynamic for instance
|
||||
if(!( ( ( prevTile == Tile::water_Id ) && ( tile == Tile::calmWater_Id ) ) ||
|
||||
( ( prevTile == Tile::calmWater_Id ) && ( tile == Tile::water_Id ) ) ||
|
||||
( ( prevTile == Tile::calmWater_Id ) && ( tile == Tile::water_Id ) ) ||
|
||||
( ( prevTile == Tile::lava_Id ) && ( tile == Tile::calmLava_Id ) ) ||
|
||||
( ( prevTile == Tile::calmLava_Id ) && ( tile == Tile::calmLava_Id ) ) ||
|
||||
( ( prevTile == Tile::calmLava_Id ) && ( tile == Tile::lava_Id ) ) ) )
|
||||
|
|
@ -1253,7 +1250,7 @@ void ClientConnection::handleDisconnect(shared_ptr<DisconnectPacket> packet)
|
|||
{
|
||||
connection->close(DisconnectPacket::eDisconnect_Kicked);
|
||||
done = true;
|
||||
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
pMinecraft->connectionDisconnected( m_userIndex , packet->reason );
|
||||
app.SetDisconnectReason( packet->reason );
|
||||
|
|
@ -1337,7 +1334,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr<TakeItemEntityPacket> pac
|
|||
|
||||
if (from != NULL)
|
||||
{
|
||||
// If this is a local player, then we only want to do processing for it if this connection is associated with the player it is for. In
|
||||
// If this is a local player, then we only want to do processing for it if this connection is associated with the player it is for. In
|
||||
// particular, we don't want to remove the item entity until we are processing it for the right connection, or else we won't have a valid
|
||||
// "from" reference if we've already removed the item for an earlier processed connection
|
||||
if( isLocalPlayer )
|
||||
|
|
@ -1422,7 +1419,7 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
|
|||
case ChatPacket::e_ChatBedMeSleep:
|
||||
message=app.GetString(IDS_TILE_BED_MESLEEP);
|
||||
break;
|
||||
case ChatPacket::e_ChatPlayerJoinedGame:
|
||||
case ChatPacket::e_ChatPlayerJoinedGame:
|
||||
message=app.GetString(IDS_PLAYER_JOINED);
|
||||
iPos=message.find(L"%s");
|
||||
message.replace(iPos,2,playerDisplayName);
|
||||
|
|
@ -1537,7 +1534,7 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
|
|||
replaceEntitySource = true;
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case ChatPacket::e_ChatDeathFellAccidentLadder:
|
||||
message=app.GetString(IDS_DEATH_FELL_ACCIDENT_LADDER);
|
||||
replacePlayer = true;
|
||||
|
|
@ -1702,7 +1699,7 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
|
|||
message=app.GetString(IDS_MAX_WOLVES_BRED);
|
||||
break;
|
||||
|
||||
// can't shear the mooshroom
|
||||
// can't shear the mooshroom
|
||||
case ChatPacket::e_ChatPlayerCantShearMooshroom:
|
||||
message=app.GetString(IDS_CANT_SHEAR_MOOSHROOM);
|
||||
break;
|
||||
|
|
@ -1710,16 +1707,16 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
|
|||
// Paintings/Item Frames
|
||||
case ChatPacket::e_ChatPlayerMaxHangingEntities:
|
||||
message=app.GetString(IDS_MAX_HANGINGENTITIES);
|
||||
break;
|
||||
break;
|
||||
// Enemy spawn eggs in peaceful
|
||||
case ChatPacket::e_ChatPlayerCantSpawnInPeaceful:
|
||||
message=app.GetString(IDS_CANT_SPAWN_IN_PEACEFUL);
|
||||
break;
|
||||
break;
|
||||
|
||||
// Enemy spawn eggs in peaceful
|
||||
case ChatPacket::e_ChatPlayerMaxBoats:
|
||||
message=app.GetString(IDS_MAX_BOATS);
|
||||
break;
|
||||
break;
|
||||
|
||||
case ChatPacket::e_ChatCommandTeleportSuccess:
|
||||
message=app.GetString(IDS_COMMAND_TELEPORT_SUCCESS);
|
||||
|
|
@ -1851,7 +1848,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
|||
BOOL isAtLeastOneFriend = g_NetworkManager.IsHost();
|
||||
BOOL isFriendsWithHost = TRUE;
|
||||
BOOL cantPlayContentRestricted = FALSE;
|
||||
|
||||
|
||||
if(!g_NetworkManager.IsHost())
|
||||
{
|
||||
// set the game host settings
|
||||
|
|
@ -1885,7 +1882,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
|||
}
|
||||
if( playerXuid != INVALID_XUID )
|
||||
{
|
||||
// Is this user friends with the host player?
|
||||
// Is this user friends with the host player?
|
||||
BOOL result;
|
||||
DWORD error;
|
||||
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
|
||||
|
|
@ -1915,7 +1912,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
|||
}
|
||||
if( playerXuid != INVALID_XUID )
|
||||
{
|
||||
// Is this user friends with the host player?
|
||||
// Is this user friends with the host player?
|
||||
BOOL result;
|
||||
DWORD error;
|
||||
error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
|
||||
|
|
@ -2030,7 +2027,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
|||
|
||||
if(m_userIndex == ProfileManager.GetPrimaryPad() )
|
||||
{
|
||||
// Is this user friends with the host player?
|
||||
// Is this user friends with the host player?
|
||||
bool isFriend = true;
|
||||
unsigned int friendCount = 0;
|
||||
#ifdef __PS3__
|
||||
|
|
@ -2060,7 +2057,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
|||
requestParam.offset = 0;
|
||||
requestParam.userInfo.userId = ProfileManager.getUserID(ProfileManager.GetPrimaryPad());
|
||||
|
||||
int ret = sce::Toolkit::NP::Friends::Interface::getFriendslist(&friendList, &requestParam, false);
|
||||
int ret = sce::Toolkit::NP::Friends::Interface::getFriendslist(&friendList, &requestParam, false);
|
||||
if( ret == 0 )
|
||||
{
|
||||
if( friendList.hasResult() )
|
||||
|
|
@ -2070,7 +2067,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
|||
}
|
||||
#endif
|
||||
if( ret == 0 )
|
||||
{
|
||||
{
|
||||
isFriend = false;
|
||||
SceNpId npid;
|
||||
for( unsigned int i = 0; i < friendCount; i++ )
|
||||
|
|
@ -2153,7 +2150,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
|||
isAtLeastOneFriend = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
app.DebugPrintf("ClientConnection::handlePreLogin: User has at least one friend? %s\n", isAtLeastOneFriend ? "Yes" : "No");
|
||||
|
|
@ -2195,8 +2192,8 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
|||
DisconnectPacket::eDisconnectReason reason = DisconnectPacket::eDisconnect_NoUGC_Remote;
|
||||
#else
|
||||
DisconnectPacket::eDisconnectReason reason = DisconnectPacket::eDisconnect_None;
|
||||
#endif
|
||||
if(m_userIndex == ProfileManager.GetPrimaryPad())
|
||||
#endif
|
||||
if(m_userIndex == ProfileManager.GetPrimaryPad())
|
||||
{
|
||||
if(!isFriendsWithHost) reason = DisconnectPacket::eDisconnect_NotFriendsWithHost;
|
||||
else if(!isAtLeastOneFriend) reason = DisconnectPacket::eDisconnect_NoFriendsInGame;
|
||||
|
|
@ -2208,7 +2205,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
|||
app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_ExitWorld,(void *)TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if(!isFriendsWithHost) reason = DisconnectPacket::eDisconnect_NotFriendsWithHost;
|
||||
else if(!canPlayLocal) reason = DisconnectPacket::eDisconnect_NoUGC_Single_Local;
|
||||
else if(cantPlayContentRestricted) reason = DisconnectPacket::eDisconnect_ContentRestricted_Single_Local;
|
||||
|
|
@ -2221,7 +2218,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
|||
|
||||
app.SetDisconnectReason( reason );
|
||||
|
||||
// 4J-PB - this locks up on the read and write threads not closing down, because they are trying to lock the incoming critsec when it's already locked by this thread
|
||||
// 4J-PB - this locks up on the read and write threads not closing down, because they are trying to lock the incoming critsec when it's already locked by this thread
|
||||
// Minecraft::GetInstance()->connectionDisconnected( m_userIndex , reason );
|
||||
// done = true;
|
||||
// connection->flush();
|
||||
|
|
@ -2278,7 +2275,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
|||
#endif
|
||||
|
||||
// On PS3, all non-signed in players (even guests) can get a useful offlineXUID
|
||||
#if !(defined __PS3__ || defined _DURANGO )
|
||||
#if !(defined __PS3__ || defined _DURANGO )
|
||||
if( !ProfileManager.IsGuest( m_userIndex ) )
|
||||
#endif
|
||||
{
|
||||
|
|
@ -2287,7 +2284,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
|||
}
|
||||
BOOL allAllowed, friendsAllowed;
|
||||
ProfileManager.AllowedPlayerCreatedContent(m_userIndex,true,&allAllowed,&friendsAllowed);
|
||||
send( shared_ptr<LoginPacket>( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE),
|
||||
send( shared_ptr<LoginPacket>( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE),
|
||||
packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), app.GetPlayerCapeId(m_userIndex), ProfileManager.IsGuest( m_userIndex ))));
|
||||
|
||||
if(!g_NetworkManager.IsHost() )
|
||||
|
|
@ -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)
|
||||
{
|
||||
//subEntities[i].entityId += offs;
|
||||
(*it)->entityId += offs;
|
||||
for (auto& it : *subEntities )
|
||||
{
|
||||
it->entityId += offs;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2438,7 +2433,7 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr<SetEntityLinkPacket> pa
|
|||
minecraft.gui.setOverlayMessage(I18n.get("mount.onboard", Options.getTranslatedKeyMessage(options.keySneak.key)), false);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
else if (packet->type == SetEntityLinkPacket::LEASH)
|
||||
{
|
||||
if ( (sourceEntity != NULL) && sourceEntity->instanceof(eTYPE_MOB) )
|
||||
|
|
@ -2508,7 +2503,7 @@ void ClientConnection::handleTexture(shared_ptr<TexturePacket> packet)
|
|||
wprintf(L"Client received request for custom texture %ls\n",packet->textureName.c_str());
|
||||
#endif
|
||||
PBYTE pbData=NULL;
|
||||
DWORD dwBytes=0;
|
||||
DWORD dwBytes=0;
|
||||
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
|
||||
|
||||
if(dwBytes!=0)
|
||||
|
|
@ -2540,7 +2535,7 @@ void ClientConnection::handleTextureAndGeometry(shared_ptr<TextureAndGeometryPac
|
|||
wprintf(L"Client received request for custom texture and geometry %ls\n",packet->textureName.c_str());
|
||||
#endif
|
||||
PBYTE pbData=NULL;
|
||||
DWORD dwBytes=0;
|
||||
DWORD dwBytes=0;
|
||||
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
|
||||
DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName);
|
||||
|
||||
|
|
@ -2574,9 +2569,9 @@ void ClientConnection::handleTextureAndGeometry(shared_ptr<TextureAndGeometryPac
|
|||
// Add the texture data
|
||||
app.AddMemoryTextureFile(packet->textureName,packet->pbData,packet->dwTextureBytes);
|
||||
// Add the geometry data
|
||||
if(packet->dwBoxC!=0)
|
||||
if(packet->dwBoxC!=0)
|
||||
{
|
||||
app.SetAdditionalSkinBoxes(packet->dwSkinID,packet->BoxDataA,packet->dwBoxC);
|
||||
app.SetAdditionalSkinBoxes(packet->dwSkinID,packet->BoxDataA,packet->dwBoxC);
|
||||
}
|
||||
// Add the anim override
|
||||
app.SetAnimOverrideBitmask(packet->dwSkinID,packet->uiAnimOverrideBitmask);
|
||||
|
|
@ -2622,7 +2617,7 @@ void ClientConnection::handleTextureChange(shared_ptr<TextureChangePacket> packe
|
|||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(!packet->path.empty() && packet->path.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(packet->path))
|
||||
{
|
||||
if( minecraft->addPendingClientTextureRequest(packet->path) )
|
||||
|
|
@ -2728,7 +2723,7 @@ void ClientConnection::handleRespawn(shared_ptr<RespawnPacket> packet)
|
|||
level->removeEntity( shared_ptr<Entity>(minecraft->localplayers[m_userIndex]) );
|
||||
|
||||
level = dimensionLevel;
|
||||
|
||||
|
||||
// Whilst calling setLevel, make sure that minecraft::player is set up to be correct for this
|
||||
// connection
|
||||
shared_ptr<MultiplayerLocalPlayer> lastPlayer = minecraft->player;
|
||||
|
|
@ -2737,7 +2732,7 @@ void ClientConnection::handleRespawn(shared_ptr<RespawnPacket> packet)
|
|||
minecraft->player = lastPlayer;
|
||||
|
||||
TelemetryManager->RecordLevelExit(m_userIndex, eSen_LevelExitStatus_Succeeded);
|
||||
|
||||
|
||||
//minecraft->player->dimension = packet->dimension;
|
||||
minecraft->localplayers[m_userIndex]->dimension = packet->dimension;
|
||||
//minecraft->setScreen(new ReceivingLevelScreen(this));
|
||||
|
|
@ -2788,12 +2783,12 @@ void ClientConnection::handleRespawn(shared_ptr<RespawnPacket> packet)
|
|||
{
|
||||
ui.NavigateToScene(m_userIndex, eUIScene_ConnectingProgress, param);
|
||||
}
|
||||
|
||||
|
||||
app.SetAction( m_userIndex, eAppAction_WaitForDimensionChangeComplete);
|
||||
}
|
||||
|
||||
//minecraft->respawnPlayer(minecraft->player->GetXboxPad(),true, packet->dimension);
|
||||
|
||||
|
||||
// Wrap respawnPlayer call up in code to set & restore the player/gamemode etc. as some things
|
||||
// in there assume that we are set up for the player that the respawn is coming in for
|
||||
int oldIndex = minecraft->getLocalPlayerIdx();
|
||||
|
|
@ -2818,7 +2813,7 @@ void ClientConnection::handleExplosion(shared_ptr<ExplodePacket> packet)
|
|||
MultiPlayerLevel *mpLevel = (MultiPlayerLevel *)minecraft->level;
|
||||
mpLevel->enableResetChanges(false);
|
||||
// 4J - now directly pass a pointer to the toBlow array in the packet rather than copying around
|
||||
e->finalizeExplosion(true, &packet->toBlow);
|
||||
e->finalizeExplosion(true, &packet->toBlow);
|
||||
mpLevel->enableResetChanges(true);
|
||||
PIXEndNamedEvent();
|
||||
PIXEndNamedEvent();
|
||||
|
|
@ -2864,7 +2859,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
|||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -2878,7 +2873,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
|||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -2892,7 +2887,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
|||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -2907,7 +2902,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
|||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -2922,7 +2917,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
|||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -2937,7 +2932,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
|||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -2949,7 +2944,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
|||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -2961,7 +2956,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
|||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -2975,7 +2970,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
|||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -2990,7 +2985,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
|||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -3002,7 +2997,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
|||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -3025,7 +3020,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
|||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -3037,7 +3032,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
|||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -3115,7 +3110,7 @@ void ClientConnection::handleContainerAck(shared_ptr<ContainerAckPacket> packet)
|
|||
void ClientConnection::handleContainerContent(shared_ptr<ContainerSetContentPacket> packet)
|
||||
{
|
||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[m_userIndex];
|
||||
if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY)
|
||||
if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY)
|
||||
{
|
||||
player->inventoryMenu->setAll(&packet->items);
|
||||
}
|
||||
|
|
@ -3195,7 +3190,7 @@ void ClientConnection::handleTileEntityData(shared_ptr<TileEntityDataPacket> pac
|
|||
else if (packet->type == TileEntityDataPacket::TYPE_BEACON && dynamic_pointer_cast<BeaconTileEntity>(te) != NULL)
|
||||
{
|
||||
dynamic_pointer_cast<BeaconTileEntity>(te)->load(packet->tag);
|
||||
}
|
||||
}
|
||||
else if (packet->type == TileEntityDataPacket::TYPE_SKULL && dynamic_pointer_cast<SkullTileEntity>(te) != NULL)
|
||||
{
|
||||
dynamic_pointer_cast<SkullTileEntity>(te)->load(packet->tag);
|
||||
|
|
@ -3273,7 +3268,7 @@ void ClientConnection::handleGameEvent(shared_ptr<GameEventPacket> gameEventPack
|
|||
else if (event == GameEventPacket::WIN_GAME)
|
||||
{
|
||||
ui.SetWinUserIndex( (BYTE)gameEventPacket->param );
|
||||
|
||||
|
||||
#ifdef _XBOX
|
||||
|
||||
// turn off the gamertags in splitscreen for the primary player, since they are about to be made fullscreen
|
||||
|
|
@ -3513,7 +3508,7 @@ void ClientConnection::displayPrivilegeChanges(shared_ptr<MultiplayerLocalPlayer
|
|||
case Player::ePlayerGamePrivilege_Invulnerable:
|
||||
if(privOn) message = app.GetString(IDS_PRIV_INVULNERABLE_TOGGLE_ON);
|
||||
else message = app.GetString(IDS_PRIV_INVULNERABLE_TOGGLE_OFF);
|
||||
break;
|
||||
break;
|
||||
case Player::ePlayerGamePrivilege_CanToggleInvisible:
|
||||
if(privOn) message = app.GetString(IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON);
|
||||
else message = app.GetString(IDS_PRIV_CAN_INVISIBLE_TOGGLE_OFF);
|
||||
|
|
@ -3587,7 +3582,7 @@ void ClientConnection::handleCustomPayload(shared_ptr<CustomPayloadPacket> custo
|
|||
UIScene_TradingMenu *screen = (UIScene_TradingMenu *)scene;
|
||||
trader = screen->getMerchant();
|
||||
#endif
|
||||
|
||||
|
||||
MerchantRecipeList *recipeList = MerchantRecipeList::createFromStream(&input);
|
||||
trader->overrideOffers(recipeList);
|
||||
}
|
||||
|
|
@ -3674,7 +3669,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E
|
|||
|
||||
DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack();
|
||||
if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
|
||||
{
|
||||
{
|
||||
// no upsell, we're about to quit
|
||||
MinecraftServer::getInstance()->setSaveOnExit( false );
|
||||
// flag a app action of exit game
|
||||
|
|
@ -3728,7 +3723,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E
|
|||
int ClientConnection::ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
// results switched for this dialog
|
||||
if(result==C4JStorage::EMessage_ResultDecline)
|
||||
if(result==C4JStorage::EMessage_ResultDecline)
|
||||
{
|
||||
//INT saveOrCheckpointId = 0;
|
||||
//bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId);
|
||||
|
|
@ -3747,7 +3742,7 @@ int ClientConnection::ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::
|
|||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
wstring ClientConnection::GetDisplayNameByGamertag(wstring gamertag)
|
||||
{
|
||||
#ifdef _DURANGO
|
||||
|
|
@ -3892,31 +3887,31 @@ void ClientConnection::handleUpdateAttributes(shared_ptr<UpdateAttributesPacket>
|
|||
if ( !entity->instanceof(eTYPE_LIVINGENTITY) )
|
||||
{
|
||||
// Entity is not a living entity!
|
||||
assert(0);
|
||||
assert(0);
|
||||
}
|
||||
|
||||
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)
|
||||
unordered_set<UpdateAttributesPacket::AttributeSnapshot *> attributeSnapshots = packet->getValues();
|
||||
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();
|
||||
|
||||
instance->setBaseValue(attribute->getBase());
|
||||
instance->removeModifiers();
|
||||
|
||||
unordered_set<AttributeModifier *> *modifiers = attribute->getModifiers();
|
||||
|
||||
for (AUTO_VAR(it2,modifiers->begin()); it2 != modifiers->end(); ++it2)
|
||||
{
|
||||
AttributeModifier* modifier = *it2;
|
||||
instance->addModifier(new AttributeModifier(modifier->getId(), modifier->getAmount(), modifier->getOperation() ) );
|
||||
if ( modifiers )
|
||||
{
|
||||
for ( AttributeModifier* modifier : *modifiers )
|
||||
{
|
||||
instance->addModifier(new AttributeModifier(modifier->getId(), modifier->getAmount(), modifier->getOperation()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1475,9 +1475,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 +5640,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 +5658,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 +5703,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 +5729,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 +5741,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 +5751,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 +5766,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 +5786,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 +5843,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 +5853,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 +6988,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 +7096,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 +7109,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 +7127,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 +7184,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 +7197,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 +7242,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 +7255,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 +7272,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 +7329,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 +7369,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 +7569,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 +7588,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 +7610,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 +8318,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 +8333,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 +8343,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 +8480,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 +8532,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 +8590,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 +8651,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 +8706,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 +8750,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 +8777,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 +8787,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 +8830,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 +8932,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 +8945,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,11 +9049,10 @@ 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;
|
||||
|
||||
delete pCurrent;
|
||||
if ( pCurrent )
|
||||
delete pCurrent;
|
||||
iPosition++;
|
||||
}
|
||||
m_DLCDownloadQueue.clear();
|
||||
|
|
@ -9100,11 +9074,10 @@ 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;
|
||||
|
||||
delete pCurrent;
|
||||
if ( pCurrent )
|
||||
delete pCurrent;
|
||||
iPosition++;
|
||||
}
|
||||
m_TMSPPDownloadQueue.clear();
|
||||
|
|
@ -9118,10 +9091,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 +9122,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 +9177,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 +9201,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 +9218,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 +9236,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 +9254,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 );
|
||||
|
|
|
|||
|
|
@ -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() )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ DLCManager::DLCManager()
|
|||
|
||||
DLCManager::~DLCManager()
|
||||
{
|
||||
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
|
||||
for ( DLCPack *pack : m_packs )
|
||||
{
|
||||
DLCPack *pack = *it;
|
||||
delete pack;
|
||||
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,10 +92,10 @@ 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;
|
||||
delete pack;
|
||||
if ( pack )
|
||||
delete pack;
|
||||
}
|
||||
|
||||
m_packs.clear();
|
||||
|
|
@ -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() )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 ¶m)
|
||||
{
|
||||
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)
|
||||
|
|
@ -50,7 +50,7 @@ bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item)
|
|||
{
|
||||
// 4J-JEV: Ripped code from enchantmenthelpers
|
||||
// Maybe we want to add an addEnchantment method to EnchantmentHelpers
|
||||
if (item->id == Item::enchantedBook_Id)
|
||||
if (item->id == Item::enchantedBook_Id)
|
||||
{
|
||||
Item::enchantedBook->addEnchantment( item, new EnchantmentInstance(m_enchantmentId, m_enchantmentLevel) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co
|
|||
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter rot=%d\n",m_rotation);
|
||||
}
|
||||
else if(attributeName.compare(L"dim") == 0)
|
||||
|
|
@ -160,7 +160,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk *
|
|||
{
|
||||
if( m_completed ) return;
|
||||
if(chunk->level->dimension->id != m_dimension) return;
|
||||
|
||||
|
||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition");
|
||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
|
|
@ -199,7 +199,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve
|
|||
{
|
||||
if( m_completed ) return;
|
||||
if(chunk->level->dimension->id != m_dimension) return;
|
||||
|
||||
|
||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)");
|
||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -44,9 +44,9 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
|||
|
||||
int icon = -1;
|
||||
int auxValue = 0;
|
||||
|
||||
|
||||
if(m_lastRuleStatusChanged != NULL)
|
||||
{
|
||||
{
|
||||
icon = m_lastRuleStatusChanged->getIcon();
|
||||
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
||||
m_lastRuleStatusChanged = 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)
|
||||
|
|
@ -40,7 +40,7 @@ GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGame
|
|||
rule = new UseTileRuleDefinition();
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_UpdatePlayerRule)
|
||||
{
|
||||
{
|
||||
rule = new UpdatePlayerRuleDefinition();
|
||||
}
|
||||
else
|
||||
|
|
@ -57,17 +57,17 @@ void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesI
|
|||
{
|
||||
GameRule *newRule = NULL;
|
||||
int i = 0;
|
||||
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
||||
for (auto& it : m_children )
|
||||
{
|
||||
newRule = new GameRule(*it, rule->getConnection() );
|
||||
(*it)->populateGameRule(type,newRule);
|
||||
newRule = new GameRule(it, rule->getConnection() );
|
||||
it->populateGameRule(type,newRule);
|
||||
|
||||
GameRule::ValueType value;
|
||||
value.gr = newRule;
|
||||
value.isPointer = true;
|
||||
|
||||
// Somehow add the newRule to the current rule
|
||||
rule->setParameter(L"rule" + _toString<int>(i),value);
|
||||
rule->setParameter(L"rule" + std::to_wstring(i),value);
|
||||
++i;
|
||||
}
|
||||
GameRuleDefinition::populateGameRule(type, rule);
|
||||
|
|
@ -76,14 +76,14 @@ void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesI
|
|||
bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int y, int z)
|
||||
{
|
||||
bool statusChanged = false;
|
||||
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
||||
for (auto& it : rule->m_parameters )
|
||||
{
|
||||
if(it->second.isPointer)
|
||||
if(it.second.isPointer)
|
||||
{
|
||||
bool changed = it->second.gr->getGameRuleDefinition()->onUseTile(it->second.gr,tileId,x,y,z);
|
||||
bool changed = it.second.gr->getGameRuleDefinition()->onUseTile(it.second.gr,tileId,x,y,z);
|
||||
if(!statusChanged && changed)
|
||||
{
|
||||
m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition();
|
||||
m_lastRuleStatusChanged = it.second.gr->getGameRuleDefinition();
|
||||
statusChanged = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -94,14 +94,14 @@ bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, in
|
|||
bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool statusChanged = false;
|
||||
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
||||
for (auto& it : rule->m_parameters )
|
||||
{
|
||||
if(it->second.isPointer)
|
||||
if(it.second.isPointer)
|
||||
{
|
||||
bool changed = it->second.gr->getGameRuleDefinition()->onCollectItem(it->second.gr,item);
|
||||
bool changed = it.second.gr->getGameRuleDefinition()->onCollectItem(it.second.gr,item);
|
||||
if(!statusChanged && changed)
|
||||
{
|
||||
m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition();
|
||||
{
|
||||
m_lastRuleStatusChanged = it.second.gr->getGameRuleDefinition();
|
||||
statusChanged = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -111,8 +111,8 @@ bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIn
|
|||
|
||||
void CompoundGameRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
||||
{
|
||||
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
||||
for (auto it : m_children )
|
||||
{
|
||||
(*it)->postProcessPlayer(player);
|
||||
it->postProcessPlayer(player);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,10 +17,10 @@ ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0)
|
|||
|
||||
void ConsoleGenerateStructure::getChildren(vector<GameRuleDefinition *> *children)
|
||||
{
|
||||
GameRuleDefinition::getChildren(children);
|
||||
|
||||
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); it++)
|
||||
children->push_back( *it );
|
||||
GameRuleDefinition::getChildren(children);
|
||||
|
||||
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,27 +117,24 @@ 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);
|
||||
}
|
||||
return boundingBox;
|
||||
}
|
||||
|
||||
bool ConsoleGenerateStructure::postProcess(Level *level, Random *random, BoundingBox *chunkBB)
|
||||
{
|
||||
{
|
||||
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,12 +1007,15 @@ 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;
|
||||
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1)
|
||||
for ( auto& it : chunk->tileEntities )
|
||||
{
|
||||
result->push_back(te);
|
||||
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;
|
||||
|
||||
dos->writeUTF( (*it).first );
|
||||
wstring pName = parameter.first;
|
||||
ValueType vType = parameter.second;
|
||||
|
||||
dos->writeUTF( parameter.first );
|
||||
dos->writeBoolean( vType.isPointer );
|
||||
|
||||
if (vType.isPointer)
|
||||
|
|
@ -80,7 +80,7 @@ void GameRule::read(DataInputStream *dis)
|
|||
for (int i = 0; i < savedParams; i++)
|
||||
{
|
||||
wstring pNames = dis->readUTF();
|
||||
|
||||
|
||||
ValueType vType = getParameter(pNames);
|
||||
|
||||
if (dis->readBoolean())
|
||||
|
|
|
|||
|
|
@ -18,15 +18,15 @@ void GameRuleDefinition::write(DataOutputStream *dos)
|
|||
ConsoleGameRules::write(dos, eType); // stringID
|
||||
|
||||
writeAttributes(dos, 0);
|
||||
|
||||
|
||||
// 4J-JEV: Get children.
|
||||
vector<GameRuleDefinition *> *children = new vector<GameRuleDefinition *>();
|
||||
getChildren( children );
|
||||
|
||||
// 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) {}
|
||||
|
|
@ -116,13 +116,13 @@ vector<GameRuleDefinition *> *GameRuleDefinition::enumerate()
|
|||
|
||||
unordered_map<GameRuleDefinition *, int> *GameRuleDefinition::enumerateMap()
|
||||
{
|
||||
unordered_map<GameRuleDefinition *, int> *out
|
||||
unordered_map<GameRuleDefinition *, int> *out
|
||||
= new unordered_map<GameRuleDefinition *, int>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ WCHAR *GameRuleManager::wchAttrNameA[] =
|
|||
L"spawnY", // eGameRuleAttr_spawnY
|
||||
L"spawnZ", // eGameRuleAttr_spawnZ
|
||||
L"orientation",
|
||||
L"dimension",
|
||||
L"dimension",
|
||||
L"topTileId", // eGameRuleAttr_topTileId
|
||||
L"biomeId", // eGameRuleAttr_biomeId
|
||||
L"feature", // eGameRuleAttr_feature
|
||||
|
|
@ -127,7 +127,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
|
|||
|
||||
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(pack);
|
||||
// = loadGameRules(dData, dSize); //, strings);
|
||||
|
||||
|
||||
createdLevelGenerationOptions->setGrSource( new JustGrSource() );
|
||||
createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_tutorial );
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
|
|||
app.DebugPrintf("\tversion=%d.\n", version);
|
||||
|
||||
for (int i = 0; i < 8; i++) dis.readByte();
|
||||
|
||||
|
||||
BYTE compression_type = dis.readByte();
|
||||
|
||||
app.DebugPrintf("\tcompressionType=%d.\n", compression_type);
|
||||
|
|
@ -174,11 +174,11 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
|
|||
decomp_len = dis.readInt();
|
||||
|
||||
app.DebugPrintf("\tcompr_len=%d.\n\tdecomp_len=%d.\n", compr_len, decomp_len);
|
||||
|
||||
|
||||
|
||||
// Decompress File Body
|
||||
|
||||
byteArray content(new BYTE[decomp_len], decomp_len),
|
||||
byteArray content(new BYTE[decomp_len], decomp_len),
|
||||
compr_content(new BYTE[compr_len], compr_len);
|
||||
dis.read(compr_content);
|
||||
|
||||
|
|
@ -251,7 +251,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
|||
// Initialise output stream.
|
||||
ByteArrayOutputStream baos;
|
||||
DataOutputStream dos(&baos);
|
||||
|
||||
|
||||
// Write header.
|
||||
|
||||
// VERSION NUMBER
|
||||
|
|
@ -279,7 +279,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
|||
compr_dos.writeInt( 0 ); // XmlObjects.length
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
StringTable *st = m_currentGameRuleDefinitions->getStringTable();
|
||||
|
||||
if (st == NULL)
|
||||
|
|
@ -311,9 +311,9 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
|||
dos.writeInt( compr_ba.length ); // Write length
|
||||
dos.writeInt( compr_baos.buf.length );
|
||||
dos.write(compr_ba);
|
||||
|
||||
|
||||
delete [] compr_ba.data;
|
||||
|
||||
|
||||
compr_dos.close();
|
||||
compr_baos.close();
|
||||
// -- END COMPRESSED -- //
|
||||
|
|
@ -323,7 +323,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
|||
*dOut = baos.buf.data;
|
||||
|
||||
baos.buf.data = NULL;
|
||||
|
||||
|
||||
dos.close(); baos.close();
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
|
|
@ -378,7 +377,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
|||
//DWORD dwLen = 0;
|
||||
//PBYTE pbData = dlcFile->getData(dwLen);
|
||||
//byteArray data(pbData,dwLen);
|
||||
|
||||
|
||||
byteArray data(dIn, dSize);
|
||||
ByteArrayInputStream bais(data);
|
||||
DataInputStream dis(&bais);
|
||||
|
|
@ -497,7 +496,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
|||
}
|
||||
}*/
|
||||
|
||||
// subfile
|
||||
// subfile
|
||||
UINT numFiles = contentDis->readInt();
|
||||
for (UINT i = 0; i < numFiles; i++)
|
||||
{
|
||||
|
|
@ -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;
|
||||
|
|
@ -565,10 +564,10 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
|||
|
||||
LevelGenerationOptions *GameRuleManager::readHeader(DLCGameRulesHeader *grh)
|
||||
{
|
||||
LevelGenerationOptions *out =
|
||||
LevelGenerationOptions *out =
|
||||
new LevelGenerationOptions();
|
||||
|
||||
|
||||
|
||||
out->setSrc(LevelGenerationOptions::eSrc_fromDLC);
|
||||
out->setGrSource(grh);
|
||||
addLevelGenerationOptions(out);
|
||||
|
|
@ -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
|
||||
|
|
@ -741,7 +728,7 @@ LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key)
|
|||
LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions *lgo)
|
||||
{
|
||||
vector<LevelGenerationOptions *> *lgs = m_levelGenerators.getLevelGenerators();
|
||||
|
||||
|
||||
for (int i = 0; i<lgs->size(); i++)
|
||||
if (lgs->at(i) == lgo)
|
||||
return i;
|
||||
|
|
@ -761,7 +748,7 @@ void GameRuleManager::unloadCurrentGameRules()
|
|||
if (m_currentLevelGenerationOptions->isFromSave())
|
||||
{
|
||||
m_levelGenerators.removeLevelGenerator( m_currentLevelGenerationOptions );
|
||||
|
||||
|
||||
delete m_currentLevelGenerationOptions;
|
||||
}
|
||||
else if (m_currentLevelGenerationOptions->isFromDLC())
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
|
|||
m_pbBaseSaveData = NULL;
|
||||
m_dwBaseSaveSize = 0;
|
||||
|
||||
m_parentDLCPack = parentPack;
|
||||
m_parentDLCPack = parentPack;
|
||||
m_bLoadingData = false;
|
||||
}
|
||||
|
||||
|
|
@ -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)
|
||||
|
|
@ -195,7 +203,7 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
|
|||
{
|
||||
if(attributeValue.compare(L"true") == 0) m_useFlatWorld = true;
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter flatworld=%s\n",m_useFlatWorld?"TRUE":"FALSE");
|
||||
}
|
||||
}
|
||||
else if(attributeName.compare(L"saveName") == 0)
|
||||
{
|
||||
wstring string(attributeValue);
|
||||
|
|
@ -218,7 +226,7 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
|
|||
app.DebugPrintf("LevelGenerationOptions: Adding parameter displayName=%ls\n", getDisplayName());
|
||||
}
|
||||
else if(attributeName.compare(L"texturePackId") == 0)
|
||||
{
|
||||
{
|
||||
setRequiredTexturePackId( _fromString<unsigned int>(attributeValue) );
|
||||
setRequiresTexturePack( true );
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter texturePackId=%0x\n", getRequiredTexturePackId());
|
||||
|
|
@ -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,17 +440,17 @@ 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
|
||||
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;
|
||||
return out;
|
||||
}
|
||||
|
||||
void LevelGenerationOptions::loadBaseSaveData()
|
||||
|
|
@ -472,7 +468,7 @@ void LevelGenerationOptions::loadBaseSaveData()
|
|||
{
|
||||
// corrupt DLC
|
||||
setLoadedData();
|
||||
app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n",mountIndex,ProfileManager.GetPrimaryPad());
|
||||
app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n",mountIndex,ProfileManager.GetPrimaryPad());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -604,7 +600,7 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
|||
}
|
||||
|
||||
}
|
||||
#ifdef _DURANGO
|
||||
#ifdef _DURANGO
|
||||
DWORD result = StorageManager.UnmountInstalledDLC(L"WPACK");
|
||||
#else
|
||||
DWORD result = StorageManager.UnmountInstalledDLC("WPACK");
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -651,7 +646,7 @@ bool LevelGenerationOptions::requiresTexturePack() { return info()->requiresText
|
|||
UINT LevelGenerationOptions::getRequiredTexturePackId() { return info()->getRequiredTexturePackId(); }
|
||||
|
||||
wstring LevelGenerationOptions::getDefaultSaveName()
|
||||
{
|
||||
{
|
||||
switch (getSrc())
|
||||
{
|
||||
case eSrc_fromSave: return getString( info()->getDefaultSaveName() );
|
||||
|
|
@ -661,7 +656,7 @@ wstring LevelGenerationOptions::getDefaultSaveName()
|
|||
return L"";
|
||||
}
|
||||
LPCWSTR LevelGenerationOptions::getWorldName()
|
||||
{
|
||||
{
|
||||
switch (getSrc())
|
||||
{
|
||||
case eSrc_fromSave: return getString( info()->getWorldName() );
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition()
|
|||
{
|
||||
m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;;
|
||||
m_health = 0;
|
||||
m_food = 0;
|
||||
m_food = 0;
|
||||
m_spawnPos = NULL;
|
||||
m_yRot = 0.0f;
|
||||
}
|
||||
|
||||
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,21 +14,21 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
// 4J-JEV: Super class handles attr-facing fine.
|
||||
//void XboxStructureActionPlaceContainer::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
|
||||
|
||||
|
||||
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)
|
||||
|
|
@ -79,15 +79,15 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
|
|||
|
||||
level->setTileAndData( worldX, worldY, worldZ, m_tile, 0, Tile::UPDATE_ALL );
|
||||
shared_ptr<Container> container = dynamic_pointer_cast<Container>(level->getTileEntity( worldX, worldY, worldZ ));
|
||||
|
||||
|
||||
app.DebugPrintf("XboxStructureActionPlaceContainer - placing a container at (%d,%d,%d)\n", worldX, worldY, worldZ);
|
||||
if ( container != NULL )
|
||||
{
|
||||
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;
|
||||
|
||||
addItem->addItemToContainer(container,slotId);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ void CGameNetworkManager::Initialise()
|
|||
#else
|
||||
s_pPlatformNetworkManager = new CPlatformNetworkManagerStub();
|
||||
#endif
|
||||
s_pPlatformNetworkManager->Initialise( this, flagIndexSize );
|
||||
s_pPlatformNetworkManager->Initialise( this, flagIndexSize );
|
||||
m_bNetworkThreadRunning = false;
|
||||
m_bInitialised = true;
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ void CGameNetworkManager::DoWork()
|
|||
if((g_NetworkManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1 && bConnected == false && g_NetworkManager.IsInSession() )
|
||||
{
|
||||
app.SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case XN_LIVE_INVITE_ACCEPTED:
|
||||
|
|
@ -162,7 +162,7 @@ bool CGameNetworkManager::_RunNetworkGame(LPVOID lpParameter)
|
|||
|
||||
success = s_pPlatformNetworkManager->_RunNetworkGame();
|
||||
if(!success)
|
||||
{
|
||||
{
|
||||
app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_ExitWorld,(void *)TRUE);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ bool CGameNetworkManager::_RunNetworkGame(LPVOID lpParameter)
|
|||
// Client needs QNET_STATE_GAME_PLAY so that IsInGameplay() returns true
|
||||
s_pPlatformNetworkManager->SetGamePlayState();
|
||||
}
|
||||
|
||||
|
||||
if( g_NetworkManager.IsLeavingGame() ) return false;
|
||||
|
||||
app.SetGameStarted(true);
|
||||
|
|
@ -199,7 +199,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
{
|
||||
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;
|
||||
seed = param->seed;
|
||||
|
||||
|
||||
app.setLevelGenerationOptions(param->levelGen);
|
||||
if(param->levelGen != NULL)
|
||||
{
|
||||
|
|
@ -305,7 +305,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
ServerReadyWait();
|
||||
ServerReadyDestroy();
|
||||
|
||||
if( MinecraftServer::serverHalted() )
|
||||
if( MinecraftServer::serverHalted() )
|
||||
return false;
|
||||
|
||||
// printf("Server ready to go!\n");
|
||||
|
|
@ -316,7 +316,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
}
|
||||
|
||||
#ifndef _XBOX
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
// Make sure that we have transitioned through any joining/creating stages and are actually playing the game, so that we know the players should be valid
|
||||
bool changedMessage = false;
|
||||
while(!IsReadyToPlayOrIdle())
|
||||
|
|
@ -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)
|
||||
{
|
||||
(*it)->tick();
|
||||
for (auto& it : createdConnections )
|
||||
{
|
||||
if ( it )
|
||||
it->tick();
|
||||
}
|
||||
|
||||
// 4J Stu - We were ticking this way too fast which could cause the connection to time out
|
||||
|
|
@ -522,8 +523,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
else
|
||||
{
|
||||
connection->close();
|
||||
AUTO_VAR(it, find( createdConnections.begin(), createdConnections.end(), connection ));
|
||||
if(it != createdConnections.end() ) createdConnections.erase( it );
|
||||
auto it = find(createdConnections.begin(), createdConnections.end(), connection);
|
||||
if(it != createdConnections.end() ) createdConnections.erase( it );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -536,12 +537,12 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(g_NetworkManager.IsLeavingGame() || !IsInSession() )
|
||||
{
|
||||
for(AUTO_VAR(it, createdConnections.begin()); it < createdConnections.end(); ++it)
|
||||
{
|
||||
(*it)->close();
|
||||
for (auto& it : createdConnections)
|
||||
{
|
||||
it->close();
|
||||
}
|
||||
// assert(false);
|
||||
MinecraftServer::HaltServer();
|
||||
|
|
@ -832,7 +833,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
|||
ProfileManager.SetPrimaryPad(iPad);
|
||||
|
||||
g_NetworkManager.SetLocalGame(false);
|
||||
|
||||
|
||||
// If the player was signed in before selecting play, we'll not have read the profile yet, so query the sign-in status to get this to happen
|
||||
ProfileManager.QuerySigninStatus();
|
||||
|
||||
|
|
@ -848,7 +849,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
|||
pInviteInfo ); // pInviteInfo
|
||||
if( !success )
|
||||
{
|
||||
app.DebugPrintf( "Failed joining game from invite\n" );
|
||||
app.DebugPrintf( "Failed joining game from invite\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -894,7 +895,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
|||
Compression::UseDefaultThreadStorage();
|
||||
Tile::CreateNewThreadStorage();
|
||||
IntCache::CreateNewThreadStorage();
|
||||
|
||||
|
||||
g_NetworkManager.m_bNetworkThreadRunning = true;
|
||||
bool success = g_NetworkManager._RunNetworkGame(lpParameter);
|
||||
g_NetworkManager.m_bNetworkThreadRunning = false;
|
||||
|
|
@ -906,7 +907,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
|||
Sleep(1);
|
||||
}
|
||||
ui.CleanUpSkinReload();
|
||||
if(app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None)
|
||||
if(app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None)
|
||||
{
|
||||
app.SetDisconnectReason( DisconnectPacket::eDisconnect_ConnectionCreationFailed );
|
||||
}
|
||||
|
|
@ -949,7 +950,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
|||
SetThreadName(-1, "Minecraft Server thread");
|
||||
AABB::CreateNewThreadStorage();
|
||||
Vec3::CreateNewThreadStorage();
|
||||
IntCache::CreateNewThreadStorage();
|
||||
IntCache::CreateNewThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
OldChunkStorage::UseDefaultThreadStorage();
|
||||
Entity::useSmallIds();
|
||||
|
|
@ -958,7 +959,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
|||
FireworksRecipe::CreateNewThreadStorage();
|
||||
|
||||
MinecraftServer::main(seed, lpParameter); //saveData, app.GetGameHostOption(eGameHostOption_All));
|
||||
|
||||
|
||||
Tile::ReleaseThreadStorage();
|
||||
AABB::ReleaseThreadStorage();
|
||||
Vec3::ReleaseThreadStorage();
|
||||
|
|
@ -1012,7 +1013,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam )
|
|||
// The pair of methods MustSignInReturned_0 & PSNSignInReturned_0 handle this
|
||||
int CGameNetworkManager::MustSignInReturned_0(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
#ifdef __PS3__
|
||||
SQRNetworkManager_PS3::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_0, pParam,true);
|
||||
|
|
@ -1072,7 +1073,7 @@ int CGameNetworkManager::PSNSignInReturned_0(void* pParam, bool bContinue, int i
|
|||
// The pair of methods MustSignInReturned_1 & PSNSignInReturned_1 handle this
|
||||
int CGameNetworkManager::MustSignInReturned_1(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
#ifdef __PS3__
|
||||
SQRNetworkManager_PS3::AttemptPSNSignIn(&CGameNetworkManager::PSNSignInReturned_1, pParam,true);
|
||||
|
|
@ -1104,7 +1105,7 @@ int CGameNetworkManager::PSNSignInReturned_1(void* pParam, bool bContinue, int i
|
|||
#elif defined __ORBIS__
|
||||
// TODO: No Orbis equivalent (should there be?)
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1129,7 +1130,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
Vec3::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
MinecraftServer *pServer = MinecraftServer::getInstance();
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
|
||||
|
|
@ -1168,7 +1169,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
pMinecraft->progressRenderer->progressStartNoAbort( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) );
|
||||
pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME );
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
pMinecraft->progressRenderer->progressStartNoAbort( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) );
|
||||
pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME );
|
||||
|
|
@ -1182,7 +1183,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
|
||||
// wait for the server to be in a non-ticking state
|
||||
pServer->m_serverPausedEvent->WaitForSignal(INFINITE);
|
||||
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
|
||||
// Swap these two messages around as one is too long to display at 480
|
||||
pMinecraft->progressRenderer->progressStartNoAbort( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME );
|
||||
|
|
@ -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);
|
||||
|
|
@ -1244,7 +1244,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
{
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
|
||||
// Reset this flag as the we don't need to know that we only lost the room only from this point onwards, the behaviour is exactly the same
|
||||
g_NetworkManager.m_bLastDisconnectWasLostRoomOnly = false;
|
||||
g_NetworkManager.m_bFullSessionMessageOnNextSessionChange = false;
|
||||
|
|
@ -1275,7 +1275,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
{
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
|
||||
// Restore the network player of all the server players that are local
|
||||
if( pServer != 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) );
|
||||
|
|
@ -1302,7 +1301,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
pMinecraft->m_pendingLocalConnections[index]->getConnection()->getSocket()->setPlayer(g_NetworkManager.GetLocalPlayerByUserIndex(index));
|
||||
}
|
||||
else if ( pMinecraft->m_connectionFailed[index] && (pMinecraft->m_connectionFailedReason[index] == DisconnectPacket::eDisconnect_ConnectionCreationFailed) )
|
||||
{
|
||||
{
|
||||
pMinecraft->removeLocalPlayerIdx(index);
|
||||
#ifdef _XBOX_ONE
|
||||
ProfileManager.RemoveGamepadFromGame(index);
|
||||
|
|
@ -1311,7 +1310,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pMinecraft->progressRenderer->progressStagePercentage(100);
|
||||
|
||||
#ifndef _XBOX
|
||||
|
|
@ -1333,7 +1332,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
#endif
|
||||
|
||||
// Start the game again
|
||||
app.SetGameStarted(true);
|
||||
app.SetGameStarted(true);
|
||||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_PauseServer,(void *)FALSE);
|
||||
app.SetChangingSessionType(false);
|
||||
app.SetReallyChangingSessionType(false);
|
||||
|
|
@ -1387,7 +1386,7 @@ void CGameNetworkManager::StateChange_AnyToJoining()
|
|||
app.DebugPrintf("Disabling Guest Signin\n");
|
||||
XEnableGuestSignin(FALSE);
|
||||
Minecraft::GetInstance()->clearPendingClientTextureRequests();
|
||||
|
||||
|
||||
ConnectionProgressParams *param = new ConnectionProgressParams();
|
||||
param->iPad = ProfileManager.GetPrimaryPad();
|
||||
param->stringId = -1;
|
||||
|
|
@ -1435,7 +1434,7 @@ void CGameNetworkManager::StateChange_AnyToStarting()
|
|||
completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes;
|
||||
completionData->iPad = ProfileManager.GetPrimaryPad();
|
||||
loadingParams->completionData = completionData;
|
||||
|
||||
|
||||
ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams);
|
||||
}
|
||||
}
|
||||
|
|
@ -1559,7 +1558,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer )
|
|||
bool multiplayer = g_NetworkManager.GetPlayerCount() > 1, localgame = g_NetworkManager.IsLocalGame();
|
||||
for (int iPad=0; iPad<XUSER_MAX_COUNT; ++iPad)
|
||||
{
|
||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
|
||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
|
||||
if (pNetworkPlayer == NULL) continue;
|
||||
|
||||
app.SetRichPresenceContext(iPad,CONTEXT_GAME_STATE_BLANK);
|
||||
|
|
@ -1584,7 +1583,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer )
|
|||
else
|
||||
{
|
||||
if( !pNetworkPlayer->IsHost() )
|
||||
{
|
||||
{
|
||||
for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if(Minecraft::GetInstance()->localplayers[idx] != NULL)
|
||||
|
|
@ -1640,7 +1639,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
}
|
||||
|
||||
// Need to check we're signed in to PSN
|
||||
bool isSignedInLive = true;
|
||||
bool isSignedInLive = true;
|
||||
bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable();
|
||||
int iPadNotSignedInLive = -1;
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; i++)
|
||||
|
|
@ -1680,7 +1679,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPadNotSignedInLive);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// Not signed in to PSN
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
|
||||
|
|
@ -1700,10 +1699,10 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
{
|
||||
m_pInviteInfo = (INVITE_INFO *) pInviteInfo;
|
||||
m_iPlayerInvited = userIndex;
|
||||
|
||||
|
||||
m_pUpsell = new PsPlusUpsellWrapper(index);
|
||||
m_pUpsell->displayUpsell();
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1723,9 +1722,9 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
// 4J-PB we shouldn't bring any inactive players into the game, except for the invited player (who may be an inactive player)
|
||||
// 4J Stu - If we are not in a game, then bring in all players signed in
|
||||
if(index==userIndex || pMinecraft->localplayers[index]!=NULL )
|
||||
{
|
||||
{
|
||||
++joiningUsers;
|
||||
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
|
||||
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
|
||||
localUsersMask |= GetLocalPlayerMask( index );
|
||||
}
|
||||
}
|
||||
|
|
@ -1742,7 +1741,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
|
||||
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_XBOX) || defined(__PS3__)
|
||||
if(joiningUsers > 1 && !RenderManager.IsHiDef() && userIndex != ProfileManager.GetPrimaryPad())
|
||||
{
|
||||
|
|
@ -1796,10 +1795,10 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
}
|
||||
#endif
|
||||
if( !g_NetworkManager.IsInSession() )
|
||||
{
|
||||
{
|
||||
#if defined (__PS3__) || defined (__PSVITA__)
|
||||
// PS3 is more complicated here - we need to make sure that the player is online. If they are then we can do the same as the xbox, if not we need to try and get them online and then, if they do sign in, go down the same path
|
||||
|
||||
|
||||
// Determine why they're not "signed in live"
|
||||
// MGH - On Vita we need to add a new message at some point for connecting when already signed in
|
||||
if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()))
|
||||
|
|
@ -1816,7 +1815,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
|||
|
||||
|
||||
#else
|
||||
HandleInviteWhenInMenus(userIndex, pInviteInfo);
|
||||
HandleInviteWhenInMenus(userIndex, pInviteInfo);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
|
@ -1856,7 +1855,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
|||
if(!ProfileManager.IsFullVersion())
|
||||
{
|
||||
// The marketplace will fail with the primary player set to -1
|
||||
ProfileManager.SetPrimaryPad(userIndex);
|
||||
ProfileManager.SetPrimaryPad(userIndex);
|
||||
|
||||
app.SetAction(userIndex,eAppAction_DashboardTrialJoinFromInvite);
|
||||
}
|
||||
|
|
@ -1900,7 +1899,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
|||
ProfileManager.QuerySigninStatus();
|
||||
|
||||
// 4J-PB - clear any previous connection errors
|
||||
Minecraft::GetInstance()->clearConnectionFailed();
|
||||
Minecraft::GetInstance()->clearConnectionFailed();
|
||||
|
||||
g_NetworkManager.SetLocalGame(false);
|
||||
|
||||
|
|
@ -1910,7 +1909,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
|||
bool success = g_NetworkManager.JoinGameFromInviteInfo( userIndex, localUsersMask, pInviteInfo );
|
||||
if( !success )
|
||||
{
|
||||
app.DebugPrintf( "Failed joining game from invite\n" );
|
||||
app.DebugPrintf( "Failed joining game from invite\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "stdafx.h"
|
||||
#include "stdafx.h"
|
||||
#include "..\..\..\Minecraft.World\Socket.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "PlatformNetworkManagerStub.h"
|
||||
|
|
@ -64,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)
|
||||
{
|
||||
IQNetPlayer *pQNetPrimaryPlayer = *it;
|
||||
for (auto& pQNetPrimaryPlayer : m_machineQNetPrimaryPlayers)
|
||||
{
|
||||
if( pQNetPlayer->IsSameSystem(pQNetPrimaryPlayer) )
|
||||
{
|
||||
systemHasPrimaryPlayer = true;
|
||||
|
|
@ -78,7 +77,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer )
|
|||
}
|
||||
}
|
||||
g_NetworkManager.PlayerJoining( networkPlayer );
|
||||
|
||||
|
||||
if( createFakeSocket == true && !m_bHostChanged )
|
||||
{
|
||||
g_NetworkManager.CreateSocket( networkPlayer, localPlayer );
|
||||
|
|
@ -98,7 +97,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer )
|
|||
// g_NetworkManager.UpdateAndSetGameSessionData();
|
||||
SystemFlagAddPlayer( networkPlayer );
|
||||
}
|
||||
|
||||
|
||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if(playerChangedCallback[idx] != NULL)
|
||||
|
|
@ -162,7 +161,7 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa
|
|||
{
|
||||
playerChangedCallback[ i ] = NULL;
|
||||
}
|
||||
|
||||
|
||||
m_bLeavingGame = false;
|
||||
m_bLeaveGameOnTick = false;
|
||||
m_bHostChanged = false;
|
||||
|
|
@ -318,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();
|
||||
|
|
@ -473,7 +472,7 @@ void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback(int iPad, void
|
|||
|
||||
void CPlatformNetworkManagerStub::HandleSignInChange()
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
bool CPlatformNetworkManagerStub::_RunNetworkGame()
|
||||
|
|
@ -500,24 +499,24 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame()
|
|||
void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/)
|
||||
{
|
||||
// DWORD playerCount = m_pIQNet->GetPlayerCount();
|
||||
//
|
||||
//
|
||||
// if( this->m_bLeavingGame )
|
||||
// return;
|
||||
//
|
||||
//
|
||||
// if( GetHostPlayer() == NULL )
|
||||
// return;
|
||||
//
|
||||
//
|
||||
// for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
|
||||
// {
|
||||
// if( i < playerCount )
|
||||
// {
|
||||
// INetworkPlayer *pNetworkPlayer = GetPlayerByIndex(i);
|
||||
//
|
||||
//
|
||||
// // We can call this from NotifyPlayerLeaving but at that point the player is still considered in the session
|
||||
// if( pNetworkPlayer != pNetworkPlayerLeaving )
|
||||
// {
|
||||
// m_hostGameSessionData.players[i] = ((NetworkPlayerXbox *)pNetworkPlayer)->GetUID();
|
||||
//
|
||||
//
|
||||
// char *temp;
|
||||
// temp = (char *)wstringtofilename( pNetworkPlayer->GetOnlineName() );
|
||||
// memcpy(m_hostGameSessionData.szPlayers[i],temp,XUSER_NAME_SIZE);
|
||||
|
|
@ -534,7 +533,7 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pN
|
|||
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// m_hostGameSessionData.hostPlayerUID = ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetXuid();
|
||||
// m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All);
|
||||
}
|
||||
|
|
@ -823,7 +822,7 @@ void CPlatformNetworkManagerStub::GetFullFriendSessionInfo( FriendSessionInfo *f
|
|||
void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh()
|
||||
{
|
||||
app.DebugPrintf("Resetting friends session search data\n");
|
||||
|
||||
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||
{
|
||||
m_searchResultsCount[i] = 0;
|
||||
|
|
@ -844,8 +843,8 @@ 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 )
|
||||
{
|
||||
currentNetworkPlayers.erase(it);
|
||||
|
|
@ -862,7 +861,7 @@ INetworkPlayer *CPlatformNetworkManagerStub::getNetworkPlayer(IQNetPlayer *pQNet
|
|||
|
||||
INetworkPlayer *CPlatformNetworkManagerStub::GetLocalPlayerByUserIndex(int userIndex )
|
||||
{
|
||||
return getNetworkPlayer(m_pIQNet->GetLocalPlayerByUserIndex(userIndex));
|
||||
return getNetworkPlayer(m_pIQNet->GetLocalPlayerByUserIndex(userIndex));
|
||||
}
|
||||
|
||||
INetworkPlayer *CPlatformNetworkManagerStub::GetPlayerByIndex(int playerIndex)
|
||||
|
|
|
|||
|
|
@ -7,21 +7,21 @@
|
|||
|
||||
CPlatformNetworkManagerSony *g_pPlatformNetworkManager;
|
||||
|
||||
bool CPlatformNetworkManagerSony::IsLocalGame()
|
||||
{
|
||||
return m_bIsOfflineGame;
|
||||
bool CPlatformNetworkManagerSony::IsLocalGame()
|
||||
{
|
||||
return m_bIsOfflineGame;
|
||||
}
|
||||
bool CPlatformNetworkManagerSony::IsPrivateGame()
|
||||
{
|
||||
return m_bIsPrivateGame;
|
||||
bool CPlatformNetworkManagerSony::IsPrivateGame()
|
||||
{
|
||||
return m_bIsPrivateGame;
|
||||
}
|
||||
bool CPlatformNetworkManagerSony::IsLeavingGame()
|
||||
{
|
||||
return m_bLeavingGame;
|
||||
bool CPlatformNetworkManagerSony::IsLeavingGame()
|
||||
{
|
||||
return m_bLeavingGame;
|
||||
}
|
||||
void CPlatformNetworkManagerSony::ResetLeavingGame()
|
||||
{
|
||||
m_bLeavingGame = false;
|
||||
void CPlatformNetworkManagerSony::ResetLeavingGame()
|
||||
{
|
||||
m_bLeavingGame = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -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;
|
||||
|
|
@ -202,7 +201,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer *
|
|||
}
|
||||
}
|
||||
g_NetworkManager.PlayerJoining( networkPlayer );
|
||||
|
||||
|
||||
if( createFakeSocket == true && !m_bHostChanged )
|
||||
{
|
||||
g_NetworkManager.CreateSocket( networkPlayer, localPlayer );
|
||||
|
|
@ -224,7 +223,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer *
|
|||
g_NetworkManager.UpdateAndSetGameSessionData();
|
||||
SystemFlagAddPlayer( networkPlayer );
|
||||
}
|
||||
|
||||
|
||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if(playerChangedCallback[idx] != NULL)
|
||||
|
|
@ -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 );
|
||||
|
|
@ -309,7 +308,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
|
|||
}
|
||||
|
||||
g_NetworkManager.PlayerLeaving( networkPlayer );
|
||||
|
||||
|
||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if(playerChangedCallback[idx] != NULL)
|
||||
|
|
@ -374,7 +373,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
|
|||
#ifdef __ORBIS__
|
||||
m_pSQRNet = new SQRNetworkManager_Orbis(this);
|
||||
m_pSQRNet->Initialise();
|
||||
#elif defined __PS3__
|
||||
#elif defined __PS3__
|
||||
m_pSQRNet = new SQRNetworkManager_PS3(this);
|
||||
m_pSQRNet->Initialise();
|
||||
#else // __PSVITA__
|
||||
|
|
@ -405,7 +404,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
|
|||
{
|
||||
playerChangedCallback[ i ] = NULL;
|
||||
}
|
||||
|
||||
|
||||
m_bLeavingGame = false;
|
||||
m_bLeaveGameOnTick = false;
|
||||
m_bHostChanged = false;
|
||||
|
|
@ -419,7 +418,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
|
|||
|
||||
m_searchResultsCount = 0;
|
||||
m_pSearchResults = NULL;
|
||||
|
||||
|
||||
m_lastSearchStartTime = 0;
|
||||
|
||||
// Success!
|
||||
|
|
@ -458,7 +457,7 @@ int CPlatformNetworkManagerSony::CorrectErrorIDS(int IDS)
|
|||
bool preferSignoutError = false;
|
||||
int state;
|
||||
|
||||
#if defined __PSVITA__ // MGH - to fix devtrack #6258
|
||||
#if defined __PSVITA__ // MGH - to fix devtrack #6258
|
||||
if(!ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad()))
|
||||
preferSignoutError = true;
|
||||
#elif defined __ORBIS__
|
||||
|
|
@ -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;
|
||||
|
|
@ -552,7 +550,7 @@ void CPlatformNetworkManagerSony::DoWork()
|
|||
m_notificationListener,
|
||||
0, // Any notification
|
||||
&dwNotifyId,
|
||||
&ulpNotifyParam)
|
||||
&ulpNotifyParam)
|
||||
)
|
||||
{
|
||||
|
||||
|
|
@ -650,7 +648,7 @@ bool CPlatformNetworkManagerSony::IsInStatsEnabledSession()
|
|||
DWORD dataSize = sizeof(QNET_LIVE_STATS_MODE);
|
||||
QNET_LIVE_STATS_MODE statsMode;
|
||||
m_pIQNet->GetOpt(QNET_OPTION_LIVE_STATS_MODE, &statsMode , &dataSize );
|
||||
|
||||
|
||||
// Use QNET_LIVE_STATS_MODE_AUTO if there is another way to check if stats are enabled or not
|
||||
bool statsEnabled = statsMode == QNET_LIVE_STATS_MODE_ENABLED;
|
||||
return m_pIQNet->GetState() != QNET_STATE_IDLE && statsEnabled;
|
||||
|
|
@ -732,7 +730,7 @@ bool CPlatformNetworkManagerSony::LeaveGame(bool bMigrateHost)
|
|||
|
||||
// If we are the host wait for the game server to end
|
||||
if(m_pSQRNet->IsHost() && g_NetworkManager.ServerStoppedValid())
|
||||
{
|
||||
{
|
||||
m_pSQRNet->EndGame();
|
||||
g_NetworkManager.ServerStoppedWait();
|
||||
g_NetworkManager.ServerStoppedDestroy();
|
||||
|
|
@ -887,7 +885,7 @@ void CPlatformNetworkManagerSony::UnRegisterPlayerChangedCallback(int iPad, void
|
|||
|
||||
void CPlatformNetworkManagerSony::HandleSignInChange()
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
bool CPlatformNetworkManagerSony::_RunNetworkGame()
|
||||
|
|
@ -930,7 +928,7 @@ void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pN
|
|||
{
|
||||
m_hostGameSessionData.hostPlayerUID.setForAdhoc();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All);
|
||||
|
||||
|
|
@ -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;
|
||||
|
|
@ -1224,7 +1222,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session
|
|||
else
|
||||
{
|
||||
swprintf(sessionInfo->displayLabel,app.GetString(IDS_GAME_HOST_NAME_UNKNOWN));
|
||||
}
|
||||
}
|
||||
sessionInfo->displayLabelLength = wcslen( sessionInfo->displayLabel );
|
||||
|
||||
// If this host wasn't disabled use this one.
|
||||
|
|
@ -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 )
|
||||
{
|
||||
|
|
@ -1301,7 +1299,7 @@ INetworkPlayer *CPlatformNetworkManagerSony::getNetworkPlayer(SQRNetworkPlayer *
|
|||
|
||||
INetworkPlayer *CPlatformNetworkManagerSony::GetLocalPlayerByUserIndex(int userIndex )
|
||||
{
|
||||
return getNetworkPlayer(m_pSQRNet->GetLocalPlayerByUserIndex(userIndex));
|
||||
return getNetworkPlayer(m_pSQRNet->GetLocalPlayerByUserIndex(userIndex));
|
||||
}
|
||||
|
||||
INetworkPlayer *CPlatformNetworkManagerSony::GetPlayerByIndex(int playerIndex)
|
||||
|
|
@ -1400,7 +1398,7 @@ bool CPlatformNetworkManagerSony::setAdhocMode( bool bAdhoc )
|
|||
{
|
||||
if(m_bUsingAdhocMode != bAdhoc)
|
||||
{
|
||||
m_bUsingAdhocMode = bAdhoc;
|
||||
m_bUsingAdhocMode = bAdhoc;
|
||||
if(m_bUsingAdhocMode)
|
||||
{
|
||||
// uninit the PSN, and init adhoc
|
||||
|
|
@ -1419,14 +1417,14 @@ bool CPlatformNetworkManagerSony::setAdhocMode( bool bAdhoc )
|
|||
else
|
||||
{
|
||||
if(m_pSQRNet_Vita_Adhoc->IsInitialised())
|
||||
{
|
||||
int ret = sceNetCtlAdhocDisconnect();
|
||||
{
|
||||
int ret = sceNetCtlAdhocDisconnect();
|
||||
// uninit the adhoc, and init psn
|
||||
m_pSQRNet_Vita_Adhoc->UnInitialise();
|
||||
}
|
||||
|
||||
if(m_pSQRNet_Vita->IsInitialised()==false)
|
||||
{
|
||||
{
|
||||
m_pSQRNet_Vita->Initialise();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ bool InfoTask::isCompleted()
|
|||
return false;
|
||||
|
||||
bool bAllComplete = true;
|
||||
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
// If the player is under water then allow all keypresses so they can jump out
|
||||
|
|
@ -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,8 +3,8 @@
|
|||
|
||||
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)
|
||||
{
|
||||
TutorialTask *task = *it;
|
||||
for (auto& task : m_taskSequence)
|
||||
{
|
||||
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())
|
||||
|
|
@ -99,11 +92,9 @@ bool ProcedureCompoundTask::isCompleted()
|
|||
|
||||
if(allCompleted)
|
||||
{
|
||||
//Disable all constraints
|
||||
itEnd = m_taskSequence.end();
|
||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
||||
// Disable all constraints
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails *other)
|
|||
|
||||
void Tutorial::staticCtor()
|
||||
{
|
||||
//
|
||||
//
|
||||
/*
|
||||
*****
|
||||
*****
|
||||
|
|
@ -72,7 +72,7 @@ void Tutorial::staticCtor()
|
|||
s_completableTasks.push_back( e_Tutorial_State_Enchanting );
|
||||
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Hold_To_Mine );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Tool_Damaged );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Tool_Damaged );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Swim_Up );
|
||||
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Unused_2 );
|
||||
|
|
@ -164,7 +164,7 @@ void Tutorial::staticCtor()
|
|||
s_completableTasks.push_back( e_Tutorial_Hint_Thin_Glass );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Melon );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Vine );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Fence_Gate );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Fence_Gate );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Mycel );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Water_Lily );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Nether_Brick );
|
||||
|
|
@ -319,7 +319,7 @@ void Tutorial::staticCtor()
|
|||
s_completableTasks.push_back( e_Tutorial_State_Enderchests );
|
||||
s_completableTasks.push_back( e_Tutorial_State_Horse_Menu );
|
||||
s_completableTasks.push_back( e_Tutorial_State_Hopper_Menu );
|
||||
|
||||
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Wither );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Witch );
|
||||
s_completableTasks.push_back( e_Tutorial_Hint_Bat );
|
||||
|
|
@ -470,7 +470,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
|
|||
if(!isHintCompleted(e_Tutorial_Hint_Detector_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Detector_Rail, this, detectorRailItems, 1 ) );
|
||||
|
||||
int tallGrassItems[] = {Tile::tallgrass_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_Tall_Grass))
|
||||
if(!isHintCompleted(e_Tutorial_Hint_Tall_Grass))
|
||||
{
|
||||
addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::DEAD_SHRUB ) );
|
||||
addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::TALL_GRASS ) );
|
||||
|
|
@ -753,46 +753,46 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
|
|||
|
||||
int potatoItems[] = {Tile::potatoes_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_Potato)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Potato, this, potatoItems, 1, -1, -1, 7 ) );
|
||||
|
||||
|
||||
int carrotItems[] = {Tile::carrots_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_Carrot)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Carrot, this, carrotItems, 1, -1, -1, 7 ) );
|
||||
|
||||
|
||||
int commandBlockItems[] = {Tile::commandBlock_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_CommandBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_CommandBlock, this, commandBlockItems, 1 ) );
|
||||
|
||||
|
||||
int beaconItems[] = {Tile::beacon_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_Beacon)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Beacon, this, beaconItems, 1 ) );
|
||||
|
||||
|
||||
int activatorRailItems[] = {Tile::activatorRail_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_Activator_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Activator_Rail, this, activatorRailItems, 1 ) );
|
||||
|
||||
|
||||
int redstoneBlockItems[] = {Tile::redstoneBlock_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_RedstoneBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_RedstoneBlock, this, redstoneBlockItems, 1 ) );
|
||||
|
||||
|
||||
int daylightDetectorItems[] = {Tile::daylightDetector_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_DaylightDetector)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_DaylightDetector, this, daylightDetectorItems, 1 ) );
|
||||
|
||||
|
||||
int dropperItems[] = {Tile::dropper_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_Dropper)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Dropper, this, dropperItems, 1 ) );
|
||||
|
||||
|
||||
int hopperItems[] = {Tile::hopper_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_Hopper)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Hopper, this, hopperItems, 1 ) );
|
||||
|
||||
|
||||
int comparatorItems[] = {Tile::comparator_off_Id, Tile::comparator_on_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_Comparator)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Comparator, this, comparatorItems, 2, Item::comparator_Id ) );
|
||||
|
||||
|
||||
int trappedChestItems[] = {Tile::chest_trap_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_ChestTrap)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_ChestTrap, this, trappedChestItems, 1 ) );
|
||||
|
||||
|
||||
int hayBlockItems[] = {Tile::hayBlock_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_HayBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_HayBlock, this, hayBlockItems, 1 ) );
|
||||
|
||||
|
||||
int clayHardenedItems[] = {Tile::clayHardened_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_ClayHardened)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_ClayHardened, this, clayHardenedItems, 1 ) );
|
||||
|
||||
|
||||
int clayHardenedColoredItems[] = {Tile::clayHardened_colored_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_ClayHardenedColored)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_ClayHardenedColored, this, clayHardenedColoredItems, 1 ) );
|
||||
|
||||
|
||||
int coalBlockItems[] = {Tile::coalBlock_Id};
|
||||
if(!isHintCompleted(e_Tutorial_Hint_CoalBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_CoalBlock, this, coalBlockItems, 1 ) );
|
||||
|
||||
|
|
@ -1000,9 +1000,9 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
|
|||
* HORSE ENCOUNTER
|
||||
*
|
||||
*/
|
||||
if(isFullTutorial || !isStateCompleted(e_Tutorial_State_Horse) )
|
||||
if(isFullTutorial || !isStateCompleted(e_Tutorial_State_Horse) )
|
||||
{
|
||||
addTask(e_Tutorial_State_Horse,
|
||||
addTask(e_Tutorial_State_Horse,
|
||||
new HorseChoiceTask(this, IDS_TUTORIAL_TASK_HORSE_OVERVIEW, IDS_TUTORIAL_TASK_DONKEY_OVERVIEW, IDS_TUTORIAL_TASK_MULE_OVERVIEW, IDS_TUTORIAL_PROMPT_HORSE_OVERVIEW,
|
||||
true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Horse) );
|
||||
|
||||
|
|
@ -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 )
|
||||
|
|
@ -1361,7 +1361,7 @@ void Tutorial::tick()
|
|||
}
|
||||
|
||||
if(!m_allowShow)
|
||||
{
|
||||
{
|
||||
if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
||||
{
|
||||
uiTempDisabled = true;
|
||||
|
|
@ -1397,7 +1397,7 @@ void Tutorial::tick()
|
|||
app.TutorialSceneNavigateBack(m_iPad);
|
||||
m_bSceneIsSplitscreen=app.GetLocalPlayerCount()>1;
|
||||
if(m_bSceneIsSplitscreen)
|
||||
{
|
||||
{
|
||||
app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup,(void *)this, false, false, &m_hTutorialScene);
|
||||
}
|
||||
else
|
||||
|
|
@ -1427,9 +1427,8 @@ void Tutorial::tick()
|
|||
}
|
||||
|
||||
// Check constraints
|
||||
for(AUTO_VAR(it, m_globalConstraints.begin()); it < m_globalConstraints.end(); ++it)
|
||||
{
|
||||
TutorialConstraint *constraint = *it;
|
||||
for (auto& constraint : m_globalConstraints)
|
||||
{
|
||||
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)
|
||||
{
|
||||
TutorialHint *hint = *it;
|
||||
for (auto& hint : hints[m_CurrentState])
|
||||
{
|
||||
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)
|
||||
{
|
||||
TutorialConstraint *constraint = *it;
|
||||
for (auto& constraint : constraints[m_CurrentState])
|
||||
{
|
||||
if( !constraint->isConstraintSatisfied(m_iPad) && constraint->isConstraintRestrictive(m_iPad) )
|
||||
{
|
||||
constraintChanged = true;
|
||||
|
|
@ -1484,15 +1481,15 @@ 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() )
|
||||
{
|
||||
isCurrentTask = false;
|
||||
if(
|
||||
( !task->ShowMinimumTime() || ( task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) )
|
||||
( !task->ShowMinimumTime() || ( task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) )
|
||||
&& task->isCompleted()
|
||||
)
|
||||
{
|
||||
|
|
@ -1509,8 +1506,8 @@ 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());
|
||||
while(itCon != constraintsToRemove[m_CurrentState].end() )
|
||||
auto itCon = constraintsToRemove[m_CurrentState].begin();
|
||||
while(itCon != constraintsToRemove[m_CurrentState].end() )
|
||||
{
|
||||
constraints[e_Tutorial_State_Gameplay].push_back(itCon->first);
|
||||
constraintsToRemove[e_Tutorial_State_Gameplay].push_back( pair<TutorialConstraint *, unsigned char>(itCon->first, itCon->second) );
|
||||
|
|
@ -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)
|
||||
{
|
||||
delete (*itRem);
|
||||
for (auto& itRem : activeTasks[m_CurrentState])
|
||||
{
|
||||
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 );
|
||||
|
|
@ -1636,7 +1633,7 @@ void Tutorial::tick()
|
|||
message->m_promptId = currentTask[m_CurrentState]->getPromptId();
|
||||
message->m_allowFade = currentTask[m_CurrentState]->AllowFade();
|
||||
setMessage( message );
|
||||
currentTask[m_CurrentState]->TaskReminders()? m_iTaskReminders = 1 : m_iTaskReminders = 0;
|
||||
currentTask[m_CurrentState]->TaskReminders()? m_iTaskReminders = 1 : m_iTaskReminders = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1697,8 +1694,8 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
|
|||
}
|
||||
else
|
||||
{
|
||||
AUTO_VAR(it, messages.find(message->m_messageId));
|
||||
if( it != messages.end() && it->second != NULL )
|
||||
auto it = messages.find(message->m_messageId);
|
||||
if( it != messages.end() && it->second != NULL )
|
||||
{
|
||||
TutorialMessage *messageString = it->second;
|
||||
text = wstring( messageString->getMessageForDisplay() );
|
||||
|
|
@ -1727,8 +1724,8 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
|
|||
}
|
||||
else if(message->m_promptId >= 0)
|
||||
{
|
||||
AUTO_VAR(it, messages.find(message->m_promptId));
|
||||
if(it != messages.end() && it->second != NULL)
|
||||
auto it = messages.find(message->m_promptId);
|
||||
if(it != messages.end() && it->second != NULL)
|
||||
{
|
||||
TutorialMessage *prompt = it->second;
|
||||
text.append( prompt->getMessageForDisplay() );
|
||||
|
|
@ -1781,7 +1778,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message)
|
|||
bool messageShown = false;
|
||||
DWORD time = GetTickCount();
|
||||
if(message != NULL && (message->m_forceDisplay || hintsOn) &&
|
||||
(!message->m_delay ||
|
||||
(!message->m_delay ||
|
||||
(
|
||||
(m_hintDisplayed && (time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime ) ||
|
||||
(!m_hintDisplayed && (time - lastMessageTime) > m_iTutorialMinimumDisplayMessageTime )
|
||||
|
|
@ -1793,7 +1790,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message)
|
|||
|
||||
if(messageShown)
|
||||
{
|
||||
m_lastHintDisplayedTime = time;
|
||||
m_lastHintDisplayedTime = time;
|
||||
m_hintDisplayed = true;
|
||||
if(hint!=NULL) setHintCompleted( hint );
|
||||
}
|
||||
|
|
@ -1817,7 +1814,7 @@ void Tutorial::showTutorialPopup(bool show)
|
|||
m_allowShow = show;
|
||||
|
||||
if(!show)
|
||||
{
|
||||
{
|
||||
if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
||||
{
|
||||
uiTempDisabled = true;
|
||||
|
|
@ -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,12 +2168,12 @@ 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 )
|
||||
{
|
||||
constraintsToRemove[m_CurrentState].erase( it );
|
||||
|
|
@ -2209,8 +2181,8 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa
|
|||
}
|
||||
}
|
||||
|
||||
AUTO_VAR(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) );
|
||||
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
|
||||
it = find( constraints[e_Tutorial_State_Gameplay].begin(), constraints[e_Tutorial_State_Gameplay].end(), c);
|
||||
|
|
@ -2271,7 +2243,7 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*=
|
|||
// The action that caused the change of state may also have completed the current task
|
||||
if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isCompleted() )
|
||||
{
|
||||
activeTasks[m_CurrentState].erase( find( activeTasks[m_CurrentState].begin(), activeTasks[m_CurrentState].end(), currentTask[m_CurrentState]) );
|
||||
activeTasks[m_CurrentState].erase( find( activeTasks[m_CurrentState].begin(), activeTasks[m_CurrentState].end(), currentTask[m_CurrentState]) );
|
||||
|
||||
if( activeTasks[m_CurrentState].size() > 0 )
|
||||
{
|
||||
|
|
@ -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)
|
||||
{
|
||||
TutorialTask *task = *it;
|
||||
for (auto& task : activeTasks[newState] )
|
||||
{
|
||||
task->onStateChange(newState);
|
||||
}
|
||||
m_CurrentState = newState;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "TutorialConstraints.h"
|
||||
#include "TutorialTask.h"
|
||||
|
||||
TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, vector<TutorialConstraint *> *inConstraints,
|
||||
TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, vector<TutorialConstraint *> *inConstraints,
|
||||
bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders)
|
||||
: tutorial( tutorial ), descriptionId( descriptionId ), m_promptId( -1 ), enablePreCompletion( enablePreCompletion ),
|
||||
areConstraintsEnabled( false ), bIsCompleted( false ), bHasBeenActivated( false ),
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ IUIScene_CraftingMenu::_eGroupTab IUIScene_CraftingMenu::m_GroupTabBkgMapping3x3
|
|||
// eBaseItemType_bow,
|
||||
// eBaseItemType_pockettool,
|
||||
// eBaseItemType_utensil,
|
||||
//
|
||||
//
|
||||
// }
|
||||
// eBaseItemType;
|
||||
|
||||
|
|
@ -180,11 +180,11 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
UpdateTooltips();
|
||||
break;
|
||||
case ACTION_MENU_PAUSEMENU:
|
||||
case ACTION_MENU_B:
|
||||
case ACTION_MENU_B:
|
||||
ui.ShowTooltip( iPad, eToolTipButtonX, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonB, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonA, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonA, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
|
||||
// kill the crafting xui
|
||||
//ui.PlayUISFX(eSFX_Back);
|
||||
ui.CloseUIScenes(iPad);
|
||||
|
|
@ -197,14 +197,14 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
#endif
|
||||
// Do some crafting!
|
||||
if(m_pPlayer && m_pPlayer->inventory)
|
||||
{
|
||||
{
|
||||
//RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
|
||||
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
||||
// Force a make if the debug is on
|
||||
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything))
|
||||
{
|
||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0)
|
||||
{
|
||||
{
|
||||
int iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
||||
|
||||
int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
|
||||
|
|
@ -256,7 +256,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
}
|
||||
}
|
||||
|
||||
if(pRecipeIngredientsRequired[iRecipe].bCanMake[iPad])
|
||||
if(pRecipeIngredientsRequired[iRecipe].bCanMake[iPad])
|
||||
{
|
||||
pTempItemInst->onCraftedBy(m_pPlayer->level, dynamic_pointer_cast<Player>( m_pPlayer->shared_from_this() ), pTempItemInst->count );
|
||||
// TODO 4J Stu - handleCraftItem should do a lot more than what it does, loads of the "can we craft" code should also probably be
|
||||
|
|
@ -340,7 +340,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
break;
|
||||
|
||||
case ACTION_MENU_LEFT_SCROLL:
|
||||
// turn off the old group tab
|
||||
// turn off the old group tab
|
||||
showTabHighlight(m_iGroupIndex,false);
|
||||
|
||||
if(m_iGroupIndex==0)
|
||||
|
|
@ -434,7 +434,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
// clear the indices
|
||||
iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1;
|
||||
iVSlotIndexA[1]=0;
|
||||
iVSlotIndexA[2]=1;
|
||||
iVSlotIndexA[2]=1;
|
||||
|
||||
UpdateVerticalSlots();
|
||||
UpdateHighlight();
|
||||
|
|
@ -485,13 +485,13 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
else
|
||||
{
|
||||
iVSlotIndexA[1]--;
|
||||
}
|
||||
}
|
||||
ui.PlayUISFX(eSFX_Focus);
|
||||
}
|
||||
else
|
||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>2)
|
||||
{
|
||||
{
|
||||
{
|
||||
if(m_iCurrentSlotVIndex!=0)
|
||||
{
|
||||
// just move the highlight
|
||||
|
|
@ -499,11 +499,11 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
ui.PlayUISFX(eSFX_Focus);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
//move the slots
|
||||
iVSlotIndexA[2]=iVSlotIndexA[1];
|
||||
iVSlotIndexA[1]=iVSlotIndexA[0];
|
||||
// on 0 and went up, so cycle the values
|
||||
// on 0 and went up, so cycle the values
|
||||
if(iVSlotIndexA[0]==0)
|
||||
{
|
||||
iVSlotIndexA[0]=CanBeMadeA[m_iCurrentSlotHIndex].iCount-1;
|
||||
|
|
@ -536,7 +536,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
|
||||
{
|
||||
if(bNoScrollSlots)
|
||||
{
|
||||
{
|
||||
if(iVSlotIndexA[1]==(CanBeMadeA[m_iCurrentSlotHIndex].iCount-1))
|
||||
{
|
||||
iVSlotIndexA[1]=0;
|
||||
|
|
@ -577,7 +577,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
{
|
||||
m_iCurrentSlotVIndex++;
|
||||
ui.PlayUISFX(eSFX_Focus);
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateVerticalSlots();
|
||||
UpdateHighlight();
|
||||
|
|
@ -621,9 +621,9 @@ 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
|
||||
// dump out the recipe products
|
||||
|
||||
// for (int i = 0; i < iRecipeC; i++)
|
||||
// {
|
||||
|
|
@ -631,7 +631,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
// if (pTempItemInst != NULL)
|
||||
// {
|
||||
// wstring itemstring=pTempItemInst->toString();
|
||||
//
|
||||
//
|
||||
// printf("Recipe [%d] = ",i);
|
||||
// OutputDebugStringW(itemstring.c_str());
|
||||
// if(pTempItemInst->id!=0)
|
||||
|
|
@ -645,7 +645,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
// {
|
||||
// printf("ID\t%d\tAux val\t%d\tBase type\t%d\tMaterial\t%d Count=%d\n",pTempItemInst->id, pTempItemInst->getAuxValue(),pTempItemInst->getItem()->getBaseItemType(),pTempItemInst->getItem()->getMaterial(),pTempItemInst->GetCount());
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
@ -686,9 +686,9 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
if (m_pPlayer->inventory->items[k] != NULL)
|
||||
{
|
||||
// do they have the ingredient, and the aux value matches, and enough off it?
|
||||
if((m_pPlayer->inventory->items[k]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) &&
|
||||
if((m_pPlayer->inventory->items[k]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) &&
|
||||
// check if the ingredient required doesn't care about the aux value, or if it does, does the inventory item aux match it
|
||||
((pRecipeIngredientsRequired[i].iIngAuxValA[j]==Recipes::ANY_AUX_VALUE) || (pRecipeIngredientsRequired[i].iIngAuxValA[j]==m_pPlayer->inventory->items[k]->getAuxValue()))
|
||||
((pRecipeIngredientsRequired[i].iIngAuxValA[j]==Recipes::ANY_AUX_VALUE) || (pRecipeIngredientsRequired[i].iIngAuxValA[j]==m_pPlayer->inventory->items[k]->getAuxValue()))
|
||||
)
|
||||
{
|
||||
// do they have enough? We need to check the whole inventory, since they may have enough in different slots (milk isn't milkx3, but milk,milk,milk)
|
||||
|
|
@ -724,18 +724,18 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
// 4J Stu - TU-1 hotfix
|
||||
// Fix for #13143 - Players are able to craft items they do not have enough ingredients for if they store the ingredients in multiple, smaller stacks
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if bFoundA[j] is false, then we didn't have enough of the ingredient required by the recipe, so mark the grid items we're short of
|
||||
if(bFoundA[j]==false)
|
||||
{
|
||||
{
|
||||
int iMissing = pRecipeIngredientsRequired[i].iIngValA[j]-iTotalCount;
|
||||
int iGridIndex=0;
|
||||
while(iMissing!=0)
|
||||
{
|
||||
// need to check if there is an aux val and match that
|
||||
if(((pRecipeIngredientsRequired[i].uiGridA[iGridIndex]&0x00FFFFFF)==pRecipeIngredientsRequired[i].iIngIDA[j]) &&
|
||||
if(((pRecipeIngredientsRequired[i].uiGridA[iGridIndex]&0x00FFFFFF)==pRecipeIngredientsRequired[i].iIngIDA[j]) &&
|
||||
((pRecipeIngredientsRequired[i].iIngAuxValA[j]==Recipes::ANY_AUX_VALUE) ||(pRecipeIngredientsRequired[i].iIngAuxValA[j]== ((pRecipeIngredientsRequired[i].uiGridA[iGridIndex]&0xFF000000)>>24))) )
|
||||
{
|
||||
// this grid entry is the ingredient we don't have enough of
|
||||
|
|
@ -780,7 +780,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
|
||||
// ignore for the misc base type - these have not been placed in a base type group
|
||||
if(iBaseType!=Item::eBaseItemType_undefined)
|
||||
{
|
||||
{
|
||||
for(int k=0;k<iHSlotBrushControl;k++)
|
||||
{
|
||||
// if the item base type is the same as one already in, then add it to that list
|
||||
|
|
@ -804,7 +804,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
if(!bFound)
|
||||
{
|
||||
if(iHSlotBrushControl<m_iCraftablesMaxHSlotC)
|
||||
{
|
||||
{
|
||||
// add to the list
|
||||
CanBeMadeA[iHSlotBrushControl].iItemBaseType=iBaseType;
|
||||
CanBeMadeA[iHSlotBrushControl].iRecipeA[CanBeMadeA[iHSlotBrushControl].iCount++]=i;
|
||||
|
|
@ -827,7 +827,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
}
|
||||
|
||||
delete [] bFoundA;
|
||||
itRecipe++;
|
||||
itRecipe++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -847,7 +847,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||
uiAlpha = 31;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if(pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].bCanMake[getPad()])
|
||||
{
|
||||
uiAlpha = 31;
|
||||
|
|
@ -936,10 +936,10 @@ void IUIScene_CraftingMenu::UpdateHighlight()
|
|||
{
|
||||
itemstring=app.GetString( IDS_ITEM_FIREBALLCOAL );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
itemstring=app.GetString(id );
|
||||
itemstring=app.GetString(id );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1004,7 +1004,7 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots()
|
|||
uiAlpha = 31;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if(pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].bCanMake[getPad()])
|
||||
{
|
||||
uiAlpha = 31;
|
||||
|
|
@ -1043,7 +1043,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||
hideAllIngredientsSlots();
|
||||
|
||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount!=0)
|
||||
{
|
||||
{
|
||||
int iSlot,iRecipy;
|
||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
|
||||
{
|
||||
|
|
@ -1135,13 +1135,13 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||
}
|
||||
|
||||
}
|
||||
for (int x = 0; x < iBoxWidth; x++)
|
||||
for (int x = 0; x < iBoxWidth; x++)
|
||||
{
|
||||
for (int y = 0; y < iBoxWidth; y++)
|
||||
for (int y = 0; y < iBoxWidth; y++)
|
||||
{
|
||||
int index = x+y*iBoxWidth;
|
||||
if(pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]!=0)
|
||||
{
|
||||
{
|
||||
int id=pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]&0x00FFFFFF;
|
||||
assert(id!=0);
|
||||
int iAuxVal=(pRecipeIngredientsRequired[iRecipy].uiGridA[x+y*3]&0xFF000000)>>24;
|
||||
|
|
@ -1164,7 +1164,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||
setIngredientSlotRedBox(index, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if((pRecipeIngredientsRequired[iRecipy].usBitmaskMissingGridIngredients[getPad()]&(1<<(x+y*3)))!=0)
|
||||
{
|
||||
setIngredientSlotRedBox(index, true);
|
||||
|
|
@ -1179,7 +1179,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||
{
|
||||
setIngredientSlotRedBox(index, false);
|
||||
setIngredientSlotItem(getPad(),index,nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1203,7 +1203,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||
{
|
||||
setIngredientSlotRedBox(i, false);
|
||||
setIngredientSlotItem(getPad(),i,nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1220,7 +1220,7 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade)
|
|||
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
||||
|
||||
if(bCanBeMade)
|
||||
{
|
||||
{
|
||||
int iSlot;//,iRecipy;
|
||||
if(CanBeMadeA[m_iCurrentSlotHIndex].iCount>1)
|
||||
{
|
||||
|
|
@ -1293,13 +1293,13 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade)
|
|||
#ifdef _DEBUG
|
||||
setDescriptionText(L"This is some placeholder description text about the craftable item.");
|
||||
#else
|
||||
setDescriptionText(L"");
|
||||
setDescriptionText(L"");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setDescriptionText(L"");
|
||||
setDescriptionText(L"");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1323,7 +1323,7 @@ void IUIScene_CraftingMenu::UpdateTooltips()
|
|||
{
|
||||
iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
iSlot=0;
|
||||
}
|
||||
|
|
@ -1363,7 +1363,7 @@ void IUIScene_CraftingMenu::UpdateTooltips()
|
|||
{
|
||||
iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
iSlot=0;
|
||||
}
|
||||
|
|
@ -1396,7 +1396,7 @@ bool IUIScene_CraftingMenu::isItemSelected(int itemId)
|
|||
{
|
||||
bool isSelected = false;
|
||||
if(m_pPlayer && m_pPlayer->inventory)
|
||||
{
|
||||
{
|
||||
//RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
|
||||
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM_AUX(Tile::treeTrunk_Id, 0)
|
||||
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::DARK_TRUNK)
|
||||
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::BIRCH_TRUNK)
|
||||
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::JUNGLE_TRUNK)
|
||||
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::JUNGLE_TRUNK)
|
||||
ITEM(Tile::gravel_Id)
|
||||
ITEM(Tile::redBrick_Id)
|
||||
ITEM(Tile::mossyCobblestone_Id)
|
||||
|
|
@ -144,7 +144,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Tile::sponge_Id)
|
||||
ITEM(Tile::melon_Id)
|
||||
ITEM(Tile::pumpkin_Id)
|
||||
ITEM(Tile::litPumpkin_Id)
|
||||
ITEM(Tile::litPumpkin_Id)
|
||||
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_DEFAULT)
|
||||
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_EVERGREEN)
|
||||
ITEM_AUX(Tile::sapling_Id, Sapling::TYPE_BIRCH)
|
||||
|
|
@ -321,7 +321,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Tile::anvil_Id);
|
||||
ITEM(Item::bed_Id)
|
||||
ITEM(Item::bucket_empty_Id)
|
||||
ITEM(Item::bucket_lava_Id)
|
||||
ITEM(Item::bucket_lava_Id)
|
||||
ITEM(Item::bucket_water_Id)
|
||||
ITEM(Item::bucket_milk_Id)
|
||||
ITEM(Item::cauldron_Id)
|
||||
|
|
@ -408,7 +408,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::beef_cooked_Id)
|
||||
ITEM(Item::beef_raw_Id)
|
||||
ITEM(Item::chicken_raw_Id)
|
||||
ITEM(Item::chicken_cooked_Id)
|
||||
ITEM(Item::chicken_cooked_Id)
|
||||
ITEM(Item::rotten_flesh_Id)
|
||||
ITEM(Item::spiderEye_Id)
|
||||
ITEM(Item::potato_Id)
|
||||
|
|
@ -430,7 +430,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::pickAxe_wood_Id)
|
||||
ITEM(Item::hatchet_wood_Id)
|
||||
ITEM(Item::hoe_wood_Id)
|
||||
|
||||
|
||||
ITEM(Item::emptyMap_Id)
|
||||
ITEM(Item::helmet_chain_Id)
|
||||
ITEM(Item::chestplate_chain_Id)
|
||||
|
|
@ -441,7 +441,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::pickAxe_stone_Id)
|
||||
ITEM(Item::hatchet_stone_Id)
|
||||
ITEM(Item::hoe_stone_Id)
|
||||
|
||||
|
||||
ITEM(Item::bow_Id)
|
||||
ITEM(Item::helmet_iron_Id)
|
||||
ITEM(Item::chestplate_iron_Id)
|
||||
|
|
@ -452,7 +452,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::pickAxe_iron_Id)
|
||||
ITEM(Item::hatchet_iron_Id)
|
||||
ITEM(Item::hoe_iron_Id)
|
||||
|
||||
|
||||
ITEM(Item::arrow_Id)
|
||||
ITEM(Item::helmet_gold_Id)
|
||||
ITEM(Item::chestplate_gold_Id)
|
||||
|
|
@ -514,7 +514,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::brick_Id)
|
||||
ITEM(Item::netherbrick_Id)
|
||||
ITEM(Item::stick_Id)
|
||||
ITEM(Item::bowl_Id)
|
||||
ITEM(Item::bowl_Id)
|
||||
ITEM(Item::bone_Id)
|
||||
ITEM(Item::string_Id)
|
||||
ITEM(Item::feather_Id)
|
||||
|
|
@ -523,13 +523,13 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::gunpowder_Id)
|
||||
ITEM(Item::clay_Id)
|
||||
ITEM(Item::yellowDust_Id)
|
||||
ITEM(Item::seeds_wheat_Id)
|
||||
ITEM(Item::seeds_wheat_Id)
|
||||
ITEM(Item::seeds_melon_Id)
|
||||
ITEM(Item::seeds_pumpkin_Id)
|
||||
ITEM(Item::wheat_Id)
|
||||
ITEM(Item::reeds_Id)
|
||||
ITEM(Item::egg_Id)
|
||||
ITEM(Item::sugar_Id)
|
||||
ITEM(Item::sugar_Id)
|
||||
ITEM(Item::slimeBall_Id)
|
||||
ITEM(Item::blazeRod_Id)
|
||||
ITEM(Item::goldNugget_Id)
|
||||
|
|
@ -562,7 +562,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
ITEM(Item::magmaCream_Id)
|
||||
ITEM(Item::speckledMelon_Id)
|
||||
ITEM(Item::glassBottle_Id)
|
||||
ITEM_AUX(Item::potion_Id,0) // Water bottle
|
||||
ITEM_AUX(Item::potion_Id,0) // Water bottle
|
||||
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_TYPE_AWKWARD)) // Awkward Potion
|
||||
|
||||
|
||||
|
|
@ -594,7 +594,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INSTANTHEALTH))
|
||||
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_NIGHTVISION))
|
||||
//ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_INVISIBILITY))
|
||||
|
||||
|
||||
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_WEAKNESS))
|
||||
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, MASK_LEVEL2, MASK_STRENGTH))
|
||||
ITEM_AUX(Item::potion_Id,MACRO_MAKEPOTION_AUXVAL(0, 0, MASK_SLOWNESS))
|
||||
|
|
@ -669,7 +669,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
|||
// Top Row
|
||||
ECreative_Inventory_Groups blocksGroup[] = {eCreativeInventory_BuildingBlocks};
|
||||
specs[eCreativeInventoryTab_BuildingBlocks] = new TabSpec(L"Structures", IDS_GROUPNAME_BUILDING_BLOCKS, 1, blocksGroup);
|
||||
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
ECreative_Inventory_Groups decorationsGroup[] = {eCreativeInventory_Decoration};
|
||||
ECreative_Inventory_Groups debugDecorationsGroup[] = {eCreativeInventory_ArtToolsDecorations};
|
||||
|
|
@ -720,7 +720,7 @@ IUIScene_CreativeMenu::IUIScene_CreativeMenu()
|
|||
m_creativeSlotX = m_creativeSlotY = m_inventorySlotX = m_inventorySlotY = 0;
|
||||
|
||||
// 4J JEV - Settup Tabs
|
||||
for (int i = 0; i < eCreativeInventoryTab_COUNT; i++)
|
||||
for (int i = 0; i < eCreativeInventoryTab_COUNT; i++)
|
||||
{
|
||||
m_tabDynamicPos[i] = 0;
|
||||
m_tabPage[i] = 0;
|
||||
|
|
@ -735,7 +735,7 @@ void IUIScene_CreativeMenu::switchTab(ECreativeInventoryTabs tab)
|
|||
if(tab != m_curTab) updateTabHighlightAndText(tab);
|
||||
|
||||
m_curTab = tab;
|
||||
|
||||
|
||||
updateScrollCurrentPage(m_tabPage[m_curTab] + 1, specs[m_curTab]->getPageCount());
|
||||
|
||||
specs[tab]->populateMenu(itemPickerMenu,m_tabDynamicPos[m_curTab], m_tabPage[m_curTab]);
|
||||
|
|
@ -769,7 +769,7 @@ void IUIScene_CreativeMenu::ScrollBar(UIVec2D pointerPos)
|
|||
IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups, int debugGroupsCount /*= 0*/, ECreative_Inventory_Groups *debugGroups /*= NULL*/)
|
||||
: m_icon(icon), m_descriptionId(descriptionId), m_staticGroupsCount(staticGroupsCount), m_dynamicGroupsCount(dynamicGroupsCount), m_debugGroupsCount(debugGroupsCount)
|
||||
{
|
||||
|
||||
|
||||
m_pages = 0;
|
||||
m_staticGroupsA = NULL;
|
||||
|
||||
|
|
@ -828,8 +828,8 @@ 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 );
|
||||
}
|
||||
|
|
@ -953,7 +953,7 @@ unsigned int IUIScene_CreativeMenu::TabSpec::getPageCount()
|
|||
IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr<SimpleContainer> smp, shared_ptr<Inventory> inv ) : AbstractContainerMenu()
|
||||
{
|
||||
inventory = inv;
|
||||
creativeContainer = smp;
|
||||
creativeContainer = smp;
|
||||
|
||||
//int startLength = slots->size();
|
||||
|
||||
|
|
@ -994,7 +994,7 @@ IUIScene_AbstractContainerMenu::ESceneSection IUIScene_CreativeMenu::GetSectionA
|
|||
switch( eSection )
|
||||
{
|
||||
case eSectionInventoryCreativeSelector:
|
||||
if (eTapDirection == eTapStateDown || eTapDirection == eTapStateUp)
|
||||
if (eTapDirection == eTapStateDown || eTapDirection == eTapStateUp)
|
||||
{
|
||||
newSection = eSectionInventoryCreativeUsing;
|
||||
}
|
||||
|
|
@ -1081,7 +1081,7 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction)
|
|||
dir = -1;
|
||||
// Fall through intentional
|
||||
case ACTION_MENU_RIGHT_SCROLL:
|
||||
{
|
||||
{
|
||||
ECreativeInventoryTabs tab = (ECreativeInventoryTabs)(m_curTab + dir);
|
||||
if (tab < 0) tab = (ECreativeInventoryTabs)(eCreativeInventoryTab_COUNT - 1);
|
||||
if (tab >= eCreativeInventoryTab_COUNT) tab = eCreativeInventoryTab_BuildingBlocks;
|
||||
|
|
@ -1375,7 +1375,7 @@ void IUIScene_CreativeMenu::BuildFirework(vector<shared_ptr<ItemInstance> > *lis
|
|||
itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag);
|
||||
|
||||
firework->setTag(itemTag);
|
||||
}
|
||||
}
|
||||
|
||||
list->push_back(firework);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||
|
||||
switch(iAction)
|
||||
{
|
||||
case ACTION_MENU_B:
|
||||
case ACTION_MENU_B:
|
||||
ui.ShowTooltip( iPad, eToolTipButtonX, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonB, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonA, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonA, false );
|
||||
ui.ShowTooltip( iPad, eToolTipButtonRB, false );
|
||||
// kill the crafting xui
|
||||
//ui.PlayUISFX(eSFX_Back);
|
||||
ui.CloseUIScenes(iPad);
|
||||
|
|
@ -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 <EFBFBD>Enchanted Books<6B> 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;
|
||||
}
|
||||
|
|
@ -249,7 +248,7 @@ void IUIScene_TradingMenu::updateDisplay()
|
|||
|
||||
vector<HtmlString> *offerDescription = GetItemDescription(activeRecipe->getSellItem());
|
||||
setOfferDescription(offerDescription);
|
||||
|
||||
|
||||
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
|
||||
shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
|
||||
|
||||
|
|
@ -307,7 +306,7 @@ void IUIScene_TradingMenu::updateDisplay()
|
|||
setRequest1RedBox(false);
|
||||
setRequest2RedBox(false);
|
||||
setRequest1Item(nullptr);
|
||||
setRequest2Item(nullptr);
|
||||
setRequest2Item(nullptr);
|
||||
vector<HtmlString> offerDescription;
|
||||
setOfferDescription(&offerDescription);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ bool UIControl_EnchantmentButton::setupControl(UIScene *scene, IggyValuePath *pa
|
|||
UIControl::setControlType(UIControl::eEnchantmentButton);
|
||||
bool success = UIControl_Button::setupControl(scene,parent,controlName);
|
||||
|
||||
//Button specific initialisers
|
||||
//Button specific initialisers
|
||||
m_funcChangeState = registerFastName(L"ChangeState");
|
||||
|
||||
return success;
|
||||
|
|
@ -40,7 +40,7 @@ void UIControl_EnchantmentButton::ReInit()
|
|||
{
|
||||
UIControl_Button::ReInit();
|
||||
|
||||
|
||||
|
||||
m_lastState = eState_Inactive;
|
||||
m_lastCost = 0;
|
||||
m_bHasFocus = false;
|
||||
|
|
@ -54,10 +54,10 @@ void UIControl_EnchantmentButton::tick()
|
|||
}
|
||||
|
||||
void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region)
|
||||
{
|
||||
{
|
||||
UIScene_EnchantingMenu *enchantingScene = (UIScene_EnchantingMenu *)m_parentScene;
|
||||
EnchantmentMenu *menu = enchantingScene->getMenu();
|
||||
|
||||
|
||||
float width = region->x1 - region->x0;
|
||||
float height = region->y1 - region->y0;
|
||||
float xo = width/2;
|
||||
|
|
@ -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;
|
||||
|
|
@ -143,7 +143,7 @@ void UIControl_EnchantmentButton::updateState()
|
|||
EState state = eState_Inactive;
|
||||
|
||||
int cost = menu->costs[m_index];
|
||||
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
if(cost > pMinecraft->localplayers[enchantingScene->getPad()]->experienceLevel && !pMinecraft->localplayers[enchantingScene->getPad()]->abilities.instabuild)
|
||||
{
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,14 +175,14 @@ void UIControl_PlayerSkinPreview::CycleNextAnimation()
|
|||
|
||||
void UIControl_PlayerSkinPreview::CyclePreviousAnimation()
|
||||
{
|
||||
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1);
|
||||
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1);
|
||||
if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1);
|
||||
|
||||
m_swingTime = 0.0f;
|
||||
}
|
||||
|
||||
void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
|
||||
{
|
||||
{
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
|
|
@ -193,7 +193,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
|
|||
float height = region->y1 - region->y0;
|
||||
float xo = width/2;
|
||||
float yo = height;
|
||||
|
||||
|
||||
glTranslatef(xo, yo - 3.5f, 50.0f);
|
||||
//glTranslatef(120.0f, 294, 0.0f);
|
||||
|
||||
|
|
@ -224,11 +224,9 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
|
|||
//vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -238,11 +236,9 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
|
|||
|
||||