refactor: unglob std::shared_ptr

This commit is contained in:
Tropical
2026-03-06 11:20:45 -06:00
parent 0dd1654dec
commit 67ceccf2d4
1065 changed files with 5754 additions and 5749 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ int ChunkPos::hashCode()
return h1 ^ h2;
}
double ChunkPos::distanceToSqr(shared_ptr<Entity> e)
double ChunkPos::distanceToSqr(std::shared_ptr<Entity> e)
{
double xPos = x * 16 + 8;
double zPos = z * 16 + 8;
+1 -1
View File
@@ -13,7 +13,7 @@ public:
static __int64 hashCode(int x, int z);
int hashCode();
double distanceToSqr(shared_ptr<Entity> e);
double distanceToSqr(std::shared_ptr<Entity> e);
double distanceToSqr(double px, double pz); // 4J added
int getMiddleBlockX();
+1 -1
View File
@@ -17,7 +17,7 @@ CompoundTag *DerivedLevelData::createTag()
return wrapped->createTag();
}
CompoundTag *DerivedLevelData::createTag(vector<shared_ptr<Player> > *players)
CompoundTag *DerivedLevelData::createTag(vector<std::shared_ptr<Player> > *players)
{
return wrapped->createTag(players);
}
+1 -1
View File
@@ -15,7 +15,7 @@ protected:
public:
CompoundTag *createTag();
CompoundTag *createTag(vector<shared_ptr<Player> > *players);
CompoundTag *createTag(vector<std::shared_ptr<Player> > *players);
__int64 getSeed();
int getXSpawn();
int getYSpawn();
+9 -9
View File
@@ -94,15 +94,15 @@ int EmptyLevelChunk::getRawBrightness(int x, int y, int z, int skyDampen)
return 0;
}
void EmptyLevelChunk::addEntity(shared_ptr<Entity> e)
void EmptyLevelChunk::addEntity(std::shared_ptr<Entity> e)
{
}
void EmptyLevelChunk::removeEntity(shared_ptr<Entity> e)
void EmptyLevelChunk::removeEntity(std::shared_ptr<Entity> e)
{
}
void EmptyLevelChunk::removeEntity(shared_ptr<Entity> e, int yc)
void EmptyLevelChunk::removeEntity(std::shared_ptr<Entity> e, int yc)
{
}
@@ -115,16 +115,16 @@ void EmptyLevelChunk::skyBrightnessChanged()
{
}
shared_ptr<TileEntity> EmptyLevelChunk::getTileEntity(int x, int y, int z)
std::shared_ptr<TileEntity> EmptyLevelChunk::getTileEntity(int x, int y, int z)
{
return shared_ptr<TileEntity>();
return std::shared_ptr<TileEntity>();
}
void EmptyLevelChunk::addTileEntity(shared_ptr<TileEntity> te)
void EmptyLevelChunk::addTileEntity(std::shared_ptr<TileEntity> te)
{
}
void EmptyLevelChunk::setTileEntity(int x, int y, int z, shared_ptr<TileEntity> tileEntity)
void EmptyLevelChunk::setTileEntity(int x, int y, int z, std::shared_ptr<TileEntity> tileEntity)
{
}
@@ -144,11 +144,11 @@ void EmptyLevelChunk::markUnsaved()
{
}
void EmptyLevelChunk::getEntities(shared_ptr<Entity> except, AABB bb, vector<shared_ptr<Entity> > &es)
void EmptyLevelChunk::getEntities(std::shared_ptr<Entity> except, AABB bb, vector<std::shared_ptr<Entity> > &es)
{
}
void EmptyLevelChunk::getEntitiesOfClass(const type_info& ec, AABB bb, vector<shared_ptr<Entity> > &es)
void EmptyLevelChunk::getEntitiesOfClass(const type_info& ec, AABB bb, vector<std::shared_ptr<Entity> > &es)
{
}
+8 -8
View File
@@ -28,20 +28,20 @@ public:
void getNeighbourBrightnesses(int *brightnesses, LightLayer::variety layer, int x, int y, int z); // 4J added
void setBrightness(LightLayer::variety layer, int x, int y, int z, int brightness);
int getRawBrightness(int x, int y, int z, int skyDampen);
void addEntity(shared_ptr<Entity> e);
void removeEntity(shared_ptr<Entity> e);
void removeEntity(shared_ptr<Entity> e, int yc);
void addEntity(std::shared_ptr<Entity> e);
void removeEntity(std::shared_ptr<Entity> e);
void removeEntity(std::shared_ptr<Entity> e, int yc);
bool isSkyLit(int x, int y, int z);
void skyBrightnessChanged();
shared_ptr<TileEntity> getTileEntity(int x, int y, int z);
void addTileEntity(shared_ptr<TileEntity> te);
void setTileEntity(int x, int y, int z, shared_ptr<TileEntity> tileEntity);
std::shared_ptr<TileEntity> getTileEntity(int x, int y, int z);
void addTileEntity(std::shared_ptr<TileEntity> te);
void setTileEntity(int x, int y, int z, std::shared_ptr<TileEntity> tileEntity);
void removeTileEntity(int x, int y, int z);
void load();
void unload(bool unloadTileEntities) ; // 4J - added parameter
void markUnsaved();
void getEntities(shared_ptr<Entity> except, AABB bb, vector<shared_ptr<Entity> > &es);
void getEntitiesOfClass(const type_info& ec, AABB bb, vector<shared_ptr<Entity> > &es);
void getEntities(std::shared_ptr<Entity> except, AABB bb, vector<std::shared_ptr<Entity> > &es);
void getEntitiesOfClass(const type_info& ec, AABB bb, vector<std::shared_ptr<Entity> > &es);
int countEntities();
bool shouldSave(bool force);
void setBlocks(byteArray newBlocks, int sub);
+5 -5
View File
@@ -18,23 +18,23 @@ public:
//virtual void playSound(const wstring& name, double x, double y, double z, float volume, float pitch) = 0;
virtual void playSound(int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f) = 0;
virtual void playSound(shared_ptr<Entity> entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f) = 0;
virtual void playSound(std::shared_ptr<Entity> entity,int iSound, double x, double y, double z, float volume, float pitch, float fSoundClipDist=16.0f) = 0;
// 4J removed - virtual void addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za) = 0;
virtual void addParticle(ePARTICLE_TYPE name, double x, double y, double z, double xa, double ya, double za) = 0; // 4J added
virtual void entityAdded(shared_ptr<Entity> entity) = 0;
virtual void entityAdded(std::shared_ptr<Entity> entity) = 0;
virtual void entityRemoved(shared_ptr<Entity> entity) = 0;
virtual void entityRemoved(std::shared_ptr<Entity> entity) = 0;
virtual void playerRemoved(shared_ptr<Entity> entity) = 0; // 4J added - for when a player is removed from the level's player array, not just the entity storage
virtual void playerRemoved(std::shared_ptr<Entity> entity) = 0; // 4J added - for when a player is removed from the level's player array, not just the entity storage
virtual void skyColorChanged() = 0;
virtual void playStreamingMusic(const wstring& name, int x, int y, int z) = 0;
virtual void levelEvent(shared_ptr<Player> source, int type, int x, int y, int z, int data) = 0;
virtual void levelEvent(std::shared_ptr<Player> source, int type, int x, int y, int z, int data) = 0;
virtual void destroyTileProgress(int id, int x, int y, int z, int progress) = 0;
};
@@ -77,12 +77,12 @@ void VillageSiege::tick()
bool VillageSiege::tryToSetupSiege()
{
vector<shared_ptr<Player> > *players = &level->players;
vector<std::shared_ptr<Player> > *players = &level->players;
//for (Player player : players)
for(AUTO_VAR(it, players->begin()); it != players->end(); ++it)
{
shared_ptr<Player> player = *it;
shared_ptr<Village> _village = level->villages->getClosestVillage((int) player->x, (int) player->y, (int) player->z, 1);
std::shared_ptr<Player> player = *it;
std::shared_ptr<Village> _village = level->villages->getClosestVillage((int) player->x, (int) player->y, (int) player->z, 1);
village = _village;
if (_village == NULL) continue;
@@ -101,11 +101,11 @@ bool VillageSiege::tryToSetupSiege()
spawnY = center->y;
spawnZ = center->z + (int) (Mth::sin(level->random->nextFloat() * PI * 2.f) * radius * 0.9);
overlaps = false;
vector<shared_ptr<Village> > *villages = level->villages->getVillages();
vector<std::shared_ptr<Village> > *villages = level->villages->getVillages();
//for (Village v : level.villages.getVillages())
for(AUTO_VAR(itV, villages->begin()); itV != villages->end(); ++itV)
{
shared_ptr<Village>v = *itV;
std::shared_ptr<Village>v = *itV;
if (v == _village) continue;
if (v->isInside(spawnX, spawnY, spawnZ))
{
@@ -131,10 +131,10 @@ bool VillageSiege::trySpawn()
{
Vec3 *spawnPos = findRandomSpawnPos(spawnX, spawnY, spawnZ);
if (spawnPos == NULL) return false;
shared_ptr<Zombie> mob;
std::shared_ptr<Zombie> mob;
//try
{
mob = shared_ptr<Zombie>( new Zombie(level) );
mob = std::shared_ptr<Zombie>( new Zombie(level) );
mob->finalizeMobSpawn();
mob->setVillager(false);
}
@@ -144,7 +144,7 @@ bool VillageSiege::trySpawn()
//}
mob->moveTo(spawnPos->x, spawnPos->y, spawnPos->z, level->random->nextFloat() * 360, 0);
level->addEntity(mob);
shared_ptr<Village> _village = village.lock();
std::shared_ptr<Village> _village = village.lock();
if( _village == NULL ) return false;
Pos *center = _village->getCenter();
@@ -154,7 +154,7 @@ bool VillageSiege::trySpawn()
Vec3 *VillageSiege::findRandomSpawnPos(int x, int y, int z)
{
shared_ptr<Village> _village = village.lock();
std::shared_ptr<Village> _village = village.lock();
if( _village == NULL ) return NULL;
for (int i = 0; i < 10; ++i)
+6 -6
View File
@@ -8,7 +8,7 @@
#include "Explosion.h"
#include "../Util/SoundTypes.h"
Explosion::Explosion(Level *level, shared_ptr<Entity> source, double x, double y, double z, float r)
Explosion::Explosion(Level *level, std::shared_ptr<Entity> source, double x, double y, double z, float r)
{
fire = false;
random = new Random();
@@ -97,14 +97,14 @@ void Explosion::explode()
// Fix for 360 #123866 - [CRASH] TU13: Code: Compliance: Placing the TNT next to Ender Crystals will crash the title after a certain amount of time.
// If we explode something next to an EnderCrystal then it creates a new explosion that overwrites the shared vector in the level
// So copy it here instead of directly using the shared one
vector<shared_ptr<Entity> > *levelEntities = level->getEntities(source, AABB::newTemp(x0, y0, z0, x1, y1, z1));
vector<shared_ptr<Entity> > entities(levelEntities->begin(), levelEntities->end() );
vector<std::shared_ptr<Entity> > *levelEntities = level->getEntities(source, AABB::newTemp(x0, y0, z0, x1, y1, z1));
vector<std::shared_ptr<Entity> > entities(levelEntities->begin(), levelEntities->end() );
Vec3 *center = Vec3::newTemp(x, y, z);
AUTO_VAR(itEnd, entities.end());
for (AUTO_VAR(it, entities.begin()); it != itEnd; it++)
{
shared_ptr<Entity> e = *it; //entities->at(i);
std::shared_ptr<Entity> e = *it; //entities->at(i);
// 4J Stu - If the entity is not in a block that would be blown up, then they should not be damaged
// Fix for #46606 - TU5: Content: Gameplay: The player can be damaged and killed by explosions behind obsidian walls
@@ -149,7 +149,7 @@ void Explosion::explode()
e->yd += ya * push;
e->zd += za * push;
shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
if (player != NULL)
{
//app.DebugPrintf("Adding player knockback (%f,%f,%f)\n", xa * pow, ya * pow, za * pow);
@@ -255,7 +255,7 @@ Explosion::playerVec3Map *Explosion::getHitPlayers()
return &hitPlayers;
}
Vec3 *Explosion::getHitPlayerKnockback( shared_ptr<Player> player )
Vec3 *Explosion::getHitPlayerKnockback( std::shared_ptr<Player> player )
{
AUTO_VAR(it, hitPlayers.find(player));
+4 -4
View File
@@ -19,17 +19,17 @@ private:
public:
double x, y, z;
shared_ptr<Entity> source;
std::shared_ptr<Entity> source;
float r;
unordered_set<TilePos, TilePosKeyHash, TilePosKeyEq> toBlow;
private:
typedef unordered_map<shared_ptr<Player>, Vec3 * , PlayerKeyHash, PlayerKeyEq> playerVec3Map;
typedef unordered_map<std::shared_ptr<Player>, Vec3 * , PlayerKeyHash, PlayerKeyEq> playerVec3Map;
playerVec3Map hitPlayers;
public:
Explosion(Level *level, shared_ptr<Entity> source, double x, double y, double z, float r);
Explosion(Level *level, std::shared_ptr<Entity> source, double x, double y, double z, float r);
~Explosion();
public:
@@ -38,5 +38,5 @@ public:
public:
void finalizeExplosion(bool generateParticles, vector<TilePos> *toBlowDirect = NULL); // 4J - added toBlow parameter
playerVec3Map *getHitPlayers();
Vec3 *getHitPlayerKnockback( shared_ptr<Player> player );
Vec3 *getHitPlayerKnockback( std::shared_ptr<Player> player );
};
+99 -99
View File
@@ -558,20 +558,20 @@ BiomeSource *Level::getBiomeSource()
return dimension->biomeSource;
}
Level::Level(shared_ptr<LevelStorage> levelStorage, const wstring& name, Dimension *dimension, LevelSettings *levelSettings, bool doCreateChunkSource)
Level::Level(std::shared_ptr<LevelStorage> levelStorage, const wstring& name, Dimension *dimension, LevelSettings *levelSettings, bool doCreateChunkSource)
: seaLevel(constSeaLevel)
{
_init();
this->levelStorage = levelStorage;//shared_ptr<LevelStorage>(levelStorage);
this->levelStorage = levelStorage;//std::shared_ptr<LevelStorage>(levelStorage);
this->dimension = dimension;
this->levelData = new LevelData(levelSettings, name);
if( !this->levelData->useNewSeaLevel() ) seaLevel = Level::genDepth / 2; // 4J added - sea level is one unit lower since 1.8.2, maintain older height for old levels
this->savedDataStorage = new SavedDataStorage(levelStorage.get());
shared_ptr<Villages> savedVillages = dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
std::shared_ptr<Villages> savedVillages = dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
if (savedVillages == NULL)
{
villages = shared_ptr<Villages>(new Villages(this));
villages = std::shared_ptr<Villages>(new Villages(this));
savedDataStorage->set(Villages::VILLAGE_FILE_ID, villages);
}
else
@@ -597,10 +597,10 @@ Level::Level(Level *level, Dimension *dimension)
if( !this->levelData->useNewSeaLevel() ) seaLevel = Level::genDepth / 2; // 4J added - sea level is one unit lower since 1.8.2, maintain older height for old levels
this->savedDataStorage = new SavedDataStorage( levelStorage.get() );
shared_ptr<Villages> savedVillages = dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
std::shared_ptr<Villages> savedVillages = dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
if (savedVillages == NULL)
{
villages = shared_ptr<Villages>(new Villages(this));
villages = std::shared_ptr<Villages>(new Villages(this));
savedDataStorage->set(Villages::VILLAGE_FILE_ID, villages);
}
else
@@ -617,29 +617,29 @@ Level::Level(Level *level, Dimension *dimension)
}
Level::Level(shared_ptr<LevelStorage>levelStorage, const wstring& levelName, LevelSettings *levelSettings)
Level::Level(std::shared_ptr<LevelStorage>levelStorage, const wstring& levelName, LevelSettings *levelSettings)
: seaLevel( constSeaLevel )
{
_init(levelStorage, levelName, levelSettings, NULL, true);
}
Level::Level(shared_ptr<LevelStorage>levelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource)
Level::Level(std::shared_ptr<LevelStorage>levelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource)
: seaLevel( constSeaLevel )
{
_init( levelStorage, levelName, levelSettings, fixedDimension, doCreateChunkSource );
}
void Level::_init(shared_ptr<LevelStorage>levelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource)
void Level::_init(std::shared_ptr<LevelStorage>levelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource)
{
_init();
this->levelStorage = levelStorage;//shared_ptr<LevelStorage>(levelStorage);
this->levelStorage = levelStorage;//std::shared_ptr<LevelStorage>(levelStorage);
this->savedDataStorage = new SavedDataStorage(levelStorage.get());
shared_ptr<Villages> savedVillages = dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
std::shared_ptr<Villages> savedVillages = dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
if (savedVillages == NULL)
{
villages = shared_ptr<Villages>(new Villages(this));
villages = std::shared_ptr<Villages>(new Villages(this));
savedDataStorage->set(Villages::VILLAGE_FILE_ID, villages);
}
else
@@ -1581,7 +1581,7 @@ HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly)
}
void Level::playSound(shared_ptr<Entity> entity, int iSound, float volume, float pitch)
void Level::playSound(std::shared_ptr<Entity> entity, int iSound, float volume, float pitch)
{
if(entity == NULL) return;
AUTO_VAR(itEnd, listeners.end());
@@ -1648,7 +1648,7 @@ void Level::addParticle(ePARTICLE_TYPE id, double x, double y, double z, double
(*it)->addParticle(id, x, y, z, xd, yd, zd);
}
bool Level::addGlobalEntity(shared_ptr<Entity> e)
bool Level::addGlobalEntity(std::shared_ptr<Entity> e)
{
globalEntities.push_back(e);
return true;
@@ -1656,7 +1656,7 @@ bool Level::addGlobalEntity(shared_ptr<Entity> e)
#pragma optimize( "", off )
bool Level::addEntity(shared_ptr<Entity> e)
bool Level::addEntity(std::shared_ptr<Entity> e)
{
int xc = Mth::floor(e->x / 16);
int zc = Mth::floor(e->z / 16);
@@ -1676,7 +1676,7 @@ bool Level::addEntity(shared_ptr<Entity> e)
{
if (dynamic_pointer_cast<Player>( e ) != NULL)
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
// 4J Stu - Added so we don't continually add the player to the players list while they are dead
if( find( players.begin(), players.end(), e ) == players.end() )
@@ -1704,7 +1704,7 @@ bool Level::addEntity(shared_ptr<Entity> e)
#pragma optimize( "", on )
void Level::entityAdded(shared_ptr<Entity> e)
void Level::entityAdded(std::shared_ptr<Entity> e)
{
AUTO_VAR(itEnd, listeners.end());
for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++)
@@ -1714,7 +1714,7 @@ void Level::entityAdded(shared_ptr<Entity> e)
}
void Level::entityRemoved(shared_ptr<Entity> e)
void Level::entityRemoved(std::shared_ptr<Entity> e)
{
AUTO_VAR(itEnd, listeners.end());
for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++)
@@ -1724,7 +1724,7 @@ void Level::entityRemoved(shared_ptr<Entity> e)
}
// 4J added
void Level::playerRemoved(shared_ptr<Entity> e)
void Level::playerRemoved(std::shared_ptr<Entity> e)
{
AUTO_VAR(itEnd, listeners.end());
for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++)
@@ -1733,7 +1733,7 @@ void Level::playerRemoved(shared_ptr<Entity> e)
}
}
void Level::removeEntity(shared_ptr<Entity> e)
void Level::removeEntity(std::shared_ptr<Entity> e)
{
if (e->rider.lock() != NULL)
{
@@ -1746,8 +1746,8 @@ void Level::removeEntity(shared_ptr<Entity> e)
e->remove();
if (dynamic_pointer_cast<Player>( e ) != NULL)
{
vector<shared_ptr<Player> >::iterator it = players.begin();
vector<shared_ptr<Player> >::iterator itEnd = players.end();
vector<std::shared_ptr<Player> >::iterator it = players.begin();
vector<std::shared_ptr<Player> >::iterator itEnd = players.end();
while( it != itEnd && *it != dynamic_pointer_cast<Player>(e) )
it++;
@@ -1762,14 +1762,14 @@ void Level::removeEntity(shared_ptr<Entity> e)
}
void Level::removeEntityImmediately(shared_ptr<Entity> e)
void Level::removeEntityImmediately(std::shared_ptr<Entity> e)
{
e->remove();
if (dynamic_pointer_cast<Player>( e ) != NULL)
{
vector<shared_ptr<Player> >::iterator it = players.begin();
vector<shared_ptr<Player> >::iterator itEnd = players.end();
vector<std::shared_ptr<Player> >::iterator it = players.begin();
vector<std::shared_ptr<Player> >::iterator itEnd = players.end();
while( it != itEnd && *it != dynamic_pointer_cast<Player>(e) )
it++;
@@ -1790,8 +1790,8 @@ void Level::removeEntityImmediately(shared_ptr<Entity> e)
}
EnterCriticalSection(&m_entitiesCS);
vector<shared_ptr<Entity> >::iterator it = entities.begin();
vector<shared_ptr<Entity> >::iterator endIt = entities.end();
vector<std::shared_ptr<Entity> >::iterator it = entities.begin();
vector<std::shared_ptr<Entity> >::iterator endIt = entities.end();
while( it != endIt && *it != e)
it++;
@@ -1823,7 +1823,7 @@ void Level::removeListener(LevelListener *listener)
// 4J - added noEntities and blockAtEdge parameter
AABBList *Level::getCubes(shared_ptr<Entity> source, AABB *box, bool noEntities, bool blockAtEdge)
AABBList *Level::getCubes(std::shared_ptr<Entity> source, AABB *box, bool noEntities, bool blockAtEdge)
{
boxes.clear();
int x0 = Mth::floor(box->x0);
@@ -1895,8 +1895,8 @@ AABBList *Level::getCubes(shared_ptr<Entity> source, AABB *box, bool noEntities,
if( noEntities ) return &boxes;
double r = 0.25;
vector<shared_ptr<Entity> > *ee = getEntities(source, box->grow(r, r, r));
vector<shared_ptr<Entity> >::iterator itEnd = ee->end();
vector<std::shared_ptr<Entity> > *ee = getEntities(source, box->grow(r, r, r));
vector<std::shared_ptr<Entity> >::iterator itEnd = ee->end();
for (AUTO_VAR(it, ee->begin()); it != itEnd; it++)
{
AABB *collideBox = (*it)->getCollideBox();
@@ -1986,7 +1986,7 @@ float Level::getSkyDarken(float a)
Vec3 *Level::getSkyColor(shared_ptr<Entity> source, float a)
Vec3 *Level::getSkyColor(std::shared_ptr<Entity> source, float a)
{
float td = getTimeOfDay(a);
@@ -2197,10 +2197,10 @@ void Level::forceAddTileTick(int x, int y, int z, int tileId, int tickDelay)
void Level::tickEntities()
{
//for (int i = 0; i < globalEntities.size(); i++)
vector<shared_ptr<Entity> >::iterator itGE = globalEntities.begin();
vector<std::shared_ptr<Entity> >::iterator itGE = globalEntities.begin();
while( itGE != globalEntities.end() )
{
shared_ptr<Entity> e = *itGE;//globalEntities.at(i);
std::shared_ptr<Entity> e = *itGE;//globalEntities.at(i);
e->tick();
if (e->removed)
{
@@ -2241,7 +2241,7 @@ void Level::tickEntities()
AUTO_VAR(itETREnd, entitiesToRemove.end());
for (AUTO_VAR(it, entitiesToRemove.begin()); it != itETREnd; it++)
{
shared_ptr<Entity> e = *it;//entitiesToRemove.at(j);
std::shared_ptr<Entity> e = *it;//entitiesToRemove.at(j);
int xc = e->xChunk;
int zc = e->zChunk;
if (e->inChunk && hasChunk(xc, zc))
@@ -2267,7 +2267,7 @@ void Level::tickEntities()
for (unsigned int i = 0; i < entities.size(); )
{
shared_ptr<Entity> e = entities.at(i);
std::shared_ptr<Entity> e = entities.at(i);
if (e->riding != NULL)
{
@@ -2326,7 +2326,7 @@ void Level::tickEntities()
updatingTileEntities = true;
for (AUTO_VAR(it, tileEntityList.begin()); it != tileEntityList.end();)
{
shared_ptr<TileEntity> te = *it;//tilevector<shared_ptr<Entity> >.at(i);
std::shared_ptr<TileEntity> te = *it;//tilevector<std::shared_ptr<Entity> >.at(i);
if( !te->isRemoved() && te->hasLevel() )
{
if (hasChunkAt(te->x, te->y, te->z))
@@ -2394,7 +2394,7 @@ void Level::tickEntities()
{
for( AUTO_VAR(it, pendingTileEntities.begin()); it != pendingTileEntities.end(); it++ )
{
shared_ptr<TileEntity> e = *it;
std::shared_ptr<TileEntity> e = *it;
if( !e->isRemoved() )
{
if( find(tileEntityList.begin(),tileEntityList.end(),e) == tileEntityList.end() )
@@ -2415,7 +2415,7 @@ void Level::tickEntities()
LeaveCriticalSection(&m_tileEntityListCS);
}
void Level::addAllPendingTileEntities(vector< shared_ptr<TileEntity> >& entities)
void Level::addAllPendingTileEntities(vector< std::shared_ptr<TileEntity> >& entities)
{
EnterCriticalSection(&m_tileEntityListCS);
if( updatingTileEntities )
@@ -2435,13 +2435,13 @@ void Level::addAllPendingTileEntities(vector< shared_ptr<TileEntity> >& entities
LeaveCriticalSection(&m_tileEntityListCS);
}
void Level::tick(shared_ptr<Entity> e)
void Level::tick(std::shared_ptr<Entity> e)
{
tick(e, true);
}
void Level::tick(shared_ptr<Entity> e, bool actual)
void Level::tick(std::shared_ptr<Entity> e, bool actual)
{
int xc = Mth::floor(e->x);
int zc = Mth::floor(e->z);
@@ -2537,13 +2537,13 @@ bool Level::isUnobstructed(AABB *aabb)
return isUnobstructed(aabb, nullptr);
}
bool Level::isUnobstructed(AABB *aabb, shared_ptr<Entity> ignore)
bool Level::isUnobstructed(AABB *aabb, std::shared_ptr<Entity> ignore)
{
vector<shared_ptr<Entity> > *ents = getEntities(nullptr, aabb);
vector<std::shared_ptr<Entity> > *ents = getEntities(nullptr, aabb);
AUTO_VAR(itEnd, ents->end());
for (AUTO_VAR(it, ents->begin()); it != itEnd; it++)
{
shared_ptr<Entity> e = *it;
std::shared_ptr<Entity> e = *it;
if (!e->removed && e->blocksBuilding && e != ignore) return false;
}
return true;
@@ -2658,7 +2658,7 @@ bool Level::containsFireTile(AABB *box)
}
bool Level::checkAndHandleWater(AABB *box, Material *material, shared_ptr<Entity> e)
bool Level::checkAndHandleWater(AABB *box, Material *material, std::shared_ptr<Entity> e)
{
int x0 = Mth::floor(box->x0);
int x1 = Mth::floor(box->x1 + 1);
@@ -2758,15 +2758,15 @@ bool Level::containsLiquid(AABB *box, Material *material)
}
shared_ptr<Explosion> Level::explode(shared_ptr<Entity> source, double x, double y, double z, float r, bool destroyBlocks)
std::shared_ptr<Explosion> Level::explode(std::shared_ptr<Entity> source, double x, double y, double z, float r, bool destroyBlocks)
{
return explode(source, x, y, z, r, false, destroyBlocks);
}
shared_ptr<Explosion> Level::explode(shared_ptr<Entity> source, double x, double y, double z, float r, bool fire, bool destroyBlocks)
std::shared_ptr<Explosion> Level::explode(std::shared_ptr<Entity> source, double x, double y, double z, float r, bool fire, bool destroyBlocks)
{
shared_ptr<Explosion> explosion = shared_ptr<Explosion>( new Explosion(this, source, x, y, z, r) );
std::shared_ptr<Explosion> explosion = std::shared_ptr<Explosion>( new Explosion(this, source, x, y, z, r) );
explosion->fire = fire;
explosion->destroyBlocks = destroyBlocks;
explosion->explode();
@@ -2799,7 +2799,7 @@ float Level::getSeenPercent(Vec3 *center, AABB *bb)
}
bool Level::extinguishFire(shared_ptr<Player> player, int x, int y, int z, int face)
bool Level::extinguishFire(std::shared_ptr<Player> player, int x, int y, int z, int face)
{
if (face == 0) y--;
if (face == 1) y++;
@@ -2818,9 +2818,9 @@ bool Level::extinguishFire(shared_ptr<Player> player, int x, int y, int z, int f
}
/*
shared_ptr<Entity> Level::findSubclassOf(Entity::Class *entityClass)
std::shared_ptr<Entity> Level::findSubclassOf(Entity::Class *entityClass)
{
return shared_ptr<Entity>();
return std::shared_ptr<Entity>();
}
*/
@@ -2841,7 +2841,7 @@ wstring Level::gatherChunkSourceStats()
}
shared_ptr<TileEntity> Level::getTileEntity(int x, int y, int z)
std::shared_ptr<TileEntity> Level::getTileEntity(int x, int y, int z)
{
if (y >= Level::maxBuildHeight)
{
@@ -2852,14 +2852,14 @@ shared_ptr<TileEntity> Level::getTileEntity(int x, int y, int z)
if (lc != NULL)
{
shared_ptr<TileEntity> tileEntity = lc->getTileEntity(x & 15, y, z & 15);
std::shared_ptr<TileEntity> tileEntity = lc->getTileEntity(x & 15, y, z & 15);
if (tileEntity == NULL)
{
EnterCriticalSection(&m_tileEntityListCS);
for( AUTO_VAR(it, pendingTileEntities.begin()); it != pendingTileEntities.end(); it++ )
{
shared_ptr<TileEntity> e = *it;
std::shared_ptr<TileEntity> e = *it;
if (!e->isRemoved() && e->x == x && e->y == y && e->z == z)
{
@@ -2876,7 +2876,7 @@ shared_ptr<TileEntity> Level::getTileEntity(int x, int y, int z)
}
void Level::setTileEntity(int x, int y, int z, shared_ptr<TileEntity> tileEntity)
void Level::setTileEntity(int x, int y, int z, std::shared_ptr<TileEntity> tileEntity)
{
if (tileEntity != NULL && !tileEntity->isRemoved())
{
@@ -2905,7 +2905,7 @@ void Level::setTileEntity(int x, int y, int z, shared_ptr<TileEntity> tileEntity
void Level::removeTileEntity(int x, int y, int z)
{
EnterCriticalSection(&m_tileEntityListCS);
shared_ptr<TileEntity> te = getTileEntity(x, y, z);
std::shared_ptr<TileEntity> te = getTileEntity(x, y, z);
if (te != NULL && updatingTileEntities)
{
te->setRemoved();
@@ -2936,7 +2936,7 @@ void Level::removeTileEntity(int x, int y, int z)
LeaveCriticalSection(&m_tileEntityListCS);
}
void Level::markForRemoval(shared_ptr<TileEntity> entity)
void Level::markForRemoval(std::shared_ptr<TileEntity> entity)
{
tileEntitiesToUnload.push_back(entity);
}
@@ -3163,7 +3163,7 @@ void Level::buildAndPrepareChunksToPoll()
AUTO_VAR(itEnd, players.end());
for (AUTO_VAR(it, players.begin()); it != itEnd; it++)
{
shared_ptr<Player> player = *it;
std::shared_ptr<Player> player = *it;
int xx = Mth::floor(player->x / 16);
int zz = Mth::floor(player->z / 16);
@@ -3183,7 +3183,7 @@ void Level::buildAndPrepareChunksToPoll()
int *zz = new int[playerCount];
for (int i = 0; i < playerCount; i++)
{
shared_ptr<Player> player = players[i];
std::shared_ptr<Player> player = players[i];
xx[i] = Mth::floor(player->x / 16);
zz[i] = Mth::floor(player->z / 16);
chunksToPoll.insert(ChunkPos(xx[i], zz[i] ));
@@ -3239,7 +3239,7 @@ void Level::tickClientSideTiles(int xo, int zo, LevelChunk *lc)
z += zo;
if (id == 0 && this->getDaytimeRawBrightness(x, y, z) <= random->nextInt(8) && getBrightness(LightLayer::Sky, x, y, z) <= 0)
{
shared_ptr<Player> player = getNearestPlayer(x + 0.5, y + 0.5, z + 0.5, 8);
std::shared_ptr<Player> player = getNearestPlayer(x + 0.5, y + 0.5, z + 0.5, 8);
if (player != NULL && player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 2 * 2)
{
// 4J-PB - Fixed issue with cave audio event having 2 sounds at 192k
@@ -3728,7 +3728,7 @@ vector<TickNextTickData> *Level::fetchTicksInChunk(LevelChunk *chunk, bool remov
}
vector<shared_ptr<Entity> > *Level::getEntities(shared_ptr<Entity> except, AABB *bb)
vector<std::shared_ptr<Entity> > *Level::getEntities(std::shared_ptr<Entity> except, AABB *bb)
{
MemSect(40);
es.clear();
@@ -3768,13 +3768,13 @@ vector<shared_ptr<Entity> > *Level::getEntities(shared_ptr<Entity> except, AABB
}
vector<shared_ptr<Entity> > *Level::getEntitiesOfClass(const type_info& baseClass, AABB *bb)
vector<std::shared_ptr<Entity> > *Level::getEntitiesOfClass(const type_info& baseClass, AABB *bb)
{
int xc0 = Mth::floor((bb->x0 - 2) / 16);
int xc1 = Mth::floor((bb->x1 + 2) / 16);
int zc0 = Mth::floor((bb->z0 - 2) / 16);
int zc1 = Mth::floor((bb->z1 + 2) / 16);
vector<shared_ptr<Entity> > *es = new vector<shared_ptr<Entity> >();
vector<std::shared_ptr<Entity> > *es = new vector<std::shared_ptr<Entity> >();
#ifdef __PSVITA__
#ifdef _ENTITIES_RW_SECTION
@@ -3805,15 +3805,15 @@ vector<shared_ptr<Entity> > *Level::getEntitiesOfClass(const type_info& baseClas
return es;
}
shared_ptr<Entity> Level::getClosestEntityOfClass(const type_info& baseClass, AABB *bb, shared_ptr<Entity> source)
std::shared_ptr<Entity> Level::getClosestEntityOfClass(const type_info& baseClass, AABB *bb, std::shared_ptr<Entity> source)
{
vector<shared_ptr<Entity> > *entities = getEntitiesOfClass(baseClass, bb);
shared_ptr<Entity> closest = nullptr;
vector<std::shared_ptr<Entity> > *entities = getEntitiesOfClass(baseClass, bb);
std::shared_ptr<Entity> closest = nullptr;
double closestDistSqr = Double::MAX_VALUE;
//for (Entity entity : entities)
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
{
shared_ptr<Entity> entity = *it;
std::shared_ptr<Entity> entity = *it;
if (entity == source) continue;
double distSqr = source->distanceToSqr(entity);
if (distSqr > closestDistSqr) continue;
@@ -3824,16 +3824,16 @@ shared_ptr<Entity> Level::getClosestEntityOfClass(const type_info& baseClass, AA
return closest;
}
vector<shared_ptr<Entity> > Level::getAllEntities()
vector<std::shared_ptr<Entity> > Level::getAllEntities()
{
EnterCriticalSection(&m_entitiesCS);
vector<shared_ptr<Entity> > retVec = entities;
vector<std::shared_ptr<Entity> > retVec = entities;
LeaveCriticalSection(&m_entitiesCS);
return retVec;
}
void Level::tileEntityChanged(int x, int y, int z, shared_ptr<TileEntity> te)
void Level::tileEntityChanged(int x, int y, int z, std::shared_ptr<TileEntity> te)
{
if (this->hasChunkAt(x, y, z))
{
@@ -3849,7 +3849,7 @@ unsigned int Level::countInstanceOf(BaseObject::Class *clas)
AUTO_VAR(itEnd, entities.end());
for (AUTO_VAR(it, entities.begin()); it != itEnd; it++)
{
shared_ptr<Entity> e = *it;//entities.at(i);
std::shared_ptr<Entity> e = *it;//entities.at(i);
if (clas->isAssignableFrom(e->getClass())) count++;
}
LeaveCriticalSection(&m_entitiesCS);
@@ -3869,7 +3869,7 @@ unsigned int Level::countInstanceOf(eINSTANCEOF clas, bool singleType, unsigned
AUTO_VAR(itEnd, entities.end());
for (AUTO_VAR(it, entities.begin()); it != itEnd; it++)
{
shared_ptr<Entity> e = *it;//entities.at(i);
std::shared_ptr<Entity> e = *it;//entities.at(i);
if( singleType )
{
if (e->GetType() == clas)
@@ -3904,7 +3904,7 @@ unsigned int Level::countInstanceOfInRange(eINSTANCEOF clas, bool singleType, in
AUTO_VAR(itEnd, entities.end());
for (AUTO_VAR(it, entities.begin()); it != itEnd; it++)
{
shared_ptr<Entity> e = *it;//entities.at(i);
std::shared_ptr<Entity> e = *it;//entities.at(i);
float sd = e->distanceTo(x,y,z);
if (sd * sd > range * range)
@@ -3932,7 +3932,7 @@ unsigned int Level::countInstanceOfInRange(eINSTANCEOF clas, bool singleType, in
return count;
}
void Level::addEntities(vector<shared_ptr<Entity> > *list)
void Level::addEntities(vector<std::shared_ptr<Entity> > *list)
{
//entities.addAll(list);
EnterCriticalSection(&m_entitiesCS);
@@ -3973,13 +3973,13 @@ void Level::addEntities(vector<shared_ptr<Entity> > *list)
}
void Level::removeEntities(vector<shared_ptr<Entity> > *list)
void Level::removeEntities(vector<std::shared_ptr<Entity> > *list)
{
//entitiesToRemove.addAll(list);
entitiesToRemove.insert(entitiesToRemove.end(), list->begin(), list->end());
}
bool Level::mayPlace(int tileId, int x, int y, int z, bool ignoreEntities, int face, shared_ptr<Entity> ignoreEntity)
bool Level::mayPlace(int tileId, int x, int y, int z, bool ignoreEntities, int face, std::shared_ptr<Entity> ignoreEntity)
{
int targetType = getTile(x, y, z);
Tile *targetTile = Tile::tiles[targetType];
@@ -4010,7 +4010,7 @@ int Level::getSeaLevel()
}
Path *Level::findPath(shared_ptr<Entity> from, shared_ptr<Entity> to, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat)
Path *Level::findPath(std::shared_ptr<Entity> from, std::shared_ptr<Entity> to, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat)
{
int x = Mth::floor(from->x);
int y = Mth::floor(from->y + 1);
@@ -4029,7 +4029,7 @@ Path *Level::findPath(shared_ptr<Entity> from, shared_ptr<Entity> to, float maxD
}
Path *Level::findPath(shared_ptr<Entity> from, int xBest, int yBest, int zBest, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat)
Path *Level::findPath(std::shared_ptr<Entity> from, int xBest, int yBest, int zBest, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat)
{
int x = Mth::floor(from->x);
int y = Mth::floor(from->y);
@@ -4092,21 +4092,21 @@ bool Level::hasNeighborSignal(int x, int y, int z)
}
// 4J Stu - Added maxYDist param
shared_ptr<Player> Level::getNearestPlayer(shared_ptr<Entity> source, double maxDist, double maxYDist /*= -1*/)
std::shared_ptr<Player> Level::getNearestPlayer(std::shared_ptr<Entity> source, double maxDist, double maxYDist /*= -1*/)
{
return getNearestPlayer(source->x, source->y, source->z, maxDist, maxYDist);
}
// 4J Stu - Added maxYDist param
shared_ptr<Player> Level::getNearestPlayer(double x, double y, double z, double maxDist, double maxYDist /*= -1*/)
std::shared_ptr<Player> Level::getNearestPlayer(double x, double y, double z, double maxDist, double maxYDist /*= -1*/)
{
MemSect(21);
double best = -1;
shared_ptr<Player> result = nullptr;
std::shared_ptr<Player> result = nullptr;
AUTO_VAR(itEnd, players.end());
for (AUTO_VAR(it, players.begin()); it != itEnd; it++)
{
shared_ptr<Player> p = *it;//players.at(i);
std::shared_ptr<Player> p = *it;//players.at(i);
double dist = p->distanceToSqr(x, y, z);
// Allow specifying shorter distances in the vertical
@@ -4123,14 +4123,14 @@ shared_ptr<Player> Level::getNearestPlayer(double x, double y, double z, double
return result;
}
shared_ptr<Player> Level::getNearestPlayer(double x, double z, double maxDist)
std::shared_ptr<Player> Level::getNearestPlayer(double x, double z, double maxDist)
{
double best = -1;
shared_ptr<Player> result = nullptr;
std::shared_ptr<Player> result = nullptr;
AUTO_VAR(itEnd, players.end());
for (AUTO_VAR(it, players.begin()); it != itEnd; it++)
{
shared_ptr<Player> p = *it;
std::shared_ptr<Player> p = *it;
double dist = p->distanceToSqr(x, p->y, z);
if ((maxDist < 0 || dist < maxDist * maxDist) && (best == -1 || dist < best))
{
@@ -4141,20 +4141,20 @@ shared_ptr<Player> Level::getNearestPlayer(double x, double z, double maxDist)
return result;
}
shared_ptr<Player> Level::getNearestAttackablePlayer(shared_ptr<Entity> source, double maxDist)
std::shared_ptr<Player> Level::getNearestAttackablePlayer(std::shared_ptr<Entity> source, double maxDist)
{
return getNearestAttackablePlayer(source->x, source->y, source->z, maxDist);
}
shared_ptr<Player> Level::getNearestAttackablePlayer(double x, double y, double z, double maxDist)
std::shared_ptr<Player> Level::getNearestAttackablePlayer(double x, double y, double z, double maxDist)
{
double best = -1;
shared_ptr<Player> result = nullptr;
std::shared_ptr<Player> result = nullptr;
AUTO_VAR(itEnd, players.end());
for (AUTO_VAR(it, players.begin()); it != itEnd; it++)
{
shared_ptr<Player> p = *it;
std::shared_ptr<Player> p = *it;
if (p->abilities.invulnerable)
{
@@ -4190,7 +4190,7 @@ shared_ptr<Player> Level::getNearestAttackablePlayer(double x, double y, double
return result;
}
shared_ptr<Player> Level::getPlayerByName(const wstring& name)
std::shared_ptr<Player> Level::getPlayerByName(const wstring& name)
{
AUTO_VAR(itEnd, players.end());
for (AUTO_VAR(it, players.begin()); it != itEnd; it++)
@@ -4200,10 +4200,10 @@ shared_ptr<Player> Level::getPlayerByName(const wstring& name)
return *it; //players.at(i);
}
}
return shared_ptr<Player>();
return std::shared_ptr<Player>();
}
shared_ptr<Player> Level::getPlayerByUUID(const wstring& name)
std::shared_ptr<Player> Level::getPlayerByUUID(const wstring& name)
{
AUTO_VAR(itEnd, players.end());
for (AUTO_VAR(it, players.begin()); it != itEnd; it++)
@@ -4213,7 +4213,7 @@ shared_ptr<Player> Level::getPlayerByUUID(const wstring& name)
return *it; //players.at(i);
}
}
return shared_ptr<Player>();
return std::shared_ptr<Player>();
}
// 4J Stu - Removed in 1.2.3 ?
@@ -4353,7 +4353,7 @@ void Level::setTime(__int64 time)
if ( timeDiff > 0 && levelData->getTime() != -1 )
{
AUTO_VAR(itEnd, players.end());
for (vector<shared_ptr<Player> >::iterator it = players.begin(); it != itEnd; it++)
for (vector<std::shared_ptr<Player> >::iterator it = players.begin(); it != itEnd; it++)
{
(*it)->awardStat( GenericStats::timePlayed(), GenericStats::param_time(timeDiff) );
}
@@ -4396,7 +4396,7 @@ void Level::setSpawnPos(Pos *spawnPos)
}
void Level::ensureAdded(shared_ptr<Entity> entity)
void Level::ensureAdded(std::shared_ptr<Entity> entity)
{
int xc = Mth::floor(entity->x / 16);
int zc = Mth::floor(entity->z / 16);
@@ -4419,13 +4419,13 @@ void Level::ensureAdded(shared_ptr<Entity> entity)
}
bool Level::mayInteract(shared_ptr<Player> player, int xt, int yt, int zt, int content)
bool Level::mayInteract(std::shared_ptr<Player> player, int xt, int yt, int zt, int content)
{
return true;
}
void Level::broadcastEntityEvent(shared_ptr<Entity> e, uint8_t event)
void Level::broadcastEntityEvent(std::shared_ptr<Entity> e, uint8_t event)
{
}
@@ -4506,13 +4506,13 @@ bool Level::isHumidAt(int x, int y, int z)
}
void Level::setSavedData(const wstring& id, shared_ptr<SavedData> data)
void Level::setSavedData(const wstring& id, std::shared_ptr<SavedData> data)
{
savedDataStorage->set(id, data);
}
shared_ptr<SavedData> Level::getSavedData(const type_info& clazz, const wstring& id)
std::shared_ptr<SavedData> Level::getSavedData(const type_info& clazz, const wstring& id)
{
return savedDataStorage->get(clazz, id);
}
@@ -4544,7 +4544,7 @@ void Level::levelEvent(int type, int x, int y, int z, int data)
}
void Level::levelEvent(shared_ptr<Player> source, int type, int x, int y, int z, int data)
void Level::levelEvent(std::shared_ptr<Player> source, int type, int x, int y, int z, int data)
{
AUTO_VAR(itEnd, listeners.end());
for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++)
+59 -59
View File
@@ -92,22 +92,22 @@ public:
public:
CRITICAL_SECTION m_entitiesCS; // 4J added
vector<shared_ptr<Entity> > entities;
vector<std::shared_ptr<Entity> > entities;
protected:
vector<shared_ptr<Entity> > entitiesToRemove;
vector<std::shared_ptr<Entity> > entitiesToRemove;
public:
bool hasEntitiesToRemove(); // 4J added
bool m_bDisableAddNewTileEntities; // 4J Added
CRITICAL_SECTION m_tileEntityListCS; // 4J added
vector<shared_ptr<TileEntity> > tileEntityList;
vector<std::shared_ptr<TileEntity> > tileEntityList;
private:
vector<shared_ptr<TileEntity> > pendingTileEntities;
vector<shared_ptr<TileEntity> > tileEntitiesToUnload;
vector<std::shared_ptr<TileEntity> > pendingTileEntities;
vector<std::shared_ptr<TileEntity> > tileEntitiesToUnload;
bool updatingTileEntities;
public:
vector<shared_ptr<Player> > players;
vector<shared_ptr<Entity> > globalEntities;
vector<std::shared_ptr<Player> > players;
vector<std::shared_ptr<Entity> > globalEntities;
private:
int cloudColor;
@@ -140,16 +140,16 @@ protected:
public:
ChunkSource *chunkSource; // 4J - changed to public
protected:
// This is the only shared_ptr ref to levelStorage - we need to keep this as long as at least one Level references it,
// This is the only std::shared_ptr ref to levelStorage - we need to keep this as long as at least one Level references it,
// to be able to cope with moving from dimension to dimension where the Level(Level *level, Dimension *dimension) ctor is used
shared_ptr<LevelStorage> levelStorage;
std::shared_ptr<LevelStorage> levelStorage;
LevelData *levelData;
public:
bool isFindingSpawn;
SavedDataStorage *savedDataStorage;
shared_ptr<Villages> villages;
std::shared_ptr<Villages> villages;
VillageSiege *villageSiege;
public:
@@ -160,13 +160,13 @@ private:
// 4J Stu - Added these ctors to handle init of member variables
void _init();
void _init(shared_ptr<LevelStorage>levelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource = true);
void _init(std::shared_ptr<LevelStorage>levelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource = true);
public:
Level(shared_ptr<LevelStorage>levelStorage, const wstring& name, Dimension *dimension, LevelSettings *levelSettings, bool doCreateChunkSource = true);
Level(std::shared_ptr<LevelStorage>levelStorage, const wstring& name, Dimension *dimension, LevelSettings *levelSettings, bool doCreateChunkSource = true);
Level(Level *level, Dimension *dimension);
Level(shared_ptr<LevelStorage>levelStorage, const wstring& levelName, LevelSettings *levelSettings);
Level(shared_ptr<LevelStorage>levelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource = true);
Level(std::shared_ptr<LevelStorage>levelStorage, const wstring& levelName, LevelSettings *levelSettings);
Level(std::shared_ptr<LevelStorage>levelStorage, const wstring& levelName, LevelSettings *levelSettings, Dimension *fixedDimension, bool doCreateChunkSource = true);
virtual ~Level();
@@ -278,7 +278,7 @@ public:
HitResult *clip(Vec3 *a, Vec3 *b, bool liquid);
HitResult *clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly);
virtual void playSound(shared_ptr<Entity> entity, int iSound, float volume, float pitch);
virtual void playSound(std::shared_ptr<Entity> entity, int iSound, float volume, float pitch);
virtual void playSound(double x, double y, double z, int iSound, float volume, float pitch, float fClipSoundDist=16.0f);
virtual void playLocalSound(double x, double y, double z, int iSound, float volume, float pitch, float fClipSoundDist=16.0f);
@@ -287,17 +287,17 @@ public:
void playMusic(double x, double y, double z, const wstring& string, float volume);
// 4J removed - void addParticle(const wstring& id, double x, double y, double z, double xd, double yd, double zd);
void addParticle(ePARTICLE_TYPE id, double x, double y, double z, double xd, double yd, double zd); // 4J added
virtual bool addGlobalEntity(shared_ptr<Entity> e);
virtual bool addEntity(shared_ptr<Entity> e);
virtual bool addGlobalEntity(std::shared_ptr<Entity> e);
virtual bool addEntity(std::shared_ptr<Entity> e);
protected:
virtual void entityAdded(shared_ptr<Entity> e);
virtual void entityRemoved(shared_ptr<Entity> e);
virtual void playerRemoved(shared_ptr<Entity> e); // 4J added
virtual void entityAdded(std::shared_ptr<Entity> e);
virtual void entityRemoved(std::shared_ptr<Entity> e);
virtual void playerRemoved(std::shared_ptr<Entity> e); // 4J added
public:
virtual void removeEntity(shared_ptr<Entity> e);
void removeEntityImmediately(shared_ptr<Entity> e);
virtual void removeEntity(std::shared_ptr<Entity> e);
void removeEntityImmediately(std::shared_ptr<Entity> e);
void addListener(LevelListener *listener);
void removeListener(LevelListener *listener);
@@ -305,11 +305,11 @@ private:
AABBList boxes;
public:
AABBList *getCubes(shared_ptr<Entity> source, AABB *box, bool noEntities=false, bool blockAtEdge=false); // 4J - added noEntities & blockAtEdge parameters
AABBList *getCubes(std::shared_ptr<Entity> source, AABB *box, bool noEntities=false, bool blockAtEdge=false); // 4J - added noEntities & blockAtEdge parameters
AABBList *getTileCubes(AABB *box, bool blockAtEdge); // 4J Stu - Brought forward from 12w36 to fix #46282 - TU5: Gameplay: Exiting the minecart in a tight corridor damages the player
int getOldSkyDarken(float a); // 4J - change brought forward from 1.8.2
float getSkyDarken(float a); // 4J - change brought forward from 1.8.2
Vec3 *getSkyColor(shared_ptr<Entity> source, float a);
Vec3 *getSkyColor(std::shared_ptr<Entity> source, float a);
float getTimeOfDay(float a);
int getMoonPhase(float a);
float getSunAngle(float a);
@@ -324,29 +324,29 @@ public:
virtual void addToTickNextTick(int x, int y, int z, int tileId, int tickDelay);
virtual void forceAddTileTick(int x, int y, int z, int tileId, int tickDelay);
virtual void tickEntities();
void addAllPendingTileEntities(vector< shared_ptr<TileEntity> >& entities);
void tick(shared_ptr<Entity> e);
virtual void tick(shared_ptr<Entity> e, bool actual);
void addAllPendingTileEntities(vector< std::shared_ptr<TileEntity> >& entities);
void tick(std::shared_ptr<Entity> e);
virtual void tick(std::shared_ptr<Entity> e, bool actual);
bool isUnobstructed(AABB *aabb);
bool isUnobstructed(AABB *aabb, shared_ptr<Entity> ignore);
bool isUnobstructed(AABB *aabb, std::shared_ptr<Entity> ignore);
bool containsAnyBlocks(AABB *box);
bool containsAnyLiquid(AABB *box);
bool containsAnyLiquid_NoLoad(AABB *box); // 4J added
bool containsFireTile(AABB *box);
bool checkAndHandleWater(AABB *box, Material *material, shared_ptr<Entity> e);
bool checkAndHandleWater(AABB *box, Material *material, std::shared_ptr<Entity> e);
bool containsMaterial(AABB *box, Material *material);
bool containsLiquid(AABB *box, Material *material);
// 4J Stu - destroyBlocks param brought forward as part of fix for tnt cannons
shared_ptr<Explosion> explode(shared_ptr<Entity> source, double x, double y, double z, float r, bool destroyBlocks);
virtual shared_ptr<Explosion> explode(shared_ptr<Entity> source, double x, double y, double z, float r, bool fire, bool destroyBlocks);
std::shared_ptr<Explosion> explode(std::shared_ptr<Entity> source, double x, double y, double z, float r, bool destroyBlocks);
virtual std::shared_ptr<Explosion> explode(std::shared_ptr<Entity> source, double x, double y, double z, float r, bool fire, bool destroyBlocks);
float getSeenPercent(Vec3 *center, AABB *bb);
bool extinguishFire(shared_ptr<Player> player, int x, int y, int z, int face);
bool extinguishFire(std::shared_ptr<Player> player, int x, int y, int z, int face);
wstring gatherStats();
wstring gatherChunkSourceStats();
virtual shared_ptr<TileEntity> getTileEntity(int x, int y, int z);
void setTileEntity(int x, int y, int z, shared_ptr<TileEntity> tileEntity);
virtual std::shared_ptr<TileEntity> getTileEntity(int x, int y, int z);
void setTileEntity(int x, int y, int z, std::shared_ptr<TileEntity> tileEntity);
void removeTileEntity(int x, int y, int z);
void markForRemoval(shared_ptr<TileEntity> entity);
void markForRemoval(std::shared_ptr<TileEntity> entity);
virtual bool isSolidRenderTile(int x, int y, int z);
virtual bool isSolidBlockingTile(int x, int y, int z);
bool isSolidBlockingTileInLoadedChunk(int x, int y, int z, bool valueIfNotLoaded);
@@ -413,38 +413,38 @@ public:
virtual vector<TickNextTickData> *fetchTicksInChunk(LevelChunk *chunk, bool remove);
private:
vector<shared_ptr<Entity> > es;
vector<std::shared_ptr<Entity> > es;
public:
bool isClientSide;
vector<shared_ptr<Entity> > *getEntities(shared_ptr<Entity> except, AABB *bb);
vector<shared_ptr<Entity> > *getEntitiesOfClass(const type_info& baseClass, AABB *bb);
shared_ptr<Entity> getClosestEntityOfClass(const type_info& baseClass, AABB *bb, shared_ptr<Entity> source);
vector<shared_ptr<Entity> > getAllEntities();
void tileEntityChanged(int x, int y, int z, shared_ptr<TileEntity> te);
vector<std::shared_ptr<Entity> > *getEntities(std::shared_ptr<Entity> except, AABB *bb);
vector<std::shared_ptr<Entity> > *getEntitiesOfClass(const type_info& baseClass, AABB *bb);
std::shared_ptr<Entity> getClosestEntityOfClass(const type_info& baseClass, AABB *bb, std::shared_ptr<Entity> source);
vector<std::shared_ptr<Entity> > getAllEntities();
void tileEntityChanged(int x, int y, int z, std::shared_ptr<TileEntity> te);
// unsigned int countInstanceOf(BaseObject::Class *clas);
unsigned int countInstanceOf(eINSTANCEOF clas, bool singleType, unsigned int *protectedCount = NULL, unsigned int *couldWanderCount = NULL); // 4J added
unsigned int countInstanceOfInRange(eINSTANCEOF clas, bool singleType, int range, int x, int y, int z); // 4J Added
void addEntities(vector<shared_ptr<Entity> > *list);
virtual void removeEntities(vector<shared_ptr<Entity> > *list);
bool mayPlace(int tileId, int x, int y, int z, bool ignoreEntities, int face, shared_ptr<Entity> ignoreEntity);
void addEntities(vector<std::shared_ptr<Entity> > *list);
virtual void removeEntities(vector<std::shared_ptr<Entity> > *list);
bool mayPlace(int tileId, int x, int y, int z, bool ignoreEntities, int face, std::shared_ptr<Entity> ignoreEntity);
int getSeaLevel();
Path *findPath(shared_ptr<Entity> from, shared_ptr<Entity> to, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat);
Path *findPath(shared_ptr<Entity> from, int xBest, int yBest, int zBest, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat);
Path *findPath(std::shared_ptr<Entity> from, std::shared_ptr<Entity> to, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat);
Path *findPath(std::shared_ptr<Entity> from, int xBest, int yBest, int zBest, float maxDist, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat);
bool getDirectSignal(int x, int y, int z, int dir);
bool hasDirectSignal(int x, int y, int z);
bool getSignal(int x, int y, int z, int dir);
bool hasNeighborSignal(int x, int y, int z);
// 4J Added maxYDist param
shared_ptr<Player> getNearestPlayer(shared_ptr<Entity> source, double maxDist, double maxYDist = -1);
shared_ptr<Player> getNearestPlayer(double x, double y, double z, double maxDist, double maxYDist = -1);
shared_ptr<Player> getNearestPlayer(double x, double z, double maxDist);
shared_ptr<Player> getNearestAttackablePlayer(shared_ptr<Entity> source, double maxDist);
shared_ptr<Player> getNearestAttackablePlayer(double x, double y, double z, double maxDist);
std::shared_ptr<Player> getNearestPlayer(std::shared_ptr<Entity> source, double maxDist, double maxYDist = -1);
std::shared_ptr<Player> getNearestPlayer(double x, double y, double z, double maxDist, double maxYDist = -1);
std::shared_ptr<Player> getNearestPlayer(double x, double z, double maxDist);
std::shared_ptr<Player> getNearestAttackablePlayer(std::shared_ptr<Entity> source, double maxDist);
std::shared_ptr<Player> getNearestAttackablePlayer(double x, double y, double z, double maxDist);
shared_ptr<Player> getPlayerByName(const wstring& name);
shared_ptr<Player> getPlayerByUUID(const wstring& name); // 4J Added
std::shared_ptr<Player> getPlayerByName(const wstring& name);
std::shared_ptr<Player> getPlayerByUUID(const wstring& name); // 4J Added
byteArray getBlocksAndData(int x, int y, int z, int xs, int ys, int zs, bool includeLighting = true);
void setBlocksAndData(int x, int y, int z, int xs, int ys, int zs, byteArray data, bool includeLighting = true);
virtual void disconnect(bool sendDisconnect = true);
@@ -456,9 +456,9 @@ public:
Pos *getSharedSpawnPos();
void setSpawnPos(int x, int y, int z);
void setSpawnPos(Pos *spawnPos);
void ensureAdded(shared_ptr<Entity> entity);
virtual bool mayInteract(shared_ptr<Player> player, int xt, int yt, int zt, int content);
virtual void broadcastEntityEvent(shared_ptr<Entity> e, uint8_t event);
void ensureAdded(std::shared_ptr<Entity> entity);
virtual bool mayInteract(std::shared_ptr<Player> player, int xt, int yt, int zt, int content);
virtual void broadcastEntityEvent(std::shared_ptr<Entity> e, uint8_t event);
ChunkSource *getChunkSource();
virtual void tileEvent(int x, int y, int z, int tile, int b0, int b1);
LevelStorage *getLevelStorage();
@@ -476,11 +476,11 @@ public:
bool isRaining();
bool isRainingAt(int x, int y, int z);
bool isHumidAt(int x, int y, int z);
void setSavedData(const wstring& id, shared_ptr<SavedData> data);
shared_ptr<SavedData> getSavedData(const type_info& clazz, const wstring& id);
void setSavedData(const wstring& id, std::shared_ptr<SavedData> data);
std::shared_ptr<SavedData> getSavedData(const type_info& clazz, const wstring& id);
int getFreeAuxValueFor(const wstring& id);
void levelEvent(int type, int x, int y, int z, int data);
void levelEvent(shared_ptr<Player> source, int type, int x, int y, int z, int data);
void levelEvent(std::shared_ptr<Player> source, int type, int x, int y, int z, int data);
int getMaxBuildHeight();
int getHeight();
Random *getRandomFor(int x, int z, int blend);
+28 -28
View File
@@ -58,7 +58,7 @@ void LevelChunk::init(Level *level, int x, int z)
#else
EnterCriticalSection(&m_csEntities);
#endif
entityBlocks = new vector<shared_ptr<Entity> > *[ENTITY_BLOCKS_LENGTH];
entityBlocks = new vector<std::shared_ptr<Entity> > *[ENTITY_BLOCKS_LENGTH];
#ifdef _ENTITIES_RW_SECTION
LeaveCriticalRWSection(&m_csEntities, true);
#else
@@ -90,7 +90,7 @@ void LevelChunk::init(Level *level, int x, int z)
#endif
for (int i = 0; i < ENTITY_BLOCKS_LENGTH; i++)
{
entityBlocks[i] = new vector<shared_ptr<Entity> >();
entityBlocks[i] = new vector<std::shared_ptr<Entity> >();
}
#ifdef _ENTITIES_RW_SECTION
LeaveCriticalRWSection(&m_csEntities, true);
@@ -1016,7 +1016,7 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data)
// if (_tile > 0 && dynamic_cast<EntityTile *>(Tile::tiles[_tile]) != NULL)
if (_tile > 0 && Tile::tiles[_tile] != NULL && Tile::tiles[_tile]->isEntityTile())
{
shared_ptr<TileEntity> te = getTileEntity(x, y, z);
std::shared_ptr<TileEntity> te = getTileEntity(x, y, z);
if (te == NULL)
{
te = ((EntityTile *) Tile::tiles[_tile])->newTileEntity(level);
@@ -1034,7 +1034,7 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data)
// else if (old > 0 && dynamic_cast<EntityTile *>(Tile::tiles[old]) != NULL)
else if (old > 0 && Tile::tiles[_tile] != NULL && Tile::tiles[_tile]->isEntityTile())
{
shared_ptr<TileEntity> te = getTileEntity(x, y, z);
std::shared_ptr<TileEntity> te = getTileEntity(x, y, z);
if (te != NULL)
{
te->clearCache();
@@ -1074,7 +1074,7 @@ bool LevelChunk::setData(int x, int y, int z, int val, int mask, bool *maskedBit
int _tile = getTile(x, y, z);
if (_tile > 0 && dynamic_cast<EntityTile *>( Tile::tiles[_tile] ) != NULL)
{
shared_ptr<TileEntity> te = getTileEntity(x, y, z);
std::shared_ptr<TileEntity> te = getTileEntity(x, y, z);
if (te != NULL)
{
te->clearCache();
@@ -1166,7 +1166,7 @@ int LevelChunk::getRawBrightness(int x, int y, int z, int skyDampen)
return light;
}
void LevelChunk::addEntity(shared_ptr<Entity> e)
void LevelChunk::addEntity(std::shared_ptr<Entity> e)
{
lastSaveHadEntities = true;
@@ -1200,12 +1200,12 @@ void LevelChunk::addEntity(shared_ptr<Entity> e)
}
void LevelChunk::removeEntity(shared_ptr<Entity> e)
void LevelChunk::removeEntity(std::shared_ptr<Entity> e)
{
removeEntity(e, e->yChunk);
}
void LevelChunk::removeEntity(shared_ptr<Entity> e, int yc)
void LevelChunk::removeEntity(std::shared_ptr<Entity> e, int yc)
{
if (yc < 0) yc = 0;
if (yc >= ENTITY_BLOCKS_LENGTH) yc = ENTITY_BLOCKS_LENGTH - 1;
@@ -1261,14 +1261,14 @@ void LevelChunk::skyBrightnessChanged()
level->setTilesDirty(x0, y0, z0, x1, y1, z1);
}
shared_ptr<TileEntity> LevelChunk::getTileEntity(int x, int y, int z)
std::shared_ptr<TileEntity> LevelChunk::getTileEntity(int x, int y, int z)
{
TilePos pos(x, y, z);
// 4J Stu - Changed as we should not be using the [] accessor (causes an insert when we don't want one)
//shared_ptr<TileEntity> tileEntity = tileEntities[pos];
//std::shared_ptr<TileEntity> tileEntity = tileEntities[pos];
EnterCriticalSection(&m_csTileEntities);
shared_ptr<TileEntity> tileEntity = nullptr;
std::shared_ptr<TileEntity> tileEntity = nullptr;
AUTO_VAR(it, tileEntities.find(pos));
if (it == tileEntities.end())
@@ -1320,7 +1320,7 @@ shared_ptr<TileEntity> LevelChunk::getTileEntity(int x, int y, int z)
return tileEntity;
}
void LevelChunk::addTileEntity(shared_ptr<TileEntity> te)
void LevelChunk::addTileEntity(std::shared_ptr<TileEntity> te)
{
int xx = (int)(te->x - this->x * 16);
int yy = (int)te->y;
@@ -1334,7 +1334,7 @@ void LevelChunk::addTileEntity(shared_ptr<TileEntity> te)
}
}
void LevelChunk::setTileEntity(int x, int y, int z, shared_ptr<TileEntity> tileEntity)
void LevelChunk::setTileEntity(int x, int y, int z, std::shared_ptr<TileEntity> tileEntity)
{
TilePos pos(x, y, z);
@@ -1371,7 +1371,7 @@ void LevelChunk::removeTileEntity(int x, int y, int z)
AUTO_VAR(it, tileEntities.find(pos));
if( it != tileEntities.end() )
{
shared_ptr<TileEntity> te = tileEntities[pos];
std::shared_ptr<TileEntity> te = tileEntities[pos];
tileEntities.erase(pos);
if( te != NULL )
{
@@ -1401,7 +1401,7 @@ void LevelChunk::load()
for (int i = 0; i < entityTags->size(); i++)
{
CompoundTag *teTag = entityTags->get(i);
shared_ptr<Entity> te = EntityIO::loadStatic(teTag, level);
std::shared_ptr<Entity> te = EntityIO::loadStatic(teTag, level);
if (te != NULL)
{
addEntity(te);
@@ -1415,7 +1415,7 @@ void LevelChunk::load()
for (int i = 0; i < tileEntityTags->size(); i++)
{
CompoundTag *teTag = tileEntityTags->get(i);
shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
std::shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
if (te != NULL)
{
addTileEntity(te);
@@ -1428,7 +1428,7 @@ void LevelChunk::load()
}
#endif
vector< shared_ptr<TileEntity> > values;
vector< std::shared_ptr<TileEntity> > values;
EnterCriticalSection(&m_csTileEntities);
for( AUTO_VAR(it, tileEntities.begin()); it != tileEntities.end(); it++ )
{
@@ -1506,9 +1506,9 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter
for (int i = 0; i < ENTITY_BLOCKS_LENGTH; i++)
{
AUTO_VAR(itEnd, entityBlocks[i]->end());
for( vector<shared_ptr<Entity> >::iterator it = entityBlocks[i]->begin(); it != itEnd; it++ )
for( vector<std::shared_ptr<Entity> >::iterator it = entityBlocks[i]->begin(); it != itEnd; it++ )
{
shared_ptr<Entity> e = *it;
std::shared_ptr<Entity> e = *it;
CompoundTag *teTag = new CompoundTag();
if (e->save(teTag))
{
@@ -1529,10 +1529,10 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter
ListTag<CompoundTag> *tileEntityTags = new ListTag<CompoundTag>();
AUTO_VAR(itEnd,tileEntities.end());
for( unordered_map<TilePos, shared_ptr<TileEntity>, TilePosKeyHash, TilePosKeyEq>::iterator it = tileEntities.begin();
for( unordered_map<TilePos, std::shared_ptr<TileEntity>, TilePosKeyHash, TilePosKeyEq>::iterator it = tileEntities.begin();
it != itEnd; it++)
{
shared_ptr<TileEntity> te = it->second;
std::shared_ptr<TileEntity> te = it->second;
CompoundTag *teTag = new CompoundTag();
te->save(teTag);
tileEntityTags->add(teTag);
@@ -1560,7 +1560,7 @@ void LevelChunk::markUnsaved()
}
void LevelChunk::getEntities(shared_ptr<Entity> except, AABB *bb, vector<shared_ptr<Entity> > &es)
void LevelChunk::getEntities(std::shared_ptr<Entity> except, AABB *bb, vector<std::shared_ptr<Entity> > &es)
{
int yc0 = Mth::floor((bb->y0 - 2) / 16);
int yc1 = Mth::floor((bb->y1 + 2) / 16);
@@ -1573,16 +1573,16 @@ void LevelChunk::getEntities(shared_ptr<Entity> except, AABB *bb, vector<shared_
#endif
for (int yc = yc0; yc <= yc1; yc++)
{
vector<shared_ptr<Entity> > *entities = entityBlocks[yc];
vector<std::shared_ptr<Entity> > *entities = entityBlocks[yc];
AUTO_VAR(itEnd, entities->end());
for (AUTO_VAR(it, entities->begin()); it != itEnd; it++)
{
shared_ptr<Entity> e = *it; //entities->at(i);
std::shared_ptr<Entity> e = *it; //entities->at(i);
if (e != except && e->bb->intersects(bb))
{
es.push_back(e);
vector<shared_ptr<Entity> > *subs = e->getSubEntities();
vector<std::shared_ptr<Entity> > *subs = e->getSubEntities();
if (subs != NULL)
{
for (int j = 0; j < subs->size(); j++)
@@ -1602,7 +1602,7 @@ void LevelChunk::getEntities(shared_ptr<Entity> except, AABB *bb, vector<shared_
#endif
}
void LevelChunk::getEntitiesOfClass(const type_info& ec, AABB *bb, vector<shared_ptr<Entity> > &es)
void LevelChunk::getEntitiesOfClass(const type_info& ec, AABB *bb, vector<std::shared_ptr<Entity> > &es)
{
int yc0 = Mth::floor((bb->y0 - 2) / 16);
int yc1 = Mth::floor((bb->y1 + 2) / 16);
@@ -1630,12 +1630,12 @@ void LevelChunk::getEntitiesOfClass(const type_info& ec, AABB *bb, vector<shared
#endif
for (int yc = yc0; yc <= yc1; yc++)
{
vector<shared_ptr<Entity> > *entities = entityBlocks[yc];
vector<std::shared_ptr<Entity> > *entities = entityBlocks[yc];
AUTO_VAR(itEnd, entities->end());
for (AUTO_VAR(it, entities->begin()); it != itEnd; it++)
{
shared_ptr<Entity> e = *it; //entities->at(i);
std::shared_ptr<Entity> e = *it; //entities->at(i);
bool isAssignableFrom = false;
// Some special cases where the base class is a general type that our class may be derived from, otherwise do a direct comparison of type_info
+10 -10
View File
@@ -100,8 +100,8 @@ private:
bool hasGapsToCheck;
public:
unordered_map<TilePos, shared_ptr<TileEntity>, TilePosKeyHash, TilePosKeyEq> tileEntities;
vector<shared_ptr<Entity> > **entityBlocks;
unordered_map<TilePos, std::shared_ptr<TileEntity>, TilePosKeyHash, TilePosKeyEq> tileEntities;
vector<std::shared_ptr<Entity> > **entityBlocks;
static const int sTerrainPopulatedFromHere = 2;
static const int sTerrainPopulatedFromW = 4;
@@ -188,14 +188,14 @@ public:
virtual void getNeighbourBrightnesses(int *brightnesses, LightLayer::variety layer, int x, int y, int z); // 4J added
virtual void setBrightness(LightLayer::variety layer, int x, int y, int z, int brightness);
virtual int getRawBrightness(int x, int y, int z, int skyDampen);
virtual void addEntity(shared_ptr<Entity> e);
virtual void removeEntity(shared_ptr<Entity> e);
virtual void removeEntity(shared_ptr<Entity> e, int yc);
virtual void addEntity(std::shared_ptr<Entity> e);
virtual void removeEntity(std::shared_ptr<Entity> e);
virtual void removeEntity(std::shared_ptr<Entity> e, int yc);
virtual bool isSkyLit(int x, int y, int z);
virtual void skyBrightnessChanged();
virtual shared_ptr<TileEntity> getTileEntity(int x, int y, int z);
virtual void addTileEntity(shared_ptr<TileEntity> te);
virtual void setTileEntity(int x, int y, int z, shared_ptr<TileEntity> tileEntity);
virtual std::shared_ptr<TileEntity> getTileEntity(int x, int y, int z);
virtual void addTileEntity(std::shared_ptr<TileEntity> te);
virtual void setTileEntity(int x, int y, int z, std::shared_ptr<TileEntity> tileEntity);
virtual void removeTileEntity(int x, int y, int z);
virtual void load();
virtual void unload(bool unloadTileEntities) ; // 4J - added parameter
@@ -203,8 +203,8 @@ public:
virtual bool isUnloaded();
#endif
virtual void markUnsaved();
virtual void getEntities(shared_ptr<Entity> except, AABB *bb, vector<shared_ptr<Entity> > &es);
virtual void getEntitiesOfClass(const type_info& ec, AABB *bb, vector<shared_ptr<Entity> > &es);
virtual void getEntities(std::shared_ptr<Entity> except, AABB *bb, vector<std::shared_ptr<Entity> > &es);
virtual void getEntitiesOfClass(const type_info& ec, AABB *bb, vector<std::shared_ptr<Entity> > &es);
virtual int countEntities();
virtual bool shouldSave(bool force);
virtual int getBlocksAndData(byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int p, bool includeLighting = true); // 4J - added includeLighting parameter
+1 -1
View File
@@ -243,7 +243,7 @@ CompoundTag *LevelData::createTag()
return tag;
}
CompoundTag *LevelData::createTag(vector<shared_ptr<Player> > *players)
CompoundTag *LevelData::createTag(vector<std::shared_ptr<Player> > *players)
{
// 4J - removed all code for storing tags for players
return createTag();
+1 -1
View File
@@ -58,7 +58,7 @@ public:
LevelData(LevelSettings *levelSettings, const wstring& levelName);
LevelData(LevelData *copy);
CompoundTag *createTag();
CompoundTag *createTag(vector<shared_ptr<Player> > *players);
CompoundTag *createTag(vector<std::shared_ptr<Player> > *players);
enum
{
@@ -351,7 +351,7 @@ LevelData *DirectoryLevelStorage::prepareLevel()
return NULL;
}
void DirectoryLevelStorage::saveLevelData(LevelData *levelData, vector<shared_ptr<Player> > *players)
void DirectoryLevelStorage::saveLevelData(LevelData *levelData, vector<std::shared_ptr<Player> > *players)
{
// 4J Jev, removed try/catch
@@ -385,7 +385,7 @@ void DirectoryLevelStorage::saveLevelData(LevelData *levelData)
delete root;
}
void DirectoryLevelStorage::save(shared_ptr<Player> player)
void DirectoryLevelStorage::save(std::shared_ptr<Player> player)
{
// 4J Jev, removed try/catch.
PlayerUID playerXuid = player->getXuid();
@@ -433,7 +433,7 @@ void DirectoryLevelStorage::save(shared_ptr<Player> player)
}
// 4J Changed return val to bool to check if new player or loaded player
bool DirectoryLevelStorage::load(shared_ptr<Player> player)
bool DirectoryLevelStorage::load(std::shared_ptr<Player> player)
{
bool newPlayer = true;
CompoundTag *tag = loadPlayerDataTag( player->getXuid() );
@@ -746,7 +746,7 @@ void DirectoryLevelStorage::dontSaveMapMappingForPlayer(PlayerUID xuid)
#endif
}
void DirectoryLevelStorage::deleteMapFilesForPlayer(shared_ptr<Player> player)
void DirectoryLevelStorage::deleteMapFilesForPlayer(std::shared_ptr<Player> player)
{
PlayerUID playerXuid = player->getXuid();
if(playerXuid != INVALID_XUID) deleteMapFilesForPlayer(playerXuid);
@@ -119,10 +119,10 @@ public:
void checkSession();
virtual ChunkStorage *createChunkStorage(Dimension *dimension);
LevelData *prepareLevel();
virtual void saveLevelData(LevelData *levelData, vector<shared_ptr<Player> > *players);
virtual void saveLevelData(LevelData *levelData, vector<std::shared_ptr<Player> > *players);
virtual void saveLevelData(LevelData *levelData);
virtual void save(shared_ptr<Player> player);
virtual bool load(shared_ptr<Player> player); // 4J Changed return val to bool to check if new player or loaded player
virtual void save(std::shared_ptr<Player> player);
virtual bool load(std::shared_ptr<Player> player); // 4J Changed return val to bool to check if new player or loaded player
virtual CompoundTag *loadPlayerDataTag(PlayerUID xuid);
virtual void clearOldPlayerFiles(); // 4J Added
PlayerIO *getPlayerIO();
@@ -133,7 +133,7 @@ public:
// 4J Added
virtual int getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, int centreZC, int scale);
virtual void saveMapIdLookup();
virtual void deleteMapFilesForPlayer(shared_ptr<Player> player);
virtual void deleteMapFilesForPlayer(std::shared_ptr<Player> player);
virtual void saveAllCachedData();
void resetNetherPlayerPositions(); // 4J Added
static wstring getPlayerDir() { return sc_szPlayerDir; }
@@ -118,9 +118,9 @@ void DirectoryLevelStorageSource::deleteRecursive(vector<File *> *files)
}
}
shared_ptr<LevelStorage> DirectoryLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir)
std::shared_ptr<LevelStorage> DirectoryLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir)
{
return shared_ptr<LevelStorage> (new DirectoryLevelStorage(saveFile, baseDir, levelId, createPlayerDir));
return std::shared_ptr<LevelStorage> (new DirectoryLevelStorage(saveFile, baseDir, levelId, createPlayerDir));
}
bool DirectoryLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId)
@@ -27,7 +27,7 @@ protected:
static void deleteRecursive(vector<File *> *files);
public:
virtual shared_ptr<LevelStorage> selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir);
virtual std::shared_ptr<LevelStorage> selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir);
virtual bool isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId);
virtual bool requiresConversion(ConsoleSaveFile *saveFile, const wstring& levelId);
virtual bool convertLevel(ConsoleSaveFile *saveFile, const wstring& levelId, ProgressListener *progress);
+14 -14
View File
@@ -98,29 +98,29 @@ void EntityIO::staticCtor()
setId(DragonFireball::create, eTYPE_DRAGON_FIREBALL, L"DragonFireball", 1000);
}
shared_ptr<Entity> EntityIO::newEntity(const wstring& id, Level *level)
std::shared_ptr<Entity> EntityIO::newEntity(const wstring& id, Level *level)
{
shared_ptr<Entity> entity;
std::shared_ptr<Entity> entity;
AUTO_VAR(it, idCreateMap->find(id));
if(it != idCreateMap->end() )
{
entityCreateFn create = it->second;
if (create != NULL) entity = shared_ptr<Entity>(create(level));
if (create != NULL) entity = std::shared_ptr<Entity>(create(level));
}
return entity;
}
shared_ptr<Entity> EntityIO::loadStatic(CompoundTag *tag, Level *level)
std::shared_ptr<Entity> EntityIO::loadStatic(CompoundTag *tag, Level *level)
{
shared_ptr<Entity> entity;
std::shared_ptr<Entity> entity;
AUTO_VAR(it, idCreateMap->find(tag->getString(L"id")));
if(it != idCreateMap->end() )
{
entityCreateFn create = it->second;
if (create != NULL) entity = shared_ptr<Entity>(create(level));
if (create != NULL) entity = std::shared_ptr<Entity>(create(level));
}
if (entity != NULL)
@@ -136,15 +136,15 @@ shared_ptr<Entity> EntityIO::loadStatic(CompoundTag *tag, Level *level)
return entity;
}
shared_ptr<Entity> EntityIO::newById(int id, Level *level)
std::shared_ptr<Entity> EntityIO::newById(int id, Level *level)
{
shared_ptr<Entity> entity;
std::shared_ptr<Entity> entity;
AUTO_VAR(it, numCreateMap->find(id));
if(it != numCreateMap->end() )
{
entityCreateFn create = it->second;
if (create != NULL) entity = shared_ptr<Entity>(create(level));
if (create != NULL) entity = std::shared_ptr<Entity>(create(level));
}
if (entity != NULL)
@@ -157,9 +157,9 @@ shared_ptr<Entity> EntityIO::newById(int id, Level *level)
return entity;
}
shared_ptr<Entity> EntityIO::newByEnumType(eINSTANCEOF eType, Level *level)
std::shared_ptr<Entity> EntityIO::newByEnumType(eINSTANCEOF eType, Level *level)
{
shared_ptr<Entity> entity;
std::shared_ptr<Entity> entity;
unordered_map<eINSTANCEOF, int, eINSTANCEOFKeyHash, eINSTANCEOFKeyEq>::iterator it = classNumMap->find( eType );
if( it != classNumMap->end() )
@@ -168,20 +168,20 @@ shared_ptr<Entity> EntityIO::newByEnumType(eINSTANCEOF eType, Level *level)
if(it2 != numCreateMap->end() )
{
entityCreateFn create = it2->second;
if (create != NULL) entity = shared_ptr<Entity>(create(level));
if (create != NULL) entity = std::shared_ptr<Entity>(create(level));
}
}
return entity;
}
int EntityIO::getId(shared_ptr<Entity> entity)
int EntityIO::getId(std::shared_ptr<Entity> entity)
{
unordered_map<eINSTANCEOF, int, eINSTANCEOFKeyHash, eINSTANCEOFKeyEq>::iterator it = classNumMap->find( entity->GetType() );
return (*it).second;
}
wstring EntityIO::getEncodeId(shared_ptr<Entity> entity)
wstring EntityIO::getEncodeId(std::shared_ptr<Entity> entity)
{
unordered_map<eINSTANCEOF, wstring, eINSTANCEOFKeyHash, eINSTANCEOFKeyEq>::iterator it = classIdMap->find( entity->GetType() );
if( it != classIdMap->end() )
+6 -6
View File
@@ -44,12 +44,12 @@ private:
public:
static void staticCtor();
static shared_ptr<Entity> newEntity(const wstring& id, Level *level);
static shared_ptr<Entity> loadStatic(CompoundTag *tag, Level *level);
static shared_ptr<Entity> newById(int id, Level *level);
static shared_ptr<Entity> newByEnumType(eINSTANCEOF eType, Level *level);
static int getId(shared_ptr<Entity> entity);
static wstring getEncodeId(shared_ptr<Entity> entity);
static std::shared_ptr<Entity> newEntity(const wstring& id, Level *level);
static std::shared_ptr<Entity> loadStatic(CompoundTag *tag, Level *level);
static std::shared_ptr<Entity> newById(int id, Level *level);
static std::shared_ptr<Entity> newByEnumType(eINSTANCEOF eType, Level *level);
static int getId(std::shared_ptr<Entity> entity);
static wstring getEncodeId(std::shared_ptr<Entity> entity);
static int getId(const wstring &encodeId);
static wstring getEncodeId(int entityIoValue);
static int getNameId(int entityIoValue);
+1 -1
View File
@@ -10,7 +10,7 @@ class LevelSource
{
public:
virtual int getTile(int x, int y, int z) = 0;
virtual shared_ptr<TileEntity> getTileEntity(int x, int y, int z) = 0;
virtual std::shared_ptr<TileEntity> getTileEntity(int x, int y, int z) = 0;
virtual int getLightColor(int x, int y, int z, int emitt, int tileId = -1) = 0; // 4J - brought forward from 1.8.2, added tileId
virtual float getBrightness(int x, int y, int z, int emitt) = 0;
virtual float getBrightness(int x, int y, int z) = 0;
+1 -1
View File
@@ -21,7 +21,7 @@ public:
virtual LevelData *prepareLevel() = 0;
virtual void checkSession() = 0;
virtual ChunkStorage *createChunkStorage(Dimension *dimension) = 0;
virtual void saveLevelData(LevelData *levelData, vector<shared_ptr<Player> > *players) = 0;
virtual void saveLevelData(LevelData *levelData, vector<std::shared_ptr<Player> > *players) = 0;
virtual void saveLevelData(LevelData *levelData) = 0;
virtual PlayerIO *getPlayerIO() = 0;
virtual void closeAll() = 0;
@@ -26,7 +26,7 @@ ChunkStorage *LevelStorageProfilerDecorator::createChunkStorage(Dimension *dimen
return new ChunkStorageProfilerDecorator(capsulated->createChunkStorage(dimension));
}
void LevelStorageProfilerDecorator::saveLevelData(LevelData *levelData, vector<shared_ptr<Player> > *players)
void LevelStorageProfilerDecorator::saveLevelData(LevelData *levelData, vector<std::shared_ptr<Player> > *players)
{
capsulated->saveLevelData(levelData, players);
}
@@ -18,7 +18,7 @@ public:
LevelData *prepareLevel();
void checkSession();
ChunkStorage *createChunkStorage(Dimension *dimension);
void saveLevelData(LevelData *levelData, vector<shared_ptr<Player> > *players);
void saveLevelData(LevelData *levelData, vector<std::shared_ptr<Player> > *players);
void saveLevelData(LevelData *levelData);
PlayerIO *getPlayerIO();
void closeAll();
@@ -13,7 +13,7 @@ class LevelStorageSource
{
public:
virtual wstring getName() = 0;
virtual shared_ptr<LevelStorage> selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir) = 0;
virtual std::shared_ptr<LevelStorage> selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir) = 0;
virtual vector<LevelSummary *> *getLevelList() = 0;
virtual void clearAll() = 0;
virtual LevelData *getDataTagFor(ConsoleSaveFile *saveFile, const wstring& levelId) = 0;
@@ -23,7 +23,7 @@ MapItemSavedData::MapDecoration::MapDecoration(char img, char x, char y, char ro
this->visible = visible;
}
MapItemSavedData::HoldingPlayer::HoldingPlayer(shared_ptr<Player> player, const MapItemSavedData *parent) : parent( parent ), player( player )
MapItemSavedData::HoldingPlayer::HoldingPlayer(std::shared_ptr<Player> player, const MapItemSavedData *parent) : parent( parent ), player( player )
{
// inited outside of ctor
rowsDirtyMin = intArray(MapItem::IMAGE_WIDTH);
@@ -48,7 +48,7 @@ MapItemSavedData::HoldingPlayer::~HoldingPlayer()
delete lastSentDecorations.data;
}
charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptr<ItemInstance> itemInstance)
charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(std::shared_ptr<ItemInstance> itemInstance)
{
if (--sendPosTick < 0)
{
@@ -125,7 +125,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptr<ItemInsta
}
delete data.data;
}
shared_ptr<ServerPlayer> servPlayer = dynamic_pointer_cast<ServerPlayer>(player);
std::shared_ptr<ServerPlayer> servPlayer = dynamic_pointer_cast<ServerPlayer>(player);
for (int d = 0; d < 10; d++)
{
int column = (tick * 11) % (MapItem::IMAGE_WIDTH);
@@ -223,11 +223,11 @@ void MapItemSavedData::save(CompoundTag *tag)
tag->putByteArray(L"colors", colors);
}
void MapItemSavedData::tickCarriedBy(shared_ptr<Player> player, shared_ptr<ItemInstance> item)
void MapItemSavedData::tickCarriedBy(std::shared_ptr<Player> player, std::shared_ptr<ItemInstance> item)
{
if (carriedByPlayers.find(player) == carriedByPlayers.end())
{
shared_ptr<HoldingPlayer> hp = shared_ptr<HoldingPlayer>( new HoldingPlayer(player, this ) );
std::shared_ptr<HoldingPlayer> hp = std::shared_ptr<HoldingPlayer>( new HoldingPlayer(player, this ) );
carriedByPlayers.insert( playerHoldingPlayerMapType::value_type(player, hp) );
carriedBy.push_back(hp);
}
@@ -245,12 +245,12 @@ void MapItemSavedData::tickCarriedBy(shared_ptr<Player> player, shared_ptr<ItemI
bool addedPlayers = false;
for (AUTO_VAR(it, carriedBy.begin()); it != carriedBy.end(); )
{
shared_ptr<HoldingPlayer> hp = *it;
std::shared_ptr<HoldingPlayer> hp = *it;
// 4J Stu - Players in the same dimension as an item frame with a map need to be sent this data, so don't remove them
if (hp->player->removed ) //|| (!hp->player->inventory->contains(item) && !item->isFramed() ))
{
AUTO_VAR(it2, carriedByPlayers.find( (shared_ptr<Player> ) hp->player ));
AUTO_VAR(it2, carriedByPlayers.find( (std::shared_ptr<Player> ) hp->player ));
if( it2 != carriedByPlayers.end() )
{
carriedByPlayers.erase( it2 );
@@ -268,7 +268,7 @@ void MapItemSavedData::tickCarriedBy(shared_ptr<Player> player, shared_ptr<ItemI
PlayerList *players = MinecraftServer::getInstance()->getPlayerList();
for(AUTO_VAR(it3, players->players.begin()); it3 != players->players.end(); ++it3)
{
shared_ptr<ServerPlayer> serverPlayer = *it3;
std::shared_ptr<ServerPlayer> serverPlayer = *it3;
if(serverPlayer->dimension == 1)
{
atLeastOnePlayerInTheEnd = true;
@@ -354,7 +354,7 @@ void MapItemSavedData::tickCarriedBy(shared_ptr<Player> player, shared_ptr<ItemI
#if 0
for(AUTO_VAR(it,playerLevel->entities.begin()); it != playerLevel->entities.end(); ++it)
{
shared_ptr<Entity> ent = *it;
std::shared_ptr<Entity> ent = *it;
if((ent->GetType() & eTYPE_ENEMY) == 0) continue;
@@ -393,7 +393,7 @@ void MapItemSavedData::tickCarriedBy(shared_ptr<Player> player, shared_ptr<ItemI
PlayerList *players = MinecraftServer::getInstance()->getPlayerList();
for(AUTO_VAR(it3, players->players.begin()); it3 != players->players.end(); ++it3)
{
shared_ptr<ServerPlayer> decorationPlayer = *it3;
std::shared_ptr<ServerPlayer> decorationPlayer = *it3;
if(decorationPlayer!=NULL && decorationPlayer->dimension == this->dimension)
{
float xd = (float) (decorationPlayer->x - x) / (1 << scale);
@@ -470,12 +470,12 @@ void MapItemSavedData::tickCarriedBy(shared_ptr<Player> player, shared_ptr<ItemI
}
}
charArray MapItemSavedData::getUpdatePacket(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player)
charArray MapItemSavedData::getUpdatePacket(std::shared_ptr<ItemInstance> itemInstance, Level *level, std::shared_ptr<Player> player)
{
AUTO_VAR(it, carriedByPlayers.find(player));
if (it == carriedByPlayers.end() ) return charArray();
shared_ptr<HoldingPlayer> hp = it->second;
std::shared_ptr<HoldingPlayer> hp = it->second;
return hp->nextUpdatePacket(itemInstance);
}
@@ -486,7 +486,7 @@ void MapItemSavedData::setDirty(int x, int y0, int y1)
AUTO_VAR(itEnd, carriedBy.end());
for (AUTO_VAR(it, carriedBy.begin()); it != itEnd; it++)
{
shared_ptr<HoldingPlayer> hp = *it; //carriedBy.at(i);
std::shared_ptr<HoldingPlayer> hp = *it; //carriedBy.at(i);
if (hp->rowsDirtyMin[x] < 0 || hp->rowsDirtyMin[x] > y0) hp->rowsDirtyMin[x] = y0;
if (hp->rowsDirtyMax[x] < 0 || hp->rowsDirtyMax[x] < y1) hp->rowsDirtyMax[x] = y1;
}
@@ -534,7 +534,7 @@ void MapItemSavedData::handleComplexItemData(charArray &data)
// 4J Added
// We only have one map per player per dimension, so if they pickup someone elses map we merge their map data with ours
// so that we can see everything that they discovered but still only have one map data ourself
void MapItemSavedData::mergeInMapData(shared_ptr<MapItemSavedData> dataToAdd)
void MapItemSavedData::mergeInMapData(std::shared_ptr<MapItemSavedData> dataToAdd)
{
int w = MapItem::IMAGE_WIDTH;
int h = MapItem::IMAGE_HEIGHT;
@@ -562,7 +562,7 @@ void MapItemSavedData::mergeInMapData(shared_ptr<MapItemSavedData> dataToAdd)
}
}
void MapItemSavedData::removeItemFrameDecoration(shared_ptr<ItemInstance> item)
void MapItemSavedData::removeItemFrameDecoration(std::shared_ptr<ItemInstance> item)
{
AUTO_VAR(frameDecoration, nonPlayerDecorations.find( item->getFrame()->entityId ) );
if ( frameDecoration != nonPlayerDecorations.end() )
@@ -28,7 +28,7 @@ public:
class HoldingPlayer
{
public:
const shared_ptr<Player> player;
const std::shared_ptr<Player> player;
intArray rowsDirtyMin;
intArray rowsDirtyMax;
@@ -42,9 +42,9 @@ public:
public:
// 4J Stu - Had to add a reference to the MapItemSavedData object that created us as we try to access it's member variables
HoldingPlayer(shared_ptr<Player> player, const MapItemSavedData *parent);
HoldingPlayer(std::shared_ptr<Player> player, const MapItemSavedData *parent);
~HoldingPlayer();
charArray nextUpdatePacket(shared_ptr<ItemInstance> itemInstance);
charArray nextUpdatePacket(std::shared_ptr<ItemInstance> itemInstance);
};
public:
@@ -53,10 +53,10 @@ public:
uint8_t scale;
byteArray colors;
int step;
vector<shared_ptr<HoldingPlayer> > carriedBy;
vector<std::shared_ptr<HoldingPlayer> > carriedBy;
private:
typedef unordered_map<shared_ptr<Player> , shared_ptr<HoldingPlayer> , PlayerKeyHash, PlayerKeyEq> playerHoldingPlayerMapType;
typedef unordered_map<std::shared_ptr<Player> , std::shared_ptr<HoldingPlayer> , PlayerKeyHash, PlayerKeyEq> playerHoldingPlayerMapType;
playerHoldingPlayerMapType carriedByPlayers;
public:
@@ -75,15 +75,15 @@ public:
virtual void load(CompoundTag *tag);
virtual void save(CompoundTag *tag);
void tickCarriedBy(shared_ptr<Player> player, shared_ptr<ItemInstance> item);
void tickCarriedBy(std::shared_ptr<Player> player, std::shared_ptr<ItemInstance> item);
charArray getUpdatePacket(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player);
charArray getUpdatePacket(std::shared_ptr<ItemInstance> itemInstance, Level *level, std::shared_ptr<Player> player);
using SavedData::setDirty;
void setDirty(int x, int y0, int y1);
void handleComplexItemData(charArray &data);
// 4J Stu Added
void mergeInMapData(shared_ptr<MapItemSavedData> dataToAdd);
void removeItemFrameDecoration(shared_ptr<ItemInstance> item);
void mergeInMapData(std::shared_ptr<MapItemSavedData> dataToAdd);
void removeItemFrameDecoration(std::shared_ptr<ItemInstance> item);
};
@@ -89,7 +89,7 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension)
return new McRegionChunkStorage(m_saveFile, L"");
}
void McRegionLevelStorage::saveLevelData(LevelData *levelData, vector<shared_ptr<Player> > *players)
void McRegionLevelStorage::saveLevelData(LevelData *levelData, vector<std::shared_ptr<Player> > *players)
{
levelData->setVersion(MCREGION_VERSION_ID);
MemSect(38);
@@ -17,6 +17,6 @@ public:
~McRegionLevelStorage();
virtual ChunkStorage *createChunkStorage(Dimension *dimension);
virtual void saveLevelData(LevelData *levelData, vector<shared_ptr<Player> > *players);
virtual void saveLevelData(LevelData *levelData, vector<std::shared_ptr<Player> > *players);
virtual void closeAll();
};
@@ -74,10 +74,10 @@ void McRegionLevelStorageSource::clearAll()
{
}
shared_ptr<LevelStorage> McRegionLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir)
std::shared_ptr<LevelStorage> McRegionLevelStorageSource::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir)
{
// return new LevelStorageProfilerDecorator(new McRegionLevelStorage(baseDir, levelId, createPlayerDir));
return shared_ptr<LevelStorage>(new McRegionLevelStorage(saveFile, baseDir, levelId, createPlayerDir));
return std::shared_ptr<LevelStorage>(new McRegionLevelStorage(saveFile, baseDir, levelId, createPlayerDir));
}
bool McRegionLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId)
@@ -17,7 +17,7 @@ public:
virtual wstring getName();
virtual vector<LevelSummary *> *getLevelList();
virtual void clearAll();
virtual shared_ptr<LevelStorage> selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir);
virtual std::shared_ptr<LevelStorage> selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, bool createPlayerDir);
virtual bool isConvertible(ConsoleSaveFile *saveFile, const wstring& levelId);
virtual bool requiresConversion(ConsoleSaveFile *saveFile, const wstring& levelId);
virtual bool convertLevel(ConsoleSaveFile *saveFile, const wstring& levelId, ProgressListener *progress);
@@ -26,7 +26,7 @@ ChunkStorage *MemoryLevelStorage::createChunkStorage(Dimension *dimension)
return new MemoryChunkStorage();
}
void MemoryLevelStorage::saveLevelData(LevelData *levelData, vector<shared_ptr<Player> > *players)
void MemoryLevelStorage::saveLevelData(LevelData *levelData, vector<std::shared_ptr<Player> > *players)
{
}
@@ -43,11 +43,11 @@ void MemoryLevelStorage::closeAll()
{
}
void MemoryLevelStorage::save(shared_ptr<Player> player)
void MemoryLevelStorage::save(std::shared_ptr<Player> player)
{
}
bool MemoryLevelStorage::load(shared_ptr<Player> player)
bool MemoryLevelStorage::load(std::shared_ptr<Player> player)
{
return false;
}
@@ -20,12 +20,12 @@ public:
virtual LevelData *prepareLevel();
virtual void checkSession();
virtual ChunkStorage *createChunkStorage(Dimension *dimension);
virtual void saveLevelData(LevelData *levelData, vector<shared_ptr<Player> > *players);
virtual void saveLevelData(LevelData *levelData, vector<std::shared_ptr<Player> > *players);
virtual void saveLevelData(LevelData *levelData);
virtual PlayerIO *getPlayerIO();
virtual void closeAll();
virtual void save(shared_ptr<Player> player);
virtual bool load(shared_ptr<Player> player);
virtual void save(std::shared_ptr<Player> player);
virtual bool load(std::shared_ptr<Player> player);
virtual CompoundTag *loadPlayerDataTag(const wstring& playerName);
virtual ConsoleSavePath getDataFile(const wstring& id);
};
@@ -13,9 +13,9 @@ wstring MemoryLevelStorageSource::getName()
return L"Memory Storage";
}
shared_ptr<LevelStorage> MemoryLevelStorageSource::selectLevel(const wstring& levelId, bool createPlayerDir)
std::shared_ptr<LevelStorage> MemoryLevelStorageSource::selectLevel(const wstring& levelId, bool createPlayerDir)
{
return shared_ptr<LevelStorage> () new MemoryLevelStorage());
return std::shared_ptr<LevelStorage> () new MemoryLevelStorage());
}
vector<LevelSummary *> *MemoryLevelStorageSource::getLevelList()
@@ -8,7 +8,7 @@ class MemoryLevelStorageSource : public LevelStorageSource
public:
MemoryLevelStorageSource();
wstring getName();
shared_ptr<LevelStorage> selectLevel(const wstring& levelId, bool createPlayerDir);
std::shared_ptr<LevelStorage> selectLevel(const wstring& levelId, bool createPlayerDir);
vector<LevelSummary *> *getLevelList();
void clearAll();
LevelData *getDataTagFor(const wstring& levelId);
@@ -21,7 +21,7 @@ ChunkStorage *MockedLevelStorage::createChunkStorage(Dimension *dimension)
return NULL;
}
void MockedLevelStorage::saveLevelData(LevelData *levelData, vector<shared_ptr<Player> > *players)
void MockedLevelStorage::saveLevelData(LevelData *levelData, vector<std::shared_ptr<Player> > *players)
{
}
@@ -11,7 +11,7 @@ public:
virtual LevelData *prepareLevel();
virtual void checkSession();
virtual ChunkStorage *createChunkStorage(Dimension *dimension);
virtual void saveLevelData(LevelData *levelData, vector<shared_ptr<Player> > *players);
virtual void saveLevelData(LevelData *levelData, vector<std::shared_ptr<Player> > *players);
virtual void saveLevelData(LevelData *levelData);
virtual PlayerIO *getPlayerIO();
virtual void closeAll();
@@ -211,9 +211,9 @@ bool OldChunkStorage::saveEntities(LevelChunk *lc, Level *level, CompoundTag *ta
for (int i = 0; i < lc->ENTITY_BLOCKS_LENGTH; i++)
{
AUTO_VAR(itEnd, lc->entityBlocks[i]->end());
for( vector<shared_ptr<Entity> >::iterator it = lc->entityBlocks[i]->begin(); it != itEnd; it++ )
for( vector<std::shared_ptr<Entity> >::iterator it = lc->entityBlocks[i]->begin(); it != itEnd; it++ )
{
shared_ptr<Entity> e = *it;
std::shared_ptr<Entity> e = *it;
lc->lastSaveHadEntities = true;
CompoundTag *teTag = new CompoundTag();
if (e->save(teTag))
@@ -268,10 +268,10 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, DataOutputStream *dos)
ListTag<CompoundTag> *tileEntityTags = new ListTag<CompoundTag>();
AUTO_VAR(itEnd, lc->tileEntities.end());
for( unordered_map<TilePos, shared_ptr<TileEntity>, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin();
for( unordered_map<TilePos, std::shared_ptr<TileEntity>, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin();
it != itEnd; it++)
{
shared_ptr<TileEntity> te = it->second;
std::shared_ptr<TileEntity> te = it->second;
CompoundTag *teTag = new CompoundTag();
te->save(teTag);
tileEntityTags->add(teTag);
@@ -357,10 +357,10 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, CompoundTag *tag)
ListTag<CompoundTag> *tileEntityTags = new ListTag<CompoundTag>();
AUTO_VAR(itEnd, lc->tileEntities.end());
for( unordered_map<TilePos, shared_ptr<TileEntity>, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin();
for( unordered_map<TilePos, std::shared_ptr<TileEntity>, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin();
it != itEnd; it++)
{
shared_ptr<TileEntity> te = it->second;
std::shared_ptr<TileEntity> te = it->second;
CompoundTag *teTag = new CompoundTag();
te->save(teTag);
tileEntityTags->add(teTag);
@@ -402,7 +402,7 @@ void OldChunkStorage::loadEntities(LevelChunk *lc, Level *level, CompoundTag *ta
for (int i = 0; i < entityTags->size(); i++)
{
CompoundTag *teTag = entityTags->get(i);
shared_ptr<Entity> te = EntityIO::loadStatic(teTag, level);
std::shared_ptr<Entity> te = EntityIO::loadStatic(teTag, level);
lc->lastSaveHadEntities = true;
if (te != NULL)
{
@@ -417,7 +417,7 @@ void OldChunkStorage::loadEntities(LevelChunk *lc, Level *level, CompoundTag *ta
for (int i = 0; i < tileEntityTags->size(); i++)
{
CompoundTag *teTag = tileEntityTags->get(i);
shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
std::shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
if (te != NULL)
{
lc->addTileEntity(te);
+3 -3
View File
@@ -10,13 +10,13 @@ class Player;
class PlayerIO
{
public:
virtual void save(shared_ptr<Player> player) = 0;
virtual bool load(shared_ptr<Player> player) = 0; // 4J Changed return val to bool to check if new player or loaded player
virtual void save(std::shared_ptr<Player> player) = 0;
virtual bool load(std::shared_ptr<Player> player) = 0; // 4J Changed return val to bool to check if new player or loaded player
virtual CompoundTag *loadPlayerDataTag(PlayerUID xuid) = 0; // 4J Changed from string name to xuid
// 4J Added
virtual void clearOldPlayerFiles() = 0;
virtual void saveMapIdLookup() = 0;
virtual void deleteMapFilesForPlayer(shared_ptr<Player> player) = 0;
virtual void deleteMapFilesForPlayer(std::shared_ptr<Player> player) = 0;
virtual void saveAllCachedData() = 0;
};
@@ -11,7 +11,7 @@ PortalForcer::PortalForcer()
}
void PortalForcer::force(Level *level, shared_ptr<Entity> e)
void PortalForcer::force(Level *level, std::shared_ptr<Entity> e)
{
if (level->dimension->id == 1)
{
@@ -54,7 +54,7 @@ void PortalForcer::force(Level *level, shared_ptr<Entity> e)
}
bool PortalForcer::findPortal(Level *level, shared_ptr<Entity> e)
bool PortalForcer::findPortal(Level *level, std::shared_ptr<Entity> e)
{
// 4J Stu - Decrease the range at which we search for a portal in the nether given our smaller nether
int r = 16;//* 8;
@@ -133,7 +133,7 @@ bool PortalForcer::findPortal(Level *level, shared_ptr<Entity> e)
}
bool PortalForcer::createPortal(Level *level, shared_ptr<Entity> e)
bool PortalForcer::createPortal(Level *level, std::shared_ptr<Entity> e)
{
// 4J Stu - Increase the range at which we try and create a portal to stop creating them floating in mid air over lava
int r = 16 * 3;
+3 -3
View File
@@ -11,11 +11,11 @@ public:
// 4J Stu Added - Java has no ctor, but we need to initialise random
PortalForcer();
void force(Level *level, shared_ptr<Entity> e);
void force(Level *level, std::shared_ptr<Entity> e);
public:
bool findPortal(Level *level, shared_ptr<Entity> e);
bool findPortal(Level *level, std::shared_ptr<Entity> e);
public:
bool createPortal(Level *level, shared_ptr<Entity> e);
bool createPortal(Level *level, std::shared_ptr<Entity> e);
};
+1 -1
View File
@@ -137,7 +137,7 @@ LevelChunk* Region::getLevelChunk(int x, int y, int z)
shared_ptr<TileEntity> Region::getTileEntity(int x, int y, int z)
std::shared_ptr<TileEntity> Region::getTileEntity(int x, int y, int z)
{
int xc = (x >> 4) - xc1;
int zc = (z >> 4) - zc1;
+1 -1
View File
@@ -23,7 +23,7 @@ public:
virtual ~Region();
bool isAllEmpty();
int getTile(int x, int y, int z);
shared_ptr<TileEntity> getTileEntity(int x, int y, int z);
std::shared_ptr<TileEntity> getTileEntity(int x, int y, int z);
float getBrightness(int x, int y, int z, int emitt);
float getBrightness(int x, int y, int z);
int getLightColor(int x, int y, int z, int emitt, int tileId = -1); // 4J - change brought forward from 1.8.2
@@ -11,8 +11,8 @@
SavedDataStorage::SavedDataStorage(LevelStorage *levelStorage)
{
/*
cache = new unordered_map<wstring, shared_ptr<SavedData> >;
savedDatas = new vector<shared_ptr<SavedData> >;
cache = new unordered_map<wstring, std::shared_ptr<SavedData> >;
savedDatas = new vector<std::shared_ptr<SavedData> >;
usedAuxIds = new unordered_map<wstring, short*>;
*/
@@ -20,12 +20,12 @@ SavedDataStorage::SavedDataStorage(LevelStorage *levelStorage)
loadAuxValues();
}
shared_ptr<SavedData> SavedDataStorage::get(const type_info& clazz, const wstring& id)
std::shared_ptr<SavedData> SavedDataStorage::get(const type_info& clazz, const wstring& id)
{
AUTO_VAR(it, cache.find( id ));
if (it != cache.end()) return (*it).second;
shared_ptr<SavedData> data = nullptr;
std::shared_ptr<SavedData> data = nullptr;
if (levelStorage != NULL)
{
//File file = levelStorage->getDataFile(id);
@@ -37,11 +37,11 @@ shared_ptr<SavedData> SavedDataStorage::get(const type_info& clazz, const wstrin
if( clazz == typeid(MapItemSavedData) )
{
data = dynamic_pointer_cast<SavedData>( shared_ptr<MapItemSavedData>(new MapItemSavedData(id)) );
data = dynamic_pointer_cast<SavedData>( std::shared_ptr<MapItemSavedData>(new MapItemSavedData(id)) );
}
else if( clazz == typeid(Villages) )
{
data = dynamic_pointer_cast<SavedData>( shared_ptr<Villages>(new Villages(id) ) );
data = dynamic_pointer_cast<SavedData>( std::shared_ptr<Villages>(new Villages(id) ) );
}
else
{
@@ -59,13 +59,13 @@ shared_ptr<SavedData> SavedDataStorage::get(const type_info& clazz, const wstrin
if (data != NULL)
{
cache.insert( unordered_map<wstring, shared_ptr<SavedData> >::value_type( id , data ) );
cache.insert( unordered_map<wstring, std::shared_ptr<SavedData> >::value_type( id , data ) );
savedDatas.push_back(data);
}
return data;
}
void SavedDataStorage::set(const wstring& id, shared_ptr<SavedData> data)
void SavedDataStorage::set(const wstring& id, std::shared_ptr<SavedData> data)
{
if (data == NULL)
{
@@ -91,7 +91,7 @@ void SavedDataStorage::save()
AUTO_VAR(itEnd, savedDatas.end());
for (AUTO_VAR(it, savedDatas.begin()); it != itEnd; it++)
{
shared_ptr<SavedData> data = *it; //savedDatas->at(i);
std::shared_ptr<SavedData> data = *it; //savedDatas->at(i);
if (data->isDirty())
{
save(data);
@@ -100,7 +100,7 @@ void SavedDataStorage::save()
}
}
void SavedDataStorage::save(shared_ptr<SavedData> data)
void SavedDataStorage::save(std::shared_ptr<SavedData> data)
{
if (levelStorage == NULL) return;
//File file = levelStorage->getDataFile(data->id);
@@ -9,22 +9,22 @@ class SavedDataStorage
private:
LevelStorage *levelStorage;
typedef unordered_map<wstring, shared_ptr<SavedData> > cacheMapType;
typedef unordered_map<wstring, std::shared_ptr<SavedData> > cacheMapType;
cacheMapType cache;
vector<shared_ptr<SavedData> > savedDatas;
vector<std::shared_ptr<SavedData> > savedDatas;
typedef unordered_map<wstring, short> uaiMapType;
uaiMapType usedAuxIds;
public:
SavedDataStorage(LevelStorage *);
shared_ptr<SavedData> get(const type_info& clazz, const wstring& id);
void set(const wstring& id, shared_ptr<SavedData> data);
std::shared_ptr<SavedData> get(const type_info& clazz, const wstring& id);
void set(const wstring& id, std::shared_ptr<SavedData> data);
void save();
private:
void save(shared_ptr<SavedData> data);
void save(std::shared_ptr<SavedData> data);
void loadAuxValues();
public:
@@ -207,12 +207,12 @@ void ZonedChunkStorage::loadEntities(Level *level, LevelChunk *lc)
int type = tag->getInt(L"_TYPE");
if (type == 0)
{
shared_ptr<Entity> e = EntityIO::loadStatic(tag, level);
std::shared_ptr<Entity> e = EntityIO::loadStatic(tag, level);
if (e != NULL) lc->addEntity(e);
}
else if (type == 1)
{
shared_ptr<TileEntity> te = TileEntity::loadStatic(tag);
std::shared_ptr<TileEntity> te = TileEntity::loadStatic(tag);
if (te != NULL) lc->addTileEntity(te);
}
}
@@ -232,12 +232,12 @@ void ZonedChunkStorage::saveEntities(Level *level, LevelChunk *lc)
#endif
for (int i = 0; i < LevelChunk::ENTITY_BLOCKS_LENGTH; i++)
{
vector<shared_ptr<Entity> > *entities = lc->entityBlocks[i];
vector<std::shared_ptr<Entity> > *entities = lc->entityBlocks[i];
AUTO_VAR(itEndTags, entities->end());
for (AUTO_VAR(it, entities->begin()); it != itEndTags; it++)
{
shared_ptr<Entity> e = *it; //entities->at(j);
std::shared_ptr<Entity> e = *it; //entities->at(j);
CompoundTag *cp = new CompoundTag();
cp->putInt(L"_TYPE", 0);
e->save(cp);
@@ -250,10 +250,10 @@ void ZonedChunkStorage::saveEntities(Level *level, LevelChunk *lc)
LeaveCriticalSection(&lc->m_csEntities);
#endif
for( unordered_map<TilePos, shared_ptr<TileEntity> , TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin();
for( unordered_map<TilePos, std::shared_ptr<TileEntity> , TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin();
it != lc->tileEntities.end(); it++)
{
shared_ptr<TileEntity> te = it->second;
std::shared_ptr<TileEntity> te = it->second;
CompoundTag *cp = new CompoundTag();
cp->putInt(L"_TYPE", 1);
te->save(cp);
+9 -9
View File
@@ -53,15 +53,15 @@ void WaterLevelChunk::setBrightness(LightLayer::variety layer, int x, int y, int
{
}
void WaterLevelChunk::addEntity(shared_ptr<Entity> e)
void WaterLevelChunk::addEntity(std::shared_ptr<Entity> e)
{
}
void WaterLevelChunk::removeEntity(shared_ptr<Entity> e)
void WaterLevelChunk::removeEntity(std::shared_ptr<Entity> e)
{
}
void WaterLevelChunk::removeEntity(shared_ptr<Entity> e, int yc)
void WaterLevelChunk::removeEntity(std::shared_ptr<Entity> e, int yc)
{
}
@@ -69,16 +69,16 @@ void WaterLevelChunk::skyBrightnessChanged()
{
}
shared_ptr<TileEntity> WaterLevelChunk::getTileEntity(int x, int y, int z)
std::shared_ptr<TileEntity> WaterLevelChunk::getTileEntity(int x, int y, int z)
{
return shared_ptr<TileEntity>();
return std::shared_ptr<TileEntity>();
}
void WaterLevelChunk::addTileEntity(shared_ptr<TileEntity> te)
void WaterLevelChunk::addTileEntity(std::shared_ptr<TileEntity> te)
{
}
void WaterLevelChunk::setTileEntity(int x, int y, int z, shared_ptr<TileEntity> tileEntity)
void WaterLevelChunk::setTileEntity(int x, int y, int z, std::shared_ptr<TileEntity> tileEntity)
{
}
@@ -98,11 +98,11 @@ void WaterLevelChunk::markUnsaved()
{
}
void WaterLevelChunk::getEntities(shared_ptr<Entity> except, AABB bb, vector<shared_ptr<Entity> > &es)
void WaterLevelChunk::getEntities(std::shared_ptr<Entity> except, AABB bb, vector<std::shared_ptr<Entity> > &es)
{
}
void WaterLevelChunk::getEntitiesOfClass(const type_info& ec, AABB bb, vector<shared_ptr<Entity> > &es)
void WaterLevelChunk::getEntitiesOfClass(const type_info& ec, AABB bb, vector<std::shared_ptr<Entity> > &es)
{
}
+8 -8
View File
@@ -21,19 +21,19 @@ public:
bool setData(int x, int y, int z, int val, int mask, bool *maskedBitsChanged); // 4J added mask
void setBrightness(LightLayer::variety layer, int x, int y, int z, int brightness);
void setLevelChunkBrightness(LightLayer::variety layer, int x, int y, int z, int brightness); // 4J added - calls the setBrightness method of the parent class
void addEntity(shared_ptr<Entity> e);
void removeEntity(shared_ptr<Entity> e);
void removeEntity(shared_ptr<Entity> e, int yc);
void addEntity(std::shared_ptr<Entity> e);
void removeEntity(std::shared_ptr<Entity> e);
void removeEntity(std::shared_ptr<Entity> e, int yc);
void skyBrightnessChanged();
shared_ptr<TileEntity> getTileEntity(int x, int y, int z);
void addTileEntity(shared_ptr<TileEntity> te);
void setTileEntity(int x, int y, int z, shared_ptr<TileEntity> tileEntity);
std::shared_ptr<TileEntity> getTileEntity(int x, int y, int z);
void addTileEntity(std::shared_ptr<TileEntity> te);
void setTileEntity(int x, int y, int z, std::shared_ptr<TileEntity> tileEntity);
void removeTileEntity(int x, int y, int z);
void load();
void unload(bool unloadTileEntities) ; // 4J - added parameter
void markUnsaved();
void getEntities(shared_ptr<Entity> except, AABB bb, vector<shared_ptr<Entity> > &es);
void getEntitiesOfClass(const type_info& ec, AABB bb, vector<shared_ptr<Entity> > &es);
void getEntities(std::shared_ptr<Entity> except, AABB bb, vector<std::shared_ptr<Entity> > &es);
void getEntitiesOfClass(const type_info& ec, AABB bb, vector<std::shared_ptr<Entity> > &es);
int countEntities();
bool shouldSave(bool force);
void setBlocks(byteArray newBlocks, int sub);