Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.
This reverts commit a9be52c41a.
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
|
||||
WeighedTreasureArray ServerLevel::RANDOM_BONUS_ITEMS;
|
||||
|
||||
C4JThread* ServerLevel::m_updateThread = nullptr;
|
||||
C4JThread* ServerLevel::m_updateThread = NULL;
|
||||
C4JThread::EventArray* ServerLevel::m_updateTrigger;
|
||||
CRITICAL_SECTION ServerLevel::m_updateCS[3];
|
||||
|
||||
@@ -63,7 +63,7 @@ void ServerLevel::staticCtor()
|
||||
InitializeCriticalSection(&m_updateCS[1]);
|
||||
InitializeCriticalSection(&m_updateCS[2]);
|
||||
|
||||
m_updateThread = new C4JThread(runUpdate, nullptr, "Tile update");
|
||||
m_updateThread = new C4JThread(runUpdate, NULL, "Tile update");
|
||||
m_updateThread->SetProcessor(CPU_CORE_TILE_UPDATE);
|
||||
#ifdef __ORBIS__
|
||||
m_updateThread->SetPriority(THREAD_PRIORITY_BELOW_NORMAL); // On Orbis, this core is also used for Matching 2, and that priority of that seems to be always at default no matter what we set it to. Prioritise this below Matching 2.
|
||||
@@ -123,7 +123,7 @@ ServerLevel::ServerLevel(MinecraftServer *server, shared_ptr<LevelStorage>levelS
|
||||
scoreboard = new ServerScoreboard(server);
|
||||
|
||||
//shared_ptr<ScoreboardSaveData> scoreboardSaveData = dynamic_pointer_cast<ScoreboardSaveData>( savedDataStorage->get(typeid(ScoreboardSaveData), ScoreboardSaveData::FILE_ID) );
|
||||
//if (scoreboardSaveData == nullptr)
|
||||
//if (scoreboardSaveData == NULL)
|
||||
//{
|
||||
// scoreboardSaveData = shared_ptr<ScoreboardSaveData>( new ScoreboardSaveData() );
|
||||
// savedDataStorage->set(ScoreboardSaveData::FILE_ID, scoreboardSaveData);
|
||||
@@ -258,7 +258,7 @@ void ServerLevel::tick()
|
||||
{
|
||||
//app.DebugPrintf("Incremental save\n");
|
||||
PIXBeginNamedEvent(0,"Incremental save");
|
||||
save(false, nullptr);
|
||||
save(false, NULL);
|
||||
PIXEndNamedEvent();
|
||||
}
|
||||
|
||||
@@ -313,9 +313,9 @@ void ServerLevel::tick()
|
||||
Biome::MobSpawnerData *ServerLevel::getRandomMobSpawnAt(MobCategory *mobCategory, int x, int y, int z)
|
||||
{
|
||||
vector<Biome::MobSpawnerData *> *mobList = getChunkSource()->getMobsAt(mobCategory, x, y, z);
|
||||
if (mobList == nullptr || mobList->empty()) return nullptr;
|
||||
if (mobList == NULL || mobList->empty()) return NULL;
|
||||
|
||||
return static_cast<Biome::MobSpawnerData *>(WeighedRandom::getRandomItem(random, (vector<WeighedRandomItem *> *)mobList));
|
||||
return (Biome::MobSpawnerData *) WeighedRandom::getRandomItem(random, (vector<WeighedRandomItem *> *)mobList);
|
||||
}
|
||||
|
||||
void ServerLevel::updateSleepingPlayerList()
|
||||
@@ -433,7 +433,7 @@ void ServerLevel::tickTiles()
|
||||
if( hasChunkAt(x,y,z) )
|
||||
{
|
||||
int id = getTile(x,y,z);
|
||||
if (Tile::tiles[id] != nullptr && Tile::tiles[id]->isTicking())
|
||||
if (Tile::tiles[id] != NULL && Tile::tiles[id]->isTicking())
|
||||
{
|
||||
/*if(id == 2) ++grassTicks;
|
||||
else if(id == 11) ++lavaTicks;
|
||||
@@ -497,7 +497,7 @@ void ServerLevel::tickTiles()
|
||||
|
||||
if (isRainingAt(x, y, z))
|
||||
{
|
||||
addGlobalEntity(std::make_shared<LightningBolt>(this, x, y, z));
|
||||
addGlobalEntity( shared_ptr<LightningBolt>( new LightningBolt(this, x, y, z) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,8 +640,8 @@ void ServerLevel::resetEmptyTime()
|
||||
bool ServerLevel::tickPendingTicks(bool force)
|
||||
{
|
||||
EnterCriticalSection(&m_tickNextTickCS);
|
||||
int count = static_cast<int>(tickNextTickList.size());
|
||||
int count2 = static_cast<int>(tickNextTickSet.size());
|
||||
int count = (int)tickNextTickList.size();
|
||||
int count2 = (int)tickNextTickSet.size();
|
||||
if (count != tickNextTickSet.size())
|
||||
{
|
||||
// TODO 4J Stu - Add new exception types
|
||||
@@ -685,8 +685,8 @@ bool ServerLevel::tickPendingTicks(bool force)
|
||||
|
||||
toBeTicked.clear();
|
||||
|
||||
int count3 = static_cast<int>(tickNextTickList.size());
|
||||
int count4 = static_cast<int>(tickNextTickSet.size());
|
||||
int count3 = (int)tickNextTickList.size();
|
||||
int count4 = (int)tickNextTickSet.size();
|
||||
|
||||
bool retval = tickNextTickList.size() != 0;
|
||||
LeaveCriticalSection(&m_tickNextTickCS);
|
||||
@@ -776,7 +776,7 @@ void ServerLevel::tick(shared_ptr<Entity> e, bool actual)
|
||||
{
|
||||
e->remove();
|
||||
}
|
||||
if (!server->isNpcsEnabled() && (dynamic_pointer_cast<Npc>(e) != nullptr))
|
||||
if (!server->isNpcsEnabled() && (dynamic_pointer_cast<Npc>(e) != NULL))
|
||||
{
|
||||
e->remove();
|
||||
}
|
||||
@@ -860,7 +860,7 @@ void ServerLevel::setInitialSpawn(LevelSettings *levelSettings)
|
||||
int minXZ = - (dimension->getXZSize() * 16 ) / 2;
|
||||
int maxXZ = (dimension->getXZSize() * 16 ) / 2 - 1;
|
||||
|
||||
if (findBiome != nullptr)
|
||||
if (findBiome != NULL)
|
||||
{
|
||||
xSpawn = findBiome->x;
|
||||
zSpawn = findBiome->z;
|
||||
@@ -914,7 +914,7 @@ void ServerLevel::generateBonusItemsNearSpawn()
|
||||
if( getTile( x, y, z ) == Tile::chest_Id )
|
||||
{
|
||||
shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(getTileEntity(x, y, z));
|
||||
if (chest != nullptr)
|
||||
if (chest != NULL)
|
||||
{
|
||||
if( chest->isBonusChest )
|
||||
{
|
||||
@@ -960,7 +960,7 @@ void ServerLevel::save(bool force, ProgressListener *progressListener, bool bAut
|
||||
if(StorageManager.GetSaveDisabled()) return;
|
||||
|
||||
|
||||
if (progressListener != nullptr)
|
||||
if (progressListener != NULL)
|
||||
{
|
||||
if(bAutosave)
|
||||
{
|
||||
@@ -976,7 +976,7 @@ void ServerLevel::save(bool force, ProgressListener *progressListener, bool bAut
|
||||
saveLevelData();
|
||||
PIXEndNamedEvent();
|
||||
|
||||
if (progressListener != nullptr) progressListener->progressStage(IDS_PROGRESS_SAVING_CHUNKS);
|
||||
if (progressListener != NULL) progressListener->progressStage(IDS_PROGRESS_SAVING_CHUNKS);
|
||||
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
// Our autosave is a minimal save. All the chunks are saves by the constant save process
|
||||
@@ -1009,7 +1009,7 @@ void ServerLevel::save(bool force, ProgressListener *progressListener, bool bAut
|
||||
|
||||
//if( force && !isClientSide )
|
||||
//{
|
||||
// if (progressListener != nullptr) progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
|
||||
// if (progressListener != NULL) progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
|
||||
// levelStorage->flushSaveFile();
|
||||
//}
|
||||
}
|
||||
@@ -1024,7 +1024,7 @@ void ServerLevel::saveToDisc(ProgressListener *progressListener, bool autosave)
|
||||
if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin())
|
||||
{
|
||||
TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected();
|
||||
DLCTexturePack *pDLCTexPack=static_cast<DLCTexturePack *>(tPack);
|
||||
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack;
|
||||
|
||||
DLCPack * pDLCPack=pDLCTexPack->getDLCInfoParentPack();
|
||||
|
||||
@@ -1034,7 +1034,7 @@ void ServerLevel::saveToDisc(ProgressListener *progressListener, bool autosave)
|
||||
}
|
||||
}
|
||||
|
||||
if (progressListener != nullptr) progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
|
||||
if (progressListener != NULL) progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
|
||||
levelStorage->flushSaveFile(autosave);
|
||||
}
|
||||
|
||||
@@ -1085,7 +1085,7 @@ bool ServerLevel::addGlobalEntity(shared_ptr<Entity> e)
|
||||
{
|
||||
if (Level::addGlobalEntity(e))
|
||||
{
|
||||
server->getPlayers()->broadcast(e->x, e->y, e->z, 512, dimension->id, std::make_shared<AddGlobalEntityPacket>(e));
|
||||
server->getPlayers()->broadcast(e->x, e->y, e->z, 512, dimension->id, shared_ptr<AddGlobalEntityPacket>( new AddGlobalEntityPacket(e) ) );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -1093,7 +1093,7 @@ bool ServerLevel::addGlobalEntity(shared_ptr<Entity> e)
|
||||
|
||||
void ServerLevel::broadcastEntityEvent(shared_ptr<Entity> e, byte event)
|
||||
{
|
||||
shared_ptr<Packet> p = std::make_shared<EntityEventPacket>(e->entityId, event);
|
||||
shared_ptr<Packet> p = shared_ptr<EntityEventPacket>( new EntityEventPacket(e->entityId, event) );
|
||||
server->getLevel(dimension->id)->getTracker()->broadcastAndSend(e, p);
|
||||
}
|
||||
|
||||
@@ -1101,7 +1101,7 @@ shared_ptr<Explosion> ServerLevel::explode(shared_ptr<Entity> source, double x,
|
||||
{
|
||||
// instead of calling super, we run the same explosion code here except
|
||||
// we don't generate any particles
|
||||
shared_ptr<Explosion> explosion = std::make_shared<Explosion>(this, source, x, y, z, r);
|
||||
shared_ptr<Explosion> explosion = shared_ptr<Explosion>( new Explosion(this, source, x, y, z, r) );
|
||||
explosion->fire = fire;
|
||||
explosion->destroyBlocks = destroyBlocks;
|
||||
explosion->explode();
|
||||
@@ -1122,7 +1122,7 @@ shared_ptr<Explosion> ServerLevel::explode(shared_ptr<Entity> source, double x,
|
||||
if( sentTo.size() )
|
||||
{
|
||||
INetworkPlayer *thisPlayer = player->connection->getNetworkPlayer();
|
||||
if( thisPlayer == nullptr )
|
||||
if( thisPlayer == NULL )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1131,7 +1131,7 @@ shared_ptr<Explosion> ServerLevel::explode(shared_ptr<Entity> source, double x,
|
||||
for(auto& player2 : sentTo)
|
||||
{
|
||||
INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer();
|
||||
if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) )
|
||||
if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) )
|
||||
{
|
||||
knockbackOnly = true;
|
||||
}
|
||||
@@ -1144,7 +1144,7 @@ shared_ptr<Explosion> ServerLevel::explode(shared_ptr<Entity> source, double x,
|
||||
Vec3 *knockbackVec = explosion->getHitPlayerKnockback(player);
|
||||
//app.DebugPrintf("Sending %s with knockback (%f,%f,%f)\n", knockbackOnly?"knockbackOnly":"allExplosion",knockbackVec->x,knockbackVec->y,knockbackVec->z);
|
||||
// If the player is not the primary on the system, then we only want to send info for the knockback
|
||||
player->connection->send(std::make_shared<ExplodePacket>(x, y, z, r, &explosion->toBlow, knockbackVec, knockbackOnly));
|
||||
player->connection->send( shared_ptr<ExplodePacket>( new ExplodePacket(x, y, z, r, &explosion->toBlow, knockbackVec, knockbackOnly)));
|
||||
sentTo.push_back( player );
|
||||
}
|
||||
}
|
||||
@@ -1182,7 +1182,7 @@ void ServerLevel::runTileEvents()
|
||||
if (doTileEvent(&it))
|
||||
{
|
||||
TileEventData te = it;
|
||||
server->getPlayers()->broadcast(te.getX(), te.getY(), te.getZ(), 64, dimension->id, std::make_shared<TileEventPacket>(te.getX(), te.getY(), te.getZ(), te.getTile(), te.getParamA(), te.getParamB()));
|
||||
server->getPlayers()->broadcast(te.getX(), te.getY(), te.getZ(), 64, dimension->id, shared_ptr<TileEventPacket>( new TileEventPacket(te.getX(), te.getY(), te.getZ(), te.getTile(), te.getParamA(), te.getParamB())));
|
||||
}
|
||||
}
|
||||
tileEvents[runList].clear();
|
||||
@@ -1212,11 +1212,11 @@ void ServerLevel::tickWeather()
|
||||
{
|
||||
if (wasRaining)
|
||||
{
|
||||
server->getPlayers()->broadcastAll(std::make_shared<GameEventPacket>(GameEventPacket::STOP_RAINING, 0));
|
||||
server->getPlayers()->broadcastAll( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::STOP_RAINING, 0) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
server->getPlayers()->broadcastAll(std::make_shared<GameEventPacket>(GameEventPacket::START_RAINING, 0));
|
||||
server->getPlayers()->broadcastAll( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::START_RAINING, 0) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1268,7 +1268,7 @@ void ServerLevel::sendParticles(const wstring &name, double x, double y, double
|
||||
|
||||
void ServerLevel::sendParticles(const wstring &name, double x, double y, double z, int count, double xDist, double yDist, double zDist, double speed)
|
||||
{
|
||||
shared_ptr<Packet> packet = std::make_shared<LevelParticlesPacket>( name, static_cast<float>(x), static_cast<float>(y), static_cast<float>(z), static_cast<float>(xDist), static_cast<float>(yDist), static_cast<float>(zDist), static_cast<float>(speed), count );
|
||||
shared_ptr<Packet> packet = std::make_shared<LevelParticlesPacket>( name, (float) x, (float) y, (float) z, (float) xDist, (float) yDist, (float) zDist, (float) speed, count );
|
||||
|
||||
for(auto& it : players)
|
||||
{
|
||||
@@ -1578,7 +1578,7 @@ int ServerLevel::runUpdate(void* lpParam)
|
||||
if( (id == Tile::grass_Id && grassTicks >= MAX_GRASS_TICKS) || (id == Tile::calmLava_Id && lavaTicks >= MAX_LAVA_TICKS) ) continue;
|
||||
|
||||
// 4J Stu - Added shouldTileTick as some tiles won't even do anything if they are set to tick and use up one of our updates
|
||||
if (Tile::tiles[id] != nullptr && Tile::tiles[id]->isTicking() && Tile::tiles[id]->shouldTileTick(m_level[iLev],x + (cx * 16), y, z + (cz * 16) ) )
|
||||
if (Tile::tiles[id] != NULL && Tile::tiles[id]->isTicking() && Tile::tiles[id]->shouldTileTick(m_level[iLev],x + (cx * 16), y, z + (cz * 16) ) )
|
||||
{
|
||||
if(id == Tile::grass_Id) ++grassTicks;
|
||||
else if(id == Tile::calmLava_Id) ++lavaTicks;
|
||||
|
||||
Reference in New Issue
Block a user