Merge pull request #356 from MatthewBeshay/cleanup/nullptr-replacement

refactor: replace NULL with nullptr across C++ codebase
This commit is contained in:
Tropical 2026-03-30 00:35:20 -05:00 committed by GitHub
commit c8f59b4a99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
752 changed files with 5396 additions and 5396 deletions

View file

@ -27,7 +27,7 @@ void TeleportCommand::execute(std::shared_ptr<CommandSender> source,
std::shared_ptr<ServerPlayer> destination =
players->getPlayer(destinationID);
if (subject != NULL && destination != NULL &&
if (subject != nullptr && destination != nullptr &&
subject->level->dimension->id == destination->level->dimension->id &&
subject->isAlive()) {
subject->ride(nullptr);

View file

@ -35,7 +35,7 @@ void CreativeMode::adjustPlayer(std::shared_ptr<Player> player) {
enableCreativeForPlayer(player);
for (int i = 0; i < 9; i++) {
if (player->inventory->items[i] == NULL) {
if (player->inventory->items[i] == nullptr) {
player->inventory->items[i] = std::shared_ptr<ItemInstance>(
new ItemInstance(User::allowedTiles[i]));
} else {
@ -61,7 +61,7 @@ bool CreativeMode::useItemOn(std::shared_ptr<Player> player, Level* level,
if (t > 0) {
if (Tile::tiles[t]->use(level, x, y, z, player)) return true;
}
if (item == NULL) return false;
if (item == nullptr) return false;
int aux = item->getAuxValue();
int count = item->count;
bool success = item->useOn(player, level, x, y, z, face);

View file

@ -16,7 +16,7 @@ public:
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
std::shared_ptr<ItemInstance> item, int x, int y,
int z, int face, bool bTestUseOnOnly = false,
bool* pbUsedItem = NULL);
bool* pbUsedItem = nullptr);
virtual void startDestroyBlock(int x, int y, int z, int face);
virtual void continueDestroyBlock(int x, int y, int z, int face);
virtual void stopDestroyBlock();

View file

@ -20,7 +20,7 @@ void GameMode::initLevel(Level* level) {}
bool GameMode::destroyBlock(int x, int y, int z, int face) {
Level* level = minecraft->level;
Tile* oldTile = Tile::tiles[level->getTile(x, y, z)];
if (oldTile == NULL) return false;
if (oldTile == nullptr) return false;
// 4J - Let the rendering side of thing know we are about to destroy the
// tile, so we can synchronise collision with async render data upates.
@ -37,7 +37,7 @@ bool GameMode::destroyBlock(int x, int y, int z, int face) {
level->getChunkAt(x, z)->recalcHeightmapOnly();
bool changed = level->setTile(x, y, z, 0);
if (oldTile != NULL && changed) {
if (oldTile != nullptr && changed) {
oldTile->destroy(level, x, y, z, data);
}
return changed;
@ -91,7 +91,7 @@ void GameMode::adjustPlayer(std::shared_ptr<Player> player) {}
// }
// }
//
// if (item == NULL) return false;
// if (item == nullptr) return false;
// return item->useOn(player, level, x, y, z, face, bTestUseOnOnly);
// }

View file

@ -35,7 +35,7 @@ public:
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
std::shared_ptr<ItemInstance> item, int x, int y,
int z, int face, bool bTestUseOnOnly = false,
bool* pbUsedItem = NULL) = 0;
bool* pbUsedItem = nullptr) = 0;
virtual std::shared_ptr<Player> createPlayer(Level* level);
virtual bool interact(std::shared_ptr<Player> player,
@ -68,5 +68,5 @@ public:
// 4J Stu - Added for tutorial checks
virtual bool isInputAllowed(int mapping) { return true; }
virtual bool isTutorial() { return false; }
virtual Tutorial* getTutorial() { return NULL; }
virtual Tutorial* getTutorial() { return nullptr; }
};

View file

@ -155,8 +155,8 @@ void Options::init() {
keyMappings[12] = keyPickItem;
keyMappings[13] = keyToggleFog;
minecraft = NULL;
// optionsFile = NULL;
minecraft = nullptr;
// optionsFile = nullptr;
difficulty = 2;
hideGui = false;
@ -370,7 +370,7 @@ void Options::load() {
std::wstring line = L"";
while ((line = br->readLine()) !=
L"") // 4J - was check against NULL - do we need to distinguish
L"") // 4J - was check against nullptr - do we need to distinguish
// between empty lines and a fail here?
{
// 4J - removed try/catch

View file

@ -20,7 +20,7 @@ SurvivalMode::SurvivalMode(Minecraft* minecraft) : GameMode(minecraft) {
destroyDelay = 0;
if (ClientConstants::IS_DEMO_VERSION) {
if (dynamic_cast<DemoMode*>(this) == NULL) {
if (dynamic_cast<DemoMode*>(this) == nullptr) {
assert(false);
// throw new IllegalStateException("Invalid game mode");
// // 4J - removed
@ -55,7 +55,7 @@ bool SurvivalMode::destroyBlock(int x, int y, int z, int face) {
std::shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem();
bool couldDestroy = minecraft->player->canDestroy(Tile::tiles[t]);
if (item != NULL) {
if (item != nullptr) {
item->mineBlock(t, x, y, z, minecraft->player);
if (item->count == 0) {
minecraft->player->removeSelectedItem();
@ -98,7 +98,7 @@ void SurvivalMode::continueDestroyBlock(int x, int y, int z, int face) {
destroyProgress += tile->getDestroyProgress(minecraft->player);
if (destroyTicks % 4 == 0) {
if (tile != NULL) {
if (tile != nullptr) {
minecraft->soundEngine->play(
tile->soundType->getStepSound(), x + 0.5f, y + 0.5f,
z + 0.5f, (tile->soundType->getVolume() + 1) / 8,
@ -164,7 +164,7 @@ bool SurvivalMode::useItemOn(std::shared_ptr<Player> player, Level* level,
if (t > 0) {
if (Tile::tiles[t]->use(level, x, y, z, player)) return true;
}
if (item == NULL) return false;
if (item == nullptr) return false;
return item->useOn(player, level, x, y, z, face);
}

View file

@ -29,6 +29,6 @@ public:
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
std::shared_ptr<ItemInstance> item, int x, int y,
int z, int face, bool bTestUseOnOnly = false,
bool* pbUsedItem = NULL);
bool* pbUsedItem = nullptr);
virtual bool hasExperience();
};

View file

@ -12,7 +12,7 @@ DerivedServerLevel::DerivedServerLevel(
// delete the current one
if (this->savedDataStorage) {
delete this->savedDataStorage;
this->savedDataStorage = NULL;
this->savedDataStorage = nullptr;
}
this->savedDataStorage = wrapped->savedDataStorage;
levelData = new DerivedLevelData(wrapped->getLevelData());
@ -21,7 +21,7 @@ DerivedServerLevel::DerivedServerLevel(
DerivedServerLevel::~DerivedServerLevel() {
// we didn't allocate savedDataStorage here, so we don't want the level
// destructor to delete it
this->savedDataStorage = NULL;
this->savedDataStorage = nullptr;
}
void DerivedServerLevel::saveLevelData() {

View file

@ -45,7 +45,7 @@ MultiPlayerLevel::MultiPlayerLevel(ClientConnection* connection,
levelData->setInitialized(true);
}
if (connection != NULL) {
if (connection != nullptr) {
this->connections.push_back(connection);
}
this->difficulty = difficulty;
@ -57,7 +57,7 @@ MultiPlayerLevel::MultiPlayerLevel(ClientConnection* connection,
// setSpawnPos(new Pos(8, 64, 8));
// The base ctor already has made some storage, so need to delete that
if (this->savedDataStorage) delete savedDataStorage;
if (connection != NULL) {
if (connection != nullptr) {
savedDataStorage = connection->savedDataStorage;
}
unshareCheckX = 0;
@ -73,7 +73,7 @@ MultiPlayerLevel::MultiPlayerLevel(ClientConnection* connection,
MultiPlayerLevel::~MultiPlayerLevel() {
// Don't let the base class delete this, it comes from the connection for
// multiplayerlevels, and we'll delete there
this->savedDataStorage = NULL;
this->savedDataStorage = nullptr;
}
void MultiPlayerLevel::unshareChunkAt(int x, int z) {
@ -459,7 +459,7 @@ void MultiPlayerLevel::entityRemoved(std::shared_ptr<Entity> e) {
void MultiPlayerLevel::putEntity(int id, std::shared_ptr<Entity> e) {
std::shared_ptr<Entity> old = getEntity(id);
if (old != NULL) {
if (old != nullptr) {
removeEntity(old);
}
@ -626,7 +626,7 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/) {
Tickable* MultiPlayerLevel::makeSoundUpdater(
std::shared_ptr<Minecart> minecart) {
return NULL; // new MinecartSoundUpdater(minecraft->soundEngine, minecart,
return nullptr; // new MinecartSoundUpdater(minecraft->soundEngine, minecart,
// minecraft->player);
}
@ -730,7 +730,7 @@ void MultiPlayerLevel::animateTickDoWork() {
}
}
Minecraft::GetInstance()->animateTickLevel = NULL;
Minecraft::GetInstance()->animateTickLevel = nullptr;
delete animateRandom;
chunksToAnimate.clear();
@ -850,7 +850,7 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() {
while (it != entities.end()) {
std::shared_ptr<Entity> e = *it; // entities.at(i);
if (e->riding != NULL) {
if (e->riding != nullptr) {
if (e->riding->removed || e->riding->rider.lock() != e) {
e->riding->rider = std::weak_ptr<Entity>();
e->riding = nullptr;
@ -915,11 +915,11 @@ void MultiPlayerLevel::removeUnusedTileEntitiesInRegion(int x0, int y0, int z0,
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 &&
te->y < y1 && te->z < z1) {
LevelChunk* lc = getChunk(te->x >> 4, te->z >> 4);
if (lc != NULL) {
if (lc != nullptr) {
// Only remove tile entities where this is no longer a tile
// entity
int tileId = lc->getTile(te->x & 15, te->y, te->z & 15);
if (Tile::tiles[tileId] == NULL ||
if (Tile::tiles[tileId] == nullptr ||
!Tile::tiles[tileId]->isEntityTile()) {
tileEntityList[i] = tileEntityList.back();
tileEntityList.pop_back();

View file

@ -43,7 +43,7 @@
WeighedTreasureArray ServerLevel::RANDOM_BONUS_ITEMS;
C4JThread* ServerLevel::m_updateThread = NULL;
C4JThread* ServerLevel::m_updateThread = nullptr;
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, NULL, "Tile update");
m_updateThread = new C4JThread(runUpdate, nullptr, "Tile update");
m_updateThread->SetProcessor(CPU_CORE_TILE_UPDATE);
m_updateThread->Run();
@ -141,7 +141,7 @@ ServerLevel::ServerLevel(MinecraftServer* server,
// shared_ptr<ScoreboardSaveData> scoreboardSaveData =
// std::dynamic_pointer_cast<ScoreboardSaveData>(
// savedDataStorage->get(typeid(ScoreboardSaveData),
// ScoreboardSaveData::FILE_ID) ); if (scoreboardSaveData == NULL)
// ScoreboardSaveData::FILE_ID) ); if (scoreboardSaveData == nullptr)
//{
// scoreboardSaveData = shared_ptr<ScoreboardSaveData>( new
// ScoreboardSaveData() );
@ -292,7 +292,7 @@ void ServerLevel::tick() {
{
// app.DebugPrintf("Incremental save\n");
PIXBeginNamedEvent(0, "Incremental save");
save(false, NULL);
save(false, nullptr);
PIXEndNamedEvent();
}
@ -351,7 +351,7 @@ Biome::MobSpawnerData* ServerLevel::getRandomMobSpawnAt(
MobCategory* mobCategory, int x, int y, int z) {
std::vector<Biome::MobSpawnerData*>* mobList =
getChunkSource()->getMobsAt(mobCategory, x, y, z);
if (mobList == NULL || mobList->empty()) return NULL;
if (mobList == nullptr || mobList->empty()) return nullptr;
return (Biome::MobSpawnerData*)WeighedRandom::getRandomItem(
random, (std::vector<WeighedRandomItem*>*)mobList);
@ -462,7 +462,7 @@ void ServerLevel::tickTiles() {
int z = m_updateTileZ[iLev][i];
if (hasChunkAt(x, y, z)) {
int id = getTile(x, y, z);
if (Tile::tiles[id] != NULL && Tile::tiles[id]->isTicking()) {
if (Tile::tiles[id] != nullptr && Tile::tiles[id]->isTicking()) {
/*if(id == 2) ++grassTicks;
else if(id == 11) ++lavaTicks;
else ++otherTicks;*/
@ -759,7 +759,7 @@ void ServerLevel::tick(std::shared_ptr<Entity> e, bool actual) {
e->remove();
}
if (!server->isNpcsEnabled() &&
(std::dynamic_pointer_cast<Npc>(e) != NULL)) {
(std::dynamic_pointer_cast<Npc>(e) != nullptr)) {
e->remove();
}
Level::tick(e, actual);
@ -838,7 +838,7 @@ void ServerLevel::setInitialSpawn(LevelSettings* levelSettings) {
int minXZ = -(dimension->getXZSize() * 16) / 2;
int maxXZ = (dimension->getXZSize() * 16) / 2 - 1;
if (findBiome != NULL) {
if (findBiome != nullptr) {
xSpawn = findBiome->x;
zSpawn = findBiome->z;
delete findBiome;
@ -888,7 +888,7 @@ void ServerLevel::generateBonusItemsNearSpawn() {
std::shared_ptr<ChestTileEntity> chest =
std::dynamic_pointer_cast<ChestTileEntity>(
getTileEntity(x, y, z));
if (chest != NULL) {
if (chest != nullptr) {
if (chest->isBonusChest) {
return;
}
@ -929,7 +929,7 @@ void ServerLevel::save(bool force, ProgressListener* progressListener,
// 4J-PB - check that saves are enabled
if (StorageManager.GetSaveDisabled()) return;
if (progressListener != NULL) {
if (progressListener != nullptr) {
if (bAutosave) {
progressListener->progressStartNoAbort(
IDS_PROGRESS_AUTOSAVING_LEVEL);
@ -941,7 +941,7 @@ void ServerLevel::save(bool force, ProgressListener* progressListener,
saveLevelData();
PIXEndNamedEvent();
if (progressListener != NULL)
if (progressListener != nullptr)
progressListener->progressStage(IDS_PROGRESS_SAVING_CHUNKS);
{
@ -967,7 +967,7 @@ void ServerLevel::save(bool force, ProgressListener* progressListener,
// if( force && !isClientSide )
//{
// if (progressListener != NULL)
// if (progressListener != nullptr)
// progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
// levelStorage->flushSaveFile();
// }
@ -992,7 +992,7 @@ void ServerLevel::saveToDisc(ProgressListener* progressListener,
}
}
if (progressListener != NULL)
if (progressListener != nullptr)
progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
levelStorage->flushSaveFile(autosave);
}
@ -1008,7 +1008,7 @@ void ServerLevel::entityAdded(std::shared_ptr<Entity> e) {
Level::entityAdded(e);
entitiesById[e->entityId] = e;
std::vector<std::shared_ptr<Entity> >* es = e->getSubEntities();
if (es != NULL) {
if (es != nullptr) {
// for (int i = 0; i < es.length; i++)
for (auto it = es->begin(); it != es->end(); ++it) {
entitiesById.insert(
@ -1022,7 +1022,7 @@ void ServerLevel::entityRemoved(std::shared_ptr<Entity> e) {
Level::entityRemoved(e);
entitiesById.erase(e->entityId);
std::vector<std::shared_ptr<Entity> >* es = e->getSubEntities();
if (es != NULL) {
if (es != nullptr) {
// for (int i = 0; i < es.length; i++)
for (auto it = es->begin(); it != es->end(); ++it) {
entitiesById.erase((*it)->entityId);
@ -1078,14 +1078,14 @@ std::shared_ptr<Explosion> ServerLevel::explode(std::shared_ptr<Entity> source,
bool knockbackOnly = false;
if (sentTo.size()) {
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
if (thisPlayer == NULL) {
if (thisPlayer == nullptr) {
continue;
} else {
for (unsigned int j = 0; j < sentTo.size(); j++) {
std::shared_ptr<ServerPlayer> player2 = sentTo[j];
INetworkPlayer* otherPlayer =
player2->connection->getNetworkPlayer();
if (otherPlayer != NULL &&
if (otherPlayer != nullptr &&
thisPlayer->IsSameSystem(otherPlayer)) {
knockbackOnly = true;
}
@ -1530,7 +1530,7 @@ int ServerLevel::runUpdate(void* lpParam) {
// 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] != NULL &&
if (Tile::tiles[id] != nullptr &&
Tile::tiles[id]->isTicking() &&
Tile::tiles[id]->shouldTileTick(
m_level[iLev], x + (cx * 16), y, z + (cz * 16))) {

View file

@ -123,7 +123,7 @@ void ServerLevelListener::destroyTileProgress(int id, int x, int y, int z,
for (auto it = server->getPlayers()->players.begin();
it != server->getPlayers()->players.end(); ++it) {
std::shared_ptr<ServerPlayer> p = *it;
if (p == NULL || p->level != level || p->entityId == id) continue;
if (p == nullptr || p->level != level || p->entityId == id) continue;
double xd = (double)x - p->x;
double yd = (double)y - p->y;
double zd = (double)z - p->z;

File diff suppressed because it is too large Load diff

View file

@ -123,8 +123,8 @@ public:
std::shared_ptr<MultiplayerLocalPlayer> createExtraLocalPlayer(
int idx, const std::wstring& name, int pad, int iDimension,
ClientConnection* clientConnection = NULL,
MultiPlayerLevel* levelpassedin = NULL);
ClientConnection* clientConnection = nullptr,
MultiPlayerLevel* levelpassedin = nullptr);
void createPrimaryLocalPlayer(int iPad);
bool setLocalPlayerIdx(int idx);
int getLocalPlayerIdx();

View file

@ -53,7 +53,7 @@
#define DEBUG_SERVER_DONT_SPAWN_MOBS 0
// 4J Added
MinecraftServer* MinecraftServer::server = NULL;
MinecraftServer* MinecraftServer::server = nullptr;
bool MinecraftServer::setTimeAtEndOfTick = false;
int64_t MinecraftServer::setTime = 0;
bool MinecraftServer::setTimeOfDayAtEndOfTick = false;
@ -75,10 +75,10 @@ std::unordered_map<std::wstring, int> MinecraftServer::ironTimers;
MinecraftServer::MinecraftServer() {
// 4J - added initialisers
connection = NULL;
settings = NULL;
players = NULL;
commands = NULL;
connection = nullptr;
settings = nullptr;
players = nullptr;
commands = nullptr;
running = true;
m_bLoaded = false;
stopped = false;
@ -97,7 +97,7 @@ MinecraftServer::MinecraftServer() {
m_texturePackId = 0;
maxBuildHeight = Level::maxBuildHeight;
playerIdleTimeout = 0;
m_postUpdateThread = NULL;
m_postUpdateThread = nullptr;
forceGameType = false;
commandDispatcher = new ServerCommandDispatcher();
@ -165,11 +165,11 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData,
setPlayers(new PlayerList(this));
// 4J-JEV: Need to wait for levelGenerationOptions to load.
while (app.getLevelGenerationOptions() != NULL &&
while (app.getLevelGenerationOptions() != nullptr &&
!app.getLevelGenerationOptions()->hasLoadedData())
std::this_thread::sleep_for(std::chrono::milliseconds(1));
if (app.getLevelGenerationOptions() != NULL &&
if (app.getLevelGenerationOptions() != nullptr &&
!app.getLevelGenerationOptions()->ready()) {
// TODO: Stop loading, add error message.
}
@ -180,7 +180,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData,
std::wstring levelTypeString;
bool gameRuleUseFlatWorld = false;
if (app.getLevelGenerationOptions() != NULL) {
if (app.getLevelGenerationOptions() != nullptr) {
gameRuleUseFlatWorld =
app.getLevelGenerationOptions()->getuseFlatWorld();
}
@ -192,7 +192,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData,
}
LevelType* pLevelType = LevelType::getLevelType(levelTypeString);
if (pLevelType == NULL) {
if (pLevelType == nullptr) {
pLevelType = LevelType::lvl_normal;
}
@ -318,7 +318,7 @@ void MinecraftServer::postProcessTerminate(ProgressRenderer* mcprogress) {
}
} while (status == WAIT_TIMEOUT);
delete m_postUpdateThread;
m_postUpdateThread = NULL;
m_postUpdateThread = nullptr;
DeleteCriticalSection(&m_postProcessCS);
}
@ -353,7 +353,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
// 4J - temp - load existing level
std::shared_ptr<McRegionLevelStorage> storage = nullptr;
bool levelChunksNeedConverted = false;
if (initData->saveData != NULL) {
if (initData->saveData != nullptr) {
// We are loading a file from disk with the data passed in
#if defined(SPLIT_SAVES)
@ -381,12 +381,12 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
#if defined(SPLIT_SAVES)
bool bLevelGenBaseSave = false;
LevelGenerationOptions* levelGen = app.getLevelGenerationOptions();
if (levelGen != NULL && levelGen->requiresBaseSave()) {
if (levelGen != nullptr && levelGen->requiresBaseSave()) {
unsigned int fileSize = 0;
std::uint8_t* pvSaveData = levelGen->getBaseSaveData(fileSize);
if (pvSaveData && fileSize != 0) bLevelGenBaseSave = true;
}
ConsoleSaveFileSplit* newFormatSave = NULL;
ConsoleSaveFileSplit* newFormatSave = nullptr;
if (bLevelGenBaseSave) {
ConsoleSaveFileOriginal oldFormatSave(L"");
newFormatSave = new ConsoleSaveFileSplit(&oldFormatSave);
@ -420,11 +420,11 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
if (i == 0) {
levels[i] =
new ServerLevel(this, storage, name, dimension, levelSettings);
if (app.getLevelGenerationOptions() != NULL) {
if (app.getLevelGenerationOptions() != nullptr) {
LevelGenerationOptions* mapOptions =
app.getLevelGenerationOptions();
Pos* spawnPos = mapOptions->getSpawnPos();
if (spawnPos != NULL) {
if (spawnPos != nullptr) {
levels[i]->setSpawnPos(spawnPos);
}
@ -457,7 +457,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
#endif
levels[i]->getLevelData()->setGameType(gameType);
if (app.getLevelGenerationOptions() != NULL) {
if (app.getLevelGenerationOptions() != nullptr) {
LevelGenerationOptions* mapOptions =
app.getLevelGenerationOptions();
levels[i]->getLevelData()->setHasBeenInCreative(
@ -778,7 +778,7 @@ void MinecraftServer::saveAllChunks() {
// Functional: Gameplay: Saving after sleeping in a bed will place
// player at nighttime when restarting.
ServerLevel* level = levels[levels.length - 1 - i];
if (level) // 4J - added check as level can be NULL if we end up in
if (level) // 4J - added check as level can be nullptr if we end up in
// stopServer really early on due to network failure
{
level->save(true, Minecraft::GetInstance()->progressRenderer);
@ -804,10 +804,10 @@ void MinecraftServer::saveGameRules() {
#endif
{
byteArray ba;
ba.data = NULL;
ba.data = nullptr;
app.m_gameRules.saveGameRules(&ba.data, &ba.length);
if (ba.data != NULL) {
if (ba.data != nullptr) {
ConsoleSaveFile* csf =
getLevel(0)->getLevelStorage()->getSaveFile();
FileEntry* fe =
@ -835,8 +835,8 @@ void MinecraftServer::Suspend() {
QueryPerformanceCounter(&qwTime);
if (m_bLoaded && ProfileManager.IsFullVersion() &&
(!StorageManager.GetSaveDisabled())) {
if (players != NULL) {
players->saveAll(NULL);
if (players != nullptr) {
players->saveAll(nullptr);
}
for (unsigned int j = 0; j < levels.length; j++) {
if (s_bServerHalted) break;
@ -849,7 +849,7 @@ void MinecraftServer::Suspend() {
}
if (!s_bServerHalted) {
saveGameRules();
levels[0]->saveToDisc(NULL, true);
levels[0]->saveToDisc(nullptr, true);
}
}
QueryPerformanceCounter(&qwNewTime);
@ -896,7 +896,7 @@ void MinecraftServer::stopServer(bool didInit) {
// initialisation.
if (m_saveOnExit && ProfileManager.IsFullVersion() &&
(!StorageManager.GetSaveDisabled()) && didInit) {
if (players != NULL) {
if (players != nullptr) {
players->saveAll(Minecraft::GetInstance()->progressRenderer,
true);
}
@ -907,7 +907,7 @@ void MinecraftServer::stopServer(bool didInit) {
// for (unsigned int i = levels.length - 1; i >= 0; i--)
//{
// ServerLevel *level = levels[i];
// if (level != NULL)
// if (level != nullptr)
// {
saveAllChunks();
// }
@ -915,7 +915,7 @@ void MinecraftServer::stopServer(bool didInit) {
saveGameRules();
app.m_gameRules.unloadCurrentGameRules();
if (levels[0] != NULL) // This can be null if stopServer happens
if (levels[0] != nullptr) // This can be null if stopServer happens
// very quickly due to network error
{
levels[0]->saveToDisc(
@ -936,19 +936,19 @@ void MinecraftServer::stopServer(bool didInit) {
// 4J-PB remove the server levels
unsigned int iServerLevelC = levels.length;
for (unsigned int i = 0; i < iServerLevelC; i++) {
if (levels[i] != NULL) {
if (levels[i] != nullptr) {
delete levels[i];
levels[i] = NULL;
levels[i] = nullptr;
}
}
delete connection;
connection = NULL;
connection = nullptr;
delete players;
players = NULL;
players = nullptr;
delete settings;
settings = NULL;
settings = nullptr;
g_NetworkManager.ServerStopped();
}
@ -1047,10 +1047,10 @@ void MinecraftServer::setPlayerIdleTimeout(int playerIdleTimeout) {
extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b;
void MinecraftServer::run(int64_t seed, void* lpParameter) {
NetworkGameInitData* initData = NULL;
NetworkGameInitData* initData = nullptr;
std::uint32_t initSettings = 0;
bool findSeed = false;
if (lpParameter != NULL) {
if (lpParameter != nullptr) {
initData = (NetworkGameInitData*)lpParameter;
initSettings = app.GetGameHostOption(eGameHostOption_All);
findSeed = initData->findSeed;
@ -1178,7 +1178,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
case eXuiServerAction_AutoSaveGame:
case eXuiServerAction_SaveGame:
app.EnterSaveNotificationSection();
if (players != NULL) {
if (players != nullptr) {
players->saveAll(
Minecraft::GetInstance()->progressRenderer);
}
@ -1525,13 +1525,13 @@ void MinecraftServer::main(int64_t seed, void* lpParameter) {
server = new MinecraftServer();
server->run(seed, lpParameter);
delete server;
server = NULL;
server = nullptr;
ShutdownManager::HasFinished(ShutdownManager::eServerThread);
}
void MinecraftServer::HaltServer(bool bPrimaryPlayerSignedOut) {
s_bServerHalted = true;
if (server != NULL) {
if (server != nullptr) {
m_bPrimaryPlayerSignedOut = bPrimaryPlayerSignedOut;
server->halt();
}
@ -1569,7 +1569,7 @@ void MinecraftServer::setLevel(int dimension, ServerLevel* level) {
#if defined(_ACK_CHUNK_SEND_THROTTLING)
bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer* player) {
if (s_hasSentEnoughPackets) return false;
if (player == NULL) return false;
if (player == nullptr) return false;
for (int i = 0; i < s_sentTo.size(); i++) {
if (s_sentTo[i]->IsSameSystem(player)) {
@ -1637,7 +1637,7 @@ void MinecraftServer::chunkPacketManagement_PostTick() {}
#else
// 4J Added
bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer* player) {
if (player == NULL) return false;
if (player == nullptr) return false;
int time = GetTickCount();
if (player->GetSessionIndex() == s_slowQueuePlayerIndex &&
@ -1681,7 +1681,7 @@ void MinecraftServer::cycleSlowQueueIndex() {
if (!g_NetworkManager.IsInSession()) return;
int startingIndex = s_slowQueuePlayerIndex;
INetworkPlayer* currentPlayer = NULL;
INetworkPlayer* currentPlayer = nullptr;
int currentPlayerCount = 0;
do {
currentPlayerCount = g_NetworkManager.GetPlayerCount();
@ -1700,7 +1700,7 @@ void MinecraftServer::cycleSlowQueueIndex() {
s_slowQueuePlayerIndex = 0;
}
} while (g_NetworkManager.IsInSession() && currentPlayerCount > 0 &&
s_slowQueuePlayerIndex != startingIndex && currentPlayer != NULL &&
s_slowQueuePlayerIndex != startingIndex && currentPlayer != nullptr &&
currentPlayer->IsLocal());
// app.DebugPrintf("Cycled slow queue index to %d\n",
// s_slowQueuePlayerIndex);

View file

@ -45,9 +45,9 @@ typedef struct _NetworkGameInitData {
_NetworkGameInitData() {
seed = 0;
saveData = NULL;
saveData = nullptr;
settings = 0;
levelGen = NULL;
levelGen = nullptr;
texturePackId = 0;
findSeed = false;
xzSize = LEVEL_LEGACY_WIDTH;
@ -254,10 +254,10 @@ public:
public:
static PlayerList* getPlayerList() {
if (server != NULL)
if (server != nullptr)
return server->players;
else
return NULL;
return nullptr;
}
static void SetTimeOfDay(int64_t time) {
setTimeOfDayAtEndOfTick = true;

View file

@ -62,9 +62,9 @@ ClientConnection::ClientConnection(Minecraft* minecraft, Socket* socket,
// 4J - added initiliasers
random = new Random();
done = false;
level = NULL;
level = nullptr;
started = false;
savedDataStorage = new SavedDataStorage(NULL);
savedDataStorage = new SavedDataStorage(nullptr);
maxPlayers = 20;
this->minecraft = minecraft;
@ -75,7 +75,7 @@ ClientConnection::ClientConnection(Minecraft* minecraft, Socket* socket,
m_userIndex = iUserIndex;
}
if (socket == NULL) {
if (socket == nullptr) {
socket = new Socket(); // 4J - Local connection
}
@ -83,7 +83,7 @@ ClientConnection::ClientConnection(Minecraft* minecraft, Socket* socket,
if (createdOk) {
connection = new Connection(socket, L"Client", this);
} else {
connection = NULL;
connection = nullptr;
// TODO 4J Stu - This will cause issues since the session player owns
// the socket
// delete socket;
@ -104,10 +104,10 @@ void ClientConnection::tick() {
}
INetworkPlayer* ClientConnection::getNetworkPlayer() {
if (connection != NULL && connection->getSocket() != NULL)
if (connection != nullptr && connection->getSocket() != nullptr)
return connection->getSocket()->getPlayer();
else
return NULL;
return nullptr;
}
void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
@ -115,7 +115,7 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
PlayerUID OnlineXuid;
ProfileManager.GetXUID(m_userIndex, &OnlineXuid, true); // online xuid
MOJANG_DATA* pMojangData = NULL;
MOJANG_DATA* pMojangData = nullptr;
if (!g_NetworkManager.IsLocalGame()) {
pMojangData = app.GetMojangDataForXuid(OnlineXuid);
@ -151,7 +151,7 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
}
if (iUserID != -1) {
std::uint8_t* pBuffer = NULL;
std::uint8_t* pBuffer = nullptr;
unsigned int dwSize = 0;
bool bRes;
@ -208,7 +208,7 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
}
Level* dimensionLevel = minecraft->getLevel(packet->dimension);
if (dimensionLevel == NULL) {
if (dimensionLevel == nullptr) {
level = new MultiPlayerLevel(
this,
new LevelSettings(
@ -220,10 +220,10 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
// 4J Stu - We want to share the SavedDataStorage between levels
int otherDimensionId = packet->dimension == 0 ? -1 : 0;
Level* activeLevel = minecraft->getLevel(otherDimensionId);
if (activeLevel != NULL) {
if (activeLevel != nullptr) {
// Don't need to delete it here as it belongs to a client
// connection while will delete it when it's done
// if( level->savedDataStorage != NULL ) delete
// if( level->savedDataStorage != nullptr ) delete
// level->savedDataStorage;
level->savedDataStorage = activeLevel->savedDataStorage;
}
@ -272,12 +272,12 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
level = (MultiPlayerLevel*)minecraft->getLevel(packet->dimension);
std::shared_ptr<Player> player;
if (level == NULL) {
if (level == nullptr) {
int otherDimensionId = packet->dimension == 0 ? -1 : 0;
MultiPlayerLevel* activeLevel =
minecraft->getLevel(otherDimensionId);
if (activeLevel == NULL) {
if (activeLevel == nullptr) {
otherDimensionId = packet->dimension == 0
? 1
: (packet->dimension == -1 ? 1 : -1);
@ -381,7 +381,7 @@ void ClientConnection::handleAddEntity(
std::shared_ptr<Entity> owner = getEntity(packet->data);
// 4J - check all local players to find match
if (owner == NULL) {
if (owner == nullptr) {
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
if (minecraft->localplayers[i]) {
if (minecraft->localplayers[i]->entityId ==
@ -511,7 +511,7 @@ void ClientConnection::handleAddEntity(
from fishing std::shared_ptr<Entity> owner = getEntity(packet->data);
// 4J - check all local players to find match
if( owner == NULL )
if( owner == nullptr )
{
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
{
@ -528,7 +528,7 @@ void ClientConnection::handleAddEntity(
}
}
std::shared_ptr<Player> player =
std::dynamic_pointer_cast<Player>(owner); if (player != NULL)
std::dynamic_pointer_cast<Player>(owner); if (player != nullptr)
{
std::shared_ptr<FishingHook> hook =
std::shared_ptr<FishingHook>( new FishingHook(level, x, y, z, player) );
@ -585,7 +585,7 @@ void ClientConnection::handleAddEntity(
*/
if (e != NULL) {
if (e != nullptr) {
e->xp = packet->x;
e->yp = packet->y;
e->zp = packet->z;
@ -602,7 +602,7 @@ void ClientConnection::handleAddEntity(
std::vector<std::shared_ptr<Entity> >* subEntities =
e->getSubEntities();
if (subEntities != NULL) {
if (subEntities != nullptr) {
int offs = packet->id - e->entityId;
// for (int i = 0; i < subEntities.length; i++)
for (auto it = subEntities->begin(); it != subEntities->end();
@ -636,7 +636,7 @@ void ClientConnection::handleAddEntity(
std::shared_ptr<Entity> owner = getEntity(packet->data);
// 4J - check all local players to find match
if (owner == NULL) {
if (owner == nullptr) {
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
if (minecraft->localplayers[i]) {
if (minecraft->localplayers[i]->entityId ==
@ -648,7 +648,7 @@ void ClientConnection::handleAddEntity(
}
}
if (owner != NULL && owner->instanceof(eTYPE_LIVINGENTITY)) {
if (owner != nullptr && owner->instanceof(eTYPE_LIVINGENTITY)) {
std::dynamic_pointer_cast<Arrow>(e)->owner =
std::dynamic_pointer_cast<LivingEntity>(owner);
}
@ -685,7 +685,7 @@ void ClientConnection::handleAddGlobalEntity(
std::shared_ptr<Entity> e; // = nullptr;
if (packet->type == AddGlobalEntityPacket::LIGHTNING)
e = std::shared_ptr<LightningBolt>(new LightningBolt(level, x, y, z));
if (e != NULL) {
if (e != nullptr) {
e->xp = packet->x;
e->yp = packet->y;
e->zp = packet->z;
@ -706,7 +706,7 @@ void ClientConnection::handleAddPainting(
void ClientConnection::handleSetEntityMotion(
std::shared_ptr<SetEntityMotionPacket> packet) {
std::shared_ptr<Entity> e = getEntity(packet->id);
if (e == NULL) return;
if (e == nullptr) return;
e->lerpMotion(packet->xa / 8000.0, packet->ya / 8000.0,
packet->za / 8000.0);
}
@ -714,7 +714,7 @@ void ClientConnection::handleSetEntityMotion(
void ClientConnection::handleSetEntityData(
std::shared_ptr<SetEntityDataPacket> packet) {
std::shared_ptr<Entity> e = getEntity(packet->id);
if (e != NULL && packet->getUnpackedData() != NULL) {
if (e != nullptr && packet->getUnpackedData() != nullptr) {
e->getEntityData()->assignValues(packet->getUnpackedData());
}
}
@ -763,7 +763,7 @@ void ClientConnection::handleAddPlayer(
int item = packet->carriedItem;
if (item == 0) {
player->inventory->items[player->inventory->selected] =
std::shared_ptr<ItemInstance>(); // NULL;
std::shared_ptr<ItemInstance>(); // nullptr;
} else {
player->inventory->items[player->inventory->selected] =
std::shared_ptr<ItemInstance>(new ItemInstance(item, 1, 0));
@ -787,13 +787,13 @@ void ClientConnection::handleAddPlayer(
player->customTextureUrl.c_str(), player->name.c_str());
send(std::shared_ptr<TextureAndGeometryPacket>(
new TextureAndGeometryPacket(player->customTextureUrl, NULL,
new TextureAndGeometryPacket(player->customTextureUrl, nullptr,
0)));
}
} else if (!player->customTextureUrl.empty() &&
app.IsFileInMemoryTextures(player->customTextureUrl)) {
// Update the ref count on the memory texture data
app.AddMemoryTextureFile(player->customTextureUrl, NULL, 0);
app.AddMemoryTextureFile(player->customTextureUrl, nullptr, 0);
}
app.DebugPrintf("Custom skin for player %ls is %ls\n", player->name.c_str(),
@ -809,12 +809,12 @@ void ClientConnection::handleAddPlayer(
"player %ls\n",
player->customTextureUrl2.c_str(), player->name.c_str());
send(std::shared_ptr<TexturePacket>(
new TexturePacket(player->customTextureUrl2, NULL, 0)));
new TexturePacket(player->customTextureUrl2, nullptr, 0)));
}
} else if (!player->customTextureUrl2.empty() &&
app.IsFileInMemoryTextures(player->customTextureUrl2)) {
// Update the ref count on the memory texture data
app.AddMemoryTextureFile(player->customTextureUrl2, NULL, 0);
app.AddMemoryTextureFile(player->customTextureUrl2, nullptr, 0);
}
app.DebugPrintf("Custom cape for player %ls is %ls\n", player->name.c_str(),
@ -824,7 +824,7 @@ void ClientConnection::handleAddPlayer(
std::vector<std::shared_ptr<SynchedEntityData::DataItem> >* unpackedData =
packet->getUnpackedData();
if (unpackedData != NULL) {
if (unpackedData != nullptr) {
player->getEntityData()->assignValues(unpackedData);
}
}
@ -832,7 +832,7 @@ void ClientConnection::handleAddPlayer(
void ClientConnection::handleTeleportEntity(
std::shared_ptr<TeleportEntityPacket> packet) {
std::shared_ptr<Entity> e = getEntity(packet->id);
if (e == NULL) return;
if (e == nullptr) return;
e->xp = packet->x;
e->yp = packet->y;
e->zp = packet->z;
@ -865,7 +865,7 @@ void ClientConnection::handleSetCarriedItem(
void ClientConnection::handleMoveEntity(
std::shared_ptr<MoveEntityPacket> packet) {
std::shared_ptr<Entity> e = getEntity(packet->id);
if (e == NULL) return;
if (e == nullptr) return;
e->xp += packet->xa;
e->yp += packet->ya;
e->zp += packet->za;
@ -887,7 +887,7 @@ void ClientConnection::handleMoveEntity(
void ClientConnection::handleRotateMob(
std::shared_ptr<RotateHeadPacket> packet) {
std::shared_ptr<Entity> e = getEntity(packet->id);
if (e == NULL) return;
if (e == nullptr) return;
float yHeadRot = packet->yHeadRot * 360 / 256.f;
e->setYHeadRot(yHeadRot);
}
@ -895,7 +895,7 @@ void ClientConnection::handleRotateMob(
void ClientConnection::handleMoveEntitySmall(
std::shared_ptr<MoveEntityPacketSmall> packet) {
std::shared_ptr<Entity> e = getEntity(packet->id);
if (e == NULL) return;
if (e == nullptr) return;
e->xp += packet->xa;
e->yp += packet->ya;
e->zp += packet->za;
@ -966,7 +966,7 @@ void ClientConnection::handleMovePlayer(
player->zOld = player->z;
started = true;
minecraft->setScreen(NULL);
minecraft->setScreen(nullptr);
// Fix for #105852 - TU12: Content: Gameplay: Local splitscreen Players
// are spawned at incorrect places after re-joining previously saved and
@ -1230,7 +1230,7 @@ void ClientConnection::handleDisconnect(
app.SetDisconnectReason(packet->reason);
app.SetAction(m_userIndex, eAppAction_ExitWorld, (void*)TRUE);
// minecraft->setLevel(NULL);
// minecraft->setLevel(nullptr);
// minecraft->setScreen(new DisconnectedScreen(L"disconnect.disconnected",
// L"disconnect.genericReason", &packet->reason));
}
@ -1256,12 +1256,12 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason,
uiIDA[0] = IDS_CONFIRM_OK;
ui.RequestErrorMessage(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1,
ProfileManager.GetPrimaryPad(),
&ClientConnection::HostDisconnectReturned, NULL);
&ClientConnection::HostDisconnectReturned, nullptr);
} else {
app.SetAction(m_userIndex, eAppAction_ExitWorld, (void*)TRUE);
}
// minecraft->setLevel(NULL);
// minecraft->setLevel(nullptr);
// minecraft->setScreen(new DisconnectedScreen(L"disconnect.lost", reason,
// reasonObjects));
}
@ -1296,7 +1296,7 @@ void ClientConnection::handleTakeItemEntity(
}
}
if (to == NULL) {
if (to == nullptr) {
// Don't know if this should ever really happen, but seems safest to try
// and remove the entity that has been collected even if we can't create
// a particle as we don't know what really collected it
@ -1304,7 +1304,7 @@ void ClientConnection::handleTakeItemEntity(
return;
}
if (from != NULL) {
if (from != nullptr) {
// If this is a local player, then we only want to do processing for it
// if this connection is associated with the player it is for. In
// particular, we don't want to remove the item entity until we are
@ -1321,7 +1321,7 @@ void ClientConnection::handleTakeItemEntity(
// tutorial for the player that actually picked up the item
int playerPad = player->GetXboxPad();
if (minecraft->localgameModes[playerPad] != NULL) {
if (minecraft->localgameModes[playerPad] != nullptr) {
// 4J-PB - add in the XP orb sound
if (from->GetType() == eTYPE_EXPERIENCEORB) {
float fPitch =
@ -1766,7 +1766,7 @@ void ClientConnection::handleChat(std::shared_ptr<ChatPacket> packet) {
void ClientConnection::handleAnimate(std::shared_ptr<AnimatePacket> packet) {
std::shared_ptr<Entity> e = getEntity(packet->id);
if (e == NULL) return;
if (e == nullptr) return;
if (packet->action == AnimatePacket::SWING) {
if (e->instanceof(eTYPE_LIVINGENTITY))
std::dynamic_pointer_cast<LivingEntity>(e)->swing();
@ -1797,7 +1797,7 @@ void ClientConnection::handleAnimate(std::shared_ptr<AnimatePacket> packet) {
void ClientConnection::handleEntityActionAtPosition(
std::shared_ptr<EntityActionAtPositionPacket> packet) {
std::shared_ptr<Entity> e = getEntity(packet->id);
if (e == NULL) return;
if (e == nullptr) return;
if (packet->action == EntityActionAtPositionPacket::START_SLEEP) {
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
player->startSleepInBed(packet->x, packet->y, packet->z);
@ -2000,7 +2000,7 @@ void ClientConnection::handleAddMob(std::shared_ptr<AddMobPacket> packet) {
mob->xRotp = packet->xRot;
std::vector<std::shared_ptr<Entity> >* subEntities = mob->getSubEntities();
if (subEntities != NULL) {
if (subEntities != nullptr) {
int offs = packet->id - mob->entityId;
// for (int i = 0; i < subEntities.length; i++)
for (auto it = subEntities->begin(); it != subEntities->end();
@ -2022,7 +2022,7 @@ void ClientConnection::handleAddMob(std::shared_ptr<AddMobPacket> packet) {
std::vector<std::shared_ptr<SynchedEntityData::DataItem> >* unpackedData =
packet->getUnpackedData();
if (unpackedData != NULL) {
if (unpackedData != nullptr) {
mob->getEntityData()->assignValues(unpackedData);
}
@ -2057,9 +2057,9 @@ void ClientConnection::handleEntityLinkPacket(
// 4J: If the destination entity couldn't be found, defer handling of this
// packet This was added to support leashing (the entity link packet is sent
// before the add entity packet)
if (destEntity == NULL && packet->destId >= 0) {
if (destEntity == nullptr && packet->destId >= 0) {
// We don't handle missing source entities because it shouldn't happen
assert(!(sourceEntity == NULL && packet->sourceId >= 0));
assert(!(sourceEntity == nullptr && packet->sourceId >= 0));
deferredEntityLinkPackets.push_back(DeferredEntityLinkPacket(packet));
return;
@ -2073,16 +2073,16 @@ void ClientConnection::handleEntityLinkPacket(
->entityId) {
sourceEntity = Minecraft::GetInstance()->localplayers[m_userIndex];
if (destEntity != NULL && destEntity->instanceof(eTYPE_BOAT))
if (destEntity != nullptr && destEntity->instanceof(eTYPE_BOAT))
(std::dynamic_pointer_cast<Boat>(destEntity))->setDoLerp(false);
displayMountMessage =
(sourceEntity->riding == NULL && destEntity != NULL);
} else if (destEntity != NULL && destEntity->instanceof(eTYPE_BOAT)) {
(sourceEntity->riding == nullptr && destEntity != nullptr);
} else if (destEntity != nullptr && destEntity->instanceof(eTYPE_BOAT)) {
(std::dynamic_pointer_cast<Boat>(destEntity))->setDoLerp(true);
}
if (sourceEntity == NULL) return;
if (sourceEntity == nullptr) return;
sourceEntity->ride(destEntity);
@ -2095,8 +2095,8 @@ void ClientConnection::handleEntityLinkPacket(
}
*/
} else if (packet->type == SetEntityLinkPacket::LEASH) {
if ((sourceEntity != NULL) && sourceEntity->instanceof(eTYPE_MOB)) {
if (destEntity != NULL) {
if ((sourceEntity != nullptr) && sourceEntity->instanceof(eTYPE_MOB)) {
if (destEntity != nullptr) {
(std::dynamic_pointer_cast<Mob>(sourceEntity))
->setLeashedTo(destEntity, false);
} else {
@ -2110,7 +2110,7 @@ void ClientConnection::handleEntityLinkPacket(
void ClientConnection::handleEntityEvent(
std::shared_ptr<EntityEventPacket> packet) {
std::shared_ptr<Entity> e = getEntity(packet->entityId);
if (e != NULL) e->handleEntityEvent(packet->eventId);
if (e != nullptr) e->handleEntityEvent(packet->eventId);
}
std::shared_ptr<Entity> ClientConnection::getEntity(int entityId) {
@ -2134,7 +2134,7 @@ void ClientConnection::handleSetHealth(
// We need food
if (packet->food < FoodConstants::HEAL_LEVEL - 1) {
if (minecraft->localgameModes[m_userIndex] != NULL &&
if (minecraft->localgameModes[m_userIndex] != nullptr &&
!minecraft->localgameModes[m_userIndex]->hasInfiniteItems()) {
minecraft->localgameModes[m_userIndex]
->getTutorial()
@ -2162,7 +2162,7 @@ void ClientConnection::handleTexture(std::shared_ptr<TexturePacket> packet) {
wprintf(L"Client received request for custom texture %ls\n",
packet->textureName.c_str());
#endif
std::uint8_t* pbData = NULL;
std::uint8_t* pbData = nullptr;
unsigned int dwBytes = 0;
app.GetMemFileDetails(packet->textureName, &pbData, &dwBytes);
@ -2197,7 +2197,7 @@ void ClientConnection::handleTextureAndGeometry(
L"Client received request for custom texture and geometry %ls\n",
packet->textureName.c_str());
#endif
std::uint8_t* pbData = NULL;
std::uint8_t* pbData = nullptr;
unsigned int dwBytes = 0;
app.GetMemFileDetails(packet->textureName, &pbData, &dwBytes);
DLCSkinFile* pDLCSkinFile =
@ -2253,7 +2253,7 @@ void ClientConnection::handleTextureAndGeometry(
void ClientConnection::handleTextureChange(
std::shared_ptr<TextureChangePacket> packet) {
std::shared_ptr<Entity> e = getEntity(packet->id);
if ((e == NULL) || !e->instanceof(eTYPE_PLAYER)) return;
if ((e == nullptr) || !e->instanceof(eTYPE_PLAYER)) return;
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
bool isLocalPlayer = false;
@ -2297,21 +2297,21 @@ void ClientConnection::handleTextureChange(
packet->path.c_str(), player->name.c_str());
#endif
send(std::shared_ptr<TexturePacket>(
new TexturePacket(packet->path, NULL, 0)));
new TexturePacket(packet->path, nullptr, 0)));
}
} else if (!packet->path.empty() &&
app.IsFileInMemoryTextures(packet->path)) {
// Update the ref count on the memory texture data
app.AddMemoryTextureFile(packet->path, NULL, 0);
app.AddMemoryTextureFile(packet->path, nullptr, 0);
}
}
void ClientConnection::handleTextureAndGeometryChange(
std::shared_ptr<TextureAndGeometryChangePacket> packet) {
std::shared_ptr<Entity> e = getEntity(packet->id);
if (e == NULL) return;
if (e == nullptr) return;
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
if (e == NULL) return;
if (e == nullptr) return;
bool isLocalPlayer = false;
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
@ -2344,12 +2344,12 @@ void ClientConnection::handleTextureAndGeometryChange(
packet->path.c_str(), player->name.c_str());
#endif
send(std::shared_ptr<TextureAndGeometryPacket>(
new TextureAndGeometryPacket(packet->path, NULL, 0)));
new TextureAndGeometryPacket(packet->path, nullptr, 0)));
}
} else if (!packet->path.empty() &&
app.IsFileInMemoryTextures(packet->path)) {
// Update the ref count on the memory texture data
app.AddMemoryTextureFile(packet->path, NULL, 0);
app.AddMemoryTextureFile(packet->path, nullptr, 0);
}
}
@ -2366,7 +2366,7 @@ void ClientConnection::handleRespawn(std::shared_ptr<RespawnPacket> packet) {
MultiPlayerLevel* dimensionLevel =
(MultiPlayerLevel*)minecraft->getLevel(packet->dimension);
if (dimensionLevel == NULL) {
if (dimensionLevel == nullptr) {
dimensionLevel = new MultiPlayerLevel(
this,
new LevelSettings(
@ -2378,7 +2378,7 @@ void ClientConnection::handleRespawn(std::shared_ptr<RespawnPacket> packet) {
// 4J Stu - We want to shared the savedDataStorage between both
// levels
// if( dimensionLevel->savedDataStorage != NULL )
// if( dimensionLevel->savedDataStorage != nullptr )
//{
// Don't need to delete it here as it belongs to a client connection
// while will delete it when it's done
@ -2417,7 +2417,7 @@ void ClientConnection::handleRespawn(std::shared_ptr<RespawnPacket> packet) {
// minecraft->addPendingLocalConnection(m_userIndex, this);
if (minecraft->localgameModes[m_userIndex] != NULL) {
if (minecraft->localgameModes[m_userIndex] != nullptr) {
TutorialMode* gameMode =
(TutorialMode*)minecraft->localgameModes[m_userIndex];
gameMode->getTutorial()->showTutorialPopup(false);
@ -2718,8 +2718,8 @@ void ClientConnection::handleContainerSetSlot(
if (packet->slot >= 36 && packet->slot < 36 + 9) {
std::shared_ptr<ItemInstance> lastItem =
player->inventoryMenu->getSlot(packet->slot)->getItem();
if (packet->item != NULL) {
if (lastItem == NULL ||
if (packet->item != nullptr) {
if (lastItem == nullptr ||
lastItem->count < packet->item->count) {
packet->item->popTime = Inventory::POP_TIME_DURATION;
}
@ -2736,13 +2736,13 @@ void ClientConnection::handleContainerAck(
std::shared_ptr<ContainerAckPacket> packet) {
std::shared_ptr<MultiplayerLocalPlayer> player =
minecraft->localplayers[m_userIndex];
AbstractContainerMenu* menu = NULL;
AbstractContainerMenu* menu = nullptr;
if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY) {
menu = player->inventoryMenu;
} else if (packet->containerId == player->containerMenu->containerId) {
menu = player->containerMenu;
}
if (menu != NULL) {
if (menu != nullptr) {
if (!packet->accepted) {
send(std::shared_ptr<ContainerAckPacket>(new ContainerAckPacket(
packet->containerId, packet->uid, true)));
@ -2765,7 +2765,7 @@ void ClientConnection::handleTileEditorOpen(
std::shared_ptr<TileEditorOpenPacket> packet) {
std::shared_ptr<TileEntity> tileEntity =
level->getTileEntity(packet->x, packet->y, packet->z);
if (tileEntity != NULL) {
if (tileEntity != nullptr) {
minecraft->localplayers[m_userIndex]->openTextEdit(tileEntity);
} else if (packet->editorType == TileEditorOpenPacket::SIGN) {
std::shared_ptr<SignTileEntity> localSignDummy =
@ -2786,7 +2786,7 @@ void ClientConnection::handleSignUpdate(
minecraft->level->getTileEntity(packet->x, packet->y, packet->z);
// 4J-PB - on a client connecting, the line below fails
if (std::dynamic_pointer_cast<SignTileEntity>(te) != NULL) {
if (std::dynamic_pointer_cast<SignTileEntity>(te) != nullptr) {
std::shared_ptr<SignTileEntity> ste =
std::dynamic_pointer_cast<SignTileEntity>(te);
for (int i = 0; i < MAX_SIGN_LINES; i++) {
@ -2801,7 +2801,7 @@ void ClientConnection::handleSignUpdate(
ste->setChanged();
} else {
app.DebugPrintf(
"std::dynamic_pointer_cast<SignTileEntity>(te) == NULL\n");
"std::dynamic_pointer_cast<SignTileEntity>(te) == nullptr\n");
}
} else {
app.DebugPrintf("hasChunkAt failed\n");
@ -2814,23 +2814,23 @@ void ClientConnection::handleTileEntityData(
std::shared_ptr<TileEntity> te =
minecraft->level->getTileEntity(packet->x, packet->y, packet->z);
if (te != NULL) {
if (te != nullptr) {
if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER &&
std::dynamic_pointer_cast<MobSpawnerTileEntity>(te) != NULL) {
std::dynamic_pointer_cast<MobSpawnerTileEntity>(te) != nullptr) {
std::dynamic_pointer_cast<MobSpawnerTileEntity>(te)->load(
packet->tag);
} else if (packet->type == TileEntityDataPacket::TYPE_ADV_COMMAND &&
std::dynamic_pointer_cast<CommandBlockEntity>(te) !=
NULL) {
nullptr) {
std::dynamic_pointer_cast<CommandBlockEntity>(te)->load(
packet->tag);
} else if (packet->type == TileEntityDataPacket::TYPE_BEACON &&
std::dynamic_pointer_cast<BeaconTileEntity>(te) !=
NULL) {
nullptr) {
std::dynamic_pointer_cast<BeaconTileEntity>(te)->load(
packet->tag);
} else if (packet->type == TileEntityDataPacket::TYPE_SKULL &&
std::dynamic_pointer_cast<SkullTileEntity>(te) != NULL) {
std::dynamic_pointer_cast<SkullTileEntity>(te) != nullptr) {
std::dynamic_pointer_cast<SkullTileEntity>(te)->load(
packet->tag);
}
@ -2841,7 +2841,7 @@ void ClientConnection::handleTileEntityData(
void ClientConnection::handleContainerSetData(
std::shared_ptr<ContainerSetDataPacket> packet) {
onUnhandledPacket(packet);
if (minecraft->localplayers[m_userIndex]->containerMenu != NULL &&
if (minecraft->localplayers[m_userIndex]->containerMenu != nullptr &&
minecraft->localplayers[m_userIndex]->containerMenu->containerId ==
packet->containerId) {
minecraft->localplayers[m_userIndex]->containerMenu->setData(
@ -2852,7 +2852,7 @@ void ClientConnection::handleContainerSetData(
void ClientConnection::handleSetEquippedItem(
std::shared_ptr<SetEquippedItemPacket> packet) {
std::shared_ptr<Entity> entity = getEntity(packet->entity);
if (entity != NULL) {
if (entity != nullptr) {
// 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer
// Encountered: TU7: Content: Art: Aura of enchanted item is not
// displayed for other players in online game
@ -2881,8 +2881,8 @@ void ClientConnection::handleTileDestruction(
}
bool ClientConnection::canHandleAsyncPackets() {
return minecraft != NULL && minecraft->level != NULL &&
minecraft->localplayers[m_userIndex] != NULL && level != NULL;
return minecraft != nullptr && minecraft->level != nullptr &&
minecraft->localplayers[m_userIndex] != nullptr && level != nullptr;
}
void ClientConnection::handleGameEvent(
@ -2891,7 +2891,7 @@ void ClientConnection::handleGameEvent(
int param = gameEventPacket->param;
if (event >= 0 && event < GameEventPacket::EVENT_LANGUAGE_ID_LENGTH) {
if (GameEventPacket::EVENT_LANGUAGE_ID[event] >
0) // 4J - was NULL check
0) // 4J - was nullptr check
{
minecraft->localplayers[m_userIndex]->displayClientMessage(
GameEventPacket::EVENT_LANGUAGE_ID[event]);
@ -2912,12 +2912,12 @@ void ClientConnection::handleGameEvent(
app.DebugPrintf("handleGameEvent packet for WIN_GAME - %d\n",
m_userIndex);
// This just allows it to be shown
if (minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL)
if (minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr)
minecraft->localgameModes[ProfileManager.GetPrimaryPad()]
->getTutorial()
->showTutorialPopup(false);
ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_EndPoem,
NULL, eUILayer_Scene, eUIGroup_Fullscreen);
nullptr, eUILayer_Scene, eUIGroup_Fullscreen);
} else if (event == GameEventPacket::START_SAVING) {
if (!g_NetworkManager.IsHost()) {
// Move app started to here so that it happens immediately otherwise
@ -2953,8 +2953,8 @@ void ClientConnection::handleLevelEvent(
std::shared_ptr<LevelEventPacket> packet) {
if (packet->type == LevelEvent::SOUND_DRAGON_DEATH) {
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
if (minecraft->localplayers[i] != NULL &&
minecraft->localplayers[i]->level != NULL &&
if (minecraft->localplayers[i] != nullptr &&
minecraft->localplayers[i]->level != nullptr &&
minecraft->localplayers[i]->level->dimension->id == 1) {
minecraft->localplayers[i]->awardStat(
GenericStats::completeTheEnd(),
@ -2984,7 +2984,7 @@ void ClientConnection::handleAwardStat(
void ClientConnection::handleUpdateMobEffect(
std::shared_ptr<UpdateMobEffectPacket> packet) {
std::shared_ptr<Entity> e = getEntity(packet->entityId);
if ((e == NULL) || !e->instanceof(eTYPE_LIVINGENTITY)) return;
if ((e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY)) return;
//( std::dynamic_pointer_cast<LivingEntity>(e) )->addEffect(new
// MobEffectInstance(packet->effectId, packet->effectDurationTicks,
@ -2999,7 +2999,7 @@ void ClientConnection::handleUpdateMobEffect(
void ClientConnection::handleRemoveMobEffect(
std::shared_ptr<RemoveMobEffectPacket> packet) {
std::shared_ptr<Entity> e = getEntity(packet->entityId);
if ((e == NULL) || !e->instanceof(eTYPE_LIVINGENTITY)) return;
if ((e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY)) return;
(std::dynamic_pointer_cast<LivingEntity>(e))
->removeEffectNoUpdate(packet->effectId);
@ -3015,7 +3015,7 @@ void ClientConnection::handlePlayerInfo(
INetworkPlayer* networkPlayer =
g_NetworkManager.GetPlayerBySmallId(packet->m_networkSmallId);
if (networkPlayer != NULL && networkPlayer->IsHost()) {
if (networkPlayer != nullptr && networkPlayer->IsHost()) {
// Some settings should always be considered on for the host player
Player::enableAllPlayerPrivileges(startingPrivileges, true);
Player::setPlayerGamePrivilege(startingPrivileges,
@ -3027,17 +3027,17 @@ void ClientConnection::handlePlayerInfo(
packet->m_playerPrivileges);
std::shared_ptr<Entity> entity = getEntity(packet->m_entityId);
if (entity != NULL && entity->instanceof(eTYPE_PLAYER)) {
if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) {
std::shared_ptr<Player> player =
std::dynamic_pointer_cast<Player>(entity);
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All,
packet->m_playerPrivileges);
}
if (networkPlayer != NULL && networkPlayer->IsLocal()) {
if (networkPlayer != nullptr && networkPlayer->IsLocal()) {
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
std::shared_ptr<MultiplayerLocalPlayer> localPlayer =
minecraft->localplayers[i];
if (localPlayer != NULL && localPlayer->connection != NULL &&
if (localPlayer != nullptr && localPlayer->connection != nullptr &&
localPlayer->connection->getNetworkPlayer() == networkPlayer) {
localPlayer->setPlayerGamePrivilege(
Player::ePlayerGamePrivilege_All,
@ -3272,7 +3272,7 @@ void ClientConnection::handleServerSettingsChanged(
app.SetGameHostOption(eGameHostOption_All, packet->data);
} else if (packet->action == ServerSettingsChangedPacket::HOST_DIFFICULTY) {
for (unsigned int i = 0; i < minecraft->levels.length; ++i) {
if (minecraft->levels[i] != NULL) {
if (minecraft->levels[i] != nullptr) {
app.DebugPrintf(
"ClientConnection::handleServerSettingsChanged - "
"Difficulty = %d",
@ -3305,12 +3305,12 @@ void ClientConnection::handleUpdateProgress(
void ClientConnection::handleUpdateGameRuleProgressPacket(
std::shared_ptr<UpdateGameRuleProgressPacket> packet) {
const wchar_t* string = app.GetGameRulesString(packet->m_messageId);
if (string != NULL) {
if (string != nullptr) {
std::wstring message(string);
message = GameRuleDefinition::generateDescriptionString(
packet->m_definitionType, message, packet->m_data.data,
packet->m_data.length);
if (minecraft->localgameModes[m_userIndex] != NULL) {
if (minecraft->localgameModes[m_userIndex] != nullptr) {
minecraft->localgameModes[m_userIndex]->getTutorial()->setMessage(
message, packet->m_icon, packet->m_auxValue);
}
@ -3361,7 +3361,7 @@ int ClientConnection::HostDisconnectReturned(
ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME,
uiIDA, 2, ProfileManager.GetPrimaryPad(),
&ClientConnection::ExitGameAndSaveReturned,
NULL);
nullptr);
} else
{
MinecraftServer::getInstance()->setSaveOnExit(true);
@ -3433,7 +3433,7 @@ void ClientConnection::handleParticleEvent(
void ClientConnection::handleUpdateAttributes(
std::shared_ptr<UpdateAttributesPacket> packet) {
std::shared_ptr<Entity> entity = getEntity(packet->getEntityId());
if (entity == NULL) return;
if (entity == nullptr) return;
if (!entity->instanceof(eTYPE_LIVINGENTITY)) {
// Entity is not a living entity!
@ -3450,7 +3450,7 @@ void ClientConnection::handleUpdateAttributes(
AttributeInstance* instance =
attributes->getInstance(attribute->getId());
if (instance == NULL) {
if (instance == nullptr) {
// 4J - TODO: revisit, not familiar with the attribute system, why
// are we passing in MIN_NORMAL (Java's smallest non-zero value
// conforming to IEEE Standard 754 (?)) and MAX_VALUE

View file

@ -82,7 +82,7 @@ MultiPlayerChunkCache::MultiPlayerChunkCache(Level* level) {
}
}
} else {
waterChunk = NULL;
waterChunk = nullptr;
}
this->level = level;
@ -121,7 +121,7 @@ bool MultiPlayerChunkCache::reallyHasChunk(int x, int z) {
int idx = ix * XZSIZE + iz;
LevelChunk* chunk = cache[idx];
if (chunk == NULL) {
if (chunk == nullptr) {
return false;
}
return hasData[idx];
@ -157,7 +157,7 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) {
LevelChunk* chunk = cache[idx];
LevelChunk* lastChunk = chunk;
if (chunk == NULL) {
if (chunk == nullptr) {
EnterCriticalSection(&m_csLoadCreate);
// LevelChunk *chunk;
@ -165,7 +165,7 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) {
{
// 4J-JEV: We are about to use shared data, abort if the server is
// stopped and the data is deleted.
if (MinecraftServer::getInstance()->serverHalted()) return NULL;
if (MinecraftServer::getInstance()->serverHalted()) return nullptr;
// If we're the host, then don't create the chunk, share data from
// the server's copy
@ -249,7 +249,7 @@ LevelChunk* MultiPlayerChunkCache::getChunk(int x, int z) {
int idx = ix * XZSIZE + iz;
LevelChunk* chunk = cache[idx];
if (chunk == NULL) {
if (chunk == nullptr) {
return emptyChunk;
} else {
return chunk;
@ -269,12 +269,12 @@ void MultiPlayerChunkCache::postProcess(ChunkSource* parent, int x, int z) {}
std::vector<Biome::MobSpawnerData*>* MultiPlayerChunkCache::getMobsAt(
MobCategory* mobCategory, int x, int y, int z) {
return NULL;
return nullptr;
}
TilePos* MultiPlayerChunkCache::findNearestMapFeature(
Level* level, const std::wstring& featureName, int x, int y, int z) {
return NULL;
return nullptr;
}
void MultiPlayerChunkCache::recreateLogicStructuresForChunk(int chunkX,

View file

@ -38,7 +38,7 @@ PendingConnection::PendingConnection(MinecraftServer* server, Socket* socket,
PendingConnection::~PendingConnection() { delete connection; }
void PendingConnection::tick() {
if (acceptedLogin != NULL) {
if (acceptedLogin != nullptr) {
this->handleAcceptedLogin(acceptedLogin);
acceptedLogin = nullptr;
}
@ -104,7 +104,7 @@ void PendingConnection::sendPreLoginResponse() {
// PADDY - this is failing when a local player with chat restrictions
// joins an online game
if (player != NULL &&
if (player != nullptr &&
player->connection->m_offlineXUID != INVALID_XUID &&
player->connection->m_onlineXUID != INVALID_XUID) {
if (player->connection->m_friendsOnlyUGC) {
@ -114,7 +114,7 @@ void PendingConnection::sendPreLoginResponse() {
// the client
ugcXuids[ugcXuidCount] = player->connection->m_onlineXUID;
if (player->connection->getNetworkPlayer() != NULL &&
if (player->connection->getNetworkPlayer() != nullptr &&
player->connection->getNetworkPlayer()->IsHost())
hostIndex = ugcXuidCount;
@ -178,10 +178,10 @@ void PendingConnection::handleAcceptedLogin(
std::shared_ptr<ServerPlayer> playerEntity =
server->getPlayers()->getPlayerForLogin(this, name, playerXuid,
packet->m_onlineXuid);
if (playerEntity != NULL) {
if (playerEntity != nullptr) {
server->getPlayers()->placeNewPlayer(connection, playerEntity, packet);
connection = NULL; // We've moved responsibility for this over to the
// new PlayerConnection, NULL so we don't delete our
connection = nullptr; // We've moved responsibility for this over to the
// new PlayerConnection, nullptr so we don't delete our
// reference to it here in our dtor
}
done = true;

View file

@ -85,7 +85,7 @@ void PlayerChunkMap::PlayerChunk::add(std::shared_ptr<ServerPlayer> player,
}
void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr<ServerPlayer> player) {
PlayerChunkMap::PlayerChunk* toDelete = NULL;
PlayerChunkMap::PlayerChunk* toDelete = nullptr;
// app.DebugPrintf("--- PlayerChunkMap::PlayerChunk::remove
// x=%d\tz=%d\n",x,z);
@ -129,17 +129,17 @@ void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr<ServerPlayer> player) {
// to unload entities in chunks when players are dead. If we do not and the
// entity is removed while they are dead, that entity will remain in the
// clients world
if (player->connection != NULL &&
if (player->connection != nullptr &&
player->seenChunks.find(pos) != player->seenChunks.end()) {
INetworkPlayer* thisNetPlayer = player->connection->getNetworkPlayer();
bool noOtherPlayersFound = true;
if (thisNetPlayer != NULL) {
if (thisNetPlayer != nullptr) {
for (auto it = players.begin(); it < players.end(); ++it) {
std::shared_ptr<ServerPlayer> currPlayer = *it;
INetworkPlayer* currNetPlayer =
currPlayer->connection->getNetworkPlayer();
if (currNetPlayer != NULL &&
if (currNetPlayer != nullptr &&
currNetPlayer->IsSameSystem(thisNetPlayer) &&
currPlayer->seenChunks.find(pos) !=
currPlayer->seenChunks.end()) {
@ -155,7 +155,7 @@ void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr<ServerPlayer> player) {
}
} else {
// app.DebugPrintf("PlayerChunkMap::PlayerChunk::remove - QNetPlayer
// is NULL\n");
// is nullptr\n");
}
}
@ -221,14 +221,14 @@ void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr<Packet> packet) {
bool dontSend = false;
if (sentTo.size()) {
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
if (thisPlayer == NULL) {
if (thisPlayer == nullptr) {
dontSend = true;
} else {
for (unsigned int j = 0; j < sentTo.size(); j++) {
std::shared_ptr<ServerPlayer> player2 = sentTo[j];
INetworkPlayer* otherPlayer =
player2->connection->getNetworkPlayer();
if (otherPlayer != NULL &&
if (otherPlayer != nullptr &&
thisPlayer->IsSameSystem(otherPlayer)) {
dontSend = true;
}
@ -275,7 +275,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr<Packet> packet) {
parent->level->getServer()->getPlayers()->players[i];
// Don't worry about local players, they get all their updates through
// sharing level with the server anyway
if (player->connection == NULL) continue;
if (player->connection == nullptr) continue;
if (player->connection->isLocal()) continue;
// Don't worry about this player if they haven't had this chunk yet
@ -291,14 +291,14 @@ void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr<Packet> packet) {
bool dontSend = false;
if (sentTo.size()) {
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
if (thisPlayer == NULL) {
if (thisPlayer == nullptr) {
dontSend = true;
} else {
for (unsigned int j = 0; j < sentTo.size(); j++) {
std::shared_ptr<ServerPlayer> player2 = sentTo[j];
INetworkPlayer* otherPlayer =
player2->connection->getNetworkPlayer();
if (otherPlayer != NULL &&
if (otherPlayer != nullptr &&
thisPlayer->IsSameSystem(otherPlayer)) {
dontSend = true;
}
@ -387,9 +387,9 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) {
}
void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr<TileEntity> te) {
if (te != NULL) {
if (te != nullptr) {
std::shared_ptr<Packet> p = te->getUpdatePacket();
if (p != NULL) {
if (p != nullptr) {
broadcast(p);
}
}
@ -473,7 +473,7 @@ PlayerChunkMap::PlayerChunk* PlayerChunkMap::getChunk(int x, int z,
int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32);
auto it = chunks.find(id);
PlayerChunk* chunk = NULL;
PlayerChunk* chunk = nullptr;
if (it != chunks.end()) {
chunk = it->second;
} else if (create) {
@ -552,7 +552,7 @@ void PlayerChunkMap::broadcastTileUpdate(std::shared_ptr<Packet> packet, int x,
int xc = x >> 4;
int zc = z >> 4;
PlayerChunk* chunk = getChunk(xc, zc, false);
if (chunk != NULL) {
if (chunk != nullptr) {
chunk->broadcast(packet);
}
}
@ -561,7 +561,7 @@ void PlayerChunkMap::tileChanged(int x, int y, int z) {
int xc = x >> 4;
int zc = z >> 4;
PlayerChunk* chunk = getChunk(xc, zc, false);
if (chunk != NULL) {
if (chunk != nullptr) {
chunk->tileChanged(x & 15, y, z & 15);
}
}
@ -580,7 +580,7 @@ void PlayerChunkMap::prioritiseTileChanges(int x, int y, int z) {
int xc = x >> 4;
int zc = z >> 4;
PlayerChunk* chunk = getChunk(xc, zc, false);
if (chunk != NULL) {
if (chunk != nullptr) {
chunk->prioritiseTileChanges();
}
}
@ -690,7 +690,7 @@ void PlayerChunkMap::remove(std::shared_ptr<ServerPlayer> player) {
for (int x = xc - radius; x <= xc + radius; x++)
for (int z = zc - radius; z <= zc + radius; z++) {
PlayerChunk* playerChunk = getChunk(x, z, false);
if (playerChunk != NULL) playerChunk->remove(player);
if (playerChunk != nullptr) playerChunk->remove(player);
}
auto it = find(players.begin(), players.end(), player);
@ -761,7 +761,7 @@ bool PlayerChunkMap::isPlayerIn(std::shared_ptr<ServerPlayer> player,
int xChunk, int zChunk) {
PlayerChunk* chunk = getChunk(xChunk, zChunk, false);
if (chunk == NULL) {
if (chunk == nullptr) {
return false;
} else {
auto it1 =
@ -771,7 +771,7 @@ bool PlayerChunkMap::isPlayerIn(std::shared_ptr<ServerPlayer> player,
return it1 != chunk->players.end() && it2 == player->chunksToSend.end();
}
// return chunk == NULL ? false : chunk->players->contains(player) &&
// return chunk == nullptr ? false : chunk->players->contains(player) &&
// !player->chunksToSend->contains(chunk->pos);
}

View file

@ -162,7 +162,7 @@ void PlayerConnection::handleMovePlayer(
}
if (synched) {
if (player->riding != NULL) {
if (player->riding != nullptr) {
float yRotT = player->yRot;
float xRotT = player->xRot;
player->riding->positionRider();
@ -180,7 +180,7 @@ void PlayerConnection::handleMovePlayer(
player->doTick(false);
player->ySlideOffset = 0;
player->absMoveTo(xt, yt, zt, yRotT, xRotT);
if (player->riding != NULL) player->riding->positionRider();
if (player->riding != nullptr) player->riding->positionRider();
server->getPlayers()->move(player);
// player may have been kicked off the mount during the tick, so
@ -467,7 +467,7 @@ void PlayerConnection::handleUseItem(std::shared_ptr<UseItemPacket> packet) {
level->canEditSpawn; // = level->dimension->id != 0 ||
// server->players->isOp(player->name);
if (packet->getFace() == 255) {
if (item == NULL) return;
if (item == nullptr) return;
player->gameMode->useItem(player, level, item);
} else if ((packet->getY() < server->getMaxBuildHeight() - 1) ||
(packet->getFace() != Facing::UP &&
@ -524,15 +524,15 @@ void PlayerConnection::handleUseItem(std::shared_ptr<UseItemPacket> packet) {
item = player->inventory->getSelected();
bool forceClientUpdate = false;
if (item != NULL && packet->getItem() == NULL) {
if (item != nullptr && packet->getItem() == nullptr) {
forceClientUpdate = true;
}
if (item != NULL && item->count == 0) {
if (item != nullptr && item->count == 0) {
player->inventory->items[player->inventory->selected] = nullptr;
item = nullptr;
}
if (item == NULL || item->getUseDuration() == 0) {
if (item == nullptr || item->getUseDuration() == 0) {
player->ignoreSlotUpdateHack = true;
player->inventory->items[player->inventory->selected] =
ItemInstance::clone(
@ -582,7 +582,7 @@ void PlayerConnection::onUnhandledPacket(std::shared_ptr<Packet> packet) {
}
void PlayerConnection::send(std::shared_ptr<Packet> packet) {
if (connection->getSocket() != NULL) {
if (connection->getSocket() != nullptr) {
if (!server->getPlayers()->canReceiveAllPackets(player)) {
// Check if we are allowed to send this packet type
if (!Packet::canSendToAnyClient(packet)) {
@ -598,7 +598,7 @@ void PlayerConnection::send(std::shared_ptr<Packet> packet) {
// 4J Added
void PlayerConnection::queueSend(std::shared_ptr<Packet> packet) {
if (connection->getSocket() != NULL) {
if (connection->getSocket() != nullptr) {
if (!server->getPlayers()->canReceiveAllPackets(player)) {
// Check if we are allowed to send this packet type
if (!Packet::canSendToAnyClient(packet)) {
@ -654,14 +654,14 @@ void PlayerConnection::handlePlayerCommand(
synched = false;
} else if (packet->action == PlayerCommandPacket::RIDING_JUMP) {
// currently only supported by horses...
if ((player->riding != NULL) &&
if ((player->riding != nullptr) &&
player->riding->GetType() == eTYPE_HORSE) {
std::dynamic_pointer_cast<EntityHorse>(player->riding)
->onPlayerJump(packet->data);
}
} else if (packet->action == PlayerCommandPacket::OPEN_INVENTORY) {
// also only supported by horses...
if ((player->riding != NULL) &&
if ((player->riding != nullptr) &&
player->riding->instanceof(eTYPE_HORSE)) {
std::dynamic_pointer_cast<EntityHorse>(player->riding)
->openInventory(player);
@ -711,7 +711,7 @@ void PlayerConnection::handleInteract(std::shared_ptr<InteractPacket> packet) {
// hit something, then agree with it. The canSee can fail here as it checks
// a ray from head->head, but we may actually be looking at a different part
// of the entity that can be seen even though the ray is blocked.
if (target != NULL) // && player->canSee(target) &&
if (target != nullptr) // && player->canSee(target) &&
// player->distanceToSqr(target) < 6 * 6)
{
// boole canSee = player->canSee(target);
@ -752,7 +752,7 @@ void PlayerConnection::handleTexture(std::shared_ptr<TexturePacket> packet) {
wprintf(L"Server received request for custom texture %ls\n",
packet->textureName.c_str());
#endif
std::uint8_t* pbData = NULL;
std::uint8_t* pbData = nullptr;
unsigned int dwBytes = 0;
app.GetMemFileDetails(packet->textureName, &pbData, &dwBytes);
@ -785,7 +785,7 @@ void PlayerConnection::handleTextureAndGeometry(
wprintf(L"Server received request for custom texture %ls\n",
packet->textureName.c_str());
#endif
std::uint8_t* pbData = NULL;
std::uint8_t* pbData = nullptr;
unsigned int dwTextureBytes = 0;
app.GetMemFileDetails(packet->textureName, &pbData, &dwTextureBytes);
DLCSkinFile* pDLCSkinFile =
@ -854,7 +854,7 @@ void PlayerConnection::handleTextureReceived(const std::wstring& textureName) {
auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(),
textureName);
if (it != m_texturesRequested.end()) {
std::uint8_t* pbData = NULL;
std::uint8_t* pbData = nullptr;
unsigned int dwBytes = 0;
app.GetMemFileDetails(textureName, &pbData, &dwBytes);
@ -873,7 +873,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(
auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(),
textureName);
if (it != m_texturesRequested.end()) {
std::uint8_t* pbData = NULL;
std::uint8_t* pbData = nullptr;
unsigned int dwTextureBytes = 0;
app.GetMemFileDetails(textureName, &pbData, &dwTextureBytes);
DLCSkinFile* pDLCSkinFile = app.m_dlcManager.getSkinFile(textureName);
@ -933,12 +933,12 @@ void PlayerConnection::handleTextureChange(
packet->path.c_str(), player->name.c_str());
#endif
send(std::shared_ptr<TexturePacket>(
new TexturePacket(packet->path, NULL, 0)));
new TexturePacket(packet->path, nullptr, 0)));
}
} else if (!packet->path.empty() &&
app.IsFileInMemoryTextures(packet->path)) {
// Update the ref count on the memory texture data
app.AddMemoryTextureFile(packet->path, NULL, 0);
app.AddMemoryTextureFile(packet->path, nullptr, 0);
}
server->getPlayers()->broadcastAll(
std::shared_ptr<TextureChangePacket>(
@ -968,12 +968,12 @@ void PlayerConnection::handleTextureAndGeometryChange(
packet->path.c_str(), player->name.c_str());
#endif
send(std::shared_ptr<TextureAndGeometryPacket>(
new TextureAndGeometryPacket(packet->path, NULL, 0)));
new TextureAndGeometryPacket(packet->path, nullptr, 0)));
}
} else if (!packet->path.empty() &&
app.IsFileInMemoryTextures(packet->path)) {
// Update the ref count on the memory texture data
app.AddMemoryTextureFile(packet->path, NULL, 0);
app.AddMemoryTextureFile(packet->path, nullptr, 0);
player->setCustomSkin(packet->dwSkinID);
@ -995,7 +995,7 @@ void PlayerConnection::handleServerSettingsChanged(
// individual setting?
INetworkPlayer* networkPlayer = getNetworkPlayer();
if ((networkPlayer != NULL && networkPlayer->IsHost()) ||
if ((networkPlayer != nullptr && networkPlayer->IsHost()) ||
player->isModerator()) {
app.SetGameHostOption(
eGameHostOption_FireSpreads,
@ -1047,7 +1047,7 @@ void PlayerConnection::handleServerSettingsChanged(
void PlayerConnection::handleKickPlayer(
std::shared_ptr<KickPlayerPacket> packet) {
INetworkPlayer* networkPlayer = getNetworkPlayer();
if ((networkPlayer != NULL && networkPlayer->IsHost()) ||
if ((networkPlayer != nullptr && networkPlayer->IsHost()) ||
player->isModerator()) {
server->getPlayers()->kickPlayerByShortId(packet->m_networkSmallId);
}
@ -1111,8 +1111,8 @@ void PlayerConnection::handleContainerSetSlot(
packet->slot >= 36 && packet->slot < 36 + 9) {
std::shared_ptr<ItemInstance> lastItem =
player->inventoryMenu->getSlot(packet->slot)->getItem();
if (packet->item != NULL) {
if (lastItem == NULL || lastItem->count < packet->item->count) {
if (packet->item != nullptr) {
if (lastItem == nullptr || lastItem->count < packet->item->count) {
packet->item->popTime = Inventory::POP_TIME_DURATION;
}
}
@ -1185,7 +1185,7 @@ void PlayerConnection::handleSetCreativeModeSlot(
bool drop = packet->slotNum < 0;
std::shared_ptr<ItemInstance> item = packet->item;
if (item != NULL && item->id == Item::map_Id) {
if (item != nullptr && item->id == Item::map_Id) {
int mapScale = 3;
#if defined(_LARGE_WORLDS)
int scale = MapItemSavedData::MAP_SIZE * 2 * (1 << mapScale);
@ -1208,7 +1208,7 @@ void PlayerConnection::handleSetCreativeModeSlot(
wchar_t buf[64];
swprintf(buf, 64, L"map_%d", item->getAuxValue());
std::wstring id = std::wstring(buf);
if (data == NULL) {
if (data == nullptr) {
data =
std::shared_ptr<MapItemSavedData>(new MapItemSavedData(id));
}
@ -1227,13 +1227,13 @@ void PlayerConnection::handleSetCreativeModeSlot(
packet->slotNum < (InventoryMenu::USE_ROW_SLOT_START +
Inventory::getSelectionSize()));
bool validItem =
item == NULL || (item->id < Item::items.length && item->id >= 0 &&
Item::items[item->id] != NULL);
bool validData = item == NULL || (item->getAuxValue() >= 0 &&
item == nullptr || (item->id < Item::items.length && item->id >= 0 &&
Item::items[item->id] != nullptr);
bool validData = item == nullptr || (item->getAuxValue() >= 0 &&
item->count > 0 && item->count <= 64);
if (validSlot && validItem && validData) {
if (item == NULL) {
if (item == nullptr) {
player->inventoryMenu->setItem(packet->slotNum, nullptr);
} else {
player->inventoryMenu->setItem(packet->slotNum, item);
@ -1247,13 +1247,13 @@ void PlayerConnection::handleSetCreativeModeSlot(
dropSpamTickCount += SharedConstants::TICKS_PER_SECOND;
// drop item
std::shared_ptr<ItemEntity> dropped = player->drop(item);
if (dropped != NULL) {
if (dropped != nullptr) {
dropped->setShortLifeTime();
}
}
}
if (item != NULL && item->id == Item::map_Id) {
if (item != nullptr && item->id == Item::map_Id) {
// 4J Stu - Maps need to have their aux value update, so the client
// should always be assumed to be wrong This is how the Java works,
// as the client also incorrectly predicts the auxvalue of the
@ -1289,7 +1289,7 @@ void PlayerConnection::handleSignUpdate(
std::shared_ptr<TileEntity> te =
level->getTileEntity(packet->x, packet->y, packet->z);
if (std::dynamic_pointer_cast<SignTileEntity>(te) != NULL) {
if (std::dynamic_pointer_cast<SignTileEntity>(te) != nullptr) {
std::shared_ptr<SignTileEntity> ste =
std::dynamic_pointer_cast<SignTileEntity>(te);
if (!ste->isEditable() || ste->getPlayerWhoMayEdit() != player) {
@ -1300,7 +1300,7 @@ void PlayerConnection::handleSignUpdate(
}
// 4J-JEV: Changed to allow characters to display as a [].
if (std::dynamic_pointer_cast<SignTileEntity>(te) != NULL) {
if (std::dynamic_pointer_cast<SignTileEntity>(te) != nullptr) {
int x = packet->x;
int y = packet->y;
int z = packet->z;
@ -1331,14 +1331,14 @@ void PlayerConnection::handlePlayerInfo(
// setting?
INetworkPlayer* networkPlayer = getNetworkPlayer();
if ((networkPlayer != NULL && networkPlayer->IsHost()) ||
if ((networkPlayer != nullptr && networkPlayer->IsHost()) ||
player->isModerator()) {
std::shared_ptr<ServerPlayer> serverPlayer;
// Find the player being edited
for (auto it = server->getPlayers()->players.begin();
it != server->getPlayers()->players.end(); ++it) {
std::shared_ptr<ServerPlayer> checkingPlayer = *it;
if (checkingPlayer->connection->getNetworkPlayer() != NULL &&
if (checkingPlayer->connection->getNetworkPlayer() != nullptr &&
checkingPlayer->connection->getNetworkPlayer()->GetSmallId() ==
packet->m_networkSmallId) {
serverPlayer = checkingPlayer;
@ -1346,7 +1346,7 @@ void PlayerConnection::handlePlayerInfo(
}
}
if (serverPlayer != NULL) {
if (serverPlayer != nullptr) {
unsigned int origPrivs = serverPlayer->getAllPlayerGamePrivileges();
bool trustPlayers =
@ -1564,7 +1564,7 @@ void PlayerConnection::handleCustomPayload(
player->level->getTileEntity(x, y, z);
std::shared_ptr<CommandBlockEntity> cbe =
std::dynamic_pointer_cast<CommandBlockEntity>(tileEntity);
if (tileEntity != NULL && cbe != NULL) {
if (tileEntity != nullptr && cbe != nullptr) {
cbe->setCommand(command);
player->level->sendTileUpdated(x, y, z);
// player->sendMessage(ChatMessageComponent.forTranslation("advMode.setCommand.success",
@ -1575,7 +1575,7 @@ void PlayerConnection::handleCustomPayload(
}
} else if (CustomPayloadPacket::SET_BEACON_PACKET.compare(
customPayloadPacket->identifier) == 0) {
if (dynamic_cast<BeaconMenu*>(player->containerMenu) != NULL) {
if (dynamic_cast<BeaconMenu*>(player->containerMenu) != nullptr) {
ByteArrayInputStream bais(customPayloadPacket->data);
DataInputStream input(&bais);
int primary = input.readInt();
@ -1596,7 +1596,7 @@ void PlayerConnection::handleCustomPayload(
customPayloadPacket->identifier) == 0) {
AnvilMenu* menu = dynamic_cast<AnvilMenu*>(player->containerMenu);
if (menu) {
if (customPayloadPacket->data.data == NULL ||
if (customPayloadPacket->data.data == nullptr ||
customPayloadPacket->data.length < 1) {
menu->setItemName(L"");
} else {
@ -1680,7 +1680,7 @@ void PlayerConnection::handleCraftItem(
// 4J Stu - Fix for #13097 - Bug: Milk Buckets are removed when
// crafting Cake
if (ingItemInst != NULL) {
if (ingItemInst != nullptr) {
if (ingItemInst->getItem()->hasCraftingRemainingItem()) {
// replace item with remaining result
player->inventory->add(
@ -1795,8 +1795,8 @@ void PlayerConnection::handleTradeItem(
int buyAMatches = player->inventory->countMatches(buyAItem);
int buyBMatches = player->inventory->countMatches(buyBItem);
if ((buyAItem != NULL && buyAMatches >= buyAItem->count) &&
(buyBItem == NULL || buyBMatches >= buyBItem->count)) {
if ((buyAItem != nullptr && buyAMatches >= buyAItem->count) &&
(buyBItem == nullptr || buyBMatches >= buyBItem->count)) {
menu->getMerchant()->notifyTrade(activeRecipe);
// Remove the items we are purchasing with
@ -1825,14 +1825,14 @@ void PlayerConnection::handleTradeItem(
}
INetworkPlayer* PlayerConnection::getNetworkPlayer() {
if (connection != NULL && connection->getSocket() != NULL)
if (connection != nullptr && connection->getSocket() != nullptr)
return connection->getSocket()->getPlayer();
else
return NULL;
return nullptr;
}
bool PlayerConnection::isLocal() {
if (connection->getSocket() == NULL) {
if (connection->getSocket() == nullptr) {
return false;
} else {
bool isLocal = connection->getSocket()->isLocal();
@ -1841,12 +1841,12 @@ bool PlayerConnection::isLocal() {
}
bool PlayerConnection::isGuest() {
if (connection->getSocket() == NULL) {
if (connection->getSocket() == nullptr) {
return false;
} else {
INetworkPlayer* networkPlayer = connection->getSocket()->getPlayer();
bool isGuest = false;
if (networkPlayer != NULL) {
if (networkPlayer != nullptr) {
isGuest = networkPlayer->IsGuest() == TRUE;
}
return isGuest;

View file

@ -30,12 +30,12 @@
// point in porting code for banning, whitelisting, ops etc.
PlayerList::PlayerList(MinecraftServer* server) {
playerIo = NULL;
playerIo = nullptr;
this->server = server;
sendAllPlayerInfoIn = 0;
overrideGameMode = NULL;
overrideGameMode = nullptr;
allowCheatsForAllPlayers = false;
#if defined(_LARGE_WORLDS)
@ -59,7 +59,7 @@ PlayerList::~PlayerList() {
// else there is a circular dependency
delete (*it)->gameMode; // Gamemode also needs deleted as it references
// back to this player
(*it)->gameMode = NULL;
(*it)->gameMode = nullptr;
}
DeleteCriticalSection(&m_kickPlayersCS);
@ -71,14 +71,14 @@ void PlayerList::placeNewPlayer(Connection* connection,
std::shared_ptr<LoginPacket> packet) {
CompoundTag* playerTag = load(player);
bool newPlayer = playerTag == NULL;
bool newPlayer = playerTag == nullptr;
player->setLevel(server->getLevel(player->dimension));
player->gameMode->setLevel((ServerLevel*)player->level);
// Make sure these privileges are always turned off for the host player
INetworkPlayer* networkPlayer = connection->getSocket()->getPlayer();
if (networkPlayer != NULL && networkPlayer->IsHost()) {
if (networkPlayer != nullptr && networkPlayer->IsHost()) {
player->enableAllPlayerPrivileges(true);
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_HOST, 1);
}
@ -140,7 +140,7 @@ void PlayerList::placeNewPlayer(Connection* connection,
Item::map_Id, 1,
level->getAuxValueForMap(player->getXuid(), 0, centreXC,
centreZC, mapScale))));
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
app.getGameRuleDefinitions()->postProcessPlayer(player);
}
}
@ -157,13 +157,13 @@ void PlayerList::placeNewPlayer(Connection* connection,
player->customTextureUrl.c_str(), player->name.c_str());
#endif
playerConnection->send(std::shared_ptr<TextureAndGeometryPacket>(
new TextureAndGeometryPacket(player->customTextureUrl, NULL,
new TextureAndGeometryPacket(player->customTextureUrl, nullptr,
0)));
}
} else if (!player->customTextureUrl.empty() &&
app.IsFileInMemoryTextures(player->customTextureUrl)) {
// Update the ref count on the memory texture data
app.AddMemoryTextureFile(player->customTextureUrl, NULL, 0);
app.AddMemoryTextureFile(player->customTextureUrl, nullptr, 0);
}
if (!player->customTextureUrl2.empty() &&
@ -178,12 +178,12 @@ void PlayerList::placeNewPlayer(Connection* connection,
player->customTextureUrl2.c_str(), player->name.c_str());
#endif
playerConnection->send(std::shared_ptr<TexturePacket>(
new TexturePacket(player->customTextureUrl2, NULL, 0)));
new TexturePacket(player->customTextureUrl2, nullptr, 0)));
}
} else if (!player->customTextureUrl2.empty() &&
app.IsFileInMemoryTextures(player->customTextureUrl2)) {
// Update the ref count on the memory texture data
app.AddMemoryTextureFile(player->customTextureUrl2, NULL, 0);
app.AddMemoryTextureFile(player->customTextureUrl2, nullptr, 0);
}
player->setIsGuest(packet->m_isGuest);
@ -277,11 +277,11 @@ void PlayerList::placeNewPlayer(Connection* connection,
player->initMenu();
if (playerTag != NULL && playerTag->contains(Entity::RIDING_TAG)) {
if (playerTag != nullptr && playerTag->contains(Entity::RIDING_TAG)) {
// this player has been saved with a mount tag
std::shared_ptr<Entity> mount = EntityIO::loadStatic(
playerTag->getCompound(Entity::RIDING_TAG), level);
if (mount != NULL) {
if (mount != nullptr) {
mount->forcedLoading = true;
level->addEntity(mount);
player->ride(mount);
@ -293,12 +293,12 @@ void PlayerList::placeNewPlayer(Connection* connection,
// is travelling through the win portal, then we should set our wonGame flag
// to true so that respawning works when the EndPoem is closed
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
if (thisPlayer != NULL) {
if (thisPlayer != nullptr) {
for (auto it = players.begin(); it != players.end(); ++it) {
std::shared_ptr<ServerPlayer> servPlayer = *it;
INetworkPlayer* checkPlayer =
servPlayer->connection->getNetworkPlayer();
if (thisPlayer != checkPlayer && checkPlayer != NULL &&
if (thisPlayer != checkPlayer && checkPlayer != nullptr &&
thisPlayer->IsSameSystem(checkPlayer) && servPlayer->wonGame) {
player->wonGame = true;
break;
@ -321,7 +321,7 @@ void PlayerList::updateEntireScoreboard(ServerScoreboard* scoreboard,
//{
// Objective objective = scoreboard->getDisplayObjective(slot);
// if (objective != NULL && !objectives->contains(objective))
// if (objective != nullptr && !objectives->contains(objective))
// {
// vector<shared_ptr<Packet> > *packets =
// scoreboard->getStartTrackingPackets(objective);
@ -344,7 +344,7 @@ void PlayerList::changeDimension(std::shared_ptr<ServerPlayer> player,
ServerLevel* from) {
ServerLevel* to = player->getLevel();
if (from != NULL) from->getChunkMap()->remove(player);
if (from != nullptr) from->getChunkMap()->remove(player);
to->getChunkMap()->add(player);
to->cache->create(((int)player->x) >> 4, ((int)player->z) >> 4);
@ -427,10 +427,10 @@ void PlayerList::validatePlayerSpawnPosition(
delete levelSpawn;
Pos* bedPosition = player->getRespawnPosition();
if (bedPosition != NULL) {
if (bedPosition != nullptr) {
Pos* respawnPosition = Player::checkBedValidRespawnPosition(
server->getLevel(player->dimension), bedPosition, spawnForced);
if (respawnPosition != NULL) {
if (respawnPosition != nullptr) {
player->moveTo(respawnPosition->x + 0.5f,
respawnPosition->y + 0.1f,
respawnPosition->z + 0.5f, 0, 0);
@ -472,7 +472,7 @@ void PlayerList::add(std::shared_ptr<ServerPlayer> player) {
// 4J Stu - Swapped these lines about so that we get the chunk visiblity
// packet way ahead of all the add tracked entity packets Fix for #9169 -
// ART : Sign text is replaced with the words “Awaiting approval”.
changeDimension(player, NULL);
changeDimension(player, nullptr);
level->addEntity(player);
for (int i = 0; i < players.size(); i++) {
@ -490,7 +490,7 @@ void PlayerList::add(std::shared_ptr<ServerPlayer> player) {
for (unsigned int i = 0; i < players.size(); i++) {
std::shared_ptr<ServerPlayer> thisPlayer = players[i];
if (thisPlayer->isSleeping()) {
if (firstSleepingPlayer == NULL)
if (firstSleepingPlayer == nullptr)
firstSleepingPlayer = thisPlayer;
thisPlayer->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket(
@ -512,7 +512,7 @@ void PlayerList::remove(std::shared_ptr<ServerPlayer> player) {
// sure that the player is gone delete the map
if (player->isGuest()) playerIo->deleteMapFilesForPlayer(player);
ServerLevel* level = player->getLevel();
if (player->riding != NULL) {
if (player->riding != nullptr) {
// remove mount first because the player unmounts when being
// removed, also remove mount because it's saved in the player's
// save tag
@ -533,11 +533,11 @@ void PlayerList::remove(std::shared_ptr<ServerPlayer> player) {
// else there is a circular dependency
delete player->gameMode; // Gamemode also needs deleted as it references
// back to this player
player->gameMode = NULL;
player->gameMode = nullptr;
// 4J Stu - Save all the players currently in the game, which will also free
// up unused map id slots if required, and remove old players
saveAll(NULL, false);
saveAll(nullptr, false);
}
std::shared_ptr<ServerPlayer> PlayerList::getPlayerForLogin(
@ -559,14 +559,14 @@ std::shared_ptr<ServerPlayer> PlayerList::getPlayerForLogin(
// Work out the base server player settings
INetworkPlayer* networkPlayer =
pendingConnection->connection->getSocket()->getPlayer();
if (networkPlayer != NULL && !networkPlayer->IsHost()) {
if (networkPlayer != nullptr && !networkPlayer->IsHost()) {
player->enableAllPlayerPrivileges(
app.GetGameHostOption(eGameHostOption_TrustPlayers) > 0);
}
// 4J Added
LevelRuleset* serverRuleDefs = app.getGameRuleDefinitions();
if (serverRuleDefs != NULL) {
if (serverRuleDefs != nullptr) {
player->gameMode->setGameRules(
GameRuleDefinition::generateNewGameRulesInstance(
GameRulesInstance::eGameRulesInstanceType_ServerPlayer,
@ -602,7 +602,7 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(
if (ep->dimension != oldDimension) continue;
INetworkPlayer* otherPlayer = ep->connection->getNetworkPlayer();
if (otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer)) {
if (otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer)) {
// There's another player here in the same dimension - we're not
// the last one out
isEmptying = false;
@ -704,7 +704,7 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(
// screen
player->moveTo(serverPlayer->x, serverPlayer->y, serverPlayer->z,
serverPlayer->yRot, serverPlayer->xRot);
if (bedPosition != NULL) {
if (bedPosition != nullptr) {
player->setRespawnPosition(bedPosition, spawnForced);
delete bedPosition;
}
@ -712,11 +712,11 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(
// replaces the Player's currently held item with the first one from the
// Quickbar
player->inventory->selected = serverPlayer->inventory->selected;
} else if (bedPosition != NULL) {
} else if (bedPosition != nullptr) {
Pos* respawnPosition = Player::checkBedValidRespawnPosition(
server->getLevel(serverPlayer->dimension), bedPosition,
spawnForced);
if (respawnPosition != NULL) {
if (respawnPosition != nullptr) {
player->moveTo(respawnPosition->x + 0.5f, respawnPosition->y + 0.1f,
respawnPosition->z + 0.5f, 0, 0);
player->setRespawnPosition(bedPosition, spawnForced);
@ -807,7 +807,7 @@ void PlayerList::toggleDimension(std::shared_ptr<ServerPlayer> player,
if (ep->dimension != lastDimension) continue;
INetworkPlayer* otherPlayer = ep->connection->getNetworkPlayer();
if (otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer)) {
if (otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer)) {
// There's another player here in the same dimension - we're not the
// last one out
isEmptying = false;
@ -1006,11 +1006,11 @@ void PlayerList::tick() {
for (unsigned int i = 0; i < players.size(); i++) {
std::shared_ptr<ServerPlayer> p = players.at(i);
// 4J Stu - May be being a bit overprotective with all the NULL
// 4J Stu - May be being a bit overprotective with all the nullptr
// checks, but adding late in TU7 so want to be safe
if (p != NULL && p->connection != NULL &&
p->connection->connection != NULL &&
p->connection->connection->getSocket() != NULL &&
if (p != nullptr && p->connection != nullptr &&
p->connection->connection != nullptr &&
p->connection->connection->getSocket() != nullptr &&
p->connection->connection->getSocket()->getSmallId() ==
smallId) {
player = p;
@ -1018,7 +1018,7 @@ void PlayerList::tick() {
}
}
if (player != NULL) {
if (player != nullptr) {
player->connection->disconnect(
DisconnectPacket::eDisconnect_Closed);
}
@ -1031,7 +1031,7 @@ void PlayerList::tick() {
m_smallIdsToKick.pop_front();
INetworkPlayer* selectedPlayer =
g_NetworkManager.GetPlayerBySmallId(smallId);
if (selectedPlayer != NULL) {
if (selectedPlayer != nullptr) {
if (selectedPlayer->IsLocal() != TRUE) {
// #if 0
PlayerUID xuid = selectedPlayer->GetUID();
@ -1041,14 +1041,14 @@ void PlayerList::tick() {
for (unsigned int i = 0; i < players.size(); i++) {
std::shared_ptr<ServerPlayer> p = players.at(i);
PlayerUID playersXuid = p->getOnlineXuid();
if (p != NULL &&
if (p != nullptr &&
ProfileManager.AreXUIDSEqual(playersXuid, xuid)) {
player = p;
break;
}
}
if (player != NULL) {
if (player != nullptr) {
m_bannedXuids.push_back(player->getOnlineXuid());
// 4J Stu - If we have kicked a player, make sure that they
// have no privileges if they later try to join the world
@ -1074,7 +1074,7 @@ void PlayerList::tick() {
if (currentPlayer->removed) {
std::shared_ptr<ServerPlayer> newPlayer =
findAlivePlayerOnSystem(currentPlayer);
if (newPlayer != NULL) {
if (newPlayer != nullptr) {
receiveAllPlayers[dim][i] = newPlayer;
app.DebugPrintf(
"Replacing primary player %ls with %ls in dimension "
@ -1132,7 +1132,7 @@ bool PlayerList::isOp(std::shared_ptr<ServerPlayer> player) {
INetworkPlayer* networkPlayer = player->connection->getNetworkPlayer();
bool isOp =
cheatsEnabled && (player->isModerator() ||
(networkPlayer != NULL && networkPlayer->IsHost()));
(networkPlayer != nullptr && networkPlayer->IsHost()));
return isOp;
}
@ -1167,7 +1167,7 @@ std::shared_ptr<ServerPlayer> PlayerList::getPlayer(PlayerUID uid) {
std::shared_ptr<ServerPlayer> PlayerList::getNearestPlayer(Pos* position,
int range) {
if (players.empty()) return nullptr;
if (position == NULL) return players.at(0);
if (position == nullptr) return players.at(0);
std::shared_ptr<ServerPlayer> current = nullptr;
double dist = -1;
int rangeSqr = range * range;
@ -1194,9 +1194,9 @@ std::vector<ServerPlayer>* PlayerList::getPlayers(
const std::wstring& playerName, const std::wstring& teamName,
Level* level) {
app.DebugPrintf("getPlayers NOT IMPLEMENTED!");
return NULL;
return nullptr;
/*if (players.empty()) return NULL;
/*if (players.empty()) return nullptr;
vector<shared_ptr<ServerPlayer> > result = new
vector<shared_ptr<ServerPlayer> >(); bool reverse = count < 0; bool
playerNameNot = !playerName.empty() && playerName.startsWith("!"); bool
@ -1282,7 +1282,7 @@ bool PlayerList::meetsScoreRequirements(
void PlayerList::sendMessage(const std::wstring& name,
const std::wstring& message) {
std::shared_ptr<ServerPlayer> player = getPlayer(name);
if (player != NULL) {
if (player != nullptr) {
player->connection->send(
std::shared_ptr<ChatPacket>(new ChatPacket(message)));
}
@ -1300,7 +1300,7 @@ void PlayerList::broadcast(std::shared_ptr<Player> except, double x, double y,
// Add the source player to the machines we have "sent" to as it doesn't
// need to go to that machine either
std::vector<std::shared_ptr<ServerPlayer> > sentTo;
if (except != NULL) {
if (except != nullptr) {
sentTo.push_back(std::dynamic_pointer_cast<ServerPlayer>(except));
}
@ -1313,14 +1313,14 @@ void PlayerList::broadcast(std::shared_ptr<Player> except, double x, double y,
bool dontSend = false;
if (sentTo.size()) {
INetworkPlayer* thisPlayer = p->connection->getNetworkPlayer();
if (thisPlayer == NULL) {
if (thisPlayer == nullptr) {
dontSend = true;
} else {
for (unsigned int j = 0; j < sentTo.size(); j++) {
std::shared_ptr<ServerPlayer> player2 = sentTo[j];
INetworkPlayer* otherPlayer =
player2->connection->getNetworkPlayer();
if (otherPlayer != NULL &&
if (otherPlayer != nullptr &&
thisPlayer->IsSameSystem(otherPlayer)) {
dontSend = true;
}
@ -1343,9 +1343,9 @@ void PlayerList::broadcast(std::shared_ptr<Player> except, double x, double y,
void PlayerList::saveAll(ProgressListener* progressListener,
bool bDeleteGuestMaps /*= false*/) {
if (progressListener != NULL)
if (progressListener != nullptr)
progressListener->progressStart(IDS_PROGRESS_SAVING_PLAYERS);
// 4J - playerIo can be NULL if we have have to exit a game really early on
// 4J - playerIo can be nullptr if we have have to exit a game really early on
// due to network failure
if (playerIo) {
playerIo->saveAllCachedData();
@ -1357,7 +1357,7 @@ void PlayerList::saveAll(ProgressListener* progressListener,
if (bDeleteGuestMaps && players[i]->isGuest())
playerIo->deleteMapFilesForPlayer(players[i]);
if (progressListener != NULL)
if (progressListener != nullptr)
progressListener->progressStagePercentage(
(i * 100) / ((int)players.size()));
}
@ -1431,10 +1431,10 @@ void PlayerList::updatePlayerGameMode(std::shared_ptr<ServerPlayer> newPlayer,
Level* level) {
// reset the player's game mode (first pick from old, then copy level if
// necessary)
if (oldPlayer != NULL) {
if (oldPlayer != nullptr) {
newPlayer->gameMode->setGameModeForPlayer(
oldPlayer->gameMode->getGameModeForPlayer());
} else if (overrideGameMode != NULL) {
} else if (overrideGameMode != nullptr) {
newPlayer->gameMode->setGameModeForPlayer(overrideGameMode);
}
newPlayer->gameMode->updateGameMode(level->getLevelData()->getGameType());
@ -1454,7 +1454,7 @@ std::shared_ptr<ServerPlayer> PlayerList::findAlivePlayerOnSystem(
dimIndex = 2;
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
if (thisPlayer != NULL) {
if (thisPlayer != nullptr) {
for (auto itP = players.begin(); itP != players.end(); ++itP) {
std::shared_ptr<ServerPlayer> newPlayer = *itP;
@ -1462,7 +1462,7 @@ std::shared_ptr<ServerPlayer> PlayerList::findAlivePlayerOnSystem(
newPlayer->connection->getNetworkPlayer();
if (!newPlayer->removed && newPlayer != player &&
newPlayer->dimension == playerDim && otherPlayer != NULL &&
newPlayer->dimension == playerDim && otherPlayer != nullptr &&
otherPlayer->IsSameSystem(thisPlayer)) {
return newPlayer;
}
@ -1501,7 +1501,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr<ServerPlayer> player,
}
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
if (thisPlayer != NULL && playerRemoved) {
if (thisPlayer != nullptr && playerRemoved) {
for (auto itP = players.begin(); itP != players.end(); ++itP) {
std::shared_ptr<ServerPlayer> newPlayer = *itP;
@ -1509,7 +1509,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr<ServerPlayer> player,
newPlayer->connection->getNetworkPlayer();
if (newPlayer != player && newPlayer->dimension == playerDim &&
otherPlayer != NULL && otherPlayer->IsSameSystem(thisPlayer)) {
otherPlayer != nullptr && otherPlayer->IsSameSystem(thisPlayer)) {
#if !defined(_CONTENT_PACKAGE)
app.DebugPrintf(
"Remove: Adding player %ls as primary in dimension %d\n",
@ -1519,10 +1519,10 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr<ServerPlayer> player,
break;
}
}
} else if (thisPlayer == NULL) {
} else if (thisPlayer == nullptr) {
#if !defined(_CONTENT_PACKAGE)
app.DebugPrintf(
"Remove: Qnet player for %ls was NULL so re-checking all players\n",
"Remove: Qnet player for %ls was nullptr so re-checking all players\n",
player->name.c_str());
#endif
// 4J Stu - Something went wrong, or possibly the QNet player left
@ -1533,7 +1533,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr<ServerPlayer> player,
INetworkPlayer* checkingPlayer =
newPlayer->connection->getNetworkPlayer();
if (checkingPlayer != NULL) {
if (checkingPlayer != nullptr) {
int newPlayerDim = 0;
if (newPlayer->dimension == -1)
newPlayerDim = 1;
@ -1545,7 +1545,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr<ServerPlayer> player,
std::shared_ptr<ServerPlayer> primaryPlayer = *it;
INetworkPlayer* primPlayer =
primaryPlayer->connection->getNetworkPlayer();
if (primPlayer != NULL &&
if (primPlayer != nullptr &&
checkingPlayer->IsSameSystem(primPlayer)) {
foundPrimary = true;
break;
@ -1581,10 +1581,10 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr<ServerPlayer> player) {
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
if (thisPlayer == NULL) {
if (thisPlayer == nullptr) {
#if !defined(_CONTENT_PACKAGE)
app.DebugPrintf(
"Add: Qnet player for player %ls is NULL so not adding them\n",
"Add: Qnet player for player %ls is nullptr so not adding them\n",
player->name.c_str());
#endif
shouldAddPlayer = false;
@ -1594,7 +1594,7 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr<ServerPlayer> player) {
std::shared_ptr<ServerPlayer> oldPlayer = *it;
INetworkPlayer* checkingPlayer =
oldPlayer->connection->getNetworkPlayer();
if (checkingPlayer != NULL &&
if (checkingPlayer != nullptr &&
checkingPlayer->IsSameSystem(thisPlayer)) {
shouldAddPlayer = false;
break;

View file

@ -73,7 +73,7 @@ bool ServerChunkCache::hasChunk(int x, int z) {
if ((iz < 0) || (iz >= XZSIZE)) return true;
int idx = ix * XZSIZE + iz;
LevelChunk* lc = cache[idx];
if (lc == NULL) return false;
if (lc == nullptr) return false;
return true;
}
@ -145,17 +145,17 @@ LevelChunk* ServerChunkCache::create(
LevelChunk* chunk = cache[idx];
LevelChunk* lastChunk = chunk;
if ((chunk == NULL) || (chunk->x != x) || (chunk->z != z)) {
if ((chunk == nullptr) || (chunk->x != x) || (chunk->z != z)) {
EnterCriticalSection(&m_csLoadCreate);
chunk = load(x, z);
if (chunk == NULL) {
if (source == NULL) {
if (chunk == nullptr) {
if (source == nullptr) {
chunk = emptyChunk;
} else {
chunk = source->getChunk(x, z);
}
}
if (chunk != NULL) {
if (chunk != nullptr) {
chunk->load();
}
@ -349,7 +349,7 @@ void ServerChunkCache::overwriteLevelChunkFromSource(int x, int z) {
if ((iz < 0) || (iz >= XZSIZE)) assert(0);
int idx = ix * XZSIZE + iz;
LevelChunk* chunk = NULL;
LevelChunk* chunk = nullptr;
chunk = source->getChunk(x, z);
assert(chunk);
if (chunk) {
@ -418,35 +418,35 @@ void ServerChunkCache::dontDrop(int x, int z) {
#endif
LevelChunk* ServerChunkCache::load(int x, int z) {
if (storage == NULL) return NULL;
if (storage == nullptr) return nullptr;
LevelChunk* levelChunk = NULL;
LevelChunk* levelChunk = nullptr;
#if defined(_LARGE_WORLDS)
int ix = x + XZOFFSET;
int iz = z + XZOFFSET;
int idx = ix * XZSIZE + iz;
levelChunk = m_unloadedCache[idx];
m_unloadedCache[idx] = NULL;
if (levelChunk == NULL)
m_unloadedCache[idx] = nullptr;
if (levelChunk == nullptr)
#endif
{
levelChunk = storage->load(level, x, z);
}
if (levelChunk != NULL) {
if (levelChunk != nullptr) {
levelChunk->lastSaveTime = level->getGameTime();
}
return levelChunk;
}
void ServerChunkCache::saveEntities(LevelChunk* levelChunk) {
if (storage == NULL) return;
if (storage == nullptr) return;
storage->saveEntities(level, levelChunk);
}
void ServerChunkCache::save(LevelChunk* levelChunk) {
if (storage == NULL) return;
if (storage == nullptr) return;
levelChunk->lastSaveTime = level->getGameTime();
storage->save(level, levelChunk);
@ -584,7 +584,7 @@ void ServerChunkCache::postProcess(ChunkSource* parent, int x, int z) {
LevelChunk* chunk = getChunk(x, z);
if ((chunk->terrainPopulated & LevelChunk::sTerrainPopulatedFromHere) ==
0) {
if (source != NULL) {
if (source != nullptr) {
PIXBeginNamedEvent(0, "Main post processing");
source->postProcess(parent, x, z);
PIXEndNamedEvent();
@ -675,7 +675,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) {
// 4J - added this to support progressListner
int count = 0;
if (progressListener != NULL) {
if (progressListener != nullptr) {
auto itEnd = m_loadedChunkList.end();
for (auto it = m_loadedChunkList.begin(); it != itEnd; it++) {
LevelChunk* chunk = *it;
@ -706,7 +706,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) {
}
// 4J - added this to support progressListener
if (progressListener != NULL) {
if (progressListener != nullptr) {
if (++cc % 10 == 0) {
progressListener->progressStagePercentage(cc * 100 /
count);
@ -756,7 +756,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) {
}
// 4J - added this to support progressListener
if (progressListener != NULL) {
if (progressListener != nullptr) {
if (++cc % 10 == 0) {
progressListener->progressStagePercentage(cc * 100 /
count);
@ -775,7 +775,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) {
}
if (force) {
if (storage == NULL) {
if (storage == nullptr) {
LeaveCriticalSection(&m_csLoadCreate);
return true;
}
@ -822,14 +822,14 @@ bool ServerChunkCache::tick() {
int iz = chunk->z + XZOFFSET;
int idx = ix * XZSIZE + iz;
m_unloadedCache[idx] = chunk;
cache[idx] = NULL;
cache[idx] = nullptr;
}
}
m_toDrop.pop_front();
}
}
#endif
if (storage != NULL) storage->tick();
if (storage != nullptr) storage->tick();
}
return source->tick();
@ -872,7 +872,7 @@ int ServerChunkCache::runSaveThreadProc(void* lpParam) {
// app.DebugPrintf("Save thread has started\n");
while (params->chunkToSave != NULL) {
while (params->chunkToSave != nullptr) {
PIXBeginNamedEvent(0, "Saving entities");
// app.DebugPrintf("Save thread has started processing a chunk\n");
if (params->saveEntities)

View file

@ -71,7 +71,7 @@ void ServerConnection::tick() {
// logger.log(Level.WARNING, "Failed to handle packet: "
// + e, e);
// }
if (uc->connection != NULL) uc->connection->flush();
if (uc->connection != nullptr) uc->connection->flush();
}
}
@ -153,7 +153,7 @@ void ServerConnection::handleServerSettingsChanged(
if (packet->action == ServerSettingsChangedPacket::HOST_DIFFICULTY) {
for (unsigned int i = 0; i < pMinecraft->levels.length; ++i) {
if (pMinecraft->levels[i] != NULL) {
if (pMinecraft->levels[i] != nullptr) {
app.DebugPrintf(
"ClientConnection::handleServerSettingsChanged - "
"Difficulty = %d",

View file

@ -31,7 +31,7 @@ void ServerScoreboard::setDisplayObjective(int slot, Objective* objective) {
// Scoreboard::setDisplayObjective(slot, objective);
// if (old != objective && old != NULL)
// if (old != objective && old != nullptr)
//{
// if (getObjectiveDisplaySlotCount(old) > 0)
// {
@ -45,7 +45,7 @@ void ServerScoreboard::setDisplayObjective(int slot, Objective* objective) {
// }
// }
// if (objective != NULL)
// if (objective != nullptr)
//{
// if (trackedObjectives.contains(objective))
// {
@ -144,7 +144,7 @@ void ServerScoreboard::setSaveData(ScoreboardSaveData* data) {
}
void ServerScoreboard::setDirty() {
// if (saveData != NULL)
// if (saveData != nullptr)
//{
// saveData->setDirty();
// }
@ -152,7 +152,7 @@ void ServerScoreboard::setDirty() {
std::vector<std::shared_ptr<Packet> >*
ServerScoreboard::getStartTrackingPackets(Objective* objective) {
return NULL;
return nullptr;
// vector<shared_ptr<Packet> > *packets = new vector<shared_ptr<Packet> >();
// packets.push_back( shared_ptr<SetObjectivePacket>( new
@ -191,7 +191,7 @@ void ServerScoreboard::startTrackingObjective(Objective* objective) {
std::vector<std::shared_ptr<Packet> >* ServerScoreboard::getStopTrackingPackets(
Objective* objective) {
return NULL;
return nullptr;
// vector<shared_ptr<Packet> > *packets = new ArrayList<Packet>();
// packets->push_back( shared_ptr<SetObjectivePacket( new

View file

@ -822,7 +822,7 @@ void SoundEngine::init(Options* pOptions) {
m_hBank = AIL_add_soundbank(szBankName, 0);
if (m_hBank == NULL) {
if (m_hBank == nullptr) {
char* Error = AIL_last_error();
app.DebugPrintf("Couldn't open soundbank: %s (%s)\n", szBankName,
Error);
@ -852,7 +852,7 @@ void SoundEngine::init(Options* pOptions) {
m_bSystemMusicPlaying = false;
m_openStreamThread = NULL;
m_openStreamThread = nullptr;
}
@ -1108,7 +1108,7 @@ void SoundEngine::tick(std::shared_ptr<Mob>* players, float a) {
if (players) {
bool bListenerPostionSet = false;
for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) {
if (players[i] != NULL) {
if (players[i] != nullptr) {
m_ListenerA[i].bValid = true;
F32 x, y, z;
x = players[i]->xo + (players[i]->x - players[i]->xo) * a;
@ -1157,7 +1157,7 @@ SoundEngine::SoundEngine() {
m_iMusicDelay = 0;
m_validListenerCount = 0;
m_bHeardTrackA = NULL;
m_bHeardTrackA = nullptr;
// Start the streaming music playing some music from the overworld
SetStreamingSounds(eStream_Overworld_Calm1, eStream_Overworld_piano3,
@ -1350,7 +1350,7 @@ void SoundEngine::playStreaming(const std::wstring& name, float x, float y,
bool playerInNether = false;
for (unsigned int i = 0; i < MAX_LOCAL_PLAYERS; i++) {
if (pMinecraft->localplayers[i] != NULL) {
if (pMinecraft->localplayers[i] != nullptr) {
if (pMinecraft->localplayers[i]->dimension ==
LevelData::DIMENSION_END) {
playerInEnd = true;
@ -1511,7 +1511,7 @@ void SoundEngine::playMusicUpdate() {
// proceed to actually playing
if (!m_openStreamThread->isRunning()) {
delete m_openStreamThread;
m_openStreamThread = NULL;
m_openStreamThread = nullptr;
HSAMPLE hSample = AIL_stream_sample_handle(m_hStream);
@ -1593,7 +1593,7 @@ void SoundEngine::playMusicUpdate() {
case eMusicStreamState_OpeningCancel:
if (!m_openStreamThread->isRunning()) {
delete m_openStreamThread;
m_openStreamThread = NULL;
m_openStreamThread = nullptr;
m_StreamState = eMusicStreamState_Stop;
}
break;
@ -1612,13 +1612,13 @@ void SoundEngine::playMusicUpdate() {
break;
case eMusicStreamState_Playing:
if (GetIsPlayingStreamingGameMusic()) {
// if(m_MusicInfo.pCue!=NULL)
// if(m_MusicInfo.pCue!=nullptr)
{
bool playerInEnd = false;
bool playerInNether = false;
Minecraft* pMinecraft = Minecraft::GetInstance();
for (unsigned int i = 0; i < MAX_LOCAL_PLAYERS; ++i) {
if (pMinecraft->localplayers[i] != NULL) {
if (pMinecraft->localplayers[i] != nullptr) {
if (pMinecraft->localplayers[i]->dimension ==
LevelData::DIMENSION_END) {
playerInEnd = true;
@ -1750,7 +1750,7 @@ void SoundEngine::playMusicUpdate() {
bool playerInNether = false;
for (unsigned int i = 0; i < MAX_LOCAL_PLAYERS; i++) {
if (pMinecraft->localplayers[i] != NULL) {
if (pMinecraft->localplayers[i] != nullptr) {
if (pMinecraft->localplayers[i]->dimension ==
LevelData::DIMENSION_END) {
playerInEnd = true;
@ -1901,7 +1901,7 @@ bool SoundEngine::isStreamingWavebankReady() { return true; }
// This is unused by the linux version, it'll need to be changed
char* SoundEngine::ConvertSoundPathToName(const std::wstring& name,
bool bConvertSpaces) {
return NULL;
return nullptr;
}
void ConsoleSoundEngine::tick() {

View file

@ -36,8 +36,8 @@ public:
m_sizeOfEachBlock = 0;
m_numFreeBlocks = 0;
m_numInitialized = 0;
m_memStart = NULL;
m_memEnd = NULL;
m_memStart = nullptr;
m_memEnd = nullptr;
m_next = 0;
}
@ -65,7 +65,7 @@ public:
void DestroyPool()
{
delete[] m_memStart;
m_memStart = NULL;
m_memStart = nullptr;
}
uchar* AddrFromIndex(uint i) const
@ -89,7 +89,7 @@ public:
*p = m_numInitialized + 1;
m_numInitialized++;
}
void* ret = NULL;
void* ret = nullptr;
if ( m_numFreeBlocks > 0 )
{
ret = (void*)m_next;
@ -100,7 +100,7 @@ public:
}
else
{
m_next = NULL;
m_next = nullptr;
}
}
// LeaveCriticalSection(&m_CS);
@ -115,7 +115,7 @@ public:
return;
}
// EnterCriticalSection(&m_CS);
if (m_next != NULL)
if (m_next != nullptr)
{
(*(uint*)ptr) = IndexFromAddr( m_next );
m_next = (uchar*)ptr;

View file

@ -149,9 +149,9 @@ CMinecraftApp::CMinecraftApp() {
// m_bRead_TMS_XUIDS_XML=false;
// m_bRead_TMS_DLCINFO_XML=false;
m_pDLCFileBuffer = NULL;
m_pDLCFileBuffer = nullptr;
m_dwDLCFileSize = 0;
m_pBannedListFileBuffer = NULL;
m_pBannedListFileBuffer = nullptr;
m_dwBannedListFileSize = 0;
m_bDefaultCapeInstallAttempted = false;
@ -708,7 +708,7 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS* pSettings,
SetGameSettings(iPad, eGameSetting_Gamma, 50);
// 4J-PB - Don't reset the difficult level if we're in-game
if (Minecraft::GetInstance()->level == NULL) {
if (Minecraft::GetInstance()->level == nullptr) {
app.DebugPrintf("SetDefaultOptions - Difficulty = 1\n");
SetGameSettings(iPad, eGameSetting_Difficulty, 1);
}
@ -1032,7 +1032,7 @@ void CMinecraftApp::ActionGameSettings(int iPad, eGameSetting eVal) {
pMinecraft->options->difficulty);
// send this to the other players if we are in-game
bool bInGame = pMinecraft->level != NULL;
bool bInGame = pMinecraft->level != nullptr;
// Game Host only (and for now we can't change the diff while in
// game, so this shouldn't happen)
@ -1111,7 +1111,7 @@ void CMinecraftApp::ActionGameSettings(int iPad, eGameSetting eVal) {
}
break;
case eGameSetting_GamertagsVisible: {
bool bInGame = pMinecraft->level != NULL;
bool bInGame = pMinecraft->level != nullptr;
// Game Host only
if (bInGame && g_NetworkManager.IsHost() &&
@ -1149,7 +1149,7 @@ void CMinecraftApp::ActionGameSettings(int iPad, eGameSetting eVal) {
case eGameSetting_DisplaySplitscreenGamertags:
for (std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) {
if (pMinecraft->localplayers[idx] != NULL) {
if (pMinecraft->localplayers[idx] != nullptr) {
if (pMinecraft->localplayers[idx]->m_iScreenSection ==
C4JRender::VIEWPORT_TYPE_FULLSCREEN) {
ui.DisplayGamertag(idx, false);
@ -1188,7 +1188,7 @@ void CMinecraftApp::ActionGameSettings(int iPad, eGameSetting eVal) {
// nothing to do here
break;
case eGameSetting_BedrockFog: {
bool bInGame = pMinecraft->level != NULL;
bool bInGame = pMinecraft->level != nullptr;
// Game Host only
if (bInGame && g_NetworkManager.IsHost() &&
@ -1249,7 +1249,7 @@ void CMinecraftApp::SetPlayerSkin(int iPad, std::uint32_t dwSkinId) {
TelemetryManager->RecordSkinChanged(iPad,
GameSettingsA[iPad]->dwSelectedSkin);
if (Minecraft::GetInstance()->localplayers[iPad] != NULL)
if (Minecraft::GetInstance()->localplayers[iPad] != nullptr)
Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin(
dwSkinId);
}
@ -1261,8 +1261,8 @@ std::wstring CMinecraftApp::GetPlayerSkinName(int iPad) {
std::uint32_t CMinecraftApp::GetPlayerSkinId(int iPad) {
// 4J-PB -check the user has rights to use this skin - they may have had at
// some point but the entitlement has been removed.
DLCPack* Pack = NULL;
DLCSkinFile* skinFile = NULL;
DLCPack* Pack = nullptr;
DLCSkinFile* skinFile = nullptr;
std::uint32_t dwSkin = GameSettingsA[iPad]->dwSelectedSkin;
wchar_t chars[256];
@ -1312,7 +1312,7 @@ void CMinecraftApp::SetPlayerCape(int iPad, std::uint32_t dwCapeId) {
// SentientManager.RecordSkinChanged(iPad,
// GameSettingsA[iPad]->dwSelectedSkin);
if (Minecraft::GetInstance()->localplayers[iPad] != NULL)
if (Minecraft::GetInstance()->localplayers[iPad] != nullptr)
Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape(
dwCapeId);
}
@ -1373,7 +1373,7 @@ void CMinecraftApp::ValidateFavoriteSkins(int iPad) {
// Also check they haven't reverted to a trial pack
DLCPack* pDLCPack = app.m_dlcManager.getPackContainingSkin(chars);
if (pDLCPack != NULL) {
if (pDLCPack != nullptr) {
// 4J-PB - We should let players add the free skins to their
// favourites as well!
// DLCFile
@ -1416,7 +1416,7 @@ void CMinecraftApp::SetMinecraftLanguage(int iPad, unsigned char ucLanguage) {
unsigned char CMinecraftApp::GetMinecraftLanguage(int iPad) {
// if there are no game settings read yet, return the default language
if (GameSettingsA[iPad] == NULL) {
if (GameSettingsA[iPad] == nullptr) {
return 0;
} else {
return GameSettingsA[iPad]->ucLanguage;
@ -1430,7 +1430,7 @@ void CMinecraftApp::SetMinecraftLocale(int iPad, unsigned char ucLocale) {
unsigned char CMinecraftApp::GetMinecraftLocale(int iPad) {
// if there are no game settings read yet, return the default language
if (GameSettingsA[iPad] == NULL) {
if (GameSettingsA[iPad] == nullptr) {
return 0;
} else {
return GameSettingsA[iPad]->ucLocale;
@ -2044,7 +2044,7 @@ unsigned int CMinecraftApp::GetGameSettingsDebugMask(
std::shared_ptr<Player> player =
Minecraft::GetInstance()->localplayers[iPad];
if (bOverridePlayer || player == NULL) {
if (bOverridePlayer || player == nullptr) {
return GameSettingsA[iPad]->uiDebugBitmask;
} else {
return player->GetDebugOptions();
@ -2311,7 +2311,7 @@ void CMinecraftApp::HandleXuiActions(void) {
// Check that there is a name for the save - if we're saving
// from the tutorial and this is the first save from the
// tutorial, we'll not have a name
/*if(StorageManager.GetSaveName()==NULL)
/*if(StorageManager.GetSaveName()==nullptr)
{
app.NavigateToScene(i,eUIScene_SaveWorld);
}
@ -2385,7 +2385,7 @@ void CMinecraftApp::HandleXuiActions(void) {
// This just allows it to be shown
if (pMinecraft
->localgameModes[ProfileManager.GetPrimaryPad()] !=
NULL)
nullptr)
pMinecraft
->localgameModes[ProfileManager.GetPrimaryPad()]
->getTutorial()
@ -2699,8 +2699,8 @@ void CMinecraftApp::HandleXuiActions(void) {
// Changed - Don't use the FullScreenProgressScreen for
// action, use a dialog instead
completionData->bRequiresUserAction =
FALSE; //(param != NULL) ? TRUE : FALSE;
completionData->bShowTips = (param != NULL) ? FALSE : TRUE;
FALSE; //(param != nullptr) ? TRUE : FALSE;
completionData->bShowTips = (param != nullptr) ? FALSE : TRUE;
completionData->bShowBackground = TRUE;
completionData->bShowLogo = TRUE;
completionData->type =
@ -2823,7 +2823,7 @@ void CMinecraftApp::HandleXuiActions(void) {
} break;
case eAppAction_WaitForRespawnComplete:
player = pMinecraft->localplayers[i];
if (player != NULL && player->GetPlayerRespawned()) {
if (player != nullptr && player->GetPlayerRespawned()) {
SetAction(i, eAppAction_Idle);
if (ui.IsSceneInStack(i, eUIScene_EndPoem)) {
@ -2842,7 +2842,7 @@ void CMinecraftApp::HandleXuiActions(void) {
break;
case eAppAction_WaitForDimensionChangeComplete:
player = pMinecraft->localplayers[i];
if (player != NULL && player->connection &&
if (player != nullptr && player->connection &&
player->connection->isStarted()) {
SetAction(i, eAppAction_Idle);
ui.CloseUIScenes(i);
@ -2930,7 +2930,7 @@ void CMinecraftApp::HandleXuiActions(void) {
bool gameStarted = false;
for (int j = 0; j < pMinecraft->levels.length;
j++) {
if (pMinecraft->levels.data[j] != NULL) {
if (pMinecraft->levels.data[j] != nullptr) {
gameStarted = true;
break;
}
@ -3187,7 +3187,7 @@ void CMinecraftApp::HandleXuiActions(void) {
// unmount the pack
TexturePack* pTexPack =
Minecraft::GetInstance()->skins->getSelected();
DLCTexturePack* pDLCTexPack = NULL;
DLCTexturePack* pDLCTexPack = nullptr;
if (pTexPack->hasAudio()) {
// get the dlc texture pack, and store it
@ -3328,7 +3328,7 @@ void CMinecraftApp::HandleXuiActions(void) {
loadingParams->func =
&CGameNetworkManager::
ChangeSessionTypeThreadProc;
loadingParams->lpParam = NULL;
loadingParams->lpParam = nullptr;
UIFullscreenProgressCompletionData* completionData =
new UIFullscreenProgressCompletionData();
@ -3391,7 +3391,7 @@ void CMinecraftApp::HandleXuiActions(void) {
LoadingInputParams* loadingParams =
new LoadingInputParams();
loadingParams->func = &CMinecraftApp::RemoteSaveThreadProc;
loadingParams->lpParam = NULL;
loadingParams->lpParam = nullptr;
UIFullscreenProgressCompletionData* completionData =
new UIFullscreenProgressCompletionData();
@ -3707,7 +3707,7 @@ void CMinecraftApp::loadMediaArchive() {
void CMinecraftApp::loadStringTable() {
if (m_stringTable != NULL) {
if (m_stringTable != nullptr) {
// we need to unload the current std::string table, this is a reload
delete m_stringTable;
}
@ -3717,7 +3717,7 @@ void CMinecraftApp::loadStringTable() {
m_stringTable = new StringTable(locFile.data, locFile.length);
delete[] locFile.data;
} else {
m_stringTable = NULL;
m_stringTable = nullptr;
assert(false);
// AHHHHHHHHH.
}
@ -3729,7 +3729,7 @@ int CMinecraftApp::PrimaryPlayerSignedOutReturned(
// Minecraft *pMinecraft=Minecraft::GetInstance();
// if the player is null, we're in the menus
// if(Minecraft::GetInstance()->player!=NULL)
// if(Minecraft::GetInstance()->player!=nullptr)
// We always create a session before kicking of any of the game code, so
// even though we may still be joining/creating a game at this point we want
@ -3748,7 +3748,7 @@ int CMinecraftApp::EthernetDisconnectReturned(
Minecraft* pMinecraft = Minecraft::GetInstance();
// if the player is null, we're in the menus
if (Minecraft::GetInstance()->player != NULL) {
if (Minecraft::GetInstance()->player != nullptr) {
app.SetAction(pMinecraft->player->GetXboxPad(),
eAppAction_EthernetDisconnectedReturned);
} else {
@ -3772,7 +3772,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc(void* lpParameter) {
bool saveStats = false;
if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession()) {
if (lpParameter != NULL) {
if (lpParameter != nullptr) {
switch (app.GetDisconnectReason()) {
case DisconnectPacket::eDisconnect_Kicked:
exitReasonStringId = IDS_DISCONNECTED_KICKED;
@ -3801,18 +3801,18 @@ int CMinecraftApp::SignoutExitWorldThreadProc(void* lpParameter) {
exitReasonStringId);
// 4J - Force a disconnection, this handles the situation that the
// server has already disconnected
if (pMinecraft->levels[0] != NULL)
if (pMinecraft->levels[0] != nullptr)
pMinecraft->levels[0]->disconnect(false);
if (pMinecraft->levels[1] != NULL)
if (pMinecraft->levels[1] != nullptr)
pMinecraft->levels[1]->disconnect(false);
} else {
exitReasonStringId = IDS_EXITING_GAME;
pMinecraft->progressRenderer->progressStartNoAbort(
IDS_EXITING_GAME);
if (pMinecraft->levels[0] != NULL)
if (pMinecraft->levels[0] != nullptr)
pMinecraft->levels[0]->disconnect();
if (pMinecraft->levels[1] != NULL)
if (pMinecraft->levels[1] != nullptr)
pMinecraft->levels[1]->disconnect();
}
@ -3828,7 +3828,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc(void* lpParameter) {
// 4J Stu - Leave the session once the disconnect packet has been sent
g_NetworkManager.LeaveGame(FALSE);
} else {
if (lpParameter != NULL) {
if (lpParameter != nullptr) {
switch (app.GetDisconnectReason()) {
case DisconnectPacket::eDisconnect_Kicked:
exitReasonStringId = IDS_DISCONNECTED_KICKED;
@ -3853,7 +3853,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc(void* lpParameter) {
exitReasonStringId);
}
}
pMinecraft->setLevel(NULL, exitReasonStringId, nullptr, saveStats, true);
pMinecraft->setLevel(nullptr, exitReasonStringId, nullptr, saveStats, true);
// 4J-JEV: Fix for #106402 - TCR #014 BAS Debug Output:
// TU12: Mass Effect Mash-UP: Save file "Default_DisplayName" is created on
@ -3882,7 +3882,7 @@ int CMinecraftApp::UnlockFullInviteReturned(void* pParam, int iPad,
// full version game with a trial version, the trial crashes 4J-PB - we may
// be in the main menus here, and we don't have a pMinecraft->player
if (pMinecraft->player == NULL) {
if (pMinecraft->player == nullptr) {
bNoPlayer = true;
}
@ -4083,7 +4083,7 @@ void CMinecraftApp::SignInChangeCallback(void* pParam,
// invalidates all the guest players we have in the game
if (hasGuestIdChanged &&
pApp->m_currentSigninInfo[i].dwGuestNumber != 0 &&
g_NetworkManager.GetLocalPlayerByUserIndex(i) != NULL) {
g_NetworkManager.GetLocalPlayerByUserIndex(i) != nullptr) {
pApp->DebugPrintf(
"Recommending removal of player at index %d "
"because their guest id changed\n",
@ -4123,9 +4123,9 @@ void CMinecraftApp::SignInChangeCallback(void* pParam,
// manager or in the game, need to exit player
// TODO: Do we need to check the network manager?
if (g_NetworkManager.GetLocalPlayerByUserIndex(i) !=
NULL ||
nullptr ||
Minecraft::GetInstance()->localplayers[i] !=
NULL) {
nullptr) {
pApp->DebugPrintf("Player %d signed out\n", i);
pApp->SetAction(i, eAppAction_ExitPlayer);
}
@ -4200,7 +4200,7 @@ void CMinecraftApp::NotificationsCallback(void* pParam,
if (app.GetGameStarted() && g_NetworkManager.IsInSession()) {
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
if (!InputManager.IsPadConnected(i) &&
Minecraft::GetInstance()->localplayers[i] != NULL &&
Minecraft::GetInstance()->localplayers[i] != nullptr &&
!ui.IsPauseMenuDisplayed(i) &&
!ui.IsSceneInStack(i, eUIScene_EndPoem)) {
ui.CloseUIScenes(i);
@ -4296,7 +4296,7 @@ int CMinecraftApp::GetLocalPlayerCount(void) {
int iPlayerC = 0;
Minecraft* pMinecraft = Minecraft::GetInstance();
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
if (pMinecraft != NULL && pMinecraft->localplayers[i] != NULL) {
if (pMinecraft != nullptr && pMinecraft->localplayers[i] != nullptr) {
iPlayerC++;
}
}
@ -4420,16 +4420,16 @@ int CMinecraftApp::DLCMountedCallback(void* pParam, int iPad,
DLCPack* pack =
app.m_dlcManager.getPack(CONTENT_DATA_DISPLAY_NAME(ContentData));
if (pack != NULL && pack->IsCorrupt()) {
if (pack != nullptr && pack->IsCorrupt()) {
app.DebugPrintf(
"Pack '%ls' is corrupt, removing it from the DLC Manager.\n",
CONTENT_DATA_DISPLAY_NAME(ContentData));
app.m_dlcManager.removePack(pack);
pack = NULL;
pack = nullptr;
}
if (pack == NULL) {
if (pack == nullptr) {
app.DebugPrintf("Pack \"%ls\" is not installed, so adding it\n",
CONTENT_DATA_DISPLAY_NAME(ContentData));
@ -4480,7 +4480,7 @@ int CMinecraftApp::DLCMountedCallback(void* pParam, int iPad,
// // if the file is not already in the memory textures, then read
// it from TMS if(!bRes)
// {
// std::uint8_t *pBuffer=NULL;
// std::uint8_t *pBuffer=nullptr;
// std::uint32_t dwSize=0;
// // 4J-PB - out for now for DaveK so he doesn't get the
// birthday cape #ifdef _CONTENT_PACKAGE
@ -4581,7 +4581,7 @@ void CMinecraftApp::AddMemoryTextureFile(const std::wstring& wName,
unsigned int byteCount) {
EnterCriticalSection(&csMemFilesLock);
// check it's not already in
PMEMDATA pData = NULL;
PMEMDATA pData = nullptr;
auto it = m_MEM_Files.find(wName);
if (it != m_MEM_Files.end()) {
#if !defined(_CONTENT_PACKAGE)
@ -4591,8 +4591,8 @@ void CMinecraftApp::AddMemoryTextureFile(const std::wstring& wName,
pData = (*it).second;
if (pData->byteCount == 0 && byteCount != 0) {
// This should never be NULL if dwBytes is 0
if (pData->pbData != NULL) delete[] pData->pbData;
// This should never be nullptr if dwBytes is 0
if (pData->pbData != nullptr) delete[] pData->pbData;
pData->pbData = pbData;
pData->byteCount = byteCount;
@ -4685,7 +4685,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig, std::uint8_t* pbData,
unsigned int byteCount) {
EnterCriticalSection(&csMemTPDLock);
// check it's not already in
PMEMDATA pData = NULL;
PMEMDATA pData = nullptr;
auto it = m_MEM_TPD.find(iConfig);
if (it == m_MEM_TPD.end()) {
pData = new MEMDATA();
@ -4702,7 +4702,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig, std::uint8_t* pbData,
void CMinecraftApp::RemoveMemoryTPDFile(int iConfig) {
EnterCriticalSection(&csMemTPDLock);
// check it's not already in
PMEMDATA pData = NULL;
PMEMDATA pData = nullptr;
auto it = m_MEM_TPD.find(iConfig);
if (it != m_MEM_TPD.end()) {
pData = m_MEM_TPD[iConfig];
@ -4908,7 +4908,7 @@ int CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned(
ui.RequestErrorMessage(
IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE,
IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad,
&CMinecraftApp::WarningTrialTexturePackReturned, NULL);
&CMinecraftApp::WarningTrialTexturePackReturned, nullptr);
return S_OK;
}
@ -5438,10 +5438,10 @@ HRESULT CMinecraftApp::RegisterMojangData(WCHAR* pXuidName, PlayerUID xuid,
WCHAR* pSkin, WCHAR* pCape) {
HRESULT hr = S_OK;
eXUID eTempXuid = eXUID_Undefined;
MOJANG_DATA* pMojangData = NULL;
MOJANG_DATA* pMojangData = nullptr;
// ignore the names if we don't recognize them
if (pXuidName != NULL) {
if (pXuidName != nullptr) {
if (wcscmp(pXuidName, L"XUID_NOTCH") == 0) {
eTempXuid =
eXUID_Notch; // might be needed for the apple at some point
@ -5473,7 +5473,7 @@ HRESULT CMinecraftApp::RegisterConfigValues(WCHAR* pType, int iValue) {
HRESULT hr = S_OK;
// #ifdef 0
// if(pType!=NULL)
// if(pType!=nullptr)
// {
// if(wcscmp(pType,L"XboxOneTransfer")==0)
// {
@ -5523,7 +5523,7 @@ HRESULT CMinecraftApp::RegisterDLCData(WCHAR* pType, WCHAR* pBannerName,
wcsncpy_s(pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE);
}
if (pType != NULL) {
if (pType != nullptr) {
if (wcscmp(pType, L"Skin") == 0) {
pDLCData->eDLCType = e_DLC_SkinPack;
} else if (wcscmp(pType, L"Gamerpic") == 0) {
@ -5630,18 +5630,18 @@ bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,
}
}
DLC_INFO* CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial) {
// DLC_INFO *pDLCInfo=NULL;
// DLC_INFO *pDLCInfo=nullptr;
if (DLCInfo_Trial.size() > 0) {
auto it = DLCInfo_Trial.find(ullOfferID_Trial);
if (it == DLCInfo_Trial.end()) {
// nothing for this
return NULL;
return nullptr;
} else {
return it->second;
}
} else
return NULL;
return nullptr;
}
DLC_INFO* CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) {
@ -5682,12 +5682,12 @@ DLC_INFO* CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full) {
if (it == DLCInfo_Full.end()) {
// nothing for this
return NULL;
return nullptr;
} else {
return it->second;
}
} else
return NULL;
return nullptr;
}
void CMinecraftApp::EnterSaveNotificationSection() {
@ -5786,7 +5786,7 @@ void CMinecraftApp::ExitGameFromRemoteSave(void* lpParameter) {
ui.RequestAlertMessage(
IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad,
&CMinecraftApp::ExitGameFromRemoteSaveDialogReturned, NULL);
&CMinecraftApp::ExitGameFromRemoteSaveDialogReturned, nullptr);
}
int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(
@ -5811,7 +5811,7 @@ int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(
}
void CMinecraftApp::SetSpecialTutorialCompletionFlag(int iPad, int index) {
if (index >= 0 && index < 32 && GameSettingsA[iPad] != NULL) {
if (index >= 0 && index < 32 && GameSettingsA[iPad] != nullptr) {
GameSettingsA[iPad]->uiSpecialTutorialBitmask |= (1 << index);
}
}
@ -5832,7 +5832,7 @@ void CMinecraftApp::InvalidateBannedList(int iPad) {
if (BannedListA[iPad].pBannedList) {
delete[] BannedListA[iPad].pBannedList;
BannedListA[iPad].pBannedList = NULL;
BannedListA[iPad].pBannedList = nullptr;
}
}
}
@ -5900,7 +5900,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid,
it != m_vBannedListA[iPad]->end();) {
PBANNEDLISTDATA pBannedListData = *it;
if (pBannedListData != NULL) {
if (pBannedListData != nullptr) {
if (IsEqualXUID(pBannedListData->xuid, xuid) &&
(strcmp(pBannedListData->pszLevelName, pszLevelName) == 0))
{
@ -6321,7 +6321,7 @@ unsigned int CMinecraftApp::GetGameHostOption(unsigned int uiHostSettings,
}
bool CMinecraftApp::CanRecordStatsAndAchievements() {
bool isTutorial = Minecraft::GetInstance() != NULL &&
bool isTutorial = Minecraft::GetInstance() != nullptr &&
Minecraft::GetInstance()->isTutorial();
// 4J Stu - All of these options give the host player some advantage, so
// should not allow achievements
@ -6983,7 +6983,7 @@ int CMinecraftApp::TMSPPFileReturned(void* pParam, int iPad, int iUserData,
// set this to retrieved whether it found it or not
pCurrent->eState = e_TMS_ContentState_Retrieved;
if (pFileData != NULL) {
if (pFileData != nullptr) {
switch (pCurrent->eType) {
case e_DLC_TexturePackData: {
app.DebugPrintf("--- Got texturepack data %ls\n",
@ -7190,7 +7190,7 @@ std::vector<ModelPart*>* CMinecraftApp::SetAdditionalSkinBoxes(
std::vector<ModelPart*>* CMinecraftApp::GetAdditionalModelParts(
std::uint32_t dwSkinID) {
EnterCriticalSection(&csAdditionalModelParts);
std::vector<ModelPart*>* pvModelParts = NULL;
std::vector<ModelPart*>* pvModelParts = nullptr;
if (m_AdditionalModelParts.size() > 0) {
auto it = m_AdditionalModelParts.find(dwSkinID);
if (it != m_AdditionalModelParts.end()) {
@ -7205,7 +7205,7 @@ std::vector<ModelPart*>* CMinecraftApp::GetAdditionalModelParts(
std::vector<SKIN_BOX*>* CMinecraftApp::GetAdditionalSkinBoxes(
std::uint32_t dwSkinID) {
EnterCriticalSection(&csAdditionalSkinBoxes);
std::vector<SKIN_BOX*>* pvSkinBoxes = NULL;
std::vector<SKIN_BOX*>* pvSkinBoxes = nullptr;
if (m_AdditionalSkinBoxes.size() > 0) {
auto it = m_AdditionalSkinBoxes.find(dwSkinID);
if (it != m_AdditionalSkinBoxes.end()) {
@ -7305,7 +7305,7 @@ int CMinecraftApp::TexturePackDialogReturned(
}
int CMinecraftApp::getArchiveFileSize(const std::wstring& filename) {
TexturePack* tPack = NULL;
TexturePack* tPack = nullptr;
Minecraft* pMinecraft = Minecraft::GetInstance();
if (pMinecraft && pMinecraft->skins)
tPack = pMinecraft->skins->getSelected();
@ -7317,7 +7317,7 @@ int CMinecraftApp::getArchiveFileSize(const std::wstring& filename) {
}
bool CMinecraftApp::hasArchiveFile(const std::wstring& filename) {
TexturePack* tPack = NULL;
TexturePack* tPack = nullptr;
Minecraft* pMinecraft = Minecraft::GetInstance();
if (pMinecraft && pMinecraft->skins)
tPack = pMinecraft->skins->getSelected();
@ -7329,7 +7329,7 @@ bool CMinecraftApp::hasArchiveFile(const std::wstring& filename) {
}
byteArray CMinecraftApp::getArchiveFile(const std::wstring& filename) {
TexturePack* tPack = NULL;
TexturePack* tPack = nullptr;
Minecraft* pMinecraft = Minecraft::GetInstance();
if (pMinecraft && pMinecraft->skins)
tPack = pMinecraft->skins->getSelected();

View file

@ -950,7 +950,7 @@ public:
m_bRead_BannedListA[iPad] = bVal;
}
void ClearBanList(int iPad) {
BannedListA[iPad].pBannedList = NULL;
BannedListA[iPad].pBannedList = nullptr;
BannedListA[iPad].byteCount = 0;
}
@ -964,7 +964,7 @@ public:
virtual void GetFileFromTPD(eTPDFileType eType, std::uint8_t* pbData,
unsigned int byteCount, std::uint8_t** ppbData,
unsigned int* pByteCount) {
*ppbData = NULL;
*ppbData = nullptr;
*pByteCount = 0;
}

View file

@ -64,7 +64,7 @@ inline std::wstring ReadAudioParamString(const std::uint8_t* data,
DLCAudioFile::DLCAudioFile(const std::wstring& path)
: DLCFile(DLCManager::e_DLCType_Audio, path) {
m_pbData = NULL;
m_pbData = nullptr;
m_dataBytes = 0;
}
@ -181,7 +181,7 @@ bool DLCAudioFile::processDLCDataFile(std::uint8_t* pbData,
uiCurrentByte += sizeof(int);
if (uiVersion < CURRENT_AUDIO_VERSION_NUM) {
if (pbData != NULL) delete[] pbData;
if (pbData != nullptr) delete[] pbData;
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
return false;
}

View file

@ -7,11 +7,11 @@
DLCColourTableFile::DLCColourTableFile(const std::wstring& path)
: DLCFile(DLCManager::e_DLCType_ColourTable, path) {
m_colourTable = NULL;
m_colourTable = nullptr;
}
DLCColourTableFile::~DLCColourTableFile() {
if (m_colourTable != NULL) {
if (m_colourTable != nullptr) {
app.DebugPrintf("Deleting DLCColourTableFile data\n");
delete m_colourTable;
}

View file

@ -19,7 +19,7 @@ public:
virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes) {}
virtual std::uint8_t* getData(std::uint32_t& dataBytes) {
dataBytes = 0;
return NULL;
return nullptr;
}
virtual void addParameter(DLCManager::EDLCParameterType type,
const std::wstring& value) {}

View file

@ -4,7 +4,7 @@
DLCGameRulesFile::DLCGameRulesFile(const std::wstring& path)
: DLCGameRules(DLCManager::e_DLCType_GameRules, path) {
m_pbData = NULL;
m_pbData = nullptr;
m_dataBytes = 0;
}

View file

@ -11,14 +11,14 @@
DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring& path)
: DLCGameRules(DLCManager::e_DLCType_GameRulesHeader, path) {
m_pbData = NULL;
m_pbData = nullptr;
m_dataBytes = 0;
m_hasData = false;
m_grfPath = path.substr(0, path.length() - 4) + L".grf";
lgo = NULL;
lgo = nullptr;
}
void DLCGameRulesHeader::addData(std::uint8_t* pbData,

View file

@ -5,7 +5,7 @@
DLCLocalisationFile::DLCLocalisationFile(const std::wstring& path)
: DLCFile(DLCManager::e_DLCType_LocalisationData, path) {
m_strings = NULL;
m_strings = nullptr;
}
void DLCLocalisationFile::addData(std::uint8_t* pbData,

View file

@ -87,12 +87,12 @@ std::wstring getMountedDlcReadPath(const std::string& path) {
bool readOwnedDlcFile(const std::string& path, std::uint8_t** ppData,
unsigned int* pBytesRead) {
*ppData = NULL;
*ppData = nullptr;
*pBytesRead = 0;
const std::wstring readPath = getMountedDlcReadPath(path);
std::FILE* file = PortableFileIO::OpenBinaryFileForRead(readPath);
if (file == NULL) {
if (file == nullptr) {
return false;
}
@ -189,7 +189,7 @@ unsigned int DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/) {
void DLCManager::addPack(DLCPack* pack) { m_packs.push_back(pack); }
void DLCManager::removePack(DLCPack* pack) {
if (pack != NULL) {
if (pack != nullptr) {
auto it = find(m_packs.begin(), m_packs.end(), pack);
if (it != m_packs.end()) m_packs.erase(it);
delete pack;
@ -214,9 +214,9 @@ void DLCManager::LanguageChanged(void) {
}
DLCPack* DLCManager::getPack(const std::wstring& name) {
DLCPack* pack = NULL;
DLCPack* pack = nullptr;
// DWORD currentIndex = 0;
DLCPack* currentPack = NULL;
DLCPack* currentPack = nullptr;
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
currentPack = *it;
std::wstring wsName = currentPack->getName();
@ -232,10 +232,10 @@ DLCPack* DLCManager::getPack(const std::wstring& name) {
DLCPack* DLCManager::getPack(unsigned int index,
EDLCType type /*= e_DLCType_All*/) {
DLCPack* pack = NULL;
DLCPack* pack = nullptr;
if (type != e_DLCType_All) {
unsigned int currentIndex = 0;
DLCPack* currentPack = NULL;
DLCPack* currentPack = nullptr;
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
currentPack = *it;
if (currentPack->getDLCItemsCount(type) > 0) {
@ -263,9 +263,9 @@ unsigned int DLCManager::getPackIndex(DLCPack* pack, bool& found,
EDLCType type /*= e_DLCType_All*/) {
unsigned int foundIndex = 0;
found = false;
if (pack == NULL) {
if (pack == nullptr) {
app.DebugPrintf(
"DLCManager: Attempting to find the index for a NULL pack\n");
"DLCManager: Attempting to find the index for a nullptr pack\n");
//__debugbreak();
return foundIndex;
}
@ -317,7 +317,7 @@ unsigned int DLCManager::getPackIndexContainingSkin(const std::wstring& path,
}
DLCPack* DLCManager::getPackContainingSkin(const std::wstring& path) {
DLCPack* foundPack = NULL;
DLCPack* foundPack = nullptr;
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
DLCPack* pack = *it;
if (pack->getDLCItemsCount(e_DLCType_Skin) > 0) {
@ -331,11 +331,11 @@ DLCPack* DLCManager::getPackContainingSkin(const std::wstring& path) {
}
DLCSkinFile* DLCManager::getSkinFile(const std::wstring& path) {
DLCSkinFile* foundSkinfile = NULL;
DLCSkinFile* foundSkinfile = nullptr;
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
DLCPack* pack = *it;
foundSkinfile = pack->getSkinFile(path);
if (foundSkinfile != NULL) {
if (foundSkinfile != nullptr) {
break;
}
}
@ -345,14 +345,14 @@ DLCSkinFile* DLCManager::getSkinFile(const std::wstring& path) {
unsigned int DLCManager::checkForCorruptDLCAndAlert(
bool showMessage /*= true*/) {
unsigned int corruptDLCCount = m_dwUnnamedCorruptDLCCount;
DLCPack* pack = NULL;
DLCPack* firstCorruptPack = NULL;
DLCPack* pack = nullptr;
DLCPack* firstCorruptPack = nullptr;
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
pack = *it;
if (pack->IsCorrupt()) {
++corruptDLCCount;
if (firstCorruptPack == NULL) firstCorruptPack = pack;
if (firstCorruptPack == nullptr) firstCorruptPack = pack;
}
}
@ -360,7 +360,7 @@ unsigned int DLCManager::checkForCorruptDLCAndAlert(
if (corruptDLCCount > 0 && showMessage) {
unsigned int uiIDA[1];
uiIDA[0] = IDS_CONFIRM_OK;
if (corruptDLCCount == 1 && firstCorruptPack != NULL) {
if (corruptDLCCount == 1 && firstCorruptPack != nullptr) {
// pass in the pack format string
WCHAR wchFormat[132];
swprintf(wchFormat, 132, L"%ls\n\n%%ls",
@ -368,7 +368,7 @@ unsigned int DLCManager::checkForCorruptDLCAndAlert(
C4JStorage::EMessageResult result = ui.RequestErrorMessage(
IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA, 1,
ProfileManager.GetPrimaryPad(), NULL, NULL, wchFormat);
ProfileManager.GetPrimaryPad(), nullptr, nullptr, wchFormat);
} else {
C4JStorage::EMessageResult result = ui.RequestErrorMessage(
@ -401,7 +401,7 @@ bool DLCManager::readDLCDataFile(unsigned int& dwFilesProcessed,
return false;
unsigned int bytesRead = 0;
std::uint8_t* pbData = NULL;
std::uint8_t* pbData = nullptr;
if (!readOwnedDlcFile(path, &pbData, &bytesRead)) {
app.DebugPrintf("Failed to open DLC data file %s\n", path.c_str());
pack->SetIsCorrupt(true);
@ -462,7 +462,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
uiCurrentByte += sizeof(int);
if (uiVersion < CURRENT_DLC_VERSION_NUM) {
if (pbData != NULL) delete[] pbData;
if (pbData != nullptr) delete[] pbData;
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
return false;
}
@ -508,8 +508,8 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
for (unsigned int i = 0; i < uiFileCount; i++) {
DLCManager::EDLCType type = (DLCManager::EDLCType)fileBuf.dwType;
DLCFile* dlcFile = NULL;
DLCPack* dlcTexturePack = NULL;
DLCFile* dlcFile = nullptr;
DLCPack* dlcTexturePack = nullptr;
if (type == e_DLCType_TexturePack) {
dlcTexturePack =
@ -535,10 +535,10 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
if (type == e_DLCType_PackConfig) {
pack->addParameter(it->second, DLC_PARAM_WSTR(pbTemp, 0));
} else {
if (dlcFile != NULL)
if (dlcFile != nullptr)
dlcFile->addParameter(it->second,
DLC_PARAM_WSTR(pbTemp, 0));
else if (dlcTexturePack != NULL)
else if (dlcTexturePack != nullptr)
dlcTexturePack->addParameter(it->second,
DLC_PARAM_WSTR(pbTemp, 0));
}
@ -548,16 +548,16 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
}
// pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM);
if (dlcTexturePack != NULL) {
if (dlcTexturePack != nullptr) {
unsigned int texturePackFilesProcessed = 0;
bool validPack =
processDLCDataFile(texturePackFilesProcessed, pbTemp,
fileBuf.uiFileSize, dlcTexturePack);
pack->SetDataPointer(
NULL); // If it's a child pack, it doesn't own the data
nullptr); // If it's a child pack, it doesn't own the data
if (!validPack || texturePackFilesProcessed == 0) {
delete dlcTexturePack;
dlcTexturePack = NULL;
dlcTexturePack = nullptr;
} else {
pack->addChildPack(dlcTexturePack);
@ -568,7 +568,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
}
}
++dwFilesProcessed;
} else if (dlcFile != NULL) {
} else if (dlcFile != nullptr) {
// Data
dlcFile->addData(pbTemp, fileBuf.uiFileSize);
@ -610,7 +610,7 @@ std::uint32_t DLCManager::retrievePackIDFromDLCDataFile(const std::string& path,
std::uint32_t packId = 0;
unsigned int bytesRead = 0;
std::uint8_t* pbData = NULL;
std::uint8_t* pbData = nullptr;
if (!readOwnedDlcFile(path, &pbData, &bytesRead)) {
return 0;
}

View file

@ -19,12 +19,12 @@ DLCPack::DLCPack(const std::wstring& name, std::uint32_t dwLicenseMask) {
m_isCorrupt = false;
m_packId = 0;
m_packVersion = 0;
m_parentPack = NULL;
m_parentPack = nullptr;
m_dlcMountIndex = -1;
// This pointer is for all the data used for this pack, so deleting it
// invalidates ALL of it's children.
m_data = NULL;
m_data = nullptr;
}
@ -48,21 +48,21 @@ DLCPack::~DLCPack() {
// For the same reason, don't delete data pointer for any child pack as
// it just points to a region within the parent pack that has already
// been freed
if (m_parentPack == NULL) {
if (m_parentPack == nullptr) {
delete[] m_data;
}
}
}
int DLCPack::GetDLCMountIndex() {
if (m_parentPack != NULL) {
if (m_parentPack != nullptr) {
return m_parentPack->GetDLCMountIndex();
}
return m_dlcMountIndex;
}
XCONTENTDEVICEID DLCPack::GetDLCDeviceID() {
if (m_parentPack != NULL) {
if (m_parentPack != nullptr) {
return m_parentPack->GetDLCDeviceID();
}
return m_dlcDeviceID;
@ -141,7 +141,7 @@ bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type,
}
DLCFile* DLCPack::addFile(DLCManager::EDLCType type, const std::wstring& path) {
DLCFile* newFile = NULL;
DLCFile* newFile = nullptr;
switch (type) {
case DLCManager::e_DLCType_Skin: {
@ -187,7 +187,7 @@ DLCFile* DLCPack::addFile(DLCManager::EDLCType type, const std::wstring& path) {
break;
};
if (newFile != NULL) {
if (newFile != nullptr) {
m_files[newFile->getType()].push_back(newFile);
}
@ -196,7 +196,7 @@ DLCFile* DLCPack::addFile(DLCManager::EDLCType type, const std::wstring& path) {
// MGH - added this comp func, as the embedded func in find_if was confusing the
// PS3 compiler
static const std::wstring* g_pathCmpString = NULL;
static const std::wstring* g_pathCmpString = nullptr;
static bool pathCmp(DLCFile* val) {
return (g_pathCmpString->compare(val->getPath()) == 0);
}
@ -224,13 +224,13 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type,
}
DLCFile* DLCPack::getFile(DLCManager::EDLCType type, unsigned int index) {
DLCFile* file = NULL;
DLCFile* file = nullptr;
if (type == DLCManager::e_DLCType_All) {
for (DLCManager::EDLCType currentType = (DLCManager::EDLCType)0;
currentType < DLCManager::e_DLCType_Max;
currentType = (DLCManager::EDLCType)(currentType + 1)) {
file = getFile(currentType, index);
if (file != NULL) break;
if (file != nullptr) break;
}
} else {
if (m_files[type].size() > index) file = m_files[type][index];
@ -242,13 +242,13 @@ DLCFile* DLCPack::getFile(DLCManager::EDLCType type, unsigned int index) {
}
DLCFile* DLCPack::getFile(DLCManager::EDLCType type, const std::wstring& path) {
DLCFile* file = NULL;
DLCFile* file = nullptr;
if (type == DLCManager::e_DLCType_All) {
for (DLCManager::EDLCType currentType = (DLCManager::EDLCType)0;
currentType < DLCManager::e_DLCType_Max;
currentType = (DLCManager::EDLCType)(currentType + 1)) {
file = getFile(currentType, path);
if (file != NULL) break;
if (file != nullptr) break;
}
} else {
g_pathCmpString = &path;
@ -256,7 +256,7 @@ DLCFile* DLCPack::getFile(DLCManager::EDLCType type, const std::wstring& path) {
if (it == m_files[type].end()) {
// Not found
file = NULL;
file = nullptr;
} else {
file = *it;
}

View file

@ -7,7 +7,7 @@ DLCTextureFile::DLCTextureFile(const std::wstring& path)
m_bIsAnim = false;
m_animString = L"";
m_pbData = NULL;
m_pbData = nullptr;
m_dataBytes = 0;
}

View file

@ -4,13 +4,13 @@
DLCUIDataFile::DLCUIDataFile(const std::wstring& path)
: DLCFile(DLCManager::e_DLCType_UIData, path) {
m_pbData = NULL;
m_pbData = nullptr;
m_dataBytes = 0;
m_canDeleteData = false;
}
DLCUIDataFile::~DLCUIDataFile() {
if (m_canDeleteData && m_pbData != NULL) {
if (m_canDeleteData && m_pbData != nullptr) {
app.DebugPrintf("Deleting DLCUIDataFile data\n");
delete[] m_pbData;
}

View file

@ -46,7 +46,7 @@ void AddEnchantmentRuleDefinition::addAttribute(
bool AddEnchantmentRuleDefinition::enchantItem(
std::shared_ptr<ItemInstance> item) {
bool enchanted = false;
if (item != NULL) {
if (item != nullptr) {
// 4J-JEV: Ripped code from enchantmenthelpers
// Maybe we want to add an addEnchantment method to EnchantmentHelpers
if (item->id == Item::enchantedBook_Id) {
@ -56,7 +56,7 @@ bool AddEnchantmentRuleDefinition::enchantItem(
} else if (item->isEnchantable()) {
Enchantment* e = Enchantment::enchantments[m_enchantmentId];
if (e != NULL && e->category->canEnchant(item->getItem())) {
if (e != nullptr && e->category->canEnchant(item->getItem())) {
int level = std::min(e->getMaxLevel(), m_enchantmentLevel);
item->enchant(e, m_enchantmentLevel);
enchanted = true;

View file

@ -40,7 +40,7 @@ void AddItemRuleDefinition::getChildren(
GameRuleDefinition* AddItemRuleDefinition::addChild(
ConsoleGameRules::EGameRuleType ruleType) {
GameRuleDefinition* rule = NULL;
GameRuleDefinition* rule = nullptr;
if (ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment) {
rule = new AddEnchantmentRuleDefinition();
m_enchantments.push_back((AddEnchantmentRuleDefinition*)rule);
@ -88,7 +88,7 @@ void AddItemRuleDefinition::addAttribute(const std::wstring& attributeName,
bool AddItemRuleDefinition::addItemToContainer(
std::shared_ptr<Container> container, int slotId) {
bool added = false;
if (Item::items[m_itemId] != NULL) {
if (Item::items[m_itemId] != nullptr) {
int quantity =
std::min(m_quantity, Item::items[m_itemId]->getMaxStackSize());
std::shared_ptr<ItemInstance> newItem = std::shared_ptr<ItemInstance>(
@ -106,7 +106,7 @@ bool AddItemRuleDefinition::addItemToContainer(
} else if (slotId >= 0 && slotId < container->getContainerSize()) {
container->setItem(slotId, newItem);
added = true;
} else if (std::dynamic_pointer_cast<Inventory>(container) != NULL) {
} else if (std::dynamic_pointer_cast<Inventory>(container) != nullptr) {
added =
std::dynamic_pointer_cast<Inventory>(container)->add(newItem);
}

View file

@ -20,13 +20,13 @@ ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
m_completed = false;
m_dimension = 0;
m_schematic = NULL;
m_schematic = nullptr;
}
ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition() {
app.DebugPrintf("Deleting ApplySchematicRuleDefinition.\n");
if (!m_completed) m_levelGenOptions->releaseSchematicFile(m_schematicName);
m_schematic = NULL;
m_schematic = nullptr;
}
void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream* dos,
@ -128,7 +128,7 @@ void ApplySchematicRuleDefinition::addAttribute(
}
void ApplySchematicRuleDefinition::updateLocationBox() {
if (m_schematic == NULL)
if (m_schematic == nullptr)
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
m_locationBox = AABB(0, 0, 0, 0, 0, 0);
@ -160,7 +160,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB* chunkBox,
if (chunk->level->dimension->id != m_dimension) return;
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition");
if (m_schematic == NULL)
if (m_schematic == nullptr)
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
if (!m_locationBox.has_value()) updateLocationBox();
@ -192,7 +192,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB* chunkBox,
(m_totalBlocksChangedLighting == targetBlocks)) {
m_completed = true;
// m_levelGenOptions->releaseSchematicFile(m_schematicName);
// m_schematic = NULL;
// m_schematic = nullptr;
}
}
PIXEndNamedEvent();
@ -204,7 +204,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox,
if (chunk->level->dimension->id != m_dimension) return;
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)");
if (m_schematic == NULL)
if (m_schematic == nullptr)
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
if (!m_locationBox.has_value()) updateLocationBox();
@ -230,7 +230,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox,
(m_totalBlocksChangedLighting == targetBlocks)) {
m_completed = true;
// m_levelGenOptions->releaseSchematicFile(m_schematicName);
// m_schematic = NULL;
// m_schematic = nullptr;
}
}
PIXEndNamedEvent();

View file

@ -66,7 +66,7 @@ void CollectItemRuleDefinition::populateGameRule(
bool CollectItemRuleDefinition::onCollectItem(
GameRule* rule, std::shared_ptr<ItemInstance> item) {
bool statusChanged = false;
if (item != NULL && item->id == m_itemId &&
if (item != nullptr && item->id == m_itemId &&
item->getAuxValue() == m_auxValue &&
item->get4JData() == m_4JDataValue) {
if (!getComplete(rule)) {
@ -83,12 +83,12 @@ bool CollectItemRuleDefinition::onCollectItem(
"auxValue:%d, quantity:%d, dataTag:%d\n",
m_itemId, m_auxValue, m_quantity, m_4JDataValue);
if (rule->getConnection() != NULL) {
if (rule->getConnection() != nullptr) {
rule->getConnection()->send(
std::shared_ptr<UpdateGameRuleProgressPacket>(
new UpdateGameRuleProgressPacket(
getActionType(), this->m_descriptionId,
m_itemId, m_auxValue, this->m_4JDataValue, NULL,
m_itemId, m_auxValue, this->m_4JDataValue, nullptr,
0)));
}
}
@ -101,7 +101,7 @@ std::wstring CollectItemRuleDefinition::generateXml(
std::shared_ptr<ItemInstance> item) {
// 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd
std::wstring xml = L"";
if (item != NULL) {
if (item != nullptr) {
xml = L"<CollectItemRule itemId=\"" + _toString<int>(item->id) +
L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" "
L"promptName=\"OPTIONAL\"";

View file

@ -36,7 +36,7 @@ void CompleteAllRuleDefinition::updateStatus(GameRule* rule) {
it->second.gr);
}
}
if (rule->getConnection() != NULL) {
if (rule->getConnection() != nullptr) {
PacketData data;
data.goal = goal;
data.progress = progress;
@ -44,10 +44,10 @@ void CompleteAllRuleDefinition::updateStatus(GameRule* rule) {
int icon = -1;
int auxValue = 0;
if (m_lastRuleStatusChanged != NULL) {
if (m_lastRuleStatusChanged != nullptr) {
icon = m_lastRuleStatusChanged->getIcon();
auxValue = m_lastRuleStatusChanged->getAuxValue();
m_lastRuleStatusChanged = NULL;
m_lastRuleStatusChanged = nullptr;
}
rule->getConnection()->send(
std::shared_ptr<UpdateGameRuleProgressPacket>(

View file

@ -5,7 +5,7 @@
#include "ConsoleGameRules.h"
CompoundGameRuleDefinition::CompoundGameRuleDefinition() {
m_lastRuleStatusChanged = NULL;
m_lastRuleStatusChanged = nullptr;
}
CompoundGameRuleDefinition::~CompoundGameRuleDefinition() {
@ -23,7 +23,7 @@ void CompoundGameRuleDefinition::getChildren(
GameRuleDefinition* CompoundGameRuleDefinition::addChild(
ConsoleGameRules::EGameRuleType ruleType) {
GameRuleDefinition* rule = NULL;
GameRuleDefinition* rule = nullptr;
if (ruleType == ConsoleGameRules::eGameRuleType_CompleteAllRule) {
rule = new CompleteAllRuleDefinition();
} else if (ruleType == ConsoleGameRules::eGameRuleType_CollectItemRule) {
@ -40,13 +40,13 @@ GameRuleDefinition* CompoundGameRuleDefinition::addChild(
ruleType);
#endif
}
if (rule != NULL) m_children.push_back(rule);
if (rule != nullptr) m_children.push_back(rule);
return rule;
}
void CompoundGameRuleDefinition::populateGameRule(
GameRulesInstance::EGameRulesInstanceType type, GameRule* rule) {
GameRule* newRule = NULL;
GameRule* newRule = nullptr;
int i = 0;
for (auto it = m_children.begin(); it != m_children.end(); ++it) {
newRule = new GameRule(*it, rule->getConnection());

View file

@ -9,7 +9,7 @@
ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) {
m_x = m_y = m_z = 0;
boundingBox = NULL;
boundingBox = nullptr;
orientation = Direction::NORTH;
m_dimension = 0;
}
@ -24,7 +24,7 @@ void ConsoleGenerateStructure::getChildren(
GameRuleDefinition* ConsoleGenerateStructure::addChild(
ConsoleGameRules::EGameRuleType ruleType) {
GameRuleDefinition* rule = NULL;
GameRuleDefinition* rule = nullptr;
if (ruleType == ConsoleGameRules::eGameRuleType_GenerateBox) {
rule = new XboxStructureActionGenerateBox();
m_actions.push_back((XboxStructureActionGenerateBox*)rule);
@ -100,7 +100,7 @@ void ConsoleGenerateStructure::addAttribute(
}
BoundingBox* ConsoleGenerateStructure::getBoundingBox() {
if (boundingBox == NULL) {
if (boundingBox == nullptr) {
// Find the max bounds
int maxX, maxY, maxZ;
maxX = maxY = maxZ = 1;

View file

@ -15,16 +15,16 @@
ConsoleSchematicFile::ConsoleSchematicFile() {
m_xSize = m_ySize = m_zSize = 0;
m_refCount = 1;
m_data.data = NULL;
m_data.data = nullptr;
}
ConsoleSchematicFile::~ConsoleSchematicFile() {
app.DebugPrintf("Deleting schematic file\n");
if (m_data.data != NULL) delete[] m_data.data;
if (m_data.data != nullptr) delete[] m_data.data;
}
void ConsoleSchematicFile::save(DataOutputStream* dos) {
if (dos != NULL) {
if (dos != nullptr) {
dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
dos->writeByte(APPROPRIATE_COMPRESSION_TYPE);
@ -47,7 +47,7 @@ void ConsoleSchematicFile::save(DataOutputStream* dos) {
}
void ConsoleSchematicFile::load(DataInputStream* dis) {
if (dis != NULL) {
if (dis != nullptr) {
// VERSION CHECK //
int version = dis->readInt();
@ -70,9 +70,9 @@ void ConsoleSchematicFile::load(DataInputStream* dis) {
byteArray compressedBuffer(compressedSize);
dis->readFully(compressedBuffer);
if (m_data.data != NULL) {
if (m_data.data != nullptr) {
delete[] m_data.data;
m_data.data = NULL;
m_data.data = nullptr;
}
if (compressionType == Compression::eCompressionType_None) {
@ -114,15 +114,15 @@ void ConsoleSchematicFile::load(DataInputStream* dis) {
// and cast it to CompoundTag inside the loop
CompoundTag* tag = NbtIo::read(dis);
ListTag<Tag>* tileEntityTags = tag->getList(L"TileEntities");
if (tileEntityTags != NULL) {
if (tileEntityTags != nullptr) {
for (int i = 0; i < tileEntityTags->size(); i++) {
CompoundTag* teTag = (CompoundTag*)tileEntityTags->get(i);
std::shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
if (te == NULL) {
if (te == nullptr) {
#ifndef _CONTENT_PACKAGE
app.DebugPrintf(
"ConsoleSchematicFile has read a NULL tile entity\n");
"ConsoleSchematicFile has read a nullptr tile entity\n");
__debugbreak();
#endif
} else {
@ -134,7 +134,7 @@ void ConsoleSchematicFile::load(DataInputStream* dis) {
// 4jcraft, fixed cast of templated List to get the tag list
// and cast it to CompoundTag inside the loop
ListTag<Tag>* entityTags = tag->getList(L"Entities");
if (entityTags != NULL) {
if (entityTags != nullptr) {
for (int i = 0; i < entityTags->size(); i++) {
CompoundTag* eTag = (CompoundTag*)entityTags->get(i);
eINSTANCEOF type = EntityIO::getType(eTag->getString(L"id"));
@ -468,7 +468,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk* chunk, AABB* chunkBox,
std::shared_ptr<TileEntity> teCopy = chunk->getTileEntity(
(int)targetX & 15, (int)targetY & 15, (int)targetZ & 15);
if (teCopy != NULL) {
if (teCopy != nullptr) {
CompoundTag* teData = new CompoundTag();
te->save(teData);
@ -517,7 +517,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk* chunk, AABB* chunkBox,
}
CompoundTag* eTag = it->second;
std::shared_ptr<Entity> e = EntityIO::loadStatic(eTag, NULL);
std::shared_ptr<Entity> e = EntityIO::loadStatic(eTag, nullptr);
if (e->GetType() == eTYPE_PAINTING) {
std::shared_ptr<Painting> painting =
@ -615,18 +615,18 @@ void ConsoleSchematicFile::generateSchematicFile(
"%dx%dx%d\n",
xStart, yStart, zStart, xEnd, yEnd, zEnd, xSize, ySize, zSize);
if (dos != NULL) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
if (dos != nullptr) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
if (dos != NULL) dos->writeByte(compressionType);
if (dos != nullptr) dos->writeByte(compressionType);
// Write xSize
if (dos != NULL) dos->writeInt(xSize);
if (dos != nullptr) dos->writeInt(xSize);
// Write ySize
if (dos != NULL) dos->writeInt(ySize);
if (dos != nullptr) dos->writeInt(ySize);
// Write zSize
if (dos != NULL) dos->writeInt(zSize);
if (dos != nullptr) dos->writeInt(zSize);
// byteArray rawBuffer = level->getBlocksAndData(xStart, yStart, zStart,
// xSize, ySize, zSize, false);
@ -695,8 +695,8 @@ void ConsoleSchematicFile::generateSchematicFile(
delete[] result.data;
byteArray buffer = byteArray(ucTemp, inputSize);
if (dos != NULL) dos->writeInt(inputSize);
if (dos != NULL) dos->write(buffer);
if (dos != nullptr) dos->writeInt(inputSize);
if (dos != nullptr) dos->write(buffer);
delete[] buffer.data;
CompoundTag tag;
@ -783,7 +783,7 @@ void ConsoleSchematicFile::generateSchematicFile(
tag.put(L"Entities", entitiesTag);
if (dos != NULL) NbtIo::write(&tag, dos);
if (dos != nullptr) NbtIo::write(&tag, dos);
}
void ConsoleSchematicFile::getBlocksAndData(LevelChunk* chunk, byteArray* data,

View file

@ -38,7 +38,7 @@ public:
// maintain it's state
public:
GameRule(GameRuleDefinition* definition, Connection* connection = NULL);
GameRule(GameRuleDefinition* definition, Connection* connection = nullptr);
virtual ~GameRule();
Connection* getConnection() { return m_connection; }

View file

@ -52,7 +52,7 @@ GameRuleDefinition* GameRuleDefinition::addChild(
wprintf(L"GameRuleDefinition: Attempted to add invalid child rule - %d\n",
ruleType);
#endif
return NULL;
return nullptr;
}
void GameRuleDefinition::addAttribute(const std::wstring& attributeName,

View file

@ -77,5 +77,5 @@ public:
Connection* connection);
static std::wstring generateDescriptionString(
ConsoleGameRules::EGameRuleType defType,
const std::wstring& description, void* data = NULL, int dataLength = 0);
const std::wstring& description, void* data = nullptr, int dataLength = 0);
};

View file

@ -82,12 +82,12 @@ const WCHAR* GameRuleManager::wchAttrNameA[] = {
};
GameRuleManager::GameRuleManager() {
m_currentGameRuleDefinitions = NULL;
m_currentLevelGenerationOptions = NULL;
m_currentGameRuleDefinitions = nullptr;
m_currentLevelGenerationOptions = nullptr;
}
void GameRuleManager::loadGameRules(DLCPack* pack) {
StringTable* strings = NULL;
StringTable* strings = nullptr;
if (pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,
L"languages.loc")) {
@ -240,10 +240,10 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions* lgo, uint8_t* dIn,
// 4J-JEV: Reverse of loadGameRules.
void GameRuleManager::saveGameRules(uint8_t** dOut, unsigned int* dSize) {
if (m_currentGameRuleDefinitions == NULL &&
m_currentLevelGenerationOptions == NULL) {
if (m_currentGameRuleDefinitions == nullptr &&
m_currentLevelGenerationOptions == nullptr) {
app.DebugPrintf("GameRuleManager:: Nothing here to save.");
*dOut = NULL;
*dOut = nullptr;
*dSize = 0;
return;
}
@ -269,7 +269,7 @@ void GameRuleManager::saveGameRules(uint8_t** dOut, unsigned int* dSize) {
ByteArrayOutputStream compr_baos;
DataOutputStream compr_dos(&compr_baos);
if (m_currentGameRuleDefinitions == NULL) {
if (m_currentGameRuleDefinitions == nullptr) {
compr_dos.writeInt(0); // numStrings for StringTable
compr_dos.writeInt(version_number);
compr_dos.writeByte(
@ -281,9 +281,9 @@ void GameRuleManager::saveGameRules(uint8_t** dOut, unsigned int* dSize) {
} else {
StringTable* st = m_currentGameRuleDefinitions->getStringTable();
if (st == NULL) {
if (st == nullptr) {
app.DebugPrintf(
"GameRuleManager::saveGameRules: StringTable == NULL!");
"GameRuleManager::saveGameRules: StringTable == nullptr!");
} else {
// Write string table.
byteArray stba;
@ -322,7 +322,7 @@ void GameRuleManager::saveGameRules(uint8_t** dOut, unsigned int* dSize) {
*dSize = baos.buf.length;
*dOut = baos.buf.data;
baos.buf.data = NULL;
baos.buf.data = nullptr;
dos.close();
baos.close();
@ -403,8 +403,8 @@ bool GameRuleManager::readRuleFile(
for (int i = 0; i < 8; ++i) dis.readBoolean();
}
ByteArrayInputStream* contentBais = NULL;
DataInputStream* contentDis = NULL;
ByteArrayInputStream* contentBais = nullptr;
DataInputStream* contentDis = nullptr;
if (compressionType == Compression::eCompressionType_None) {
// No compression
@ -531,7 +531,7 @@ bool GameRuleManager::readRuleFile(
auto it = tagIdMap.find(tagId);
if (it != tagIdMap.end()) tagVal = it->second;
GameRuleDefinition* rule = NULL;
GameRuleDefinition* rule = nullptr;
if (tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions) {
rule = levelGenerator;
@ -554,14 +554,14 @@ bool GameRuleManager::readRuleFile(
if (compressionType != 0) {
// Not default
contentDis->close();
if (contentBais != NULL) delete contentBais;
if (contentBais != nullptr) delete contentBais;
delete contentDis;
}
dis.close();
bais.reset();
// if(!levelGenAdded) { delete levelGenerator; levelGenerator = NULL; }
// if(!levelGenAdded) { delete levelGenerator; levelGenerator = nullptr; }
if (!gameRulesAdded) delete gameRules;
return true;
@ -587,7 +587,7 @@ void GameRuleManager::readAttributes(DataInputStream* dis,
int attID = dis->readInt();
std::wstring value = dis->readUTF();
if (rule != NULL) rule->addAttribute(tagsAndAtts->at(attID), value);
if (rule != nullptr) rule->addAttribute(tagsAndAtts->at(attID), value);
}
}
@ -604,8 +604,8 @@ void GameRuleManager::readChildren(
auto it = tagIdMap->find(tagId);
if (it != tagIdMap->end()) tagVal = it->second;
GameRuleDefinition* childRule = NULL;
if (rule != NULL) childRule = rule->addChild(tagVal);
GameRuleDefinition* childRule = nullptr;
if (rule != nullptr) childRule = rule->addChild(tagVal);
readAttributes(dis, tagsAndAtts, childRule);
readChildren(dis, tagsAndAtts, tagIdMap, childRule);
@ -613,14 +613,14 @@ void GameRuleManager::readChildren(
}
void GameRuleManager::processSchematics(LevelChunk* levelChunk) {
if (getLevelGenerationOptions() != NULL) {
if (getLevelGenerationOptions() != nullptr) {
LevelGenerationOptions* levelGenOptions = getLevelGenerationOptions();
levelGenOptions->processSchematics(levelChunk);
}
}
void GameRuleManager::processSchematicsLighting(LevelChunk* levelChunk) {
if (getLevelGenerationOptions() != NULL) {
if (getLevelGenerationOptions() != nullptr) {
LevelGenerationOptions* levelGenOptions = getLevelGenerationOptions();
levelGenOptions->processSchematicsLighting(levelChunk);
}
@ -680,21 +680,21 @@ void GameRuleManager::setLevelGenerationOptions(
LevelGenerationOptions* levelGen) {
unloadCurrentGameRules();
m_currentGameRuleDefinitions = NULL;
m_currentGameRuleDefinitions = nullptr;
m_currentLevelGenerationOptions = levelGen;
if (m_currentLevelGenerationOptions != NULL &&
if (m_currentLevelGenerationOptions != nullptr &&
m_currentLevelGenerationOptions->requiresGameRules()) {
m_currentGameRuleDefinitions =
m_currentLevelGenerationOptions->getRequiredGameRules();
}
if (m_currentLevelGenerationOptions != NULL)
if (m_currentLevelGenerationOptions != nullptr)
m_currentLevelGenerationOptions->reset_start();
}
const wchar_t* GameRuleManager::GetGameRulesString(const std::wstring& key) {
if (m_currentGameRuleDefinitions != NULL && !key.empty()) {
if (m_currentGameRuleDefinitions != nullptr && !key.empty()) {
return m_currentGameRuleDefinitions->getString(key);
} else {
return L"";
@ -714,8 +714,8 @@ LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(
}
void GameRuleManager::unloadCurrentGameRules() {
if (m_currentLevelGenerationOptions != NULL) {
if (m_currentGameRuleDefinitions != NULL &&
if (m_currentLevelGenerationOptions != nullptr) {
if (m_currentGameRuleDefinitions != nullptr &&
m_currentLevelGenerationOptions->isFromSave())
m_levelRules.removeLevelRule(m_currentGameRuleDefinitions);
@ -729,6 +729,6 @@ void GameRuleManager::unloadCurrentGameRules() {
}
}
m_currentGameRuleDefinitions = NULL;
m_currentLevelGenerationOptions = NULL;
m_currentGameRuleDefinitions = nullptr;
m_currentLevelGenerationOptions = nullptr;
}

View file

@ -52,8 +52,8 @@ void JustGrSource::setBaseSavePath(const std::wstring& x) {
bool JustGrSource::ready() { return true; }
LevelGenerationOptions::LevelGenerationOptions(DLCPack* parentPack) {
m_spawnPos = NULL;
m_stringTable = NULL;
m_spawnPos = nullptr;
m_stringTable = nullptr;
m_hasLoadedData = false;
@ -64,7 +64,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack* parentPack) {
m_minY = INT_MAX;
m_bRequiresGameRules = false;
m_pbBaseSaveData = NULL;
m_pbBaseSaveData = nullptr;
m_baseSaveSize = 0;
m_parentDLCPack = parentPack;
@ -73,7 +73,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack* parentPack) {
LevelGenerationOptions::~LevelGenerationOptions() {
clearSchematics();
if (m_spawnPos != NULL) delete m_spawnPos;
if (m_spawnPos != nullptr) delete m_spawnPos;
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
++it) {
delete *it;
@ -143,7 +143,7 @@ void LevelGenerationOptions::getChildren(
GameRuleDefinition* LevelGenerationOptions::addChild(
ConsoleGameRules::EGameRuleType ruleType) {
GameRuleDefinition* rule = NULL;
GameRuleDefinition* rule = nullptr;
if (ruleType == ConsoleGameRules::eGameRuleType_ApplySchematic) {
rule = new ApplySchematicRuleDefinition(this);
m_schematicRules.push_back((ApplySchematicRuleDefinition*)rule);
@ -174,19 +174,19 @@ void LevelGenerationOptions::addAttribute(const std::wstring& attributeName,
app.DebugPrintf(
"LevelGenerationOptions: Adding parameter m_seed=%I64d\n", m_seed);
} else if (attributeName.compare(L"spawnX") == 0) {
if (m_spawnPos == NULL) m_spawnPos = new Pos();
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
int value = _fromString<int>(attributeValue);
m_spawnPos->x = value;
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnX=%d\n",
value);
} else if (attributeName.compare(L"spawnY") == 0) {
if (m_spawnPos == NULL) m_spawnPos = new Pos();
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
int value = _fromString<int>(attributeValue);
m_spawnPos->y = value;
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnY=%d\n",
value);
} else if (attributeName.compare(L"spawnZ") == 0) {
if (m_spawnPos == NULL) m_spawnPos = new Pos();
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
int value = _fromString<int>(attributeValue);
m_spawnPos->z = value;
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnZ=%d\n",
@ -271,7 +271,7 @@ void LevelGenerationOptions::processSchematics(LevelChunk* chunk) {
if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15,
cz + 15)) {
BoundingBox* bb = new BoundingBox(cx, cz, cx + 15, cz + 15);
structureStart->postProcess(chunk->level, NULL, bb);
structureStart->postProcess(chunk->level, nullptr, bb);
delete bb;
}
}
@ -363,7 +363,7 @@ ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile(
return it->second;
}
ConsoleSchematicFile* schematic = NULL;
ConsoleSchematicFile* schematic = nullptr;
byteArray data(pbData, dataLength);
ByteArrayInputStream bais(data);
DataInputStream dis(&bais);
@ -376,7 +376,7 @@ ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile(
ConsoleSchematicFile* LevelGenerationOptions::getSchematicFile(
const std::wstring& filename) {
ConsoleSchematicFile* schematic = NULL;
ConsoleSchematicFile* schematic = nullptr;
// If we have already loaded this, just return
auto it = m_schematics.find(filename);
if (it != m_schematics.end()) {
@ -407,7 +407,7 @@ void LevelGenerationOptions::loadStringTable(StringTable* table) {
}
const wchar_t* LevelGenerationOptions::getString(const std::wstring& key) {
if (m_stringTable == NULL) {
if (m_stringTable == nullptr) {
return L"";
} else {
return m_stringTable->getString(key);
@ -462,7 +462,7 @@ LevelGenerationOptions::getUnfinishedSchematicFiles() {
void LevelGenerationOptions::loadBaseSaveData() {
int mountIndex = -1;
if (m_parentDLCPack != NULL)
if (m_parentDLCPack != nullptr)
mountIndex = m_parentDLCPack->GetDLCMountIndex();
if (mountIndex > -1) {
@ -518,12 +518,12 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, DWORD dwErr,
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share
// file? Probably not but...
NULL, // Unused
nullptr, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu -
// Assuming that the file already exists
// if we are opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
NULL // Unsupported
nullptr // Unsupported
);
#else
const char* pchFilename = wstringtofilename(grf.getPath());
@ -532,12 +532,12 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, DWORD dwErr,
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share
// file? Probably not but...
NULL, // Unused
nullptr, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu -
// Assuming that the file already exists
// if we are opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
NULL // Unsupported
nullptr // Unsupported
);
#endif
@ -546,7 +546,7 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, DWORD dwErr,
DWORD bytesRead;
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
bool bSuccess = ReadFile(fileHandle, pbData, dwFileSize,
&bytesRead, NULL);
&bytesRead, nullptr);
if (bSuccess == FALSE) {
app.FatalLoadError();
}
@ -576,12 +576,12 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, DWORD dwErr,
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share
// file? Probably not but...
NULL, // Unused
nullptr, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu - Assuming
// that the file already exists if we are
// opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
NULL // Unsupported
nullptr // Unsupported
);
#else
const char* pchFilename = wstringtofilename(save.getPath());
@ -590,20 +590,20 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, DWORD dwErr,
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share
// file? Probably not but...
NULL, // Unused
nullptr, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu - Assuming
// that the file already exists if we are
// opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
NULL // Unsupported
nullptr // Unsupported
);
#endif
if (fileHandle != INVALID_HANDLE_VALUE) {
DWORD bytesRead, dwFileSize = GetFileSize(fileHandle, NULL);
DWORD bytesRead, dwFileSize = GetFileSize(fileHandle, nullptr);
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
bool bSuccess = ReadFile(fileHandle, pbData, dwFileSize,
&bytesRead, NULL);
&bytesRead, nullptr);
if (bSuccess == FALSE) {
app.FatalLoadError();
}
@ -632,8 +632,8 @@ void LevelGenerationOptions::reset_start() {
void LevelGenerationOptions::reset_finish() {
// if (m_spawnPos) { delete m_spawnPos; m_spawnPos
// = NULL; } if (m_stringTable) { delete m_stringTable;
// m_stringTable = NULL; }
// = nullptr; } if (m_stringTable) { delete m_stringTable;
// m_stringTable = nullptr; }
if (isFromDLC()) {
m_hasLoadedData = false;
@ -739,11 +739,11 @@ std::uint8_t* LevelGenerationOptions::getBaseSaveData(unsigned int& size) {
return m_pbBaseSaveData;
}
bool LevelGenerationOptions::hasBaseSaveData() {
return m_baseSaveSize > 0 && m_pbBaseSaveData != NULL;
return m_baseSaveSize > 0 && m_pbBaseSaveData != nullptr;
}
void LevelGenerationOptions::deleteBaseSaveData() {
delete[] m_pbBaseSaveData;
m_pbBaseSaveData = NULL;
m_pbBaseSaveData = nullptr;
m_baseSaveSize = 0;
}

View file

@ -167,7 +167,7 @@ private:
bool m_bLoadingData;
public:
LevelGenerationOptions(DLCPack* parentPack = NULL);
LevelGenerationOptions(DLCPack* parentPack = nullptr);
~LevelGenerationOptions();
virtual ConsoleGameRules::EGameRuleType getActionType();
@ -210,7 +210,7 @@ public:
std::uint8_t& topTile);
bool isFeatureChunk(int chunkX, int chunkZ,
StructureFeature::EFeatureTypes feature,
int* orientation = NULL);
int* orientation = nullptr);
void loadStringTable(StringTable* table);
const wchar_t* getString(const std::wstring& key);

View file

@ -4,7 +4,7 @@
#include "ConsoleGameRules.h"
#include "LevelRuleset.h"
LevelRuleset::LevelRuleset() { m_stringTable = NULL; }
LevelRuleset::LevelRuleset() { m_stringTable = nullptr; }
LevelRuleset::~LevelRuleset() {
for (auto it = m_areas.begin(); it != m_areas.end(); ++it) {
@ -20,7 +20,7 @@ void LevelRuleset::getChildren(std::vector<GameRuleDefinition*>* children) {
GameRuleDefinition* LevelRuleset::addChild(
ConsoleGameRules::EGameRuleType ruleType) {
GameRuleDefinition* rule = NULL;
GameRuleDefinition* rule = nullptr;
if (ruleType == ConsoleGameRules::eGameRuleType_NamedArea) {
rule = new NamedAreaRuleDefinition();
m_areas.push_back((NamedAreaRuleDefinition*)rule);
@ -35,7 +35,7 @@ void LevelRuleset::loadStringTable(StringTable* table) {
}
const wchar_t* LevelRuleset::getString(const std::wstring& key) {
if (m_stringTable == NULL) {
if (m_stringTable == nullptr) {
return L"";
} else {
return m_stringTable->getString(key);
@ -43,7 +43,7 @@ const wchar_t* LevelRuleset::getString(const std::wstring& key) {
}
AABB* LevelRuleset::getNamedArea(const std::wstring& areaName) {
AABB* area = NULL;
AABB* area = nullptr;
for (auto it = m_areas.begin(); it != m_areas.end(); ++it) {
if ((*it)->getName().compare(areaName) == 0) {
area = (*it)->getArea();

View file

@ -51,6 +51,6 @@ void StartFeature::addAttribute(const std::wstring& attributeName,
bool StartFeature::isFeatureChunk(int chunkX, int chunkZ,
StructureFeature::EFeatureTypes feature,
int* orientation) {
if (orientation != NULL) *orientation = m_orientation;
if (orientation != nullptr) *orientation = m_orientation;
return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature;
}

View file

@ -12,7 +12,7 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition() {
;
m_health = 0;
m_food = 0;
m_spawnPos = NULL;
m_spawnPos = nullptr;
m_yRot = 0.0f;
}
@ -60,7 +60,7 @@ void UpdatePlayerRuleDefinition::getChildren(
GameRuleDefinition* UpdatePlayerRuleDefinition::addChild(
ConsoleGameRules::EGameRuleType ruleType) {
GameRuleDefinition* rule = NULL;
GameRuleDefinition* rule = nullptr;
if (ruleType == ConsoleGameRules::eGameRuleType_AddItem) {
rule = new AddItemRuleDefinition();
m_items.push_back((AddItemRuleDefinition*)rule);
@ -78,19 +78,19 @@ GameRuleDefinition* UpdatePlayerRuleDefinition::addChild(
void UpdatePlayerRuleDefinition::addAttribute(
const std::wstring& attributeName, const std::wstring& attributeValue) {
if (attributeName.compare(L"spawnX") == 0) {
if (m_spawnPos == NULL) m_spawnPos = new Pos();
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
int value = _fromString<int>(attributeValue);
m_spawnPos->x = value;
app.DebugPrintf(
"UpdatePlayerRuleDefinition: Adding parameter spawnX=%d\n", value);
} else if (attributeName.compare(L"spawnY") == 0) {
if (m_spawnPos == NULL) m_spawnPos = new Pos();
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
int value = _fromString<int>(attributeValue);
m_spawnPos->y = value;
app.DebugPrintf(
"UpdatePlayerRuleDefinition: Adding parameter spawnY=%d\n", value);
} else if (attributeName.compare(L"spawnZ") == 0) {
if (m_spawnPos == NULL) m_spawnPos = new Pos();
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
int value = _fromString<int>(attributeValue);
m_spawnPos->z = value;
app.DebugPrintf(
@ -134,7 +134,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(
double z = player->z;
float yRot = player->yRot;
float xRot = player->xRot;
if (m_spawnPos != NULL) {
if (m_spawnPos != nullptr) {
x = m_spawnPos->x;
y = m_spawnPos->y;
z = m_spawnPos->z;
@ -144,7 +144,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(
yRot = m_yRot;
}
if (m_spawnPos != NULL || m_bUpdateYRot)
if (m_spawnPos != nullptr || m_bUpdateYRot)
player->absMoveTo(x, y, z, yRot, xRot);
for (auto it = m_items.begin(); it != m_items.end(); ++it) {

View file

@ -30,7 +30,7 @@ void XboxStructureActionPlaceContainer::getChildren(
GameRuleDefinition* XboxStructureActionPlaceContainer::addChild(
ConsoleGameRules::EGameRuleType ruleType) {
GameRuleDefinition* rule = NULL;
GameRuleDefinition* rule = nullptr;
if (ruleType == ConsoleGameRules::eGameRuleType_AddItem) {
rule = new AddItemRuleDefinition();
m_items.push_back((AddItemRuleDefinition*)rule);
@ -66,7 +66,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(
int worldZ = structure->getWorldZ(m_x, m_z);
if (chunkBB->isInside(worldX, worldY, worldZ)) {
if (level->getTileEntity(worldX, worldY, worldZ) != NULL) {
if (level->getTileEntity(worldX, worldY, worldZ) != nullptr) {
// Remove the current tile entity
level->removeTileEntity(worldX, worldY, worldZ);
level->setTileAndData(worldX, worldY, worldZ, 0, 0,
@ -83,7 +83,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(
"XboxStructureActionPlaceContainer - placing a container at "
"(%d,%d,%d)\n",
worldX, worldY, worldZ);
if (container != NULL) {
if (container != nullptr) {
level->setData(worldX, worldY, worldZ, m_data,
Tile::UPDATE_CLIENTS);
// Add items

View file

@ -42,7 +42,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(
int worldZ = structure->getWorldZ(m_x, m_z);
if (chunkBB->isInside(worldX, worldY, worldZ)) {
if (level->getTileEntity(worldX, worldY, worldZ) != NULL) {
if (level->getTileEntity(worldX, worldY, worldZ) != nullptr) {
// Remove the current tile entity
level->removeTileEntity(worldX, worldY, worldZ);
level->setTileAndData(worldX, worldY, worldZ, 0, 0,
@ -61,7 +61,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(
L"(%d,%d,%d)\n",
m_entityId.c_str(), worldX, worldY, worldZ);
#endif
if (entity != NULL) {
if (entity != nullptr) {
entity->setEntityId(m_entityId);
}
return true;

View file

@ -6,7 +6,7 @@ LeaderboardInterface::LeaderboardInterface(LeaderboardManager* man) {
m_pending = false;
m_filter = (LeaderboardManager::EFilterMode)-1;
m_callback = NULL;
m_callback = nullptr;
m_difficulty = 0;
m_type = LeaderboardManager::eStatsType_UNDEFINED;
m_startIndex = 0;

View file

@ -12,7 +12,7 @@ const std::wstring LeaderboardManager::filterNames[eNumFilterModes] =
void LeaderboardManager::DeleteInstance()
{
delete m_instance;
m_instance = NULL;
m_instance = nullptr;
}
LeaderboardManager::LeaderboardManager()
@ -26,7 +26,7 @@ void LeaderboardManager::zeroReadParameters()
{
m_difficulty = -1;
m_statsType = eStatsType_UNDEFINED;
m_readListener = NULL;
m_readListener = nullptr;
m_startIndex = 0;
m_readCount = 0;
m_eFilterMode = eFM_UNDEFINED;

View file

@ -24,7 +24,7 @@ SonyLeaderboardManager::SonyLeaderboardManager() {
m_myXUID = INVALID_XUID;
m_scores = NULL;
m_scores = nullptr;
m_statsType = eStatsType_Kills;
m_difficulty = 0;
@ -36,7 +36,7 @@ SonyLeaderboardManager::SonyLeaderboardManager() {
InitializeCriticalSection(&m_csViewsLock);
m_running = false;
m_threadScoreboard = NULL;
m_threadScoreboard = nullptr;
}
SonyLeaderboardManager::~SonyLeaderboardManager() {
@ -204,7 +204,7 @@ bool SonyLeaderboardManager::getScoreByIds() {
SonyRtcTick last_sort_date;
SceNpScoreRankNumber mTotalRecord;
SceNpId* npIds = NULL;
SceNpId* npIds = nullptr;
int ret;
uint32_t num = 0;
@ -236,8 +236,8 @@ bool SonyLeaderboardManager::getScoreByIds() {
/* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t
boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\
rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t NULL,
0, NULL, 0,\n\t friendCount=%i,\n...\n", transaction, npId, friendCount,
rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t nullptr,
0, nullptr, 0,\n\t friendCount=%i,\n...\n", transaction, npId, friendCount,
sizeof(SceNpId), friendCount*sizeof(SceNpId), rankData,
friendCount*sizeof(SceNpScorePlayerRankData), friendCount
); */
@ -254,9 +254,9 @@ bool SonyLeaderboardManager::getScoreByIds() {
destroyTransactionContext(ret);
if (npIds != NULL) delete[] npIds;
if (ptr != NULL) delete[] ptr;
if (comments != NULL) delete[] comments;
if (npIds != nullptr) delete[] npIds;
if (ptr != nullptr) delete[] ptr;
if (comments != nullptr) delete[] comments;
return false;
} else if (ret < 0) {
@ -268,9 +268,9 @@ bool SonyLeaderboardManager::getScoreByIds() {
m_eStatsState = eStatsState_Failed;
if (npIds != NULL) delete[] npIds;
if (ptr != NULL) delete[] ptr;
if (comments != NULL) delete[] comments;
if (npIds != nullptr) delete[] npIds;
if (ptr != nullptr) delete[] ptr;
if (comments != nullptr) delete[] comments;
return false;
} else {
@ -287,13 +287,13 @@ bool SonyLeaderboardManager::getScoreByIds() {
ptr, sizeof(SceNpScorePlayerRankData) * tmpNum, // OUT: Rank Data
comments, sizeof(SceNpScoreComment) * tmpNum, // OUT: Comments
NULL, 0, // GameData. (unused)
nullptr, 0, // GameData. (unused)
tmpNum,
&last_sort_date, &mTotalRecord,
NULL // Reserved, specify null.
nullptr // Reserved, specify null.
);
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) {
@ -322,7 +322,7 @@ bool SonyLeaderboardManager::getScoreByIds() {
m_readCount = num;
// Filter scorers and construct output structure.
if (m_scores != NULL) delete[] m_scores;
if (m_scores != nullptr) delete[] m_scores;
m_scores = new ReadScore[m_readCount];
convertToOutput(m_readCount, m_scores, ptr, comments);
m_maxRank = m_readCount;
@ -352,7 +352,7 @@ error3:
delete[] ptr;
delete[] comments;
error2:
if (npIds != NULL) delete[] npIds;
if (npIds != nullptr) delete[] npIds;
error1:
if (m_eStatsState != eStatsState_Canceled)
m_eStatsState = eStatsState_Failed;
@ -406,7 +406,7 @@ bool SonyLeaderboardManager::getScoreByRange() {
comments, sizeof(SceNpScoreComment) * num, // OUT: Comment Data
NULL, 0, // GameData.
nullptr, 0, // GameData.
num,
@ -414,7 +414,7 @@ bool SonyLeaderboardManager::getScoreByRange() {
&m_maxRank, // 'Total number of players registered in the target
// scoreboard.'
NULL // Reserved, specify null.
nullptr // Reserved, specify null.
);
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) {
@ -437,7 +437,7 @@ bool SonyLeaderboardManager::getScoreByRange() {
delete[] ptr;
delete[] comments;
m_scores = NULL;
m_scores = nullptr;
m_readCount = 0;
m_eStatsState = eStatsState_Ready;
@ -457,7 +457,7 @@ bool SonyLeaderboardManager::getScoreByRange() {
// m_stats = ptr; //Maybe: addPadding(num,ptr);
if (m_scores != NULL) delete[] m_scores;
if (m_scores != nullptr) delete[] m_scores;
m_readCount = ret;
m_scores = new ReadScore[m_readCount];
for (int i = 0; i < m_readCount; i++) {
@ -544,13 +544,13 @@ bool SonyLeaderboardManager::setScore() {
rscore.m_score, // IN: new score,
&comment, // Comments
NULL, // GameInfo
nullptr, // GameInfo
&tmp, // OUT: current rank,
NULL, // compareDate
nullptr, // compareDate
NULL // Reserved, specify null.
nullptr // Reserved, specify null.
);
if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_NOT_BEST_SCORE) // 0x8002A415
@ -593,7 +593,7 @@ void SonyLeaderboardManager::Tick() {
switch (m_eStatsState) {
case eStatsState_Ready: {
assert(m_scores != NULL || m_readCount == 0);
assert(m_scores != nullptr || m_readCount == 0);
view.m_numQueries = m_readCount;
view.m_queries = m_scores;
@ -604,7 +604,7 @@ void SonyLeaderboardManager::Tick() {
eStatsReturn ret = eStatsReturn_NoResults;
if (view.m_numQueries > 0) ret = eStatsReturn_Success;
if (m_readListener != NULL) {
if (m_readListener != nullptr) {
app.DebugPrintf(
"[SonyLeaderboardManager] OnStatsReadComplete(%i, %i, _), "
"m_readCount=%i.\n",
@ -615,14 +615,14 @@ void SonyLeaderboardManager::Tick() {
m_eStatsState = eStatsState_Idle;
delete[] m_scores;
m_scores = NULL;
m_scores = nullptr;
} break;
case eStatsState_Failed: {
view.m_numQueries = 0;
view.m_queries = NULL;
view.m_queries = nullptr;
if (m_readListener != NULL)
if (m_readListener != nullptr)
m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError,
0, view);
@ -640,7 +640,7 @@ void SonyLeaderboardManager::Tick() {
bool SonyLeaderboardManager::OpenSession() {
if (m_openSessions == 0) {
if (m_threadScoreboard == NULL) {
if (m_threadScoreboard == nullptr) {
m_threadScoreboard =
new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard");
m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS);
@ -748,7 +748,7 @@ bool SonyLeaderboardManager::ReadStats_TopRank(
void SonyLeaderboardManager::FlushStats() {}
void SonyLeaderboardManager::CancelOperation() {
m_readListener = NULL;
m_readListener = nullptr;
m_eStatsState = eStatsState_Canceled;
if (m_requestId != 0) {
@ -898,7 +898,7 @@ void SonyLeaderboardManager::fromBase32(void* out, SceNpScoreComment* in) {
char ch[2] = {0, 0};
for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++) {
ch[0] = getComment(in)[i];
unsigned char fivebits = strtol(ch, NULL, 32) << 3;
unsigned char fivebits = strtol(ch, nullptr, 32) << 3;
int sByte = (i * 5) / 8;
int eByte = (5 + (i * 5)) / 8;
@ -943,7 +943,7 @@ bool SonyLeaderboardManager::test_string(std::string testing) {
int ctx = createTransactionContext(m_titleContext);
if (ctx < 0) return false;
int ret = sceNpScoreCensorComment(ctx, (const char*)&comment, NULL);
int ret = sceNpScoreCensorComment(ctx, (const char*)&comment, nullptr);
if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED) {
app.DebugPrintf("\n[TEST_STRING]: REJECTED ");

View file

@ -115,13 +115,13 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
void* lpParameter) {
int64_t seed = 0;
if (lpParameter != NULL) {
if (lpParameter != nullptr) {
NetworkGameInitData* param = (NetworkGameInitData*)lpParameter;
seed = param->seed;
app.setLevelGenerationOptions(param->levelGen);
if (param->levelGen != NULL) {
if (app.getLevelGenerationOptions() == NULL) {
if (param->levelGen != nullptr) {
if (app.getLevelGenerationOptions() == nullptr) {
app.DebugPrintf(
"Game rule was not loaded, and seed is required. "
"Exiting.\n");
@ -156,13 +156,13 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need
// to share file? Probably not but...
NULL, // Unused
nullptr, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu
// - Assuming that the file
// already exists if we are
// opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
NULL // Unsupported
nullptr // Unsupported
);
#else
const char* pchFilename =
@ -172,23 +172,23 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need
// to share file? Probably not but...
NULL, // Unused
nullptr, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu
// - Assuming that the file
// already exists if we are
// opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
NULL // Unsupported
nullptr // Unsupported
);
#endif
if (fileHandle != INVALID_HANDLE_VALUE) {
DWORD bytesRead,
dwFileSize = GetFileSize(fileHandle, NULL);
dwFileSize = GetFileSize(fileHandle, nullptr);
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
bool bSuccess =
ReadFile(fileHandle, pbData, dwFileSize,
&bytesRead, NULL);
&bytesRead, nullptr);
if (bSuccess == FALSE) {
app.FatalLoadError();
}
@ -231,7 +231,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
// printf("Server ready to go!\n");
} else {
Socket::Initialise(NULL);
Socket::Initialise(nullptr);
}
Minecraft* pMinecraft = Minecraft::GetInstance();
@ -286,17 +286,17 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
ClientConnection* connection;
if (g_NetworkManager.IsHost()) {
connection = new ClientConnection(minecraft, NULL);
connection = new ClientConnection(minecraft, nullptr);
app.DebugPrintf("[NET] ClientConnection created, createdOk=%d\n",
connection->createdOk);
} else {
INetworkPlayer* pNetworkPlayer =
g_NetworkManager.GetLocalPlayerByUserIndex(
ProfileManager.GetLockedProfile());
if (pNetworkPlayer == NULL) {
if (pNetworkPlayer == nullptr) {
MinecraftServer::HaltServer();
app.DebugPrintf("%d\n", ProfileManager.GetLockedProfile());
// If the player is NULL here then something went wrong in the
// If the player is nullptr here then something went wrong in the
// session setup, and continuing will end up in a crash
return false;
}
@ -305,10 +305,10 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
// Fix for #13259 - CRASH: Gameplay: loading process is halted when
// player loads saved data
if (socket == NULL) {
if (socket == nullptr) {
assert(false);
MinecraftServer::HaltServer();
// If the socket is NULL here then something went wrong in the
// If the socket is nullptr here then something went wrong in the
// session setup, and continuing will end up in a crash
return false;
}
@ -319,7 +319,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
if (!connection->createdOk) {
assert(false);
delete connection;
connection = NULL;
connection = nullptr;
MinecraftServer::HaltServer();
return false;
}
@ -395,7 +395,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
// Already have setup the primary pad
if (idx == ProfileManager.GetPrimaryPad()) continue;
if (GetLocalPlayerByUserIndex(idx) != NULL &&
if (GetLocalPlayerByUserIndex(idx) != nullptr &&
!ProfileManager.IsSignedIn(idx)) {
INetworkPlayer* pNetworkPlayer =
g_NetworkManager.GetLocalPlayerByUserIndex(idx);
@ -416,7 +416,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
// them later
INetworkPlayer* pNetworkPlayer =
g_NetworkManager.GetLocalPlayerByUserIndex(idx);
if (pNetworkPlayer == NULL) continue;
if (pNetworkPlayer == nullptr) continue;
ClientConnection* connection;
@ -827,7 +827,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc(void* lpParameter) {
}
// If we failed before the server started, clear the game rules.
// Otherwise the server will clear it up.
if (MinecraftServer::getInstance() == NULL)
if (MinecraftServer::getInstance() == nullptr)
app.m_gameRules.unloadCurrentGameRules();
Tile::ReleaseThreadStorage();
return -1;
@ -840,14 +840,14 @@ int CGameNetworkManager::RunNetworkGameThreadProc(void* lpParameter) {
int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
int64_t seed = 0;
if (lpParameter != NULL) {
if (lpParameter != nullptr) {
NetworkGameInitData* param = (NetworkGameInitData*)lpParameter;
seed = param->seed;
app.SetGameHostOption(eGameHostOption_All, param->settings);
// 4J Stu - If we are loading a DLC save that's separate from the
// texture pack, load
if (param->levelGen != NULL &&
if (param->levelGen != nullptr &&
(param->texturePackId == 0 ||
param->levelGen->getRequiredTexturePackId() !=
param->texturePackId)) {
@ -874,7 +874,7 @@ int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
Tile::ReleaseThreadStorage();
Level::destroyLightingCache();
if (lpParameter != NULL) delete (NetworkGameInitData*)lpParameter;
if (lpParameter != nullptr) delete (NetworkGameInitData*)lpParameter;
return S_OK;
}
@ -885,7 +885,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc(void* lpParam) {
Compression::UseDefaultThreadStorage();
// app.SetGameStarted(false);
UIScene_PauseMenu::_ExitWorld(NULL);
UIScene_PauseMenu::_ExitWorld(nullptr);
while (g_NetworkManager.IsInSession()) {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
@ -938,7 +938,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
// Null the network player of all the server players that are local, to stop
// them being removed from the server when removed from the session
if (pServer != NULL) {
if (pServer != nullptr) {
PlayerList* players = pServer->getPlayers();
for (auto it = players->players.begin();
it < players->players.end(); ++it) {
@ -946,7 +946,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
if (servPlayer->connection->isLocal() &&
!servPlayer->connection->isGuest()) {
servPlayer->connection->connection->getSocket()->setPlayer(
NULL);
nullptr);
}
}
}
@ -981,7 +981,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
char numLocalPlayers = 0;
for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) {
if (ProfileManager.IsSignedIn(index) &&
pMinecraft->localplayers[index] != NULL) {
pMinecraft->localplayers[index] != nullptr) {
numLocalPlayers++;
localUsersMask |= GetLocalPlayerMask(index);
}
@ -997,10 +997,10 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
}
// Restore the network player of all the server players that are local
if (pServer != NULL) {
if (pServer != nullptr) {
for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) {
if (ProfileManager.IsSignedIn(index) &&
pMinecraft->localplayers[index] != NULL) {
pMinecraft->localplayers[index] != nullptr) {
PlayerUID localPlayerXuid =
pMinecraft->localplayers[index]->getXuid();
@ -1017,7 +1017,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
}
// Player might have a pending connection
if (pMinecraft->m_pendingLocalConnections[index] != NULL) {
if (pMinecraft->m_pendingLocalConnections[index] != nullptr) {
// Update the network player
pMinecraft->m_pendingLocalConnections[index]
->getConnection()
@ -1129,7 +1129,7 @@ void CGameNetworkManager::StateChange_AnyToStarting() {
if (!g_NetworkManager.IsHost()) {
LoadingInputParams* loadingParams = new LoadingInputParams();
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
loadingParams->lpParam = NULL;
loadingParams->lpParam = nullptr;
UIFullscreenProgressCompletionData* completionData =
new UIFullscreenProgressCompletionData();
@ -1151,7 +1151,7 @@ void CGameNetworkManager::StateChange_AnyToEnding(bool bStateWasPlaying) {
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
INetworkPlayer* pNetworkPlayer =
g_NetworkManager.GetLocalPlayerByUserIndex(i);
if (pNetworkPlayer != NULL && ProfileManager.IsSignedIn(i)) {
if (pNetworkPlayer != nullptr && ProfileManager.IsSignedIn(i)) {
app.DebugPrintf(
"Stats save for an offline game for the player at index "
"%d\n",
@ -1190,10 +1190,10 @@ void CGameNetworkManager::CreateSocket(INetworkPlayer* pNetworkPlayer,
bool localPlayer) {
Minecraft* pMinecraft = Minecraft::GetInstance();
Socket* socket = NULL;
Socket* socket = nullptr;
std::shared_ptr<MultiplayerLocalPlayer> mpPlayer =
pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()];
if (localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL) {
if (localPlayer && mpPlayer != nullptr && mpPlayer->connection != nullptr) {
// If we already have a MultiplayerLocalPlayer here then we are doing a
// session type change
socket = mpPlayer->connection->getSocket();
@ -1233,7 +1233,7 @@ void CGameNetworkManager::CreateSocket(INetworkPlayer* pNetworkPlayer,
idx,
DisconnectPacket::eDisconnect_ConnectionCreationFailed);
delete connection;
connection = NULL;
connection = nullptr;
}
}
}
@ -1241,9 +1241,9 @@ void CGameNetworkManager::CreateSocket(INetworkPlayer* pNetworkPlayer,
void CGameNetworkManager::CloseConnection(INetworkPlayer* pNetworkPlayer) {
MinecraftServer* server = MinecraftServer::getInstance();
if (server != NULL) {
if (server != nullptr) {
PlayerList* players = server->getPlayers();
if (players != NULL) {
if (players != nullptr) {
players->closePlayerConnectionBySmallId(
pNetworkPlayer->GetSmallId());
}
@ -1261,7 +1261,7 @@ void CGameNetworkManager::PlayerJoining(INetworkPlayer* pNetworkPlayer) {
for (int iPad = 0; iPad < XUSER_MAX_COUNT; ++iPad) {
INetworkPlayer* pNetworkPlayer =
g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
if (pNetworkPlayer == NULL) continue;
if (pNetworkPlayer == nullptr) continue;
app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BLANK);
if (multiplayer) {
@ -1321,7 +1321,7 @@ void CGameNetworkManager::GameInviteReceived(int userIndex,
// except for the invited player (who may be an inactive player) 4J
// Stu - If we are not in a game, then bring in all players signed
// in
if (index == userIndex || pMinecraft->localplayers[index] != NULL) {
if (index == userIndex || pMinecraft->localplayers[index] != nullptr) {
++joiningUsers;
if (!ProfileManager.AllowedToPlayMultiplayer(index))
noPrivileges = true;
@ -1357,7 +1357,7 @@ void CGameNetworkManager::GameInviteReceived(int userIndex,
// invite from the dashboard
// StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE,
// IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT,
// uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL,
// uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr,
// app.GetStringTable());
ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE,
IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1,
@ -1507,49 +1507,49 @@ char* CGameNetworkManager::GetOnlineName(int playerIdx) {
}
void CGameNetworkManager::ServerReadyCreate(bool create) {
m_hServerReadyEvent = (create ? (new C4JThread::Event) : NULL);
m_hServerReadyEvent = (create ? (new C4JThread::Event) : nullptr);
}
void CGameNetworkManager::ServerReady() {
if (m_hServerReadyEvent != NULL) {
if (m_hServerReadyEvent != nullptr) {
m_hServerReadyEvent->Set();
} else {
app.DebugPrintf(
"[NET] Warning: ServerReady() called but m_hServerReadyEvent is "
"NULL\n");
"nullptr\n");
}
}
void CGameNetworkManager::ServerReadyWait() {
if (m_hServerReadyEvent != NULL) {
if (m_hServerReadyEvent != nullptr) {
m_hServerReadyEvent->WaitForSignal(INFINITE);
} else {
app.DebugPrintf(
"[NET] Warning: ServerReadyWait() called but m_hServerReadyEvent "
"is NULL\n");
"is nullptr\n");
}
}
void CGameNetworkManager::ServerReadyDestroy() {
delete m_hServerReadyEvent;
m_hServerReadyEvent = NULL;
m_hServerReadyEvent = nullptr;
}
bool CGameNetworkManager::ServerReadyValid() {
return (m_hServerReadyEvent != NULL);
return (m_hServerReadyEvent != nullptr);
}
void CGameNetworkManager::ServerStoppedCreate(bool create) {
m_hServerStoppedEvent = (create ? (new C4JThread::Event) : NULL);
m_hServerStoppedEvent = (create ? (new C4JThread::Event) : nullptr);
}
void CGameNetworkManager::ServerStopped() {
if (m_hServerStoppedEvent != NULL) {
if (m_hServerStoppedEvent != nullptr) {
m_hServerStoppedEvent->Set();
} else {
app.DebugPrintf(
"[NET] Warning: ServerStopped() called but m_hServerStoppedEvent "
"is NULL\n");
"is nullptr\n");
}
}
@ -1574,23 +1574,23 @@ void CGameNetworkManager::ServerStoppedWait() {
RenderManager.Present();
} while (result == WAIT_TIMEOUT);
} else {
if (m_hServerStoppedEvent != NULL) {
if (m_hServerStoppedEvent != nullptr) {
m_hServerStoppedEvent->WaitForSignal(INFINITE);
} else {
app.DebugPrintf(
"[NET] Warning: ServerStoppedWait() called but "
"m_hServerStoppedEvent is NULL\n");
"m_hServerStoppedEvent is nullptr\n");
}
}
}
void CGameNetworkManager::ServerStoppedDestroy() {
delete m_hServerStoppedEvent;
m_hServerStoppedEvent = NULL;
m_hServerStoppedEvent = nullptr;
}
bool CGameNetworkManager::ServerStoppedValid() {
return (m_hServerStoppedEvent != NULL);
return (m_hServerStoppedEvent != nullptr);
}
int CGameNetworkManager::GetJoiningReadyPercentage() {

View file

@ -111,7 +111,7 @@ public:
static int JoinFromInvite_SignInReturned(void* pParam, bool bContinue,
int iPad);
void UpdateAndSetGameSessionData(
INetworkPlayer* pNetworkPlayerLeaving = NULL);
INetworkPlayer* pNetworkPlayerLeaving = nullptr);
void SendInviteGUI(int iPad);
void ResetLeavingGame();
@ -133,17 +133,17 @@ public:
// Events
void ServerReadyCreate(bool create); // Create the signal (or set to NULL)
void ServerReadyCreate(bool create); // Create the signal (or set to nullptr)
void ServerReady(); // Signal that we are ready
void ServerReadyWait(); // Wait for the signal
void ServerReadyDestroy(); // Destroy signal
bool ServerReadyValid(); // Is non-NULL
bool ServerReadyValid(); // Is non-nullptr
void ServerStoppedCreate(bool create); // Create the signal
void ServerStopped(); // Signal that we are ready
void ServerStoppedWait(); // Wait for the signal
void ServerStoppedDestroy(); // Destroy signal
bool ServerStoppedValid(); // Is non-NULL
bool ServerStoppedValid(); // Is non-nullptr
// Debug output

View file

@ -3,7 +3,7 @@
NetworkPlayerQNet::NetworkPlayerQNet(IQNetPlayer* qnetPlayer) {
m_qnetPlayer = qnetPlayer;
m_pSocket = NULL;
m_pSocket = nullptr;
}
unsigned char NetworkPlayerQNet::GetSmallId() {

View file

@ -107,7 +107,7 @@ private:
public:
virtual void UpdateAndSetGameSessionData(
INetworkPlayer* pNetworkPlayerLeaving = NULL) = 0;
INetworkPlayer* pNetworkPlayerLeaving = nullptr) = 0;
private:
virtual bool RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer) = 0;

View file

@ -80,7 +80,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) {
}
for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) {
if (playerChangedCallback[idx] != NULL)
if (playerChangedCallback[idx] != nullptr)
playerChangedCallback[idx](playerChangedCallbackParam[idx],
networkPlayer, false);
}
@ -88,7 +88,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) {
if (m_pIQNet->GetState() == QNET_STATE_GAME_PLAY) {
int localPlayerCount = 0;
for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) {
if (m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL)
if (m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr)
++localPlayerCount;
}
@ -107,7 +107,7 @@ bool CPlatformNetworkManagerStub::Initialise(
// 4jcraft added this, as it was never called
m_pIQNet = new IQNet();
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
playerChangedCallback[i] = NULL;
playerChangedCallback[i] = nullptr;
}
m_bLeavingGame = false;
@ -126,10 +126,10 @@ bool CPlatformNetworkManagerStub::Initialise(
m_lastSearchStartTime[i] = 0;
// The results that will be filled in with the current search
m_pSearchResults[i] = NULL;
m_pQoSResult[i] = NULL;
m_pCurrentSearchResults[i] = NULL;
m_pCurrentQoSResult[i] = NULL;
m_pSearchResults[i] = nullptr;
m_pQoSResult[i] = nullptr;
m_pCurrentSearchResults[i] = nullptr;
m_pCurrentQoSResult[i] = nullptr;
m_currentSearchResultsCount[i] = 0;
}
@ -266,8 +266,8 @@ void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback(
bool leaving),
void* callbackParam) {
if (playerChangedCallbackParam[iPad] == callbackParam) {
playerChangedCallback[iPad] = NULL;
playerChangedCallbackParam[iPad] = NULL;
playerChangedCallback[iPad] = nullptr;
playerChangedCallbackParam[iPad] = nullptr;
}
}
@ -276,13 +276,13 @@ void CPlatformNetworkManagerStub::HandleSignInChange() { return; }
bool CPlatformNetworkManagerStub::_RunNetworkGame() { return true; }
void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(
INetworkPlayer* pNetworkPlayerLeaving /*= NULL*/) {
INetworkPlayer* pNetworkPlayerLeaving /*= nullptr*/) {
// DWORD playerCount = m_pIQNet->GetPlayerCount();
//
// if( this->m_bLeavingGame )
// return;
//
// if( GetHostPlayer() == NULL )
// if( GetHostPlayer() == nullptr )
// return;
//
// for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
@ -305,13 +305,13 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(
// }
// else
// {
// m_hostGameSessionData.players[i] = NULL;
// m_hostGameSessionData.players[i] = nullptr;
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
// }
// }
// else
// {
// m_hostGameSessionData.players[i] = NULL;
// m_hostGameSessionData.players[i] = nullptr;
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
// }
// }
@ -328,13 +328,13 @@ int CPlatformNetworkManagerStub::RemovePlayerOnSocketClosedThreadProc(
Socket* socket = pNetworkPlayer->GetSocket();
if (socket != NULL) {
if (socket != nullptr) {
// printf("Waiting for socket closed event\n");
socket->m_socketClosedEvent->WaitForSignal(INFINITE);
// printf("Socket closed event has fired\n");
// 4J Stu - Clear our reference to this socket
pNetworkPlayer->SetSocket(NULL);
pNetworkPlayer->SetSocket(nullptr);
delete socket;
}
@ -404,7 +404,7 @@ void CPlatformNetworkManagerStub::SystemFlagReset() {
void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer,
int index) {
if ((index < 0) || (index >= m_flagIndexSize)) return;
if (pNetworkPlayer == NULL) return;
if (pNetworkPlayer == nullptr) return;
for (unsigned int i = 0; i < m_playerFlags.size(); i++) {
if (pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer)) {
@ -419,7 +419,7 @@ void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer,
bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer* pNetworkPlayer,
int index) {
if ((index < 0) || (index >= m_flagIndexSize)) return false;
if (pNetworkPlayer == NULL) {
if (pNetworkPlayer == nullptr) {
return false;
}
@ -497,7 +497,7 @@ void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh() {
m_searchResultsCount[i] = 0;
m_lastSearchStartTime[i] = 0;
delete m_pSearchResults[i];
m_pSearchResults[i] = NULL;
m_pSearchResults[i] = nullptr;
}
}
@ -524,7 +524,7 @@ void CPlatformNetworkManagerStub::removeNetworkPlayer(
INetworkPlayer* CPlatformNetworkManagerStub::getNetworkPlayer(
IQNetPlayer* pQNetPlayer) {
return pQNetPlayer ? (INetworkPlayer*)(pQNetPlayer->GetCustomDataValue())
: NULL;
: nullptr;
}
INetworkPlayer* CPlatformNetworkManagerStub::GetLocalPlayerByUserIndex(

View file

@ -100,7 +100,7 @@ private:
public:
virtual void UpdateAndSetGameSessionData(
INetworkPlayer* pNetworkPlayerLeaving = NULL);
INetworkPlayer* pNetworkPlayerLeaving = nullptr);
private:
// TODO 4J Stu - Do we need to be able to have more than one of these?

View file

@ -29,13 +29,13 @@ public:
bool hasPartyMember;
FriendSessionInfo() {
displayLabel = NULL;
displayLabel = nullptr;
displayLabelLength = 0;
displayLabelViewableStartIndex = 0;
hasPartyMember = false;
}
~FriendSessionInfo() {
if (displayLabel != NULL) delete displayLabel;
if (displayLabel != nullptr) delete displayLabel;
}
};

View file

@ -163,7 +163,7 @@ int CTelemetryManager::GetMode(int userId)
Minecraft *pMinecraft = Minecraft::GetInstance();
if( pMinecraft->localplayers[userId] != NULL && pMinecraft->localplayers[userId]->level != NULL && pMinecraft->localplayers[userId]->level->getLevelData() != NULL )
if( pMinecraft->localplayers[userId] != nullptr && pMinecraft->localplayers[userId]->level != nullptr && pMinecraft->localplayers[userId]->level->getLevelData() != nullptr )
{
GameType *gameType = pMinecraft->localplayers[userId]->level->getLevelData()->getGameType();
@ -235,7 +235,7 @@ int CTelemetryManager::GetSubLevelId(int userId)
Minecraft *pMinecraft = Minecraft::GetInstance();
if(pMinecraft->localplayers[userId] != NULL)
if(pMinecraft->localplayers[userId] != nullptr)
{
switch(pMinecraft->localplayers[userId]->dimension)
{

View file

@ -62,8 +62,8 @@ void ChangeStateConstraint::tick(int iPad) {
Minecraft* pMinecraft = Minecraft::GetInstance();
std::shared_ptr<MultiplayerLocalPlayer> player =
minecraft->localplayers[iPad];
if (player != NULL && player->connection &&
player->connection->getNetworkPlayer() != NULL) {
if (player != nullptr && player->connection &&
player->connection->getNetworkPlayer() != nullptr) {
player->connection->send(
std::shared_ptr<PlayerInfoPacket>(new PlayerInfoPacket(
player->connection->getNetworkPlayer()
@ -94,7 +94,7 @@ void ChangeStateConstraint::tick(int iPad) {
m_tutorial->changeTutorialState(m_targetState);
if (m_changeGameMode) {
if (minecraft->localgameModes[iPad] != NULL) {
if (minecraft->localgameModes[iPad] != nullptr) {
m_changedFromGameMode =
minecraft->localplayers[iPad]->abilities.instabuild
? GameType::CREATIVE
@ -113,8 +113,8 @@ void ChangeStateConstraint::tick(int iPad) {
Minecraft* pMinecraft = Minecraft::GetInstance();
std::shared_ptr<MultiplayerLocalPlayer> player =
minecraft->localplayers[iPad];
if (player != NULL && player->connection &&
player->connection->getNetworkPlayer() != NULL) {
if (player != nullptr && player->connection &&
player->connection->getNetworkPlayer() != nullptr) {
player->connection->send(
std::shared_ptr<PlayerInfoPacket>(
new PlayerInfoPacket(
@ -144,8 +144,8 @@ void ChangeStateConstraint::tick(int iPad) {
Minecraft* pMinecraft = Minecraft::GetInstance();
std::shared_ptr<MultiplayerLocalPlayer> player =
minecraft->localplayers[iPad];
if (player != NULL && player->connection &&
player->connection->getNetworkPlayer() != NULL) {
if (player != nullptr && player->connection &&
player->connection->getNetworkPlayer() != nullptr) {
player->connection->send(
std::shared_ptr<PlayerInfoPacket>(new PlayerInfoPacket(
player->connection->getNetworkPlayer()

View file

@ -37,7 +37,7 @@ public:
std::size_t sourceStatesCount, double x0, double y0,
double z0, double x1, double y1, double z1,
bool contains = true, bool changeGameMode = false,
GameType* targetGameMode = NULL);
GameType* targetGameMode = nullptr);
~ChangeStateConstraint();
virtual void tick(int iPad);

View file

@ -14,7 +14,7 @@ ChoiceTask::ChoiceTask(
int iCancelMapping /*= 0*/,
eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/,
ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
: TutorialTask(tutorial, descriptionId, false, NULL, true, false, false) {
: TutorialTask(tutorial, descriptionId, false, nullptr, true, false, false) {
if (requiresUserInput == true) {
constraints.push_back(new InputConstraint(iConfirmMapping));
constraints.push_back(new InputConstraint(iCancelMapping));

View file

@ -6,7 +6,7 @@ CompleteUsingItemTask::CompleteUsingItemTask(Tutorial* tutorial,
int descriptionId, int itemIds[],
unsigned int itemIdsLength,
bool enablePreCompletion)
: TutorialTask(tutorial, descriptionId, enablePreCompletion, NULL) {
: TutorialTask(tutorial, descriptionId, enablePreCompletion, nullptr) {
m_iValidItemsA = new int[itemIdsLength];
for (int i = 0; i < itemIdsLength; i++) {
m_iValidItemsA[i] = itemIds[i];

View file

@ -14,7 +14,7 @@ ControllerTask::ControllerTask(Tutorial* tutorial, int descriptionId,
int iCompletionMaskACount,
int iSouthpawMappings[],
unsigned int uiSouthpawMappingsCount)
: TutorialTask(tutorial, descriptionId, enablePreCompletion, NULL,
: TutorialTask(tutorial, descriptionId, enablePreCompletion, nullptr,
showMinimumTime) {
for (unsigned int i = 0; i < mappingsLength; ++i) {
constraints.push_back(new InputConstraint(mappings[i]));

View file

@ -23,8 +23,8 @@ public:
ControllerTask(Tutorial* tutorial, int descriptionId,
bool enablePreCompletion, bool showMinimumTime,
int mappings[], unsigned int mappingsLength,
int iCompletionMaskA[] = NULL, int iCompletionMaskACount = 0,
int iSouthpawMappings[] = NULL,
int iCompletionMaskA[] = nullptr, int iCompletionMaskACount = 0,
int iSouthpawMappings[] = nullptr,
unsigned int uiSouthpawMappingsCount = 0);
~ControllerTask();
virtual bool isCompleted();

View file

@ -4,7 +4,7 @@
CraftTask::CraftTask(int itemId, int auxValue, int quantity, Tutorial* tutorial,
int descriptionId, bool enablePreCompletion /*= true*/,
std::vector<TutorialConstraint*>* inConstraints /*= NULL*/,
std::vector<TutorialConstraint*>* inConstraints /*= nullptr*/,
bool bShowMinimumTime /*=false*/,
bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/)
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints,
@ -21,7 +21,7 @@ CraftTask::CraftTask(int itemId, int auxValue, int quantity, Tutorial* tutorial,
CraftTask::CraftTask(int* items, int* auxValues, int numItems, int quantity,
Tutorial* tutorial, int descriptionId,
bool enablePreCompletion /*= true*/,
std::vector<TutorialConstraint*>* inConstraints /*= NULL*/,
std::vector<TutorialConstraint*>* inConstraints /*= nullptr*/,
bool bShowMinimumTime /*=false*/,
bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/)
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints,

View file

@ -5,13 +5,13 @@ class CraftTask : public TutorialTask {
public:
CraftTask(int itemId, int auxValue, int quantity, Tutorial* tutorial,
int descriptionId, bool enablePreCompletion = true,
std::vector<TutorialConstraint*>* inConstraints = NULL,
std::vector<TutorialConstraint*>* inConstraints = nullptr,
bool bShowMinimumTime = false, bool bAllowFade = true,
bool m_bTaskReminders = true);
CraftTask(int* items, int* auxValues, int numItems, int quantity,
Tutorial* tutorial, int descriptionId,
bool enablePreCompletion = true,
std::vector<TutorialConstraint*>* inConstraints = NULL,
std::vector<TutorialConstraint*>* inConstraints = nullptr,
bool bShowMinimumTime = false, bool bAllowFade = true,
bool m_bTaskReminders = true);

View file

@ -21,7 +21,7 @@ DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial* tutorial,
int DiggerItemHint::startDestroyBlock(std::shared_ptr<ItemInstance> item,
Tile* tile) {
if (item != NULL) {
if (item != nullptr) {
bool itemFound = false;
for (unsigned int i = 0; i < m_iItemsCount; i++) {
if (item->id == m_iItems[i]) {
@ -42,7 +42,7 @@ int DiggerItemHint::startDestroyBlock(std::shared_ptr<ItemInstance> item,
int DiggerItemHint::attack(std::shared_ptr<ItemInstance> item,
std::shared_ptr<Entity> entity) {
if (item != NULL) {
if (item != nullptr) {
bool itemFound = false;
for (unsigned int i = 0; i < m_iItemsCount; i++) {
if (item->id == m_iItems[i]) {

View file

@ -7,7 +7,7 @@ EffectChangedTask::EffectChangedTask(Tutorial* tutorial, int descriptionId,
bool enablePreCompletion,
bool bShowMinimumTime, bool bAllowFade,
bool bTaskReminders)
: TutorialTask(tutorial, descriptionId, enablePreCompletion, NULL,
: TutorialTask(tutorial, descriptionId, enablePreCompletion, nullptr,
bShowMinimumTime, bAllowFade, bTaskReminders) {
m_effect = effect;
m_apply = apply;

View file

@ -267,10 +267,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
new CraftTask(Tile::torch_Id, -1, 1, this,
IDS_TUTORIAL_TASK_CREATE_TORCH));
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area =
app.getGameRuleDefinitions()->getNamedArea(L"tutorialArea");
if (area != NULL) {
if (area != nullptr) {
std::vector<TutorialConstraint*>* areaConstraints =
new std::vector<TutorialConstraint*>();
areaConstraints->push_back(new AreaConstraint(
@ -483,10 +483,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* MINECART
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area =
app.getGameRuleDefinitions()->getNamedArea(L"minecartArea");
if (area != NULL) {
if (area != nullptr) {
addHint(e_Tutorial_State_Gameplay,
new AreaHint(e_Tutorial_Hint_Always_On, this,
e_Tutorial_State_Gameplay,
@ -502,9 +502,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* BOAT
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"boatArea");
if (area != NULL) {
if (area != nullptr) {
addHint(e_Tutorial_State_Gameplay,
new AreaHint(e_Tutorial_Hint_Always_On, this,
e_Tutorial_State_Gameplay,
@ -520,9 +520,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* FISHING
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"fishingArea");
if (area != NULL) {
if (area != nullptr) {
addHint(e_Tutorial_State_Gameplay,
new AreaHint(e_Tutorial_Hint_Always_On, this,
e_Tutorial_State_Gameplay,
@ -538,10 +538,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* PISTON - SELF-REPAIRING BRIDGE
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area =
app.getGameRuleDefinitions()->getNamedArea(L"pistonBridgeArea");
if (area != NULL) {
if (area != nullptr) {
addHint(
e_Tutorial_State_Gameplay,
new AreaHint(e_Tutorial_Hint_Always_On, this,
@ -558,9 +558,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* PISTON - PISTON AND REDSTONE CIRCUITS
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"pistonArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State redstoneAndPistonStates[] = {
e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
@ -614,9 +614,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* PORTAL
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"portalArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State portalStates[] = {e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
this, e_Tutorial_State_Portal, portalStates, 1, area->x0,
@ -659,10 +659,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* CREATIVE
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area =
app.getGameRuleDefinitions()->getNamedArea(L"creativeArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State creativeStates[] = {e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
this, e_Tutorial_State_CreativeMode, creativeStates, 1,
@ -701,7 +701,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
AABB* exitArea =
app.getGameRuleDefinitions()->getNamedArea(L"creativeExitArea");
if (exitArea != NULL) {
if (exitArea != nullptr) {
std::vector<TutorialConstraint*>* creativeExitAreaConstraints =
new std::vector<TutorialConstraint*>();
creativeExitAreaConstraints->push_back(new AreaConstraint(
@ -737,9 +737,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* BREWING
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"brewingArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State brewingStates[] = {e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
this, e_Tutorial_State_Brewing, brewingStates, 1, area->x0,
@ -800,10 +800,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* ENCHANTING
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area =
app.getGameRuleDefinitions()->getNamedArea(L"enchantingArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
this, e_Tutorial_State_Enchanting, enchantingStates, 1,
@ -852,9 +852,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* ANVIL
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"anvilArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
this, e_Tutorial_State_Anvil, enchantingStates, 1, area->x0,
@ -902,9 +902,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* TRADING
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"tradingArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State tradingStates[] = {e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
this, e_Tutorial_State_Trading, tradingStates, 1, area->x0,
@ -950,10 +950,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* FIREWORKS
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area =
app.getGameRuleDefinitions()->getNamedArea(L"fireworksArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State fireworkStates[] = {e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
this, e_Tutorial_State_Fireworks, fireworkStates, 1, area->x0,
@ -989,9 +989,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* BEACON
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"beaconArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State beaconStates[] = {e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
this, e_Tutorial_State_Beacon, beaconStates, 1, area->x0,
@ -1027,9 +1027,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* HOPPER
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"hopperArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State hopperStates[] = {e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
this, e_Tutorial_State_Hopper, hopperStates, 1, area->x0,
@ -1077,10 +1077,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* ENDERCHEST
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area =
app.getGameRuleDefinitions()->getNamedArea(L"enderchestArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
this, e_Tutorial_State_Enderchests, enchantingStates, 1,
@ -1116,9 +1116,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* FARMING
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"farmingArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State farmingStates[] = {e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
this, e_Tutorial_State_Farming, farmingStates, 1, area->x0,
@ -1184,10 +1184,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* BREEDING
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area =
app.getGameRuleDefinitions()->getNamedArea(L"breedingArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State breedingStates[] = {e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
this, e_Tutorial_State_Breeding, breedingStates, 1, area->x0,
@ -1247,9 +1247,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
* SNOW AND IRON GOLEM
*
*/
if (app.getGameRuleDefinitions() != NULL) {
if (app.getGameRuleDefinitions() != nullptr) {
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"golemArea");
if (area != NULL) {
if (area != nullptr) {
eTutorial_State golemStates[] = {e_Tutorial_State_Gameplay};
AddGlobalConstraint(new ChangeStateConstraint(
this, e_Tutorial_State_Golem, golemStates, 1, area->x0,

View file

@ -5,7 +5,7 @@
FullTutorialActiveTask::FullTutorialActiveTask(
Tutorial* tutorial,
eTutorial_CompletionAction completeAction /*= e_Tutorial_Completion_None*/)
: TutorialTask(tutorial, -1, false, NULL, false, false, false) {
: TutorialTask(tutorial, -1, false, nullptr, false, false, false) {
m_completeAction = completeAction;
}

View file

@ -12,7 +12,7 @@ InfoTask::InfoTask(
Tutorial* tutorial, int descriptionId, int promptId /*= -1*/,
bool requiresUserInput /*= false*/, int iMapping /*= 0*/,
ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
: TutorialTask(tutorial, descriptionId, false, NULL, true, false, false) {
: TutorialTask(tutorial, descriptionId, false, nullptr, true, false, false) {
if (requiresUserInput == true) {
constraints.push_back(new InputConstraint(iMapping));
}

View file

@ -9,7 +9,7 @@ public:
PickupTask(int itemId, unsigned int quantity, int auxValue,
Tutorial* tutorial, int descriptionId,
bool enablePreCompletion = true,
std::vector<TutorialConstraint*>* inConstraints = NULL,
std::vector<TutorialConstraint*>* inConstraints = nullptr,
bool bShowMinimumTime = false, bool bAllowFade = true,
bool m_bTaskReminders = true)
: TutorialTask(tutorial, descriptionId, enablePreCompletion,

View file

@ -9,7 +9,7 @@ ProcedureCompoundTask::~ProcedureCompoundTask() {
}
void ProcedureCompoundTask::AddTask(TutorialTask* task) {
if (task != NULL) {
if (task != nullptr) {
m_taskSequence.push_back(task);
}
}

View file

@ -8,7 +8,7 @@
class ProcedureCompoundTask : public TutorialTask {
public:
ProcedureCompoundTask(Tutorial* tutorial)
: TutorialTask(tutorial, -1, false, NULL, false, true, false) {}
: TutorialTask(tutorial, -1, false, nullptr, false, true, false) {}
~ProcedureCompoundTask();

View file

@ -18,7 +18,7 @@ private:
public:
ProgressFlagTask(char* flags, char mask, EProgressFlagType type,
Tutorial* tutorial)
: TutorialTask(tutorial, -1, false, NULL),
: TutorialTask(tutorial, -1, false, nullptr),
flags(flags),
m_mask(mask),
m_type(type) {}

View file

@ -12,7 +12,7 @@ protected:
public:
RideEntityTask(const int eTYPE, Tutorial* tutorial, int descriptionId,
bool enablePreCompletion = false,
std::vector<TutorialConstraint*>* inConstraints = NULL,
std::vector<TutorialConstraint*>* inConstraints = nullptr,
bool bShowMinimumTime = false, bool bAllowFade = true,
bool bTaskReminders = true);

View file

@ -7,7 +7,7 @@
StatTask::StatTask(Tutorial* tutorial, int descriptionId,
bool enablePreCompletion, Stat* stat, int variance /*= 1*/)
: TutorialTask(tutorial, descriptionId, enablePreCompletion, NULL) {
: TutorialTask(tutorial, descriptionId, enablePreCompletion, nullptr) {
this->stat = stat;
Minecraft* minecraft = Minecraft::GetInstance();

View file

@ -10,7 +10,7 @@ private:
public:
StateChangeTask(eTutorial_State state, Tutorial* tutorial,
int descriptionId = -1, bool enablePreCompletion = false,
std::vector<TutorialConstraint*>* inConstraints = NULL,
std::vector<TutorialConstraint*>* inConstraints = nullptr,
bool bShowMinimumTime = false, bool bAllowFade = true,
bool m_bTaskReminders = true)
: TutorialTask(tutorial, descriptionId, enablePreCompletion,

View file

@ -16,7 +16,7 @@ TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial* tutorial, int items[],
}
bool TakeItemHint::onTake(std::shared_ptr<ItemInstance> item) {
if (item != NULL) {
if (item != nullptr) {
bool itemFound = false;
for (unsigned int i = 0; i < m_iItemsCount; i++) {
if (item->id == m_iItems[i]) {

View file

@ -30,7 +30,7 @@ int Tutorial::m_iTutorialConstraintDelayRemoveTicks = 15;
int Tutorial::m_iTutorialFreezeTimeValue = 8000;
bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails* other) {
if (other == NULL) return false;
if (other == nullptr) return false;
bool textTheSame = (m_messageId == other->m_messageId) &&
(m_messageString.compare(other->m_messageString) == 0);
@ -362,7 +362,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) {
m_hintDisplayed = false;
m_freezeTime = false;
m_timeFrozen = false;
m_UIScene = NULL;
m_UIScene = nullptr;
m_allowShow = true;
m_bHasTickedOnce = false;
m_firstTickTime = 0;
@ -370,7 +370,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) {
// 4jcraft added, not initialized
m_bSceneIsSplitscreen = false;
m_lastMessage = NULL;
m_lastMessage = nullptr;
lastMessageTime = 0;
m_iTaskReminders = 0;
@ -380,8 +380,8 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) {
m_hasStateChanged = false;
for (unsigned int i = 0; i < e_Tutorial_State_Max; ++i) {
currentTask[i] = NULL;
currentFailedConstraint[i] = NULL;
currentTask[i] = nullptr;
currentFailedConstraint[i] = nullptr;
}
// DEFAULT TASKS THAT ALL TUTORIALS SHARE
@ -1683,7 +1683,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) {
if (isFullTutorial)
addTask(e_Tutorial_State_Horse,
new RideEntityTask(eTYPE_HORSE, this,
IDS_TUTORIAL_TASK_HORSE_RIDE, true, NULL,
IDS_TUTORIAL_TASK_HORSE_RIDE, true, nullptr,
false, false, false));
else
addTask(e_Tutorial_State_Horse,
@ -1947,8 +1947,8 @@ Tutorial::~Tutorial() {
delete (*it);
}
currentTask[i] = NULL;
currentFailedConstraint[i] = NULL;
currentTask[i] = nullptr;
currentFailedConstraint[i] = nullptr;
}
}
@ -2115,7 +2115,7 @@ void Tutorial::tick() {
}
if (!m_allowShow) {
if (currentTask[m_CurrentState] != NULL &&
if (currentTask[m_CurrentState] != nullptr &&
(!currentTask[m_CurrentState]->AllowFade() ||
(lastMessageTime + m_iTutorialDisplayMessageTime) >
GetTickCount())) {
@ -2136,7 +2136,7 @@ void Tutorial::tick() {
}
if (ui.IsPauseMenuDisplayed(m_iPad)) {
if (currentTask[m_CurrentState] != NULL &&
if (currentTask[m_CurrentState] != nullptr &&
(!currentTask[m_CurrentState]->AllowFade() ||
(lastMessageTime + m_iTutorialDisplayMessageTime) >
GetTickCount())) {
@ -2186,14 +2186,14 @@ void Tutorial::tick() {
// Check constraints
// Only need to update these if we aren't already failing something
if (!m_allTutorialsComplete &&
(currentFailedConstraint[m_CurrentState] == NULL ||
(currentFailedConstraint[m_CurrentState] == nullptr ||
currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(
m_iPad))) {
if (currentFailedConstraint[m_CurrentState] != NULL &&
if (currentFailedConstraint[m_CurrentState] != nullptr &&
currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(
m_iPad)) {
constraintChanged = true;
currentFailedConstraint[m_CurrentState] = NULL;
currentFailedConstraint[m_CurrentState] = nullptr;
}
for (auto it = constraints[m_CurrentState].begin();
it < constraints[m_CurrentState].end(); ++it) {
@ -2207,7 +2207,7 @@ void Tutorial::tick() {
}
if (!m_allTutorialsComplete &&
currentFailedConstraint[m_CurrentState] == NULL) {
currentFailedConstraint[m_CurrentState] == nullptr) {
// Update tasks
bool isCurrentTask = true;
auto it = activeTasks[m_CurrentState].begin();
@ -2225,7 +2225,7 @@ void Tutorial::tick() {
task->getCompletionAction();
it = activeTasks[m_CurrentState].erase(it);
delete task;
task = NULL;
task = nullptr;
if (activeTasks[m_CurrentState].size() > 0) {
switch (compAction) {
@ -2297,20 +2297,20 @@ void Tutorial::tick() {
} else {
setStateCompleted(m_CurrentState);
currentTask[m_CurrentState] = NULL;
currentTask[m_CurrentState] = nullptr;
}
taskChanged = true;
// If we can complete this early, check if we can complete
// it right now
if (currentTask[m_CurrentState] != NULL &&
if (currentTask[m_CurrentState] != nullptr &&
currentTask[m_CurrentState]->isPreCompletionEnabled()) {
isCurrentTask = true;
}
} else {
++it;
}
if (task != NULL && task->ShowMinimumTime() &&
if (task != nullptr && task->ShowMinimumTime() &&
task->hasBeenActivated() &&
(lastMessageTime + m_iTutorialMinimumDisplayMessageTime) <
GetTickCount()) {
@ -2331,7 +2331,7 @@ void Tutorial::tick() {
}
}
if (currentTask[m_CurrentState] == NULL &&
if (currentTask[m_CurrentState] == nullptr &&
activeTasks[m_CurrentState].size() > 0) {
currentTask[m_CurrentState] = activeTasks[m_CurrentState][0];
currentTask[m_CurrentState]->setAsCurrentTask();
@ -2355,19 +2355,19 @@ void Tutorial::tick() {
}
if (constraintChanged || taskChanged || m_hasStateChanged ||
(currentFailedConstraint[m_CurrentState] == NULL &&
currentTask[m_CurrentState] != NULL &&
(m_lastMessage == NULL ||
(currentFailedConstraint[m_CurrentState] == nullptr &&
currentTask[m_CurrentState] != nullptr &&
(m_lastMessage == nullptr ||
currentTask[m_CurrentState]->getDescriptionId() !=
m_lastMessage->m_messageId) &&
!m_hintDisplayed)) {
if (currentFailedConstraint[m_CurrentState] != NULL) {
if (currentFailedConstraint[m_CurrentState] != nullptr) {
PopupMessageDetails* message = new PopupMessageDetails();
message->m_messageId =
currentFailedConstraint[m_CurrentState]->getDescriptionId();
message->m_allowFade = false;
setMessage(message);
} else if (currentTask[m_CurrentState] != NULL) {
} else if (currentTask[m_CurrentState] != nullptr) {
PopupMessageDetails* message = new PopupMessageDetails();
message->m_messageId =
currentTask[m_CurrentState]->getDescriptionId();
@ -2377,7 +2377,7 @@ void Tutorial::tick() {
currentTask[m_CurrentState]->TaskReminders() ? m_iTaskReminders = 1
: m_iTaskReminders = 0;
} else {
setMessage(NULL);
setMessage(nullptr);
}
}
@ -2386,8 +2386,8 @@ void Tutorial::tick() {
m_hintDisplayed = false;
}
if (currentFailedConstraint[m_CurrentState] == NULL &&
currentTask[m_CurrentState] != NULL && (m_iTaskReminders != 0) &&
if (currentFailedConstraint[m_CurrentState] == nullptr &&
currentTask[m_CurrentState] != nullptr && (m_iTaskReminders != 0) &&
(lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime)) <
GetTickCount()) {
// Reminder
@ -2413,7 +2413,7 @@ void Tutorial::tick() {
}
bool Tutorial::setMessage(PopupMessageDetails* message) {
if (message != NULL && !message->m_forceDisplay &&
if (message != nullptr && !message->m_forceDisplay &&
m_lastMessageState == m_CurrentState &&
message->isSameContent(m_lastMessage) &&
(!message->m_isReminder ||
@ -2423,7 +2423,7 @@ bool Tutorial::setMessage(PopupMessageDetails* message) {
return false;
}
if (message != NULL &&
if (message != nullptr &&
(message->m_messageId > 0 || !message->m_messageString.empty())) {
m_lastMessageState = m_CurrentState;
@ -2434,7 +2434,7 @@ bool Tutorial::setMessage(PopupMessageDetails* message) {
text = message->m_messageString;
} else {
auto it = messages.find(message->m_messageId);
if (it != messages.end() && it->second != NULL) {
if (it != messages.end() && it->second != nullptr) {
TutorialMessage* messageString = it->second;
text = std::wstring(messageString->getMessageForDisplay());
@ -2458,7 +2458,7 @@ bool Tutorial::setMessage(PopupMessageDetails* message) {
text.append(message->m_promptString);
} else if (message->m_promptId >= 0) {
auto it = messages.find(message->m_promptId);
if (it != messages.end() && it->second != NULL) {
if (it != messages.end() && it->second != nullptr) {
TutorialMessage* prompt = it->second;
text.append(prompt->getMessageForDisplay());
}
@ -2484,7 +2484,7 @@ bool Tutorial::setMessage(PopupMessageDetails* message) {
} else {
ui.SetTutorialDescription(m_iPad, &popupInfo);
}
} else if ((m_lastMessage != NULL &&
} else if ((m_lastMessage != nullptr &&
m_lastMessage->m_messageId !=
-1)) //&& (lastMessageTime + m_iTutorialReminderTime ) >
// GetTickCount() )
@ -2496,7 +2496,7 @@ bool Tutorial::setMessage(PopupMessageDetails* message) {
ui.SetTutorialDescription(m_iPad, &popupInfo);
}
if (m_lastMessage != NULL) delete m_lastMessage;
if (m_lastMessage != nullptr) delete m_lastMessage;
m_lastMessage = message;
return true;
@ -2511,7 +2511,7 @@ bool Tutorial::setMessage(TutorialHint* hint, PopupMessageDetails* message) {
bool messageShown = false;
std::uint32_t time = GetTickCount();
if (message != NULL && (message->m_forceDisplay || hintsOn) &&
if (message != nullptr && (message->m_forceDisplay || hintsOn) &&
(!message->m_delay ||
((m_hintDisplayed &&
(time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime) ||
@ -2522,7 +2522,7 @@ bool Tutorial::setMessage(TutorialHint* hint, PopupMessageDetails* message) {
if (messageShown) {
m_lastHintDisplayedTime = time;
m_hintDisplayed = true;
if (hint != NULL) setHintCompleted(hint);
if (hint != nullptr) setHintCompleted(hint);
}
}
return messageShown;
@ -2543,7 +2543,7 @@ void Tutorial::showTutorialPopup(bool show) {
m_allowShow = show;
if (!show) {
if (currentTask[m_CurrentState] != NULL &&
if (currentTask[m_CurrentState] != nullptr &&
(!currentTask[m_CurrentState]->AllowFade() ||
(lastMessageTime + m_iTutorialDisplayMessageTime) >
GetTickCount())) {
@ -2660,7 +2660,7 @@ void Tutorial::handleUIInput(int iAction) {
// TutorialTask *task = *it;
// task->handleUIInput(iAction);
// }
if (currentTask[m_CurrentState] != NULL)
if (currentTask[m_CurrentState] != nullptr)
currentTask[m_CurrentState]->handleUIInput(iAction);
}
@ -2719,7 +2719,7 @@ void Tutorial::onSelectedItemChanged(std::shared_ptr<ItemInstance> item) {
// the selected item Menus and states like riding in a minecart will NOT
// allow this
if (isSelectedItemState()) {
if (item != NULL) {
if (item != nullptr) {
switch (item->id) {
case Item::fishingRod_Id:
changeTutorialState(e_Tutorial_State_Fishing);
@ -2871,7 +2871,7 @@ void Tutorial::AddConstraint(TutorialConstraint* c) {
void Tutorial::RemoveConstraint(TutorialConstraint* c,
bool delayedRemove /*= false*/) {
if (currentFailedConstraint[m_CurrentState] == c)
currentFailedConstraint[m_CurrentState] = NULL;
currentFailedConstraint[m_CurrentState] = nullptr;
if (c->getQueuedForRemoval()) {
// If it is already queued for removal, remove it on the next tick
@ -2934,12 +2934,12 @@ void Tutorial::addMessage(
}
void Tutorial::changeTutorialState(eTutorial_State newState,
UIScene* scene /*= NULL*/)
UIScene* scene /*= nullptr*/)
{
if (newState == m_CurrentState) {
// If clearing the scene, make sure that the tutorial popup has its
// reference to this scene removed
if (scene == NULL) {
if (scene == nullptr) {
ui.RemoveInteractSceneReference(m_iPad, m_UIScene);
}
m_UIScene = scene;
@ -2960,7 +2960,7 @@ void Tutorial::changeTutorialState(eTutorial_State newState,
// The action that caused the change of state may also have completed
// the current task
if (currentTask[m_CurrentState] != NULL &&
if (currentTask[m_CurrentState] != nullptr &&
currentTask[m_CurrentState]->isCompleted()) {
activeTasks[m_CurrentState].erase(
find(activeTasks[m_CurrentState].begin(),
@ -2971,20 +2971,20 @@ void Tutorial::changeTutorialState(eTutorial_State newState,
currentTask[m_CurrentState] = activeTasks[m_CurrentState][0];
currentTask[m_CurrentState]->setAsCurrentTask();
} else {
currentTask[m_CurrentState] = NULL;
currentTask[m_CurrentState] = nullptr;
}
}
if (currentTask[m_CurrentState] != NULL) {
if (currentTask[m_CurrentState] != nullptr) {
currentTask[m_CurrentState]->onStateChange(newState);
}
// Make sure that the current message is cleared
setMessage(NULL);
setMessage(nullptr);
// If clearing the scene, make sure that the tutorial popup has its
// reference to this scene removed
if (scene == NULL) {
if (scene == nullptr) {
ui.RemoveInteractSceneReference(m_iPad, m_UIScene);
}
m_UIScene = scene;

View file

@ -135,7 +135,7 @@ public:
void setCompleted(int completableId);
bool getCompleted(int completableId);
void changeTutorialState(eTutorial_State newState, UIScene* scene = NULL);
void changeTutorialState(eTutorial_State newState, UIScene* scene = nullptr);
bool isSelectedItemState();
bool setMessage(PopupMessageDetails* message);

View file

@ -15,7 +15,7 @@ TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial* tutorial,
m_descriptionId(descriptionId),
m_type(type),
m_counter(0),
m_lastTile(NULL),
m_lastTile(nullptr),
m_hintNeeded(true),
m_allowFade(allowFade) {
tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients);

View file

@ -14,7 +14,7 @@ TutorialMode::TutorialMode(int iPad, Minecraft* minecraft,
: MultiPlayerGameMode(minecraft, connection), m_iPad(iPad) {}
TutorialMode::~TutorialMode() {
if (tutorial != NULL) delete tutorial;
if (tutorial != nullptr) delete tutorial;
}
void TutorialMode::startDestroyBlock(int x, int y, int z, int face) {
@ -33,13 +33,13 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face) {
}
std::shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem();
int damageBefore;
if (item != NULL) {
if (item != nullptr) {
damageBefore = item->getDamageValue();
}
bool changed = MultiPlayerGameMode::destroyBlock(x, y, z, face);
if (!tutorial->m_allTutorialsComplete) {
if (item != NULL && item->isDamageableItem()) {
if (item != nullptr && item->isDamageableItem()) {
int max = item->getMaxDamage();
int damageNow = item->getDamageValue();
@ -78,7 +78,7 @@ bool TutorialMode::useItemOn(std::shared_ptr<Player> player, Level* level,
tutorial->useItemOn(level, item, x, y, z, bTestUseOnly);
if (!bTestUseOnly) {
if (item != NULL) {
if (item != nullptr) {
haveItem = true;
itemCount = item->count;
}

View file

@ -22,7 +22,7 @@ public:
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
std::shared_ptr<ItemInstance> item, int x, int y,
int z, int face, Vec3* hit,
bool bTestUseOnly = false, bool* pbUsedItem = NULL);
bool bTestUseOnly = false, bool* pbUsedItem = nullptr);
virtual void attack(std::shared_ptr<Player> player,
std::shared_ptr<Entity> entity);

View file

@ -19,7 +19,7 @@ TutorialTask::TutorialTask(Tutorial* tutorial, int descriptionId,
m_bTaskReminders(bTaskReminders),
m_bShowMinimumTime(bShowMinimumTime),
m_bShownForMinimumTime(false) {
if (inConstraints != NULL) {
if (inConstraints != nullptr) {
for (auto it = inConstraints->begin(); it < inConstraints->end();
++it) {
TutorialConstraint* constraint = *it;

View file

@ -13,7 +13,7 @@ private:
public:
UseItemTask(const int itemId, Tutorial* tutorial, int descriptionId,
bool enablePreCompletion = false,
std::vector<TutorialConstraint*>* inConstraints = NULL,
std::vector<TutorialConstraint*>* inConstraints = nullptr,
bool bShowMinimumTime = false, bool bAllowFade = true,
bool bTaskReminders = true);
virtual bool isCompleted();

View file

@ -17,12 +17,12 @@ private:
public:
UseTileTask(const int tileId, int x, int y, int z, Tutorial* tutorial,
int descriptionId, bool enablePreCompletion = false,
std::vector<TutorialConstraint*>* inConstraints = NULL,
std::vector<TutorialConstraint*>* inConstraints = nullptr,
bool bShowMinimumTime = false, bool bAllowFade = true,
bool bTaskReminders = true);
UseTileTask(const int tileId, Tutorial* tutorial, int descriptionId,
bool enablePreCompletion = false,
std::vector<TutorialConstraint*>* inConstraints = NULL,
std::vector<TutorialConstraint*>* inConstraints = nullptr,
bool bShowMinimumTime = false, bool bAllowFade = true,
bool bTaskReminders = true);
virtual bool isCompleted();

View file

@ -15,13 +15,13 @@ bool XuiCraftingTask::isCompleted() {
switch (m_type) {
case e_Crafting_SelectGroup:
if (craftScene != NULL &&
if (craftScene != nullptr &&
craftScene->getCurrentGroup() == m_group) {
completed = true;
}
break;
case e_Crafting_SelectItem:
if (craftScene != NULL && craftScene->isItemSelected(m_item)) {
if (craftScene != nullptr && craftScene->isItemSelected(m_item)) {
completed = true;
}
break;

View file

@ -13,7 +13,7 @@ public:
XuiCraftingTask(Tutorial* tutorial, int descriptionId,
Recipy::_eGroupType groupToSelect,
bool enablePreCompletion = false,
std::vector<TutorialConstraint*>* inConstraints = NULL,
std::vector<TutorialConstraint*>* inConstraints = nullptr,
bool bShowMinimumTime = false, bool bAllowFade = true,
bool m_bTaskReminders = true)
: TutorialTask(tutorial, descriptionId, enablePreCompletion,
@ -25,7 +25,7 @@ public:
// Select Item
XuiCraftingTask(Tutorial* tutorial, int descriptionId, int itemId,
bool enablePreCompletion = false,
std::vector<TutorialConstraint*>* inConstraints = NULL,
std::vector<TutorialConstraint*>* inConstraints = nullptr,
bool bShowMinimumTime = false, bool bAllowFade = true,
bool m_bTaskReminders = true)
: TutorialTask(tutorial, descriptionId, enablePreCompletion,

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