mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
Merge pull request #356 from MatthewBeshay/cleanup/nullptr-replacement
refactor: replace NULL with nullptr across C++ codebase
This commit is contained in:
commit
c8f59b4a99
|
|
@ -27,7 +27,7 @@ void TeleportCommand::execute(std::shared_ptr<CommandSender> source,
|
||||||
std::shared_ptr<ServerPlayer> destination =
|
std::shared_ptr<ServerPlayer> destination =
|
||||||
players->getPlayer(destinationID);
|
players->getPlayer(destinationID);
|
||||||
|
|
||||||
if (subject != NULL && destination != NULL &&
|
if (subject != nullptr && destination != nullptr &&
|
||||||
subject->level->dimension->id == destination->level->dimension->id &&
|
subject->level->dimension->id == destination->level->dimension->id &&
|
||||||
subject->isAlive()) {
|
subject->isAlive()) {
|
||||||
subject->ride(nullptr);
|
subject->ride(nullptr);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ void CreativeMode::adjustPlayer(std::shared_ptr<Player> player) {
|
||||||
enableCreativeForPlayer(player);
|
enableCreativeForPlayer(player);
|
||||||
|
|
||||||
for (int i = 0; i < 9; i++) {
|
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>(
|
player->inventory->items[i] = std::shared_ptr<ItemInstance>(
|
||||||
new ItemInstance(User::allowedTiles[i]));
|
new ItemInstance(User::allowedTiles[i]));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -61,7 +61,7 @@ bool CreativeMode::useItemOn(std::shared_ptr<Player> player, Level* level,
|
||||||
if (t > 0) {
|
if (t > 0) {
|
||||||
if (Tile::tiles[t]->use(level, x, y, z, player)) return true;
|
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 aux = item->getAuxValue();
|
||||||
int count = item->count;
|
int count = item->count;
|
||||||
bool success = item->useOn(player, level, x, y, z, face);
|
bool success = item->useOn(player, level, x, y, z, face);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ public:
|
||||||
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
|
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
|
||||||
std::shared_ptr<ItemInstance> item, int x, int y,
|
std::shared_ptr<ItemInstance> item, int x, int y,
|
||||||
int z, int face, bool bTestUseOnOnly = false,
|
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 startDestroyBlock(int x, int y, int z, int face);
|
||||||
virtual void continueDestroyBlock(int x, int y, int z, int face);
|
virtual void continueDestroyBlock(int x, int y, int z, int face);
|
||||||
virtual void stopDestroyBlock();
|
virtual void stopDestroyBlock();
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ void GameMode::initLevel(Level* level) {}
|
||||||
bool GameMode::destroyBlock(int x, int y, int z, int face) {
|
bool GameMode::destroyBlock(int x, int y, int z, int face) {
|
||||||
Level* level = minecraft->level;
|
Level* level = minecraft->level;
|
||||||
Tile* oldTile = Tile::tiles[level->getTile(x, y, z)];
|
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
|
// 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.
|
// 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();
|
level->getChunkAt(x, z)->recalcHeightmapOnly();
|
||||||
bool changed = level->setTile(x, y, z, 0);
|
bool changed = level->setTile(x, y, z, 0);
|
||||||
|
|
||||||
if (oldTile != NULL && changed) {
|
if (oldTile != nullptr && changed) {
|
||||||
oldTile->destroy(level, x, y, z, data);
|
oldTile->destroy(level, x, y, z, data);
|
||||||
}
|
}
|
||||||
return changed;
|
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);
|
// return item->useOn(player, level, x, y, z, face, bTestUseOnOnly);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public:
|
||||||
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
|
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
|
||||||
std::shared_ptr<ItemInstance> item, int x, int y,
|
std::shared_ptr<ItemInstance> item, int x, int y,
|
||||||
int z, int face, bool bTestUseOnOnly = false,
|
int z, int face, bool bTestUseOnOnly = false,
|
||||||
bool* pbUsedItem = NULL) = 0;
|
bool* pbUsedItem = nullptr) = 0;
|
||||||
|
|
||||||
virtual std::shared_ptr<Player> createPlayer(Level* level);
|
virtual std::shared_ptr<Player> createPlayer(Level* level);
|
||||||
virtual bool interact(std::shared_ptr<Player> player,
|
virtual bool interact(std::shared_ptr<Player> player,
|
||||||
|
|
@ -68,5 +68,5 @@ public:
|
||||||
// 4J Stu - Added for tutorial checks
|
// 4J Stu - Added for tutorial checks
|
||||||
virtual bool isInputAllowed(int mapping) { return true; }
|
virtual bool isInputAllowed(int mapping) { return true; }
|
||||||
virtual bool isTutorial() { return false; }
|
virtual bool isTutorial() { return false; }
|
||||||
virtual Tutorial* getTutorial() { return NULL; }
|
virtual Tutorial* getTutorial() { return nullptr; }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -155,8 +155,8 @@ void Options::init() {
|
||||||
keyMappings[12] = keyPickItem;
|
keyMappings[12] = keyPickItem;
|
||||||
keyMappings[13] = keyToggleFog;
|
keyMappings[13] = keyToggleFog;
|
||||||
|
|
||||||
minecraft = NULL;
|
minecraft = nullptr;
|
||||||
// optionsFile = NULL;
|
// optionsFile = nullptr;
|
||||||
|
|
||||||
difficulty = 2;
|
difficulty = 2;
|
||||||
hideGui = false;
|
hideGui = false;
|
||||||
|
|
@ -370,7 +370,7 @@ void Options::load() {
|
||||||
|
|
||||||
std::wstring line = L"";
|
std::wstring line = L"";
|
||||||
while ((line = br->readLine()) !=
|
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?
|
// between empty lines and a fail here?
|
||||||
{
|
{
|
||||||
// 4J - removed try/catch
|
// 4J - removed try/catch
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ SurvivalMode::SurvivalMode(Minecraft* minecraft) : GameMode(minecraft) {
|
||||||
destroyDelay = 0;
|
destroyDelay = 0;
|
||||||
|
|
||||||
if (ClientConstants::IS_DEMO_VERSION) {
|
if (ClientConstants::IS_DEMO_VERSION) {
|
||||||
if (dynamic_cast<DemoMode*>(this) == NULL) {
|
if (dynamic_cast<DemoMode*>(this) == nullptr) {
|
||||||
assert(false);
|
assert(false);
|
||||||
// throw new IllegalStateException("Invalid game mode");
|
// throw new IllegalStateException("Invalid game mode");
|
||||||
// // 4J - removed
|
// // 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();
|
std::shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem();
|
||||||
bool couldDestroy = minecraft->player->canDestroy(Tile::tiles[t]);
|
bool couldDestroy = minecraft->player->canDestroy(Tile::tiles[t]);
|
||||||
if (item != NULL) {
|
if (item != nullptr) {
|
||||||
item->mineBlock(t, x, y, z, minecraft->player);
|
item->mineBlock(t, x, y, z, minecraft->player);
|
||||||
if (item->count == 0) {
|
if (item->count == 0) {
|
||||||
minecraft->player->removeSelectedItem();
|
minecraft->player->removeSelectedItem();
|
||||||
|
|
@ -98,7 +98,7 @@ void SurvivalMode::continueDestroyBlock(int x, int y, int z, int face) {
|
||||||
destroyProgress += tile->getDestroyProgress(minecraft->player);
|
destroyProgress += tile->getDestroyProgress(minecraft->player);
|
||||||
|
|
||||||
if (destroyTicks % 4 == 0) {
|
if (destroyTicks % 4 == 0) {
|
||||||
if (tile != NULL) {
|
if (tile != nullptr) {
|
||||||
minecraft->soundEngine->play(
|
minecraft->soundEngine->play(
|
||||||
tile->soundType->getStepSound(), x + 0.5f, y + 0.5f,
|
tile->soundType->getStepSound(), x + 0.5f, y + 0.5f,
|
||||||
z + 0.5f, (tile->soundType->getVolume() + 1) / 8,
|
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 (t > 0) {
|
||||||
if (Tile::tiles[t]->use(level, x, y, z, player)) return true;
|
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);
|
return item->useOn(player, level, x, y, z, face);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,6 @@ public:
|
||||||
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
|
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
|
||||||
std::shared_ptr<ItemInstance> item, int x, int y,
|
std::shared_ptr<ItemInstance> item, int x, int y,
|
||||||
int z, int face, bool bTestUseOnOnly = false,
|
int z, int face, bool bTestUseOnOnly = false,
|
||||||
bool* pbUsedItem = NULL);
|
bool* pbUsedItem = nullptr);
|
||||||
virtual bool hasExperience();
|
virtual bool hasExperience();
|
||||||
};
|
};
|
||||||
|
|
@ -12,7 +12,7 @@ DerivedServerLevel::DerivedServerLevel(
|
||||||
// delete the current one
|
// delete the current one
|
||||||
if (this->savedDataStorage) {
|
if (this->savedDataStorage) {
|
||||||
delete this->savedDataStorage;
|
delete this->savedDataStorage;
|
||||||
this->savedDataStorage = NULL;
|
this->savedDataStorage = nullptr;
|
||||||
}
|
}
|
||||||
this->savedDataStorage = wrapped->savedDataStorage;
|
this->savedDataStorage = wrapped->savedDataStorage;
|
||||||
levelData = new DerivedLevelData(wrapped->getLevelData());
|
levelData = new DerivedLevelData(wrapped->getLevelData());
|
||||||
|
|
@ -21,7 +21,7 @@ DerivedServerLevel::DerivedServerLevel(
|
||||||
DerivedServerLevel::~DerivedServerLevel() {
|
DerivedServerLevel::~DerivedServerLevel() {
|
||||||
// we didn't allocate savedDataStorage here, so we don't want the level
|
// we didn't allocate savedDataStorage here, so we don't want the level
|
||||||
// destructor to delete it
|
// destructor to delete it
|
||||||
this->savedDataStorage = NULL;
|
this->savedDataStorage = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DerivedServerLevel::saveLevelData() {
|
void DerivedServerLevel::saveLevelData() {
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ MultiPlayerLevel::MultiPlayerLevel(ClientConnection* connection,
|
||||||
levelData->setInitialized(true);
|
levelData->setInitialized(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection != NULL) {
|
if (connection != nullptr) {
|
||||||
this->connections.push_back(connection);
|
this->connections.push_back(connection);
|
||||||
}
|
}
|
||||||
this->difficulty = difficulty;
|
this->difficulty = difficulty;
|
||||||
|
|
@ -57,7 +57,7 @@ MultiPlayerLevel::MultiPlayerLevel(ClientConnection* connection,
|
||||||
// setSpawnPos(new Pos(8, 64, 8));
|
// setSpawnPos(new Pos(8, 64, 8));
|
||||||
// The base ctor already has made some storage, so need to delete that
|
// The base ctor already has made some storage, so need to delete that
|
||||||
if (this->savedDataStorage) delete savedDataStorage;
|
if (this->savedDataStorage) delete savedDataStorage;
|
||||||
if (connection != NULL) {
|
if (connection != nullptr) {
|
||||||
savedDataStorage = connection->savedDataStorage;
|
savedDataStorage = connection->savedDataStorage;
|
||||||
}
|
}
|
||||||
unshareCheckX = 0;
|
unshareCheckX = 0;
|
||||||
|
|
@ -73,7 +73,7 @@ MultiPlayerLevel::MultiPlayerLevel(ClientConnection* connection,
|
||||||
MultiPlayerLevel::~MultiPlayerLevel() {
|
MultiPlayerLevel::~MultiPlayerLevel() {
|
||||||
// Don't let the base class delete this, it comes from the connection for
|
// Don't let the base class delete this, it comes from the connection for
|
||||||
// multiplayerlevels, and we'll delete there
|
// multiplayerlevels, and we'll delete there
|
||||||
this->savedDataStorage = NULL;
|
this->savedDataStorage = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiPlayerLevel::unshareChunkAt(int x, int z) {
|
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) {
|
void MultiPlayerLevel::putEntity(int id, std::shared_ptr<Entity> e) {
|
||||||
std::shared_ptr<Entity> old = getEntity(id);
|
std::shared_ptr<Entity> old = getEntity(id);
|
||||||
if (old != NULL) {
|
if (old != nullptr) {
|
||||||
removeEntity(old);
|
removeEntity(old);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -626,7 +626,7 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/) {
|
||||||
|
|
||||||
Tickable* MultiPlayerLevel::makeSoundUpdater(
|
Tickable* MultiPlayerLevel::makeSoundUpdater(
|
||||||
std::shared_ptr<Minecart> minecart) {
|
std::shared_ptr<Minecart> minecart) {
|
||||||
return NULL; // new MinecartSoundUpdater(minecraft->soundEngine, minecart,
|
return nullptr; // new MinecartSoundUpdater(minecraft->soundEngine, minecart,
|
||||||
// minecraft->player);
|
// minecraft->player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -730,7 +730,7 @@ void MultiPlayerLevel::animateTickDoWork() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Minecraft::GetInstance()->animateTickLevel = NULL;
|
Minecraft::GetInstance()->animateTickLevel = nullptr;
|
||||||
delete animateRandom;
|
delete animateRandom;
|
||||||
|
|
||||||
chunksToAnimate.clear();
|
chunksToAnimate.clear();
|
||||||
|
|
@ -850,7 +850,7 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() {
|
||||||
while (it != entities.end()) {
|
while (it != entities.end()) {
|
||||||
std::shared_ptr<Entity> e = *it; // entities.at(i);
|
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) {
|
if (e->riding->removed || e->riding->rider.lock() != e) {
|
||||||
e->riding->rider = std::weak_ptr<Entity>();
|
e->riding->rider = std::weak_ptr<Entity>();
|
||||||
e->riding = nullptr;
|
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 &&
|
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 &&
|
||||||
te->y < y1 && te->z < z1) {
|
te->y < y1 && te->z < z1) {
|
||||||
LevelChunk* lc = getChunk(te->x >> 4, te->z >> 4);
|
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
|
// Only remove tile entities where this is no longer a tile
|
||||||
// entity
|
// entity
|
||||||
int tileId = lc->getTile(te->x & 15, te->y, te->z & 15);
|
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()) {
|
!Tile::tiles[tileId]->isEntityTile()) {
|
||||||
tileEntityList[i] = tileEntityList.back();
|
tileEntityList[i] = tileEntityList.back();
|
||||||
tileEntityList.pop_back();
|
tileEntityList.pop_back();
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
WeighedTreasureArray ServerLevel::RANDOM_BONUS_ITEMS;
|
WeighedTreasureArray ServerLevel::RANDOM_BONUS_ITEMS;
|
||||||
|
|
||||||
C4JThread* ServerLevel::m_updateThread = NULL;
|
C4JThread* ServerLevel::m_updateThread = nullptr;
|
||||||
C4JThread::EventArray* ServerLevel::m_updateTrigger;
|
C4JThread::EventArray* ServerLevel::m_updateTrigger;
|
||||||
CRITICAL_SECTION ServerLevel::m_updateCS[3];
|
CRITICAL_SECTION ServerLevel::m_updateCS[3];
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ void ServerLevel::staticCtor() {
|
||||||
InitializeCriticalSection(&m_updateCS[1]);
|
InitializeCriticalSection(&m_updateCS[1]);
|
||||||
InitializeCriticalSection(&m_updateCS[2]);
|
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->SetProcessor(CPU_CORE_TILE_UPDATE);
|
||||||
m_updateThread->Run();
|
m_updateThread->Run();
|
||||||
|
|
||||||
|
|
@ -141,7 +141,7 @@ ServerLevel::ServerLevel(MinecraftServer* server,
|
||||||
// shared_ptr<ScoreboardSaveData> scoreboardSaveData =
|
// shared_ptr<ScoreboardSaveData> scoreboardSaveData =
|
||||||
// std::dynamic_pointer_cast<ScoreboardSaveData>(
|
// std::dynamic_pointer_cast<ScoreboardSaveData>(
|
||||||
// savedDataStorage->get(typeid(ScoreboardSaveData),
|
// savedDataStorage->get(typeid(ScoreboardSaveData),
|
||||||
// ScoreboardSaveData::FILE_ID) ); if (scoreboardSaveData == NULL)
|
// ScoreboardSaveData::FILE_ID) ); if (scoreboardSaveData == nullptr)
|
||||||
//{
|
//{
|
||||||
// scoreboardSaveData = shared_ptr<ScoreboardSaveData>( new
|
// scoreboardSaveData = shared_ptr<ScoreboardSaveData>( new
|
||||||
// ScoreboardSaveData() );
|
// ScoreboardSaveData() );
|
||||||
|
|
@ -292,7 +292,7 @@ void ServerLevel::tick() {
|
||||||
{
|
{
|
||||||
// app.DebugPrintf("Incremental save\n");
|
// app.DebugPrintf("Incremental save\n");
|
||||||
PIXBeginNamedEvent(0, "Incremental save");
|
PIXBeginNamedEvent(0, "Incremental save");
|
||||||
save(false, NULL);
|
save(false, nullptr);
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -351,7 +351,7 @@ Biome::MobSpawnerData* ServerLevel::getRandomMobSpawnAt(
|
||||||
MobCategory* mobCategory, int x, int y, int z) {
|
MobCategory* mobCategory, int x, int y, int z) {
|
||||||
std::vector<Biome::MobSpawnerData*>* mobList =
|
std::vector<Biome::MobSpawnerData*>* mobList =
|
||||||
getChunkSource()->getMobsAt(mobCategory, x, y, z);
|
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(
|
return (Biome::MobSpawnerData*)WeighedRandom::getRandomItem(
|
||||||
random, (std::vector<WeighedRandomItem*>*)mobList);
|
random, (std::vector<WeighedRandomItem*>*)mobList);
|
||||||
|
|
@ -462,7 +462,7 @@ void ServerLevel::tickTiles() {
|
||||||
int z = m_updateTileZ[iLev][i];
|
int z = m_updateTileZ[iLev][i];
|
||||||
if (hasChunkAt(x, y, z)) {
|
if (hasChunkAt(x, y, z)) {
|
||||||
int id = getTile(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;
|
/*if(id == 2) ++grassTicks;
|
||||||
else if(id == 11) ++lavaTicks;
|
else if(id == 11) ++lavaTicks;
|
||||||
else ++otherTicks;*/
|
else ++otherTicks;*/
|
||||||
|
|
@ -759,7 +759,7 @@ void ServerLevel::tick(std::shared_ptr<Entity> e, bool actual) {
|
||||||
e->remove();
|
e->remove();
|
||||||
}
|
}
|
||||||
if (!server->isNpcsEnabled() &&
|
if (!server->isNpcsEnabled() &&
|
||||||
(std::dynamic_pointer_cast<Npc>(e) != NULL)) {
|
(std::dynamic_pointer_cast<Npc>(e) != nullptr)) {
|
||||||
e->remove();
|
e->remove();
|
||||||
}
|
}
|
||||||
Level::tick(e, actual);
|
Level::tick(e, actual);
|
||||||
|
|
@ -838,7 +838,7 @@ void ServerLevel::setInitialSpawn(LevelSettings* levelSettings) {
|
||||||
int minXZ = -(dimension->getXZSize() * 16) / 2;
|
int minXZ = -(dimension->getXZSize() * 16) / 2;
|
||||||
int maxXZ = (dimension->getXZSize() * 16) / 2 - 1;
|
int maxXZ = (dimension->getXZSize() * 16) / 2 - 1;
|
||||||
|
|
||||||
if (findBiome != NULL) {
|
if (findBiome != nullptr) {
|
||||||
xSpawn = findBiome->x;
|
xSpawn = findBiome->x;
|
||||||
zSpawn = findBiome->z;
|
zSpawn = findBiome->z;
|
||||||
delete findBiome;
|
delete findBiome;
|
||||||
|
|
@ -888,7 +888,7 @@ void ServerLevel::generateBonusItemsNearSpawn() {
|
||||||
std::shared_ptr<ChestTileEntity> chest =
|
std::shared_ptr<ChestTileEntity> chest =
|
||||||
std::dynamic_pointer_cast<ChestTileEntity>(
|
std::dynamic_pointer_cast<ChestTileEntity>(
|
||||||
getTileEntity(x, y, z));
|
getTileEntity(x, y, z));
|
||||||
if (chest != NULL) {
|
if (chest != nullptr) {
|
||||||
if (chest->isBonusChest) {
|
if (chest->isBonusChest) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -929,7 +929,7 @@ void ServerLevel::save(bool force, ProgressListener* progressListener,
|
||||||
// 4J-PB - check that saves are enabled
|
// 4J-PB - check that saves are enabled
|
||||||
if (StorageManager.GetSaveDisabled()) return;
|
if (StorageManager.GetSaveDisabled()) return;
|
||||||
|
|
||||||
if (progressListener != NULL) {
|
if (progressListener != nullptr) {
|
||||||
if (bAutosave) {
|
if (bAutosave) {
|
||||||
progressListener->progressStartNoAbort(
|
progressListener->progressStartNoAbort(
|
||||||
IDS_PROGRESS_AUTOSAVING_LEVEL);
|
IDS_PROGRESS_AUTOSAVING_LEVEL);
|
||||||
|
|
@ -941,7 +941,7 @@ void ServerLevel::save(bool force, ProgressListener* progressListener,
|
||||||
saveLevelData();
|
saveLevelData();
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
||||||
if (progressListener != NULL)
|
if (progressListener != nullptr)
|
||||||
progressListener->progressStage(IDS_PROGRESS_SAVING_CHUNKS);
|
progressListener->progressStage(IDS_PROGRESS_SAVING_CHUNKS);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -967,7 +967,7 @@ void ServerLevel::save(bool force, ProgressListener* progressListener,
|
||||||
|
|
||||||
// if( force && !isClientSide )
|
// if( force && !isClientSide )
|
||||||
//{
|
//{
|
||||||
// if (progressListener != NULL)
|
// if (progressListener != nullptr)
|
||||||
// progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
|
// progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
|
||||||
// levelStorage->flushSaveFile();
|
// levelStorage->flushSaveFile();
|
||||||
// }
|
// }
|
||||||
|
|
@ -992,7 +992,7 @@ void ServerLevel::saveToDisc(ProgressListener* progressListener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progressListener != NULL)
|
if (progressListener != nullptr)
|
||||||
progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
|
progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
|
||||||
levelStorage->flushSaveFile(autosave);
|
levelStorage->flushSaveFile(autosave);
|
||||||
}
|
}
|
||||||
|
|
@ -1008,7 +1008,7 @@ void ServerLevel::entityAdded(std::shared_ptr<Entity> e) {
|
||||||
Level::entityAdded(e);
|
Level::entityAdded(e);
|
||||||
entitiesById[e->entityId] = e;
|
entitiesById[e->entityId] = e;
|
||||||
std::vector<std::shared_ptr<Entity> >* es = e->getSubEntities();
|
std::vector<std::shared_ptr<Entity> >* es = e->getSubEntities();
|
||||||
if (es != NULL) {
|
if (es != nullptr) {
|
||||||
// for (int i = 0; i < es.length; i++)
|
// for (int i = 0; i < es.length; i++)
|
||||||
for (auto it = es->begin(); it != es->end(); ++it) {
|
for (auto it = es->begin(); it != es->end(); ++it) {
|
||||||
entitiesById.insert(
|
entitiesById.insert(
|
||||||
|
|
@ -1022,7 +1022,7 @@ void ServerLevel::entityRemoved(std::shared_ptr<Entity> e) {
|
||||||
Level::entityRemoved(e);
|
Level::entityRemoved(e);
|
||||||
entitiesById.erase(e->entityId);
|
entitiesById.erase(e->entityId);
|
||||||
std::vector<std::shared_ptr<Entity> >* es = e->getSubEntities();
|
std::vector<std::shared_ptr<Entity> >* es = e->getSubEntities();
|
||||||
if (es != NULL) {
|
if (es != nullptr) {
|
||||||
// for (int i = 0; i < es.length; i++)
|
// for (int i = 0; i < es.length; i++)
|
||||||
for (auto it = es->begin(); it != es->end(); ++it) {
|
for (auto it = es->begin(); it != es->end(); ++it) {
|
||||||
entitiesById.erase((*it)->entityId);
|
entitiesById.erase((*it)->entityId);
|
||||||
|
|
@ -1078,14 +1078,14 @@ std::shared_ptr<Explosion> ServerLevel::explode(std::shared_ptr<Entity> source,
|
||||||
bool knockbackOnly = false;
|
bool knockbackOnly = false;
|
||||||
if (sentTo.size()) {
|
if (sentTo.size()) {
|
||||||
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
||||||
if (thisPlayer == NULL) {
|
if (thisPlayer == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
for (unsigned int j = 0; j < sentTo.size(); j++) {
|
for (unsigned int j = 0; j < sentTo.size(); j++) {
|
||||||
std::shared_ptr<ServerPlayer> player2 = sentTo[j];
|
std::shared_ptr<ServerPlayer> player2 = sentTo[j];
|
||||||
INetworkPlayer* otherPlayer =
|
INetworkPlayer* otherPlayer =
|
||||||
player2->connection->getNetworkPlayer();
|
player2->connection->getNetworkPlayer();
|
||||||
if (otherPlayer != NULL &&
|
if (otherPlayer != nullptr &&
|
||||||
thisPlayer->IsSameSystem(otherPlayer)) {
|
thisPlayer->IsSameSystem(otherPlayer)) {
|
||||||
knockbackOnly = true;
|
knockbackOnly = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1530,7 +1530,7 @@ int ServerLevel::runUpdate(void* lpParam) {
|
||||||
// 4J Stu - Added shouldTileTick as some tiles won't even do
|
// 4J Stu - Added shouldTileTick as some tiles won't even do
|
||||||
// anything if they are set to tick and use up one of our
|
// anything if they are set to tick and use up one of our
|
||||||
// updates
|
// updates
|
||||||
if (Tile::tiles[id] != NULL &&
|
if (Tile::tiles[id] != nullptr &&
|
||||||
Tile::tiles[id]->isTicking() &&
|
Tile::tiles[id]->isTicking() &&
|
||||||
Tile::tiles[id]->shouldTileTick(
|
Tile::tiles[id]->shouldTileTick(
|
||||||
m_level[iLev], x + (cx * 16), y, z + (cz * 16))) {
|
m_level[iLev], x + (cx * 16), y, z + (cz * 16))) {
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ void ServerLevelListener::destroyTileProgress(int id, int x, int y, int z,
|
||||||
for (auto it = server->getPlayers()->players.begin();
|
for (auto it = server->getPlayers()->players.begin();
|
||||||
it != server->getPlayers()->players.end(); ++it) {
|
it != server->getPlayers()->players.end(); ++it) {
|
||||||
std::shared_ptr<ServerPlayer> p = *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 xd = (double)x - p->x;
|
||||||
double yd = (double)y - p->y;
|
double yd = (double)y - p->y;
|
||||||
double zd = (double)z - p->z;
|
double zd = (double)z - p->z;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -123,8 +123,8 @@ public:
|
||||||
|
|
||||||
std::shared_ptr<MultiplayerLocalPlayer> createExtraLocalPlayer(
|
std::shared_ptr<MultiplayerLocalPlayer> createExtraLocalPlayer(
|
||||||
int idx, const std::wstring& name, int pad, int iDimension,
|
int idx, const std::wstring& name, int pad, int iDimension,
|
||||||
ClientConnection* clientConnection = NULL,
|
ClientConnection* clientConnection = nullptr,
|
||||||
MultiPlayerLevel* levelpassedin = NULL);
|
MultiPlayerLevel* levelpassedin = nullptr);
|
||||||
void createPrimaryLocalPlayer(int iPad);
|
void createPrimaryLocalPlayer(int iPad);
|
||||||
bool setLocalPlayerIdx(int idx);
|
bool setLocalPlayerIdx(int idx);
|
||||||
int getLocalPlayerIdx();
|
int getLocalPlayerIdx();
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
#define DEBUG_SERVER_DONT_SPAWN_MOBS 0
|
#define DEBUG_SERVER_DONT_SPAWN_MOBS 0
|
||||||
|
|
||||||
// 4J Added
|
// 4J Added
|
||||||
MinecraftServer* MinecraftServer::server = NULL;
|
MinecraftServer* MinecraftServer::server = nullptr;
|
||||||
bool MinecraftServer::setTimeAtEndOfTick = false;
|
bool MinecraftServer::setTimeAtEndOfTick = false;
|
||||||
int64_t MinecraftServer::setTime = 0;
|
int64_t MinecraftServer::setTime = 0;
|
||||||
bool MinecraftServer::setTimeOfDayAtEndOfTick = false;
|
bool MinecraftServer::setTimeOfDayAtEndOfTick = false;
|
||||||
|
|
@ -75,10 +75,10 @@ std::unordered_map<std::wstring, int> MinecraftServer::ironTimers;
|
||||||
|
|
||||||
MinecraftServer::MinecraftServer() {
|
MinecraftServer::MinecraftServer() {
|
||||||
// 4J - added initialisers
|
// 4J - added initialisers
|
||||||
connection = NULL;
|
connection = nullptr;
|
||||||
settings = NULL;
|
settings = nullptr;
|
||||||
players = NULL;
|
players = nullptr;
|
||||||
commands = NULL;
|
commands = nullptr;
|
||||||
running = true;
|
running = true;
|
||||||
m_bLoaded = false;
|
m_bLoaded = false;
|
||||||
stopped = false;
|
stopped = false;
|
||||||
|
|
@ -97,7 +97,7 @@ MinecraftServer::MinecraftServer() {
|
||||||
m_texturePackId = 0;
|
m_texturePackId = 0;
|
||||||
maxBuildHeight = Level::maxBuildHeight;
|
maxBuildHeight = Level::maxBuildHeight;
|
||||||
playerIdleTimeout = 0;
|
playerIdleTimeout = 0;
|
||||||
m_postUpdateThread = NULL;
|
m_postUpdateThread = nullptr;
|
||||||
forceGameType = false;
|
forceGameType = false;
|
||||||
|
|
||||||
commandDispatcher = new ServerCommandDispatcher();
|
commandDispatcher = new ServerCommandDispatcher();
|
||||||
|
|
@ -165,11 +165,11 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData,
|
||||||
setPlayers(new PlayerList(this));
|
setPlayers(new PlayerList(this));
|
||||||
|
|
||||||
// 4J-JEV: Need to wait for levelGenerationOptions to load.
|
// 4J-JEV: Need to wait for levelGenerationOptions to load.
|
||||||
while (app.getLevelGenerationOptions() != NULL &&
|
while (app.getLevelGenerationOptions() != nullptr &&
|
||||||
!app.getLevelGenerationOptions()->hasLoadedData())
|
!app.getLevelGenerationOptions()->hasLoadedData())
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
|
|
||||||
if (app.getLevelGenerationOptions() != NULL &&
|
if (app.getLevelGenerationOptions() != nullptr &&
|
||||||
!app.getLevelGenerationOptions()->ready()) {
|
!app.getLevelGenerationOptions()->ready()) {
|
||||||
// TODO: Stop loading, add error message.
|
// TODO: Stop loading, add error message.
|
||||||
}
|
}
|
||||||
|
|
@ -180,7 +180,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData,
|
||||||
std::wstring levelTypeString;
|
std::wstring levelTypeString;
|
||||||
|
|
||||||
bool gameRuleUseFlatWorld = false;
|
bool gameRuleUseFlatWorld = false;
|
||||||
if (app.getLevelGenerationOptions() != NULL) {
|
if (app.getLevelGenerationOptions() != nullptr) {
|
||||||
gameRuleUseFlatWorld =
|
gameRuleUseFlatWorld =
|
||||||
app.getLevelGenerationOptions()->getuseFlatWorld();
|
app.getLevelGenerationOptions()->getuseFlatWorld();
|
||||||
}
|
}
|
||||||
|
|
@ -192,7 +192,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData,
|
||||||
}
|
}
|
||||||
|
|
||||||
LevelType* pLevelType = LevelType::getLevelType(levelTypeString);
|
LevelType* pLevelType = LevelType::getLevelType(levelTypeString);
|
||||||
if (pLevelType == NULL) {
|
if (pLevelType == nullptr) {
|
||||||
pLevelType = LevelType::lvl_normal;
|
pLevelType = LevelType::lvl_normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -318,7 +318,7 @@ void MinecraftServer::postProcessTerminate(ProgressRenderer* mcprogress) {
|
||||||
}
|
}
|
||||||
} while (status == WAIT_TIMEOUT);
|
} while (status == WAIT_TIMEOUT);
|
||||||
delete m_postUpdateThread;
|
delete m_postUpdateThread;
|
||||||
m_postUpdateThread = NULL;
|
m_postUpdateThread = nullptr;
|
||||||
DeleteCriticalSection(&m_postProcessCS);
|
DeleteCriticalSection(&m_postProcessCS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -353,7 +353,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
|
||||||
// 4J - temp - load existing level
|
// 4J - temp - load existing level
|
||||||
std::shared_ptr<McRegionLevelStorage> storage = nullptr;
|
std::shared_ptr<McRegionLevelStorage> storage = nullptr;
|
||||||
bool levelChunksNeedConverted = false;
|
bool levelChunksNeedConverted = false;
|
||||||
if (initData->saveData != NULL) {
|
if (initData->saveData != nullptr) {
|
||||||
// We are loading a file from disk with the data passed in
|
// We are loading a file from disk with the data passed in
|
||||||
|
|
||||||
#if defined(SPLIT_SAVES)
|
#if defined(SPLIT_SAVES)
|
||||||
|
|
@ -381,12 +381,12 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
|
||||||
#if defined(SPLIT_SAVES)
|
#if defined(SPLIT_SAVES)
|
||||||
bool bLevelGenBaseSave = false;
|
bool bLevelGenBaseSave = false;
|
||||||
LevelGenerationOptions* levelGen = app.getLevelGenerationOptions();
|
LevelGenerationOptions* levelGen = app.getLevelGenerationOptions();
|
||||||
if (levelGen != NULL && levelGen->requiresBaseSave()) {
|
if (levelGen != nullptr && levelGen->requiresBaseSave()) {
|
||||||
unsigned int fileSize = 0;
|
unsigned int fileSize = 0;
|
||||||
std::uint8_t* pvSaveData = levelGen->getBaseSaveData(fileSize);
|
std::uint8_t* pvSaveData = levelGen->getBaseSaveData(fileSize);
|
||||||
if (pvSaveData && fileSize != 0) bLevelGenBaseSave = true;
|
if (pvSaveData && fileSize != 0) bLevelGenBaseSave = true;
|
||||||
}
|
}
|
||||||
ConsoleSaveFileSplit* newFormatSave = NULL;
|
ConsoleSaveFileSplit* newFormatSave = nullptr;
|
||||||
if (bLevelGenBaseSave) {
|
if (bLevelGenBaseSave) {
|
||||||
ConsoleSaveFileOriginal oldFormatSave(L"");
|
ConsoleSaveFileOriginal oldFormatSave(L"");
|
||||||
newFormatSave = new ConsoleSaveFileSplit(&oldFormatSave);
|
newFormatSave = new ConsoleSaveFileSplit(&oldFormatSave);
|
||||||
|
|
@ -420,11 +420,11 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
levels[i] =
|
levels[i] =
|
||||||
new ServerLevel(this, storage, name, dimension, levelSettings);
|
new ServerLevel(this, storage, name, dimension, levelSettings);
|
||||||
if (app.getLevelGenerationOptions() != NULL) {
|
if (app.getLevelGenerationOptions() != nullptr) {
|
||||||
LevelGenerationOptions* mapOptions =
|
LevelGenerationOptions* mapOptions =
|
||||||
app.getLevelGenerationOptions();
|
app.getLevelGenerationOptions();
|
||||||
Pos* spawnPos = mapOptions->getSpawnPos();
|
Pos* spawnPos = mapOptions->getSpawnPos();
|
||||||
if (spawnPos != NULL) {
|
if (spawnPos != nullptr) {
|
||||||
levels[i]->setSpawnPos(spawnPos);
|
levels[i]->setSpawnPos(spawnPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -457,7 +457,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource,
|
||||||
#endif
|
#endif
|
||||||
levels[i]->getLevelData()->setGameType(gameType);
|
levels[i]->getLevelData()->setGameType(gameType);
|
||||||
|
|
||||||
if (app.getLevelGenerationOptions() != NULL) {
|
if (app.getLevelGenerationOptions() != nullptr) {
|
||||||
LevelGenerationOptions* mapOptions =
|
LevelGenerationOptions* mapOptions =
|
||||||
app.getLevelGenerationOptions();
|
app.getLevelGenerationOptions();
|
||||||
levels[i]->getLevelData()->setHasBeenInCreative(
|
levels[i]->getLevelData()->setHasBeenInCreative(
|
||||||
|
|
@ -778,7 +778,7 @@ void MinecraftServer::saveAllChunks() {
|
||||||
// Functional: Gameplay: Saving after sleeping in a bed will place
|
// Functional: Gameplay: Saving after sleeping in a bed will place
|
||||||
// player at nighttime when restarting.
|
// player at nighttime when restarting.
|
||||||
ServerLevel* level = levels[levels.length - 1 - i];
|
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
|
// stopServer really early on due to network failure
|
||||||
{
|
{
|
||||||
level->save(true, Minecraft::GetInstance()->progressRenderer);
|
level->save(true, Minecraft::GetInstance()->progressRenderer);
|
||||||
|
|
@ -804,10 +804,10 @@ void MinecraftServer::saveGameRules() {
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
byteArray ba;
|
byteArray ba;
|
||||||
ba.data = NULL;
|
ba.data = nullptr;
|
||||||
app.m_gameRules.saveGameRules(&ba.data, &ba.length);
|
app.m_gameRules.saveGameRules(&ba.data, &ba.length);
|
||||||
|
|
||||||
if (ba.data != NULL) {
|
if (ba.data != nullptr) {
|
||||||
ConsoleSaveFile* csf =
|
ConsoleSaveFile* csf =
|
||||||
getLevel(0)->getLevelStorage()->getSaveFile();
|
getLevel(0)->getLevelStorage()->getSaveFile();
|
||||||
FileEntry* fe =
|
FileEntry* fe =
|
||||||
|
|
@ -835,8 +835,8 @@ void MinecraftServer::Suspend() {
|
||||||
QueryPerformanceCounter(&qwTime);
|
QueryPerformanceCounter(&qwTime);
|
||||||
if (m_bLoaded && ProfileManager.IsFullVersion() &&
|
if (m_bLoaded && ProfileManager.IsFullVersion() &&
|
||||||
(!StorageManager.GetSaveDisabled())) {
|
(!StorageManager.GetSaveDisabled())) {
|
||||||
if (players != NULL) {
|
if (players != nullptr) {
|
||||||
players->saveAll(NULL);
|
players->saveAll(nullptr);
|
||||||
}
|
}
|
||||||
for (unsigned int j = 0; j < levels.length; j++) {
|
for (unsigned int j = 0; j < levels.length; j++) {
|
||||||
if (s_bServerHalted) break;
|
if (s_bServerHalted) break;
|
||||||
|
|
@ -849,7 +849,7 @@ void MinecraftServer::Suspend() {
|
||||||
}
|
}
|
||||||
if (!s_bServerHalted) {
|
if (!s_bServerHalted) {
|
||||||
saveGameRules();
|
saveGameRules();
|
||||||
levels[0]->saveToDisc(NULL, true);
|
levels[0]->saveToDisc(nullptr, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QueryPerformanceCounter(&qwNewTime);
|
QueryPerformanceCounter(&qwNewTime);
|
||||||
|
|
@ -896,7 +896,7 @@ void MinecraftServer::stopServer(bool didInit) {
|
||||||
// initialisation.
|
// initialisation.
|
||||||
if (m_saveOnExit && ProfileManager.IsFullVersion() &&
|
if (m_saveOnExit && ProfileManager.IsFullVersion() &&
|
||||||
(!StorageManager.GetSaveDisabled()) && didInit) {
|
(!StorageManager.GetSaveDisabled()) && didInit) {
|
||||||
if (players != NULL) {
|
if (players != nullptr) {
|
||||||
players->saveAll(Minecraft::GetInstance()->progressRenderer,
|
players->saveAll(Minecraft::GetInstance()->progressRenderer,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
@ -907,7 +907,7 @@ void MinecraftServer::stopServer(bool didInit) {
|
||||||
// for (unsigned int i = levels.length - 1; i >= 0; i--)
|
// for (unsigned int i = levels.length - 1; i >= 0; i--)
|
||||||
//{
|
//{
|
||||||
// ServerLevel *level = levels[i];
|
// ServerLevel *level = levels[i];
|
||||||
// if (level != NULL)
|
// if (level != nullptr)
|
||||||
// {
|
// {
|
||||||
saveAllChunks();
|
saveAllChunks();
|
||||||
// }
|
// }
|
||||||
|
|
@ -915,7 +915,7 @@ void MinecraftServer::stopServer(bool didInit) {
|
||||||
|
|
||||||
saveGameRules();
|
saveGameRules();
|
||||||
app.m_gameRules.unloadCurrentGameRules();
|
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
|
// very quickly due to network error
|
||||||
{
|
{
|
||||||
levels[0]->saveToDisc(
|
levels[0]->saveToDisc(
|
||||||
|
|
@ -936,19 +936,19 @@ void MinecraftServer::stopServer(bool didInit) {
|
||||||
// 4J-PB remove the server levels
|
// 4J-PB remove the server levels
|
||||||
unsigned int iServerLevelC = levels.length;
|
unsigned int iServerLevelC = levels.length;
|
||||||
for (unsigned int i = 0; i < iServerLevelC; i++) {
|
for (unsigned int i = 0; i < iServerLevelC; i++) {
|
||||||
if (levels[i] != NULL) {
|
if (levels[i] != nullptr) {
|
||||||
delete levels[i];
|
delete levels[i];
|
||||||
levels[i] = NULL;
|
levels[i] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
delete connection;
|
delete connection;
|
||||||
connection = NULL;
|
connection = nullptr;
|
||||||
delete players;
|
delete players;
|
||||||
players = NULL;
|
players = nullptr;
|
||||||
delete settings;
|
delete settings;
|
||||||
settings = NULL;
|
settings = nullptr;
|
||||||
|
|
||||||
g_NetworkManager.ServerStopped();
|
g_NetworkManager.ServerStopped();
|
||||||
}
|
}
|
||||||
|
|
@ -1047,10 +1047,10 @@ void MinecraftServer::setPlayerIdleTimeout(int playerIdleTimeout) {
|
||||||
|
|
||||||
extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b;
|
extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b;
|
||||||
void MinecraftServer::run(int64_t seed, void* lpParameter) {
|
void MinecraftServer::run(int64_t seed, void* lpParameter) {
|
||||||
NetworkGameInitData* initData = NULL;
|
NetworkGameInitData* initData = nullptr;
|
||||||
std::uint32_t initSettings = 0;
|
std::uint32_t initSettings = 0;
|
||||||
bool findSeed = false;
|
bool findSeed = false;
|
||||||
if (lpParameter != NULL) {
|
if (lpParameter != nullptr) {
|
||||||
initData = (NetworkGameInitData*)lpParameter;
|
initData = (NetworkGameInitData*)lpParameter;
|
||||||
initSettings = app.GetGameHostOption(eGameHostOption_All);
|
initSettings = app.GetGameHostOption(eGameHostOption_All);
|
||||||
findSeed = initData->findSeed;
|
findSeed = initData->findSeed;
|
||||||
|
|
@ -1178,7 +1178,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
|
||||||
case eXuiServerAction_AutoSaveGame:
|
case eXuiServerAction_AutoSaveGame:
|
||||||
case eXuiServerAction_SaveGame:
|
case eXuiServerAction_SaveGame:
|
||||||
app.EnterSaveNotificationSection();
|
app.EnterSaveNotificationSection();
|
||||||
if (players != NULL) {
|
if (players != nullptr) {
|
||||||
players->saveAll(
|
players->saveAll(
|
||||||
Minecraft::GetInstance()->progressRenderer);
|
Minecraft::GetInstance()->progressRenderer);
|
||||||
}
|
}
|
||||||
|
|
@ -1525,13 +1525,13 @@ void MinecraftServer::main(int64_t seed, void* lpParameter) {
|
||||||
server = new MinecraftServer();
|
server = new MinecraftServer();
|
||||||
server->run(seed, lpParameter);
|
server->run(seed, lpParameter);
|
||||||
delete server;
|
delete server;
|
||||||
server = NULL;
|
server = nullptr;
|
||||||
ShutdownManager::HasFinished(ShutdownManager::eServerThread);
|
ShutdownManager::HasFinished(ShutdownManager::eServerThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinecraftServer::HaltServer(bool bPrimaryPlayerSignedOut) {
|
void MinecraftServer::HaltServer(bool bPrimaryPlayerSignedOut) {
|
||||||
s_bServerHalted = true;
|
s_bServerHalted = true;
|
||||||
if (server != NULL) {
|
if (server != nullptr) {
|
||||||
m_bPrimaryPlayerSignedOut = bPrimaryPlayerSignedOut;
|
m_bPrimaryPlayerSignedOut = bPrimaryPlayerSignedOut;
|
||||||
server->halt();
|
server->halt();
|
||||||
}
|
}
|
||||||
|
|
@ -1569,7 +1569,7 @@ void MinecraftServer::setLevel(int dimension, ServerLevel* level) {
|
||||||
#if defined(_ACK_CHUNK_SEND_THROTTLING)
|
#if defined(_ACK_CHUNK_SEND_THROTTLING)
|
||||||
bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer* player) {
|
bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer* player) {
|
||||||
if (s_hasSentEnoughPackets) return false;
|
if (s_hasSentEnoughPackets) return false;
|
||||||
if (player == NULL) return false;
|
if (player == nullptr) return false;
|
||||||
|
|
||||||
for (int i = 0; i < s_sentTo.size(); i++) {
|
for (int i = 0; i < s_sentTo.size(); i++) {
|
||||||
if (s_sentTo[i]->IsSameSystem(player)) {
|
if (s_sentTo[i]->IsSameSystem(player)) {
|
||||||
|
|
@ -1637,7 +1637,7 @@ void MinecraftServer::chunkPacketManagement_PostTick() {}
|
||||||
#else
|
#else
|
||||||
// 4J Added
|
// 4J Added
|
||||||
bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer* player) {
|
bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer* player) {
|
||||||
if (player == NULL) return false;
|
if (player == nullptr) return false;
|
||||||
|
|
||||||
int time = GetTickCount();
|
int time = GetTickCount();
|
||||||
if (player->GetSessionIndex() == s_slowQueuePlayerIndex &&
|
if (player->GetSessionIndex() == s_slowQueuePlayerIndex &&
|
||||||
|
|
@ -1681,7 +1681,7 @@ void MinecraftServer::cycleSlowQueueIndex() {
|
||||||
if (!g_NetworkManager.IsInSession()) return;
|
if (!g_NetworkManager.IsInSession()) return;
|
||||||
|
|
||||||
int startingIndex = s_slowQueuePlayerIndex;
|
int startingIndex = s_slowQueuePlayerIndex;
|
||||||
INetworkPlayer* currentPlayer = NULL;
|
INetworkPlayer* currentPlayer = nullptr;
|
||||||
int currentPlayerCount = 0;
|
int currentPlayerCount = 0;
|
||||||
do {
|
do {
|
||||||
currentPlayerCount = g_NetworkManager.GetPlayerCount();
|
currentPlayerCount = g_NetworkManager.GetPlayerCount();
|
||||||
|
|
@ -1700,7 +1700,7 @@ void MinecraftServer::cycleSlowQueueIndex() {
|
||||||
s_slowQueuePlayerIndex = 0;
|
s_slowQueuePlayerIndex = 0;
|
||||||
}
|
}
|
||||||
} while (g_NetworkManager.IsInSession() && currentPlayerCount > 0 &&
|
} while (g_NetworkManager.IsInSession() && currentPlayerCount > 0 &&
|
||||||
s_slowQueuePlayerIndex != startingIndex && currentPlayer != NULL &&
|
s_slowQueuePlayerIndex != startingIndex && currentPlayer != nullptr &&
|
||||||
currentPlayer->IsLocal());
|
currentPlayer->IsLocal());
|
||||||
// app.DebugPrintf("Cycled slow queue index to %d\n",
|
// app.DebugPrintf("Cycled slow queue index to %d\n",
|
||||||
// s_slowQueuePlayerIndex);
|
// s_slowQueuePlayerIndex);
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,9 @@ typedef struct _NetworkGameInitData {
|
||||||
|
|
||||||
_NetworkGameInitData() {
|
_NetworkGameInitData() {
|
||||||
seed = 0;
|
seed = 0;
|
||||||
saveData = NULL;
|
saveData = nullptr;
|
||||||
settings = 0;
|
settings = 0;
|
||||||
levelGen = NULL;
|
levelGen = nullptr;
|
||||||
texturePackId = 0;
|
texturePackId = 0;
|
||||||
findSeed = false;
|
findSeed = false;
|
||||||
xzSize = LEVEL_LEGACY_WIDTH;
|
xzSize = LEVEL_LEGACY_WIDTH;
|
||||||
|
|
@ -254,10 +254,10 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static PlayerList* getPlayerList() {
|
static PlayerList* getPlayerList() {
|
||||||
if (server != NULL)
|
if (server != nullptr)
|
||||||
return server->players;
|
return server->players;
|
||||||
else
|
else
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
static void SetTimeOfDay(int64_t time) {
|
static void SetTimeOfDay(int64_t time) {
|
||||||
setTimeOfDayAtEndOfTick = true;
|
setTimeOfDayAtEndOfTick = true;
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,9 @@ ClientConnection::ClientConnection(Minecraft* minecraft, Socket* socket,
|
||||||
// 4J - added initiliasers
|
// 4J - added initiliasers
|
||||||
random = new Random();
|
random = new Random();
|
||||||
done = false;
|
done = false;
|
||||||
level = NULL;
|
level = nullptr;
|
||||||
started = false;
|
started = false;
|
||||||
savedDataStorage = new SavedDataStorage(NULL);
|
savedDataStorage = new SavedDataStorage(nullptr);
|
||||||
maxPlayers = 20;
|
maxPlayers = 20;
|
||||||
|
|
||||||
this->minecraft = minecraft;
|
this->minecraft = minecraft;
|
||||||
|
|
@ -75,7 +75,7 @@ ClientConnection::ClientConnection(Minecraft* minecraft, Socket* socket,
|
||||||
m_userIndex = iUserIndex;
|
m_userIndex = iUserIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (socket == NULL) {
|
if (socket == nullptr) {
|
||||||
socket = new Socket(); // 4J - Local connection
|
socket = new Socket(); // 4J - Local connection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,7 +83,7 @@ ClientConnection::ClientConnection(Minecraft* minecraft, Socket* socket,
|
||||||
if (createdOk) {
|
if (createdOk) {
|
||||||
connection = new Connection(socket, L"Client", this);
|
connection = new Connection(socket, L"Client", this);
|
||||||
} else {
|
} else {
|
||||||
connection = NULL;
|
connection = nullptr;
|
||||||
// TODO 4J Stu - This will cause issues since the session player owns
|
// TODO 4J Stu - This will cause issues since the session player owns
|
||||||
// the socket
|
// the socket
|
||||||
// delete socket;
|
// delete socket;
|
||||||
|
|
@ -104,10 +104,10 @@ void ClientConnection::tick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer* ClientConnection::getNetworkPlayer() {
|
INetworkPlayer* ClientConnection::getNetworkPlayer() {
|
||||||
if (connection != NULL && connection->getSocket() != NULL)
|
if (connection != nullptr && connection->getSocket() != nullptr)
|
||||||
return connection->getSocket()->getPlayer();
|
return connection->getSocket()->getPlayer();
|
||||||
else
|
else
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
|
void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
|
||||||
|
|
@ -115,7 +115,7 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
|
||||||
|
|
||||||
PlayerUID OnlineXuid;
|
PlayerUID OnlineXuid;
|
||||||
ProfileManager.GetXUID(m_userIndex, &OnlineXuid, true); // online xuid
|
ProfileManager.GetXUID(m_userIndex, &OnlineXuid, true); // online xuid
|
||||||
MOJANG_DATA* pMojangData = NULL;
|
MOJANG_DATA* pMojangData = nullptr;
|
||||||
|
|
||||||
if (!g_NetworkManager.IsLocalGame()) {
|
if (!g_NetworkManager.IsLocalGame()) {
|
||||||
pMojangData = app.GetMojangDataForXuid(OnlineXuid);
|
pMojangData = app.GetMojangDataForXuid(OnlineXuid);
|
||||||
|
|
@ -151,7 +151,7 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iUserID != -1) {
|
if (iUserID != -1) {
|
||||||
std::uint8_t* pBuffer = NULL;
|
std::uint8_t* pBuffer = nullptr;
|
||||||
unsigned int dwSize = 0;
|
unsigned int dwSize = 0;
|
||||||
bool bRes;
|
bool bRes;
|
||||||
|
|
||||||
|
|
@ -208,7 +208,7 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Level* dimensionLevel = minecraft->getLevel(packet->dimension);
|
Level* dimensionLevel = minecraft->getLevel(packet->dimension);
|
||||||
if (dimensionLevel == NULL) {
|
if (dimensionLevel == nullptr) {
|
||||||
level = new MultiPlayerLevel(
|
level = new MultiPlayerLevel(
|
||||||
this,
|
this,
|
||||||
new LevelSettings(
|
new LevelSettings(
|
||||||
|
|
@ -220,10 +220,10 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
|
||||||
// 4J Stu - We want to share the SavedDataStorage between levels
|
// 4J Stu - We want to share the SavedDataStorage between levels
|
||||||
int otherDimensionId = packet->dimension == 0 ? -1 : 0;
|
int otherDimensionId = packet->dimension == 0 ? -1 : 0;
|
||||||
Level* activeLevel = minecraft->getLevel(otherDimensionId);
|
Level* activeLevel = minecraft->getLevel(otherDimensionId);
|
||||||
if (activeLevel != NULL) {
|
if (activeLevel != nullptr) {
|
||||||
// Don't need to delete it here as it belongs to a client
|
// Don't need to delete it here as it belongs to a client
|
||||||
// connection while will delete it when it's done
|
// connection while will delete it when it's done
|
||||||
// if( level->savedDataStorage != NULL ) delete
|
// if( level->savedDataStorage != nullptr ) delete
|
||||||
// level->savedDataStorage;
|
// level->savedDataStorage;
|
||||||
level->savedDataStorage = activeLevel->savedDataStorage;
|
level->savedDataStorage = activeLevel->savedDataStorage;
|
||||||
}
|
}
|
||||||
|
|
@ -272,12 +272,12 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
|
||||||
level = (MultiPlayerLevel*)minecraft->getLevel(packet->dimension);
|
level = (MultiPlayerLevel*)minecraft->getLevel(packet->dimension);
|
||||||
std::shared_ptr<Player> player;
|
std::shared_ptr<Player> player;
|
||||||
|
|
||||||
if (level == NULL) {
|
if (level == nullptr) {
|
||||||
int otherDimensionId = packet->dimension == 0 ? -1 : 0;
|
int otherDimensionId = packet->dimension == 0 ? -1 : 0;
|
||||||
MultiPlayerLevel* activeLevel =
|
MultiPlayerLevel* activeLevel =
|
||||||
minecraft->getLevel(otherDimensionId);
|
minecraft->getLevel(otherDimensionId);
|
||||||
|
|
||||||
if (activeLevel == NULL) {
|
if (activeLevel == nullptr) {
|
||||||
otherDimensionId = packet->dimension == 0
|
otherDimensionId = packet->dimension == 0
|
||||||
? 1
|
? 1
|
||||||
: (packet->dimension == -1 ? 1 : -1);
|
: (packet->dimension == -1 ? 1 : -1);
|
||||||
|
|
@ -381,7 +381,7 @@ void ClientConnection::handleAddEntity(
|
||||||
std::shared_ptr<Entity> owner = getEntity(packet->data);
|
std::shared_ptr<Entity> owner = getEntity(packet->data);
|
||||||
|
|
||||||
// 4J - check all local players to find match
|
// 4J - check all local players to find match
|
||||||
if (owner == NULL) {
|
if (owner == nullptr) {
|
||||||
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
||||||
if (minecraft->localplayers[i]) {
|
if (minecraft->localplayers[i]) {
|
||||||
if (minecraft->localplayers[i]->entityId ==
|
if (minecraft->localplayers[i]->entityId ==
|
||||||
|
|
@ -511,7 +511,7 @@ void ClientConnection::handleAddEntity(
|
||||||
from fishing std::shared_ptr<Entity> owner = getEntity(packet->data);
|
from fishing std::shared_ptr<Entity> owner = getEntity(packet->data);
|
||||||
|
|
||||||
// 4J - check all local players to find match
|
// 4J - check all local players to find match
|
||||||
if( owner == NULL )
|
if( owner == nullptr )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -528,7 +528,7 @@ void ClientConnection::handleAddEntity(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::shared_ptr<Player> player =
|
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> hook =
|
||||||
std::shared_ptr<FishingHook>( new FishingHook(level, x, y, z, player) );
|
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->xp = packet->x;
|
||||||
e->yp = packet->y;
|
e->yp = packet->y;
|
||||||
e->zp = packet->z;
|
e->zp = packet->z;
|
||||||
|
|
@ -602,7 +602,7 @@ void ClientConnection::handleAddEntity(
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Entity> >* subEntities =
|
std::vector<std::shared_ptr<Entity> >* subEntities =
|
||||||
e->getSubEntities();
|
e->getSubEntities();
|
||||||
if (subEntities != NULL) {
|
if (subEntities != nullptr) {
|
||||||
int offs = packet->id - e->entityId;
|
int offs = packet->id - e->entityId;
|
||||||
// for (int i = 0; i < subEntities.length; i++)
|
// for (int i = 0; i < subEntities.length; i++)
|
||||||
for (auto it = subEntities->begin(); it != subEntities->end();
|
for (auto it = subEntities->begin(); it != subEntities->end();
|
||||||
|
|
@ -636,7 +636,7 @@ void ClientConnection::handleAddEntity(
|
||||||
std::shared_ptr<Entity> owner = getEntity(packet->data);
|
std::shared_ptr<Entity> owner = getEntity(packet->data);
|
||||||
|
|
||||||
// 4J - check all local players to find match
|
// 4J - check all local players to find match
|
||||||
if (owner == NULL) {
|
if (owner == nullptr) {
|
||||||
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
||||||
if (minecraft->localplayers[i]) {
|
if (minecraft->localplayers[i]) {
|
||||||
if (minecraft->localplayers[i]->entityId ==
|
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<Arrow>(e)->owner =
|
||||||
std::dynamic_pointer_cast<LivingEntity>(owner);
|
std::dynamic_pointer_cast<LivingEntity>(owner);
|
||||||
}
|
}
|
||||||
|
|
@ -685,7 +685,7 @@ void ClientConnection::handleAddGlobalEntity(
|
||||||
std::shared_ptr<Entity> e; // = nullptr;
|
std::shared_ptr<Entity> e; // = nullptr;
|
||||||
if (packet->type == AddGlobalEntityPacket::LIGHTNING)
|
if (packet->type == AddGlobalEntityPacket::LIGHTNING)
|
||||||
e = std::shared_ptr<LightningBolt>(new LightningBolt(level, x, y, z));
|
e = std::shared_ptr<LightningBolt>(new LightningBolt(level, x, y, z));
|
||||||
if (e != NULL) {
|
if (e != nullptr) {
|
||||||
e->xp = packet->x;
|
e->xp = packet->x;
|
||||||
e->yp = packet->y;
|
e->yp = packet->y;
|
||||||
e->zp = packet->z;
|
e->zp = packet->z;
|
||||||
|
|
@ -706,7 +706,7 @@ void ClientConnection::handleAddPainting(
|
||||||
void ClientConnection::handleSetEntityMotion(
|
void ClientConnection::handleSetEntityMotion(
|
||||||
std::shared_ptr<SetEntityMotionPacket> packet) {
|
std::shared_ptr<SetEntityMotionPacket> packet) {
|
||||||
std::shared_ptr<Entity> e = getEntity(packet->id);
|
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,
|
e->lerpMotion(packet->xa / 8000.0, packet->ya / 8000.0,
|
||||||
packet->za / 8000.0);
|
packet->za / 8000.0);
|
||||||
}
|
}
|
||||||
|
|
@ -714,7 +714,7 @@ void ClientConnection::handleSetEntityMotion(
|
||||||
void ClientConnection::handleSetEntityData(
|
void ClientConnection::handleSetEntityData(
|
||||||
std::shared_ptr<SetEntityDataPacket> packet) {
|
std::shared_ptr<SetEntityDataPacket> packet) {
|
||||||
std::shared_ptr<Entity> e = getEntity(packet->id);
|
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());
|
e->getEntityData()->assignValues(packet->getUnpackedData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -763,7 +763,7 @@ void ClientConnection::handleAddPlayer(
|
||||||
int item = packet->carriedItem;
|
int item = packet->carriedItem;
|
||||||
if (item == 0) {
|
if (item == 0) {
|
||||||
player->inventory->items[player->inventory->selected] =
|
player->inventory->items[player->inventory->selected] =
|
||||||
std::shared_ptr<ItemInstance>(); // NULL;
|
std::shared_ptr<ItemInstance>(); // nullptr;
|
||||||
} else {
|
} else {
|
||||||
player->inventory->items[player->inventory->selected] =
|
player->inventory->items[player->inventory->selected] =
|
||||||
std::shared_ptr<ItemInstance>(new ItemInstance(item, 1, 0));
|
std::shared_ptr<ItemInstance>(new ItemInstance(item, 1, 0));
|
||||||
|
|
@ -787,13 +787,13 @@ void ClientConnection::handleAddPlayer(
|
||||||
player->customTextureUrl.c_str(), player->name.c_str());
|
player->customTextureUrl.c_str(), player->name.c_str());
|
||||||
|
|
||||||
send(std::shared_ptr<TextureAndGeometryPacket>(
|
send(std::shared_ptr<TextureAndGeometryPacket>(
|
||||||
new TextureAndGeometryPacket(player->customTextureUrl, NULL,
|
new TextureAndGeometryPacket(player->customTextureUrl, nullptr,
|
||||||
0)));
|
0)));
|
||||||
}
|
}
|
||||||
} else if (!player->customTextureUrl.empty() &&
|
} else if (!player->customTextureUrl.empty() &&
|
||||||
app.IsFileInMemoryTextures(player->customTextureUrl)) {
|
app.IsFileInMemoryTextures(player->customTextureUrl)) {
|
||||||
// Update the ref count on the memory texture data
|
// 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(),
|
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 %ls\n",
|
||||||
player->customTextureUrl2.c_str(), player->name.c_str());
|
player->customTextureUrl2.c_str(), player->name.c_str());
|
||||||
send(std::shared_ptr<TexturePacket>(
|
send(std::shared_ptr<TexturePacket>(
|
||||||
new TexturePacket(player->customTextureUrl2, NULL, 0)));
|
new TexturePacket(player->customTextureUrl2, nullptr, 0)));
|
||||||
}
|
}
|
||||||
} else if (!player->customTextureUrl2.empty() &&
|
} else if (!player->customTextureUrl2.empty() &&
|
||||||
app.IsFileInMemoryTextures(player->customTextureUrl2)) {
|
app.IsFileInMemoryTextures(player->customTextureUrl2)) {
|
||||||
// Update the ref count on the memory texture data
|
// 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(),
|
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 =
|
std::vector<std::shared_ptr<SynchedEntityData::DataItem> >* unpackedData =
|
||||||
packet->getUnpackedData();
|
packet->getUnpackedData();
|
||||||
if (unpackedData != NULL) {
|
if (unpackedData != nullptr) {
|
||||||
player->getEntityData()->assignValues(unpackedData);
|
player->getEntityData()->assignValues(unpackedData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -832,7 +832,7 @@ void ClientConnection::handleAddPlayer(
|
||||||
void ClientConnection::handleTeleportEntity(
|
void ClientConnection::handleTeleportEntity(
|
||||||
std::shared_ptr<TeleportEntityPacket> packet) {
|
std::shared_ptr<TeleportEntityPacket> packet) {
|
||||||
std::shared_ptr<Entity> e = getEntity(packet->id);
|
std::shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
e->xp = packet->x;
|
e->xp = packet->x;
|
||||||
e->yp = packet->y;
|
e->yp = packet->y;
|
||||||
e->zp = packet->z;
|
e->zp = packet->z;
|
||||||
|
|
@ -865,7 +865,7 @@ void ClientConnection::handleSetCarriedItem(
|
||||||
void ClientConnection::handleMoveEntity(
|
void ClientConnection::handleMoveEntity(
|
||||||
std::shared_ptr<MoveEntityPacket> packet) {
|
std::shared_ptr<MoveEntityPacket> packet) {
|
||||||
std::shared_ptr<Entity> e = getEntity(packet->id);
|
std::shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
e->xp += packet->xa;
|
e->xp += packet->xa;
|
||||||
e->yp += packet->ya;
|
e->yp += packet->ya;
|
||||||
e->zp += packet->za;
|
e->zp += packet->za;
|
||||||
|
|
@ -887,7 +887,7 @@ void ClientConnection::handleMoveEntity(
|
||||||
void ClientConnection::handleRotateMob(
|
void ClientConnection::handleRotateMob(
|
||||||
std::shared_ptr<RotateHeadPacket> packet) {
|
std::shared_ptr<RotateHeadPacket> packet) {
|
||||||
std::shared_ptr<Entity> e = getEntity(packet->id);
|
std::shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
float yHeadRot = packet->yHeadRot * 360 / 256.f;
|
float yHeadRot = packet->yHeadRot * 360 / 256.f;
|
||||||
e->setYHeadRot(yHeadRot);
|
e->setYHeadRot(yHeadRot);
|
||||||
}
|
}
|
||||||
|
|
@ -895,7 +895,7 @@ void ClientConnection::handleRotateMob(
|
||||||
void ClientConnection::handleMoveEntitySmall(
|
void ClientConnection::handleMoveEntitySmall(
|
||||||
std::shared_ptr<MoveEntityPacketSmall> packet) {
|
std::shared_ptr<MoveEntityPacketSmall> packet) {
|
||||||
std::shared_ptr<Entity> e = getEntity(packet->id);
|
std::shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
e->xp += packet->xa;
|
e->xp += packet->xa;
|
||||||
e->yp += packet->ya;
|
e->yp += packet->ya;
|
||||||
e->zp += packet->za;
|
e->zp += packet->za;
|
||||||
|
|
@ -966,7 +966,7 @@ void ClientConnection::handleMovePlayer(
|
||||||
player->zOld = player->z;
|
player->zOld = player->z;
|
||||||
|
|
||||||
started = true;
|
started = true;
|
||||||
minecraft->setScreen(NULL);
|
minecraft->setScreen(nullptr);
|
||||||
|
|
||||||
// Fix for #105852 - TU12: Content: Gameplay: Local splitscreen Players
|
// Fix for #105852 - TU12: Content: Gameplay: Local splitscreen Players
|
||||||
// are spawned at incorrect places after re-joining previously saved and
|
// are spawned at incorrect places after re-joining previously saved and
|
||||||
|
|
@ -1230,7 +1230,7 @@ void ClientConnection::handleDisconnect(
|
||||||
app.SetDisconnectReason(packet->reason);
|
app.SetDisconnectReason(packet->reason);
|
||||||
|
|
||||||
app.SetAction(m_userIndex, eAppAction_ExitWorld, (void*)TRUE);
|
app.SetAction(m_userIndex, eAppAction_ExitWorld, (void*)TRUE);
|
||||||
// minecraft->setLevel(NULL);
|
// minecraft->setLevel(nullptr);
|
||||||
// minecraft->setScreen(new DisconnectedScreen(L"disconnect.disconnected",
|
// minecraft->setScreen(new DisconnectedScreen(L"disconnect.disconnected",
|
||||||
// L"disconnect.genericReason", &packet->reason));
|
// L"disconnect.genericReason", &packet->reason));
|
||||||
}
|
}
|
||||||
|
|
@ -1256,12 +1256,12 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason,
|
||||||
uiIDA[0] = IDS_CONFIRM_OK;
|
uiIDA[0] = IDS_CONFIRM_OK;
|
||||||
ui.RequestErrorMessage(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1,
|
ui.RequestErrorMessage(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1,
|
||||||
ProfileManager.GetPrimaryPad(),
|
ProfileManager.GetPrimaryPad(),
|
||||||
&ClientConnection::HostDisconnectReturned, NULL);
|
&ClientConnection::HostDisconnectReturned, nullptr);
|
||||||
} else {
|
} else {
|
||||||
app.SetAction(m_userIndex, eAppAction_ExitWorld, (void*)TRUE);
|
app.SetAction(m_userIndex, eAppAction_ExitWorld, (void*)TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// minecraft->setLevel(NULL);
|
// minecraft->setLevel(nullptr);
|
||||||
// minecraft->setScreen(new DisconnectedScreen(L"disconnect.lost", reason,
|
// minecraft->setScreen(new DisconnectedScreen(L"disconnect.lost", reason,
|
||||||
// reasonObjects));
|
// 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
|
// 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
|
// 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
|
// a particle as we don't know what really collected it
|
||||||
|
|
@ -1304,7 +1304,7 @@ void ClientConnection::handleTakeItemEntity(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from != NULL) {
|
if (from != nullptr) {
|
||||||
// If this is a local player, then we only want to do processing for it
|
// If this is a local player, then we only want to do processing for it
|
||||||
// if this connection is associated with the player it is for. In
|
// if this connection is associated with the player it is for. In
|
||||||
// particular, we don't want to remove the item entity until we are
|
// 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
|
// tutorial for the player that actually picked up the item
|
||||||
int playerPad = player->GetXboxPad();
|
int playerPad = player->GetXboxPad();
|
||||||
|
|
||||||
if (minecraft->localgameModes[playerPad] != NULL) {
|
if (minecraft->localgameModes[playerPad] != nullptr) {
|
||||||
// 4J-PB - add in the XP orb sound
|
// 4J-PB - add in the XP orb sound
|
||||||
if (from->GetType() == eTYPE_EXPERIENCEORB) {
|
if (from->GetType() == eTYPE_EXPERIENCEORB) {
|
||||||
float fPitch =
|
float fPitch =
|
||||||
|
|
@ -1766,7 +1766,7 @@ void ClientConnection::handleChat(std::shared_ptr<ChatPacket> packet) {
|
||||||
|
|
||||||
void ClientConnection::handleAnimate(std::shared_ptr<AnimatePacket> packet) {
|
void ClientConnection::handleAnimate(std::shared_ptr<AnimatePacket> packet) {
|
||||||
std::shared_ptr<Entity> e = getEntity(packet->id);
|
std::shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
if (packet->action == AnimatePacket::SWING) {
|
if (packet->action == AnimatePacket::SWING) {
|
||||||
if (e->instanceof(eTYPE_LIVINGENTITY))
|
if (e->instanceof(eTYPE_LIVINGENTITY))
|
||||||
std::dynamic_pointer_cast<LivingEntity>(e)->swing();
|
std::dynamic_pointer_cast<LivingEntity>(e)->swing();
|
||||||
|
|
@ -1797,7 +1797,7 @@ void ClientConnection::handleAnimate(std::shared_ptr<AnimatePacket> packet) {
|
||||||
void ClientConnection::handleEntityActionAtPosition(
|
void ClientConnection::handleEntityActionAtPosition(
|
||||||
std::shared_ptr<EntityActionAtPositionPacket> packet) {
|
std::shared_ptr<EntityActionAtPositionPacket> packet) {
|
||||||
std::shared_ptr<Entity> e = getEntity(packet->id);
|
std::shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
if (packet->action == EntityActionAtPositionPacket::START_SLEEP) {
|
if (packet->action == EntityActionAtPositionPacket::START_SLEEP) {
|
||||||
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
|
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
|
||||||
player->startSleepInBed(packet->x, packet->y, packet->z);
|
player->startSleepInBed(packet->x, packet->y, packet->z);
|
||||||
|
|
@ -2000,7 +2000,7 @@ void ClientConnection::handleAddMob(std::shared_ptr<AddMobPacket> packet) {
|
||||||
mob->xRotp = packet->xRot;
|
mob->xRotp = packet->xRot;
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Entity> >* subEntities = mob->getSubEntities();
|
std::vector<std::shared_ptr<Entity> >* subEntities = mob->getSubEntities();
|
||||||
if (subEntities != NULL) {
|
if (subEntities != nullptr) {
|
||||||
int offs = packet->id - mob->entityId;
|
int offs = packet->id - mob->entityId;
|
||||||
// for (int i = 0; i < subEntities.length; i++)
|
// for (int i = 0; i < subEntities.length; i++)
|
||||||
for (auto it = subEntities->begin(); it != subEntities->end();
|
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 =
|
std::vector<std::shared_ptr<SynchedEntityData::DataItem> >* unpackedData =
|
||||||
packet->getUnpackedData();
|
packet->getUnpackedData();
|
||||||
if (unpackedData != NULL) {
|
if (unpackedData != nullptr) {
|
||||||
mob->getEntityData()->assignValues(unpackedData);
|
mob->getEntityData()->assignValues(unpackedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2057,9 +2057,9 @@ void ClientConnection::handleEntityLinkPacket(
|
||||||
// 4J: If the destination entity couldn't be found, defer handling of this
|
// 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
|
// packet This was added to support leashing (the entity link packet is sent
|
||||||
// before the add entity packet)
|
// 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
|
// 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));
|
deferredEntityLinkPackets.push_back(DeferredEntityLinkPacket(packet));
|
||||||
return;
|
return;
|
||||||
|
|
@ -2073,16 +2073,16 @@ void ClientConnection::handleEntityLinkPacket(
|
||||||
->entityId) {
|
->entityId) {
|
||||||
sourceEntity = Minecraft::GetInstance()->localplayers[m_userIndex];
|
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);
|
(std::dynamic_pointer_cast<Boat>(destEntity))->setDoLerp(false);
|
||||||
|
|
||||||
displayMountMessage =
|
displayMountMessage =
|
||||||
(sourceEntity->riding == NULL && destEntity != NULL);
|
(sourceEntity->riding == nullptr && destEntity != nullptr);
|
||||||
} else if (destEntity != NULL && destEntity->instanceof(eTYPE_BOAT)) {
|
} else if (destEntity != nullptr && destEntity->instanceof(eTYPE_BOAT)) {
|
||||||
(std::dynamic_pointer_cast<Boat>(destEntity))->setDoLerp(true);
|
(std::dynamic_pointer_cast<Boat>(destEntity))->setDoLerp(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sourceEntity == NULL) return;
|
if (sourceEntity == nullptr) return;
|
||||||
|
|
||||||
sourceEntity->ride(destEntity);
|
sourceEntity->ride(destEntity);
|
||||||
|
|
||||||
|
|
@ -2095,8 +2095,8 @@ void ClientConnection::handleEntityLinkPacket(
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
} else if (packet->type == SetEntityLinkPacket::LEASH) {
|
} else if (packet->type == SetEntityLinkPacket::LEASH) {
|
||||||
if ((sourceEntity != NULL) && sourceEntity->instanceof(eTYPE_MOB)) {
|
if ((sourceEntity != nullptr) && sourceEntity->instanceof(eTYPE_MOB)) {
|
||||||
if (destEntity != NULL) {
|
if (destEntity != nullptr) {
|
||||||
(std::dynamic_pointer_cast<Mob>(sourceEntity))
|
(std::dynamic_pointer_cast<Mob>(sourceEntity))
|
||||||
->setLeashedTo(destEntity, false);
|
->setLeashedTo(destEntity, false);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2110,7 +2110,7 @@ void ClientConnection::handleEntityLinkPacket(
|
||||||
void ClientConnection::handleEntityEvent(
|
void ClientConnection::handleEntityEvent(
|
||||||
std::shared_ptr<EntityEventPacket> packet) {
|
std::shared_ptr<EntityEventPacket> packet) {
|
||||||
std::shared_ptr<Entity> e = getEntity(packet->entityId);
|
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) {
|
std::shared_ptr<Entity> ClientConnection::getEntity(int entityId) {
|
||||||
|
|
@ -2134,7 +2134,7 @@ void ClientConnection::handleSetHealth(
|
||||||
|
|
||||||
// We need food
|
// We need food
|
||||||
if (packet->food < FoodConstants::HEAL_LEVEL - 1) {
|
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]->hasInfiniteItems()) {
|
||||||
minecraft->localgameModes[m_userIndex]
|
minecraft->localgameModes[m_userIndex]
|
||||||
->getTutorial()
|
->getTutorial()
|
||||||
|
|
@ -2162,7 +2162,7 @@ void ClientConnection::handleTexture(std::shared_ptr<TexturePacket> packet) {
|
||||||
wprintf(L"Client received request for custom texture %ls\n",
|
wprintf(L"Client received request for custom texture %ls\n",
|
||||||
packet->textureName.c_str());
|
packet->textureName.c_str());
|
||||||
#endif
|
#endif
|
||||||
std::uint8_t* pbData = NULL;
|
std::uint8_t* pbData = nullptr;
|
||||||
unsigned int dwBytes = 0;
|
unsigned int dwBytes = 0;
|
||||||
app.GetMemFileDetails(packet->textureName, &pbData, &dwBytes);
|
app.GetMemFileDetails(packet->textureName, &pbData, &dwBytes);
|
||||||
|
|
||||||
|
|
@ -2197,7 +2197,7 @@ void ClientConnection::handleTextureAndGeometry(
|
||||||
L"Client received request for custom texture and geometry %ls\n",
|
L"Client received request for custom texture and geometry %ls\n",
|
||||||
packet->textureName.c_str());
|
packet->textureName.c_str());
|
||||||
#endif
|
#endif
|
||||||
std::uint8_t* pbData = NULL;
|
std::uint8_t* pbData = nullptr;
|
||||||
unsigned int dwBytes = 0;
|
unsigned int dwBytes = 0;
|
||||||
app.GetMemFileDetails(packet->textureName, &pbData, &dwBytes);
|
app.GetMemFileDetails(packet->textureName, &pbData, &dwBytes);
|
||||||
DLCSkinFile* pDLCSkinFile =
|
DLCSkinFile* pDLCSkinFile =
|
||||||
|
|
@ -2253,7 +2253,7 @@ void ClientConnection::handleTextureAndGeometry(
|
||||||
void ClientConnection::handleTextureChange(
|
void ClientConnection::handleTextureChange(
|
||||||
std::shared_ptr<TextureChangePacket> packet) {
|
std::shared_ptr<TextureChangePacket> packet) {
|
||||||
std::shared_ptr<Entity> e = getEntity(packet->id);
|
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);
|
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
|
||||||
|
|
||||||
bool isLocalPlayer = false;
|
bool isLocalPlayer = false;
|
||||||
|
|
@ -2297,21 +2297,21 @@ void ClientConnection::handleTextureChange(
|
||||||
packet->path.c_str(), player->name.c_str());
|
packet->path.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
send(std::shared_ptr<TexturePacket>(
|
send(std::shared_ptr<TexturePacket>(
|
||||||
new TexturePacket(packet->path, NULL, 0)));
|
new TexturePacket(packet->path, nullptr, 0)));
|
||||||
}
|
}
|
||||||
} else if (!packet->path.empty() &&
|
} else if (!packet->path.empty() &&
|
||||||
app.IsFileInMemoryTextures(packet->path)) {
|
app.IsFileInMemoryTextures(packet->path)) {
|
||||||
// Update the ref count on the memory texture data
|
// Update the ref count on the memory texture data
|
||||||
app.AddMemoryTextureFile(packet->path, NULL, 0);
|
app.AddMemoryTextureFile(packet->path, nullptr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::handleTextureAndGeometryChange(
|
void ClientConnection::handleTextureAndGeometryChange(
|
||||||
std::shared_ptr<TextureAndGeometryChangePacket> packet) {
|
std::shared_ptr<TextureAndGeometryChangePacket> packet) {
|
||||||
std::shared_ptr<Entity> e = getEntity(packet->id);
|
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);
|
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
|
|
||||||
bool isLocalPlayer = false;
|
bool isLocalPlayer = false;
|
||||||
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
||||||
|
|
@ -2344,12 +2344,12 @@ void ClientConnection::handleTextureAndGeometryChange(
|
||||||
packet->path.c_str(), player->name.c_str());
|
packet->path.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
send(std::shared_ptr<TextureAndGeometryPacket>(
|
send(std::shared_ptr<TextureAndGeometryPacket>(
|
||||||
new TextureAndGeometryPacket(packet->path, NULL, 0)));
|
new TextureAndGeometryPacket(packet->path, nullptr, 0)));
|
||||||
}
|
}
|
||||||
} else if (!packet->path.empty() &&
|
} else if (!packet->path.empty() &&
|
||||||
app.IsFileInMemoryTextures(packet->path)) {
|
app.IsFileInMemoryTextures(packet->path)) {
|
||||||
// Update the ref count on the memory texture data
|
// 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* dimensionLevel =
|
||||||
(MultiPlayerLevel*)minecraft->getLevel(packet->dimension);
|
(MultiPlayerLevel*)minecraft->getLevel(packet->dimension);
|
||||||
if (dimensionLevel == NULL) {
|
if (dimensionLevel == nullptr) {
|
||||||
dimensionLevel = new MultiPlayerLevel(
|
dimensionLevel = new MultiPlayerLevel(
|
||||||
this,
|
this,
|
||||||
new LevelSettings(
|
new LevelSettings(
|
||||||
|
|
@ -2378,7 +2378,7 @@ void ClientConnection::handleRespawn(std::shared_ptr<RespawnPacket> packet) {
|
||||||
|
|
||||||
// 4J Stu - We want to shared the savedDataStorage between both
|
// 4J Stu - We want to shared the savedDataStorage between both
|
||||||
// levels
|
// levels
|
||||||
// if( dimensionLevel->savedDataStorage != NULL )
|
// if( dimensionLevel->savedDataStorage != nullptr )
|
||||||
//{
|
//{
|
||||||
// Don't need to delete it here as it belongs to a client connection
|
// Don't need to delete it here as it belongs to a client connection
|
||||||
// while will delete it when it's done
|
// 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);
|
// minecraft->addPendingLocalConnection(m_userIndex, this);
|
||||||
|
|
||||||
|
|
||||||
if (minecraft->localgameModes[m_userIndex] != NULL) {
|
if (minecraft->localgameModes[m_userIndex] != nullptr) {
|
||||||
TutorialMode* gameMode =
|
TutorialMode* gameMode =
|
||||||
(TutorialMode*)minecraft->localgameModes[m_userIndex];
|
(TutorialMode*)minecraft->localgameModes[m_userIndex];
|
||||||
gameMode->getTutorial()->showTutorialPopup(false);
|
gameMode->getTutorial()->showTutorialPopup(false);
|
||||||
|
|
@ -2718,8 +2718,8 @@ void ClientConnection::handleContainerSetSlot(
|
||||||
if (packet->slot >= 36 && packet->slot < 36 + 9) {
|
if (packet->slot >= 36 && packet->slot < 36 + 9) {
|
||||||
std::shared_ptr<ItemInstance> lastItem =
|
std::shared_ptr<ItemInstance> lastItem =
|
||||||
player->inventoryMenu->getSlot(packet->slot)->getItem();
|
player->inventoryMenu->getSlot(packet->slot)->getItem();
|
||||||
if (packet->item != NULL) {
|
if (packet->item != nullptr) {
|
||||||
if (lastItem == NULL ||
|
if (lastItem == nullptr ||
|
||||||
lastItem->count < packet->item->count) {
|
lastItem->count < packet->item->count) {
|
||||||
packet->item->popTime = Inventory::POP_TIME_DURATION;
|
packet->item->popTime = Inventory::POP_TIME_DURATION;
|
||||||
}
|
}
|
||||||
|
|
@ -2736,13 +2736,13 @@ void ClientConnection::handleContainerAck(
|
||||||
std::shared_ptr<ContainerAckPacket> packet) {
|
std::shared_ptr<ContainerAckPacket> packet) {
|
||||||
std::shared_ptr<MultiplayerLocalPlayer> player =
|
std::shared_ptr<MultiplayerLocalPlayer> player =
|
||||||
minecraft->localplayers[m_userIndex];
|
minecraft->localplayers[m_userIndex];
|
||||||
AbstractContainerMenu* menu = NULL;
|
AbstractContainerMenu* menu = nullptr;
|
||||||
if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY) {
|
if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY) {
|
||||||
menu = player->inventoryMenu;
|
menu = player->inventoryMenu;
|
||||||
} else if (packet->containerId == player->containerMenu->containerId) {
|
} else if (packet->containerId == player->containerMenu->containerId) {
|
||||||
menu = player->containerMenu;
|
menu = player->containerMenu;
|
||||||
}
|
}
|
||||||
if (menu != NULL) {
|
if (menu != nullptr) {
|
||||||
if (!packet->accepted) {
|
if (!packet->accepted) {
|
||||||
send(std::shared_ptr<ContainerAckPacket>(new ContainerAckPacket(
|
send(std::shared_ptr<ContainerAckPacket>(new ContainerAckPacket(
|
||||||
packet->containerId, packet->uid, true)));
|
packet->containerId, packet->uid, true)));
|
||||||
|
|
@ -2765,7 +2765,7 @@ void ClientConnection::handleTileEditorOpen(
|
||||||
std::shared_ptr<TileEditorOpenPacket> packet) {
|
std::shared_ptr<TileEditorOpenPacket> packet) {
|
||||||
std::shared_ptr<TileEntity> tileEntity =
|
std::shared_ptr<TileEntity> tileEntity =
|
||||||
level->getTileEntity(packet->x, packet->y, packet->z);
|
level->getTileEntity(packet->x, packet->y, packet->z);
|
||||||
if (tileEntity != NULL) {
|
if (tileEntity != nullptr) {
|
||||||
minecraft->localplayers[m_userIndex]->openTextEdit(tileEntity);
|
minecraft->localplayers[m_userIndex]->openTextEdit(tileEntity);
|
||||||
} else if (packet->editorType == TileEditorOpenPacket::SIGN) {
|
} else if (packet->editorType == TileEditorOpenPacket::SIGN) {
|
||||||
std::shared_ptr<SignTileEntity> localSignDummy =
|
std::shared_ptr<SignTileEntity> localSignDummy =
|
||||||
|
|
@ -2786,7 +2786,7 @@ void ClientConnection::handleSignUpdate(
|
||||||
minecraft->level->getTileEntity(packet->x, packet->y, packet->z);
|
minecraft->level->getTileEntity(packet->x, packet->y, packet->z);
|
||||||
|
|
||||||
// 4J-PB - on a client connecting, the line below fails
|
// 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::shared_ptr<SignTileEntity> ste =
|
||||||
std::dynamic_pointer_cast<SignTileEntity>(te);
|
std::dynamic_pointer_cast<SignTileEntity>(te);
|
||||||
for (int i = 0; i < MAX_SIGN_LINES; i++) {
|
for (int i = 0; i < MAX_SIGN_LINES; i++) {
|
||||||
|
|
@ -2801,7 +2801,7 @@ void ClientConnection::handleSignUpdate(
|
||||||
ste->setChanged();
|
ste->setChanged();
|
||||||
} else {
|
} else {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"std::dynamic_pointer_cast<SignTileEntity>(te) == NULL\n");
|
"std::dynamic_pointer_cast<SignTileEntity>(te) == nullptr\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
app.DebugPrintf("hasChunkAt failed\n");
|
app.DebugPrintf("hasChunkAt failed\n");
|
||||||
|
|
@ -2814,23 +2814,23 @@ void ClientConnection::handleTileEntityData(
|
||||||
std::shared_ptr<TileEntity> te =
|
std::shared_ptr<TileEntity> te =
|
||||||
minecraft->level->getTileEntity(packet->x, packet->y, packet->z);
|
minecraft->level->getTileEntity(packet->x, packet->y, packet->z);
|
||||||
|
|
||||||
if (te != NULL) {
|
if (te != nullptr) {
|
||||||
if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER &&
|
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(
|
std::dynamic_pointer_cast<MobSpawnerTileEntity>(te)->load(
|
||||||
packet->tag);
|
packet->tag);
|
||||||
} else if (packet->type == TileEntityDataPacket::TYPE_ADV_COMMAND &&
|
} else if (packet->type == TileEntityDataPacket::TYPE_ADV_COMMAND &&
|
||||||
std::dynamic_pointer_cast<CommandBlockEntity>(te) !=
|
std::dynamic_pointer_cast<CommandBlockEntity>(te) !=
|
||||||
NULL) {
|
nullptr) {
|
||||||
std::dynamic_pointer_cast<CommandBlockEntity>(te)->load(
|
std::dynamic_pointer_cast<CommandBlockEntity>(te)->load(
|
||||||
packet->tag);
|
packet->tag);
|
||||||
} else if (packet->type == TileEntityDataPacket::TYPE_BEACON &&
|
} else if (packet->type == TileEntityDataPacket::TYPE_BEACON &&
|
||||||
std::dynamic_pointer_cast<BeaconTileEntity>(te) !=
|
std::dynamic_pointer_cast<BeaconTileEntity>(te) !=
|
||||||
NULL) {
|
nullptr) {
|
||||||
std::dynamic_pointer_cast<BeaconTileEntity>(te)->load(
|
std::dynamic_pointer_cast<BeaconTileEntity>(te)->load(
|
||||||
packet->tag);
|
packet->tag);
|
||||||
} else if (packet->type == TileEntityDataPacket::TYPE_SKULL &&
|
} 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(
|
std::dynamic_pointer_cast<SkullTileEntity>(te)->load(
|
||||||
packet->tag);
|
packet->tag);
|
||||||
}
|
}
|
||||||
|
|
@ -2841,7 +2841,7 @@ void ClientConnection::handleTileEntityData(
|
||||||
void ClientConnection::handleContainerSetData(
|
void ClientConnection::handleContainerSetData(
|
||||||
std::shared_ptr<ContainerSetDataPacket> packet) {
|
std::shared_ptr<ContainerSetDataPacket> packet) {
|
||||||
onUnhandledPacket(packet);
|
onUnhandledPacket(packet);
|
||||||
if (minecraft->localplayers[m_userIndex]->containerMenu != NULL &&
|
if (minecraft->localplayers[m_userIndex]->containerMenu != nullptr &&
|
||||||
minecraft->localplayers[m_userIndex]->containerMenu->containerId ==
|
minecraft->localplayers[m_userIndex]->containerMenu->containerId ==
|
||||||
packet->containerId) {
|
packet->containerId) {
|
||||||
minecraft->localplayers[m_userIndex]->containerMenu->setData(
|
minecraft->localplayers[m_userIndex]->containerMenu->setData(
|
||||||
|
|
@ -2852,7 +2852,7 @@ void ClientConnection::handleContainerSetData(
|
||||||
void ClientConnection::handleSetEquippedItem(
|
void ClientConnection::handleSetEquippedItem(
|
||||||
std::shared_ptr<SetEquippedItemPacket> packet) {
|
std::shared_ptr<SetEquippedItemPacket> packet) {
|
||||||
std::shared_ptr<Entity> entity = getEntity(packet->entity);
|
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
|
// 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer
|
||||||
// Encountered: TU7: Content: Art: Aura of enchanted item is not
|
// Encountered: TU7: Content: Art: Aura of enchanted item is not
|
||||||
// displayed for other players in online game
|
// displayed for other players in online game
|
||||||
|
|
@ -2881,8 +2881,8 @@ void ClientConnection::handleTileDestruction(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientConnection::canHandleAsyncPackets() {
|
bool ClientConnection::canHandleAsyncPackets() {
|
||||||
return minecraft != NULL && minecraft->level != NULL &&
|
return minecraft != nullptr && minecraft->level != nullptr &&
|
||||||
minecraft->localplayers[m_userIndex] != NULL && level != NULL;
|
minecraft->localplayers[m_userIndex] != nullptr && level != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::handleGameEvent(
|
void ClientConnection::handleGameEvent(
|
||||||
|
|
@ -2891,7 +2891,7 @@ void ClientConnection::handleGameEvent(
|
||||||
int param = gameEventPacket->param;
|
int param = gameEventPacket->param;
|
||||||
if (event >= 0 && event < GameEventPacket::EVENT_LANGUAGE_ID_LENGTH) {
|
if (event >= 0 && event < GameEventPacket::EVENT_LANGUAGE_ID_LENGTH) {
|
||||||
if (GameEventPacket::EVENT_LANGUAGE_ID[event] >
|
if (GameEventPacket::EVENT_LANGUAGE_ID[event] >
|
||||||
0) // 4J - was NULL check
|
0) // 4J - was nullptr check
|
||||||
{
|
{
|
||||||
minecraft->localplayers[m_userIndex]->displayClientMessage(
|
minecraft->localplayers[m_userIndex]->displayClientMessage(
|
||||||
GameEventPacket::EVENT_LANGUAGE_ID[event]);
|
GameEventPacket::EVENT_LANGUAGE_ID[event]);
|
||||||
|
|
@ -2912,12 +2912,12 @@ void ClientConnection::handleGameEvent(
|
||||||
app.DebugPrintf("handleGameEvent packet for WIN_GAME - %d\n",
|
app.DebugPrintf("handleGameEvent packet for WIN_GAME - %d\n",
|
||||||
m_userIndex);
|
m_userIndex);
|
||||||
// This just allows it to be shown
|
// This just allows it to be shown
|
||||||
if (minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL)
|
if (minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr)
|
||||||
minecraft->localgameModes[ProfileManager.GetPrimaryPad()]
|
minecraft->localgameModes[ProfileManager.GetPrimaryPad()]
|
||||||
->getTutorial()
|
->getTutorial()
|
||||||
->showTutorialPopup(false);
|
->showTutorialPopup(false);
|
||||||
ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_EndPoem,
|
ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_EndPoem,
|
||||||
NULL, eUILayer_Scene, eUIGroup_Fullscreen);
|
nullptr, eUILayer_Scene, eUIGroup_Fullscreen);
|
||||||
} else if (event == GameEventPacket::START_SAVING) {
|
} else if (event == GameEventPacket::START_SAVING) {
|
||||||
if (!g_NetworkManager.IsHost()) {
|
if (!g_NetworkManager.IsHost()) {
|
||||||
// Move app started to here so that it happens immediately otherwise
|
// Move app started to here so that it happens immediately otherwise
|
||||||
|
|
@ -2953,8 +2953,8 @@ void ClientConnection::handleLevelEvent(
|
||||||
std::shared_ptr<LevelEventPacket> packet) {
|
std::shared_ptr<LevelEventPacket> packet) {
|
||||||
if (packet->type == LevelEvent::SOUND_DRAGON_DEATH) {
|
if (packet->type == LevelEvent::SOUND_DRAGON_DEATH) {
|
||||||
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
||||||
if (minecraft->localplayers[i] != NULL &&
|
if (minecraft->localplayers[i] != nullptr &&
|
||||||
minecraft->localplayers[i]->level != NULL &&
|
minecraft->localplayers[i]->level != nullptr &&
|
||||||
minecraft->localplayers[i]->level->dimension->id == 1) {
|
minecraft->localplayers[i]->level->dimension->id == 1) {
|
||||||
minecraft->localplayers[i]->awardStat(
|
minecraft->localplayers[i]->awardStat(
|
||||||
GenericStats::completeTheEnd(),
|
GenericStats::completeTheEnd(),
|
||||||
|
|
@ -2984,7 +2984,7 @@ void ClientConnection::handleAwardStat(
|
||||||
void ClientConnection::handleUpdateMobEffect(
|
void ClientConnection::handleUpdateMobEffect(
|
||||||
std::shared_ptr<UpdateMobEffectPacket> packet) {
|
std::shared_ptr<UpdateMobEffectPacket> packet) {
|
||||||
std::shared_ptr<Entity> e = getEntity(packet->entityId);
|
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
|
//( std::dynamic_pointer_cast<LivingEntity>(e) )->addEffect(new
|
||||||
// MobEffectInstance(packet->effectId, packet->effectDurationTicks,
|
// MobEffectInstance(packet->effectId, packet->effectDurationTicks,
|
||||||
|
|
@ -2999,7 +2999,7 @@ void ClientConnection::handleUpdateMobEffect(
|
||||||
void ClientConnection::handleRemoveMobEffect(
|
void ClientConnection::handleRemoveMobEffect(
|
||||||
std::shared_ptr<RemoveMobEffectPacket> packet) {
|
std::shared_ptr<RemoveMobEffectPacket> packet) {
|
||||||
std::shared_ptr<Entity> e = getEntity(packet->entityId);
|
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))
|
(std::dynamic_pointer_cast<LivingEntity>(e))
|
||||||
->removeEffectNoUpdate(packet->effectId);
|
->removeEffectNoUpdate(packet->effectId);
|
||||||
|
|
@ -3015,7 +3015,7 @@ void ClientConnection::handlePlayerInfo(
|
||||||
INetworkPlayer* networkPlayer =
|
INetworkPlayer* networkPlayer =
|
||||||
g_NetworkManager.GetPlayerBySmallId(packet->m_networkSmallId);
|
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
|
// Some settings should always be considered on for the host player
|
||||||
Player::enableAllPlayerPrivileges(startingPrivileges, true);
|
Player::enableAllPlayerPrivileges(startingPrivileges, true);
|
||||||
Player::setPlayerGamePrivilege(startingPrivileges,
|
Player::setPlayerGamePrivilege(startingPrivileges,
|
||||||
|
|
@ -3027,17 +3027,17 @@ void ClientConnection::handlePlayerInfo(
|
||||||
packet->m_playerPrivileges);
|
packet->m_playerPrivileges);
|
||||||
|
|
||||||
std::shared_ptr<Entity> entity = getEntity(packet->m_entityId);
|
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::shared_ptr<Player> player =
|
||||||
std::dynamic_pointer_cast<Player>(entity);
|
std::dynamic_pointer_cast<Player>(entity);
|
||||||
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All,
|
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All,
|
||||||
packet->m_playerPrivileges);
|
packet->m_playerPrivileges);
|
||||||
}
|
}
|
||||||
if (networkPlayer != NULL && networkPlayer->IsLocal()) {
|
if (networkPlayer != nullptr && networkPlayer->IsLocal()) {
|
||||||
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
||||||
std::shared_ptr<MultiplayerLocalPlayer> localPlayer =
|
std::shared_ptr<MultiplayerLocalPlayer> localPlayer =
|
||||||
minecraft->localplayers[i];
|
minecraft->localplayers[i];
|
||||||
if (localPlayer != NULL && localPlayer->connection != NULL &&
|
if (localPlayer != nullptr && localPlayer->connection != nullptr &&
|
||||||
localPlayer->connection->getNetworkPlayer() == networkPlayer) {
|
localPlayer->connection->getNetworkPlayer() == networkPlayer) {
|
||||||
localPlayer->setPlayerGamePrivilege(
|
localPlayer->setPlayerGamePrivilege(
|
||||||
Player::ePlayerGamePrivilege_All,
|
Player::ePlayerGamePrivilege_All,
|
||||||
|
|
@ -3272,7 +3272,7 @@ void ClientConnection::handleServerSettingsChanged(
|
||||||
app.SetGameHostOption(eGameHostOption_All, packet->data);
|
app.SetGameHostOption(eGameHostOption_All, packet->data);
|
||||||
} else if (packet->action == ServerSettingsChangedPacket::HOST_DIFFICULTY) {
|
} else if (packet->action == ServerSettingsChangedPacket::HOST_DIFFICULTY) {
|
||||||
for (unsigned int i = 0; i < minecraft->levels.length; ++i) {
|
for (unsigned int i = 0; i < minecraft->levels.length; ++i) {
|
||||||
if (minecraft->levels[i] != NULL) {
|
if (minecraft->levels[i] != nullptr) {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"ClientConnection::handleServerSettingsChanged - "
|
"ClientConnection::handleServerSettingsChanged - "
|
||||||
"Difficulty = %d",
|
"Difficulty = %d",
|
||||||
|
|
@ -3305,12 +3305,12 @@ void ClientConnection::handleUpdateProgress(
|
||||||
void ClientConnection::handleUpdateGameRuleProgressPacket(
|
void ClientConnection::handleUpdateGameRuleProgressPacket(
|
||||||
std::shared_ptr<UpdateGameRuleProgressPacket> packet) {
|
std::shared_ptr<UpdateGameRuleProgressPacket> packet) {
|
||||||
const wchar_t* string = app.GetGameRulesString(packet->m_messageId);
|
const wchar_t* string = app.GetGameRulesString(packet->m_messageId);
|
||||||
if (string != NULL) {
|
if (string != nullptr) {
|
||||||
std::wstring message(string);
|
std::wstring message(string);
|
||||||
message = GameRuleDefinition::generateDescriptionString(
|
message = GameRuleDefinition::generateDescriptionString(
|
||||||
packet->m_definitionType, message, packet->m_data.data,
|
packet->m_definitionType, message, packet->m_data.data,
|
||||||
packet->m_data.length);
|
packet->m_data.length);
|
||||||
if (minecraft->localgameModes[m_userIndex] != NULL) {
|
if (minecraft->localgameModes[m_userIndex] != nullptr) {
|
||||||
minecraft->localgameModes[m_userIndex]->getTutorial()->setMessage(
|
minecraft->localgameModes[m_userIndex]->getTutorial()->setMessage(
|
||||||
message, packet->m_icon, packet->m_auxValue);
|
message, packet->m_icon, packet->m_auxValue);
|
||||||
}
|
}
|
||||||
|
|
@ -3361,7 +3361,7 @@ int ClientConnection::HostDisconnectReturned(
|
||||||
ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME,
|
ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME,
|
||||||
uiIDA, 2, ProfileManager.GetPrimaryPad(),
|
uiIDA, 2, ProfileManager.GetPrimaryPad(),
|
||||||
&ClientConnection::ExitGameAndSaveReturned,
|
&ClientConnection::ExitGameAndSaveReturned,
|
||||||
NULL);
|
nullptr);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
MinecraftServer::getInstance()->setSaveOnExit(true);
|
MinecraftServer::getInstance()->setSaveOnExit(true);
|
||||||
|
|
@ -3433,7 +3433,7 @@ void ClientConnection::handleParticleEvent(
|
||||||
void ClientConnection::handleUpdateAttributes(
|
void ClientConnection::handleUpdateAttributes(
|
||||||
std::shared_ptr<UpdateAttributesPacket> packet) {
|
std::shared_ptr<UpdateAttributesPacket> packet) {
|
||||||
std::shared_ptr<Entity> entity = getEntity(packet->getEntityId());
|
std::shared_ptr<Entity> entity = getEntity(packet->getEntityId());
|
||||||
if (entity == NULL) return;
|
if (entity == nullptr) return;
|
||||||
|
|
||||||
if (!entity->instanceof(eTYPE_LIVINGENTITY)) {
|
if (!entity->instanceof(eTYPE_LIVINGENTITY)) {
|
||||||
// Entity is not a living entity!
|
// Entity is not a living entity!
|
||||||
|
|
@ -3450,7 +3450,7 @@ void ClientConnection::handleUpdateAttributes(
|
||||||
AttributeInstance* instance =
|
AttributeInstance* instance =
|
||||||
attributes->getInstance(attribute->getId());
|
attributes->getInstance(attribute->getId());
|
||||||
|
|
||||||
if (instance == NULL) {
|
if (instance == nullptr) {
|
||||||
// 4J - TODO: revisit, not familiar with the attribute system, why
|
// 4J - TODO: revisit, not familiar with the attribute system, why
|
||||||
// are we passing in MIN_NORMAL (Java's smallest non-zero value
|
// are we passing in MIN_NORMAL (Java's smallest non-zero value
|
||||||
// conforming to IEEE Standard 754 (?)) and MAX_VALUE
|
// conforming to IEEE Standard 754 (?)) and MAX_VALUE
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ MultiPlayerChunkCache::MultiPlayerChunkCache(Level* level) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
waterChunk = NULL;
|
waterChunk = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->level = level;
|
this->level = level;
|
||||||
|
|
@ -121,7 +121,7 @@ bool MultiPlayerChunkCache::reallyHasChunk(int x, int z) {
|
||||||
int idx = ix * XZSIZE + iz;
|
int idx = ix * XZSIZE + iz;
|
||||||
|
|
||||||
LevelChunk* chunk = cache[idx];
|
LevelChunk* chunk = cache[idx];
|
||||||
if (chunk == NULL) {
|
if (chunk == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return hasData[idx];
|
return hasData[idx];
|
||||||
|
|
@ -157,7 +157,7 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) {
|
||||||
LevelChunk* chunk = cache[idx];
|
LevelChunk* chunk = cache[idx];
|
||||||
LevelChunk* lastChunk = chunk;
|
LevelChunk* lastChunk = chunk;
|
||||||
|
|
||||||
if (chunk == NULL) {
|
if (chunk == nullptr) {
|
||||||
EnterCriticalSection(&m_csLoadCreate);
|
EnterCriticalSection(&m_csLoadCreate);
|
||||||
|
|
||||||
// LevelChunk *chunk;
|
// 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
|
// 4J-JEV: We are about to use shared data, abort if the server is
|
||||||
// stopped and the data is deleted.
|
// 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
|
// If we're the host, then don't create the chunk, share data from
|
||||||
// the server's copy
|
// the server's copy
|
||||||
|
|
@ -249,7 +249,7 @@ LevelChunk* MultiPlayerChunkCache::getChunk(int x, int z) {
|
||||||
int idx = ix * XZSIZE + iz;
|
int idx = ix * XZSIZE + iz;
|
||||||
|
|
||||||
LevelChunk* chunk = cache[idx];
|
LevelChunk* chunk = cache[idx];
|
||||||
if (chunk == NULL) {
|
if (chunk == nullptr) {
|
||||||
return emptyChunk;
|
return emptyChunk;
|
||||||
} else {
|
} else {
|
||||||
return chunk;
|
return chunk;
|
||||||
|
|
@ -269,12 +269,12 @@ void MultiPlayerChunkCache::postProcess(ChunkSource* parent, int x, int z) {}
|
||||||
|
|
||||||
std::vector<Biome::MobSpawnerData*>* MultiPlayerChunkCache::getMobsAt(
|
std::vector<Biome::MobSpawnerData*>* MultiPlayerChunkCache::getMobsAt(
|
||||||
MobCategory* mobCategory, int x, int y, int z) {
|
MobCategory* mobCategory, int x, int y, int z) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TilePos* MultiPlayerChunkCache::findNearestMapFeature(
|
TilePos* MultiPlayerChunkCache::findNearestMapFeature(
|
||||||
Level* level, const std::wstring& featureName, int x, int y, int z) {
|
Level* level, const std::wstring& featureName, int x, int y, int z) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiPlayerChunkCache::recreateLogicStructuresForChunk(int chunkX,
|
void MultiPlayerChunkCache::recreateLogicStructuresForChunk(int chunkX,
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ PendingConnection::PendingConnection(MinecraftServer* server, Socket* socket,
|
||||||
PendingConnection::~PendingConnection() { delete connection; }
|
PendingConnection::~PendingConnection() { delete connection; }
|
||||||
|
|
||||||
void PendingConnection::tick() {
|
void PendingConnection::tick() {
|
||||||
if (acceptedLogin != NULL) {
|
if (acceptedLogin != nullptr) {
|
||||||
this->handleAcceptedLogin(acceptedLogin);
|
this->handleAcceptedLogin(acceptedLogin);
|
||||||
acceptedLogin = nullptr;
|
acceptedLogin = nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +104,7 @@ void PendingConnection::sendPreLoginResponse() {
|
||||||
// PADDY - this is failing when a local player with chat restrictions
|
// PADDY - this is failing when a local player with chat restrictions
|
||||||
// joins an online game
|
// joins an online game
|
||||||
|
|
||||||
if (player != NULL &&
|
if (player != nullptr &&
|
||||||
player->connection->m_offlineXUID != INVALID_XUID &&
|
player->connection->m_offlineXUID != INVALID_XUID &&
|
||||||
player->connection->m_onlineXUID != INVALID_XUID) {
|
player->connection->m_onlineXUID != INVALID_XUID) {
|
||||||
if (player->connection->m_friendsOnlyUGC) {
|
if (player->connection->m_friendsOnlyUGC) {
|
||||||
|
|
@ -114,7 +114,7 @@ void PendingConnection::sendPreLoginResponse() {
|
||||||
// the client
|
// the client
|
||||||
ugcXuids[ugcXuidCount] = player->connection->m_onlineXUID;
|
ugcXuids[ugcXuidCount] = player->connection->m_onlineXUID;
|
||||||
|
|
||||||
if (player->connection->getNetworkPlayer() != NULL &&
|
if (player->connection->getNetworkPlayer() != nullptr &&
|
||||||
player->connection->getNetworkPlayer()->IsHost())
|
player->connection->getNetworkPlayer()->IsHost())
|
||||||
hostIndex = ugcXuidCount;
|
hostIndex = ugcXuidCount;
|
||||||
|
|
||||||
|
|
@ -178,10 +178,10 @@ void PendingConnection::handleAcceptedLogin(
|
||||||
std::shared_ptr<ServerPlayer> playerEntity =
|
std::shared_ptr<ServerPlayer> playerEntity =
|
||||||
server->getPlayers()->getPlayerForLogin(this, name, playerXuid,
|
server->getPlayers()->getPlayerForLogin(this, name, playerXuid,
|
||||||
packet->m_onlineXuid);
|
packet->m_onlineXuid);
|
||||||
if (playerEntity != NULL) {
|
if (playerEntity != nullptr) {
|
||||||
server->getPlayers()->placeNewPlayer(connection, playerEntity, packet);
|
server->getPlayers()->placeNewPlayer(connection, playerEntity, packet);
|
||||||
connection = NULL; // We've moved responsibility for this over to the
|
connection = nullptr; // We've moved responsibility for this over to the
|
||||||
// new PlayerConnection, NULL so we don't delete our
|
// new PlayerConnection, nullptr so we don't delete our
|
||||||
// reference to it here in our dtor
|
// reference to it here in our dtor
|
||||||
}
|
}
|
||||||
done = true;
|
done = true;
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ void PlayerChunkMap::PlayerChunk::add(std::shared_ptr<ServerPlayer> player,
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerChunkMap::PlayerChunk::remove(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
|
// app.DebugPrintf("--- PlayerChunkMap::PlayerChunk::remove
|
||||||
// x=%d\tz=%d\n",x,z);
|
// 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
|
// 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
|
// entity is removed while they are dead, that entity will remain in the
|
||||||
// clients world
|
// clients world
|
||||||
if (player->connection != NULL &&
|
if (player->connection != nullptr &&
|
||||||
player->seenChunks.find(pos) != player->seenChunks.end()) {
|
player->seenChunks.find(pos) != player->seenChunks.end()) {
|
||||||
INetworkPlayer* thisNetPlayer = player->connection->getNetworkPlayer();
|
INetworkPlayer* thisNetPlayer = player->connection->getNetworkPlayer();
|
||||||
bool noOtherPlayersFound = true;
|
bool noOtherPlayersFound = true;
|
||||||
|
|
||||||
if (thisNetPlayer != NULL) {
|
if (thisNetPlayer != nullptr) {
|
||||||
for (auto it = players.begin(); it < players.end(); ++it) {
|
for (auto it = players.begin(); it < players.end(); ++it) {
|
||||||
std::shared_ptr<ServerPlayer> currPlayer = *it;
|
std::shared_ptr<ServerPlayer> currPlayer = *it;
|
||||||
INetworkPlayer* currNetPlayer =
|
INetworkPlayer* currNetPlayer =
|
||||||
currPlayer->connection->getNetworkPlayer();
|
currPlayer->connection->getNetworkPlayer();
|
||||||
if (currNetPlayer != NULL &&
|
if (currNetPlayer != nullptr &&
|
||||||
currNetPlayer->IsSameSystem(thisNetPlayer) &&
|
currNetPlayer->IsSameSystem(thisNetPlayer) &&
|
||||||
currPlayer->seenChunks.find(pos) !=
|
currPlayer->seenChunks.find(pos) !=
|
||||||
currPlayer->seenChunks.end()) {
|
currPlayer->seenChunks.end()) {
|
||||||
|
|
@ -155,7 +155,7 @@ void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr<ServerPlayer> player) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// app.DebugPrintf("PlayerChunkMap::PlayerChunk::remove - QNetPlayer
|
// 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;
|
bool dontSend = false;
|
||||||
if (sentTo.size()) {
|
if (sentTo.size()) {
|
||||||
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
||||||
if (thisPlayer == NULL) {
|
if (thisPlayer == nullptr) {
|
||||||
dontSend = true;
|
dontSend = true;
|
||||||
} else {
|
} else {
|
||||||
for (unsigned int j = 0; j < sentTo.size(); j++) {
|
for (unsigned int j = 0; j < sentTo.size(); j++) {
|
||||||
std::shared_ptr<ServerPlayer> player2 = sentTo[j];
|
std::shared_ptr<ServerPlayer> player2 = sentTo[j];
|
||||||
INetworkPlayer* otherPlayer =
|
INetworkPlayer* otherPlayer =
|
||||||
player2->connection->getNetworkPlayer();
|
player2->connection->getNetworkPlayer();
|
||||||
if (otherPlayer != NULL &&
|
if (otherPlayer != nullptr &&
|
||||||
thisPlayer->IsSameSystem(otherPlayer)) {
|
thisPlayer->IsSameSystem(otherPlayer)) {
|
||||||
dontSend = true;
|
dontSend = true;
|
||||||
}
|
}
|
||||||
|
|
@ -275,7 +275,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr<Packet> packet) {
|
||||||
parent->level->getServer()->getPlayers()->players[i];
|
parent->level->getServer()->getPlayers()->players[i];
|
||||||
// Don't worry about local players, they get all their updates through
|
// Don't worry about local players, they get all their updates through
|
||||||
// sharing level with the server anyway
|
// sharing level with the server anyway
|
||||||
if (player->connection == NULL) continue;
|
if (player->connection == nullptr) continue;
|
||||||
if (player->connection->isLocal()) continue;
|
if (player->connection->isLocal()) continue;
|
||||||
|
|
||||||
// Don't worry about this player if they haven't had this chunk yet
|
// 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;
|
bool dontSend = false;
|
||||||
if (sentTo.size()) {
|
if (sentTo.size()) {
|
||||||
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
||||||
if (thisPlayer == NULL) {
|
if (thisPlayer == nullptr) {
|
||||||
dontSend = true;
|
dontSend = true;
|
||||||
} else {
|
} else {
|
||||||
for (unsigned int j = 0; j < sentTo.size(); j++) {
|
for (unsigned int j = 0; j < sentTo.size(); j++) {
|
||||||
std::shared_ptr<ServerPlayer> player2 = sentTo[j];
|
std::shared_ptr<ServerPlayer> player2 = sentTo[j];
|
||||||
INetworkPlayer* otherPlayer =
|
INetworkPlayer* otherPlayer =
|
||||||
player2->connection->getNetworkPlayer();
|
player2->connection->getNetworkPlayer();
|
||||||
if (otherPlayer != NULL &&
|
if (otherPlayer != nullptr &&
|
||||||
thisPlayer->IsSameSystem(otherPlayer)) {
|
thisPlayer->IsSameSystem(otherPlayer)) {
|
||||||
dontSend = true;
|
dontSend = true;
|
||||||
}
|
}
|
||||||
|
|
@ -387,9 +387,9 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr<TileEntity> te) {
|
void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr<TileEntity> te) {
|
||||||
if (te != NULL) {
|
if (te != nullptr) {
|
||||||
std::shared_ptr<Packet> p = te->getUpdatePacket();
|
std::shared_ptr<Packet> p = te->getUpdatePacket();
|
||||||
if (p != NULL) {
|
if (p != nullptr) {
|
||||||
broadcast(p);
|
broadcast(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -473,7 +473,7 @@ PlayerChunkMap::PlayerChunk* PlayerChunkMap::getChunk(int x, int z,
|
||||||
int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32);
|
int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32);
|
||||||
auto it = chunks.find(id);
|
auto it = chunks.find(id);
|
||||||
|
|
||||||
PlayerChunk* chunk = NULL;
|
PlayerChunk* chunk = nullptr;
|
||||||
if (it != chunks.end()) {
|
if (it != chunks.end()) {
|
||||||
chunk = it->second;
|
chunk = it->second;
|
||||||
} else if (create) {
|
} else if (create) {
|
||||||
|
|
@ -552,7 +552,7 @@ void PlayerChunkMap::broadcastTileUpdate(std::shared_ptr<Packet> packet, int x,
|
||||||
int xc = x >> 4;
|
int xc = x >> 4;
|
||||||
int zc = z >> 4;
|
int zc = z >> 4;
|
||||||
PlayerChunk* chunk = getChunk(xc, zc, false);
|
PlayerChunk* chunk = getChunk(xc, zc, false);
|
||||||
if (chunk != NULL) {
|
if (chunk != nullptr) {
|
||||||
chunk->broadcast(packet);
|
chunk->broadcast(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -561,7 +561,7 @@ void PlayerChunkMap::tileChanged(int x, int y, int z) {
|
||||||
int xc = x >> 4;
|
int xc = x >> 4;
|
||||||
int zc = z >> 4;
|
int zc = z >> 4;
|
||||||
PlayerChunk* chunk = getChunk(xc, zc, false);
|
PlayerChunk* chunk = getChunk(xc, zc, false);
|
||||||
if (chunk != NULL) {
|
if (chunk != nullptr) {
|
||||||
chunk->tileChanged(x & 15, y, z & 15);
|
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 xc = x >> 4;
|
||||||
int zc = z >> 4;
|
int zc = z >> 4;
|
||||||
PlayerChunk* chunk = getChunk(xc, zc, false);
|
PlayerChunk* chunk = getChunk(xc, zc, false);
|
||||||
if (chunk != NULL) {
|
if (chunk != nullptr) {
|
||||||
chunk->prioritiseTileChanges();
|
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 x = xc - radius; x <= xc + radius; x++)
|
||||||
for (int z = zc - radius; z <= zc + radius; z++) {
|
for (int z = zc - radius; z <= zc + radius; z++) {
|
||||||
PlayerChunk* playerChunk = getChunk(x, z, false);
|
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);
|
auto it = find(players.begin(), players.end(), player);
|
||||||
|
|
@ -761,7 +761,7 @@ bool PlayerChunkMap::isPlayerIn(std::shared_ptr<ServerPlayer> player,
|
||||||
int xChunk, int zChunk) {
|
int xChunk, int zChunk) {
|
||||||
PlayerChunk* chunk = getChunk(xChunk, zChunk, false);
|
PlayerChunk* chunk = getChunk(xChunk, zChunk, false);
|
||||||
|
|
||||||
if (chunk == NULL) {
|
if (chunk == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
auto it1 =
|
auto it1 =
|
||||||
|
|
@ -771,7 +771,7 @@ bool PlayerChunkMap::isPlayerIn(std::shared_ptr<ServerPlayer> player,
|
||||||
return it1 != chunk->players.end() && it2 == player->chunksToSend.end();
|
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);
|
// !player->chunksToSend->contains(chunk->pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ void PlayerConnection::handleMovePlayer(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (synched) {
|
if (synched) {
|
||||||
if (player->riding != NULL) {
|
if (player->riding != nullptr) {
|
||||||
float yRotT = player->yRot;
|
float yRotT = player->yRot;
|
||||||
float xRotT = player->xRot;
|
float xRotT = player->xRot;
|
||||||
player->riding->positionRider();
|
player->riding->positionRider();
|
||||||
|
|
@ -180,7 +180,7 @@ void PlayerConnection::handleMovePlayer(
|
||||||
player->doTick(false);
|
player->doTick(false);
|
||||||
player->ySlideOffset = 0;
|
player->ySlideOffset = 0;
|
||||||
player->absMoveTo(xt, yt, zt, yRotT, xRotT);
|
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);
|
server->getPlayers()->move(player);
|
||||||
|
|
||||||
// player may have been kicked off the mount during the tick, so
|
// 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 ||
|
level->canEditSpawn; // = level->dimension->id != 0 ||
|
||||||
// server->players->isOp(player->name);
|
// server->players->isOp(player->name);
|
||||||
if (packet->getFace() == 255) {
|
if (packet->getFace() == 255) {
|
||||||
if (item == NULL) return;
|
if (item == nullptr) return;
|
||||||
player->gameMode->useItem(player, level, item);
|
player->gameMode->useItem(player, level, item);
|
||||||
} else if ((packet->getY() < server->getMaxBuildHeight() - 1) ||
|
} else if ((packet->getY() < server->getMaxBuildHeight() - 1) ||
|
||||||
(packet->getFace() != Facing::UP &&
|
(packet->getFace() != Facing::UP &&
|
||||||
|
|
@ -524,15 +524,15 @@ void PlayerConnection::handleUseItem(std::shared_ptr<UseItemPacket> packet) {
|
||||||
item = player->inventory->getSelected();
|
item = player->inventory->getSelected();
|
||||||
|
|
||||||
bool forceClientUpdate = false;
|
bool forceClientUpdate = false;
|
||||||
if (item != NULL && packet->getItem() == NULL) {
|
if (item != nullptr && packet->getItem() == nullptr) {
|
||||||
forceClientUpdate = true;
|
forceClientUpdate = true;
|
||||||
}
|
}
|
||||||
if (item != NULL && item->count == 0) {
|
if (item != nullptr && item->count == 0) {
|
||||||
player->inventory->items[player->inventory->selected] = nullptr;
|
player->inventory->items[player->inventory->selected] = nullptr;
|
||||||
item = nullptr;
|
item = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == NULL || item->getUseDuration() == 0) {
|
if (item == nullptr || item->getUseDuration() == 0) {
|
||||||
player->ignoreSlotUpdateHack = true;
|
player->ignoreSlotUpdateHack = true;
|
||||||
player->inventory->items[player->inventory->selected] =
|
player->inventory->items[player->inventory->selected] =
|
||||||
ItemInstance::clone(
|
ItemInstance::clone(
|
||||||
|
|
@ -582,7 +582,7 @@ void PlayerConnection::onUnhandledPacket(std::shared_ptr<Packet> packet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerConnection::send(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)) {
|
if (!server->getPlayers()->canReceiveAllPackets(player)) {
|
||||||
// Check if we are allowed to send this packet type
|
// Check if we are allowed to send this packet type
|
||||||
if (!Packet::canSendToAnyClient(packet)) {
|
if (!Packet::canSendToAnyClient(packet)) {
|
||||||
|
|
@ -598,7 +598,7 @@ void PlayerConnection::send(std::shared_ptr<Packet> packet) {
|
||||||
|
|
||||||
// 4J Added
|
// 4J Added
|
||||||
void PlayerConnection::queueSend(std::shared_ptr<Packet> packet) {
|
void PlayerConnection::queueSend(std::shared_ptr<Packet> packet) {
|
||||||
if (connection->getSocket() != NULL) {
|
if (connection->getSocket() != nullptr) {
|
||||||
if (!server->getPlayers()->canReceiveAllPackets(player)) {
|
if (!server->getPlayers()->canReceiveAllPackets(player)) {
|
||||||
// Check if we are allowed to send this packet type
|
// Check if we are allowed to send this packet type
|
||||||
if (!Packet::canSendToAnyClient(packet)) {
|
if (!Packet::canSendToAnyClient(packet)) {
|
||||||
|
|
@ -654,14 +654,14 @@ void PlayerConnection::handlePlayerCommand(
|
||||||
synched = false;
|
synched = false;
|
||||||
} else if (packet->action == PlayerCommandPacket::RIDING_JUMP) {
|
} else if (packet->action == PlayerCommandPacket::RIDING_JUMP) {
|
||||||
// currently only supported by horses...
|
// currently only supported by horses...
|
||||||
if ((player->riding != NULL) &&
|
if ((player->riding != nullptr) &&
|
||||||
player->riding->GetType() == eTYPE_HORSE) {
|
player->riding->GetType() == eTYPE_HORSE) {
|
||||||
std::dynamic_pointer_cast<EntityHorse>(player->riding)
|
std::dynamic_pointer_cast<EntityHorse>(player->riding)
|
||||||
->onPlayerJump(packet->data);
|
->onPlayerJump(packet->data);
|
||||||
}
|
}
|
||||||
} else if (packet->action == PlayerCommandPacket::OPEN_INVENTORY) {
|
} else if (packet->action == PlayerCommandPacket::OPEN_INVENTORY) {
|
||||||
// also only supported by horses...
|
// also only supported by horses...
|
||||||
if ((player->riding != NULL) &&
|
if ((player->riding != nullptr) &&
|
||||||
player->riding->instanceof(eTYPE_HORSE)) {
|
player->riding->instanceof(eTYPE_HORSE)) {
|
||||||
std::dynamic_pointer_cast<EntityHorse>(player->riding)
|
std::dynamic_pointer_cast<EntityHorse>(player->riding)
|
||||||
->openInventory(player);
|
->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
|
// 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
|
// 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.
|
// 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)
|
// player->distanceToSqr(target) < 6 * 6)
|
||||||
{
|
{
|
||||||
// boole canSee = player->canSee(target);
|
// 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",
|
wprintf(L"Server received request for custom texture %ls\n",
|
||||||
packet->textureName.c_str());
|
packet->textureName.c_str());
|
||||||
#endif
|
#endif
|
||||||
std::uint8_t* pbData = NULL;
|
std::uint8_t* pbData = nullptr;
|
||||||
unsigned int dwBytes = 0;
|
unsigned int dwBytes = 0;
|
||||||
app.GetMemFileDetails(packet->textureName, &pbData, &dwBytes);
|
app.GetMemFileDetails(packet->textureName, &pbData, &dwBytes);
|
||||||
|
|
||||||
|
|
@ -785,7 +785,7 @@ void PlayerConnection::handleTextureAndGeometry(
|
||||||
wprintf(L"Server received request for custom texture %ls\n",
|
wprintf(L"Server received request for custom texture %ls\n",
|
||||||
packet->textureName.c_str());
|
packet->textureName.c_str());
|
||||||
#endif
|
#endif
|
||||||
std::uint8_t* pbData = NULL;
|
std::uint8_t* pbData = nullptr;
|
||||||
unsigned int dwTextureBytes = 0;
|
unsigned int dwTextureBytes = 0;
|
||||||
app.GetMemFileDetails(packet->textureName, &pbData, &dwTextureBytes);
|
app.GetMemFileDetails(packet->textureName, &pbData, &dwTextureBytes);
|
||||||
DLCSkinFile* pDLCSkinFile =
|
DLCSkinFile* pDLCSkinFile =
|
||||||
|
|
@ -854,7 +854,7 @@ void PlayerConnection::handleTextureReceived(const std::wstring& textureName) {
|
||||||
auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(),
|
auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(),
|
||||||
textureName);
|
textureName);
|
||||||
if (it != m_texturesRequested.end()) {
|
if (it != m_texturesRequested.end()) {
|
||||||
std::uint8_t* pbData = NULL;
|
std::uint8_t* pbData = nullptr;
|
||||||
unsigned int dwBytes = 0;
|
unsigned int dwBytes = 0;
|
||||||
app.GetMemFileDetails(textureName, &pbData, &dwBytes);
|
app.GetMemFileDetails(textureName, &pbData, &dwBytes);
|
||||||
|
|
||||||
|
|
@ -873,7 +873,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(
|
||||||
auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(),
|
auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(),
|
||||||
textureName);
|
textureName);
|
||||||
if (it != m_texturesRequested.end()) {
|
if (it != m_texturesRequested.end()) {
|
||||||
std::uint8_t* pbData = NULL;
|
std::uint8_t* pbData = nullptr;
|
||||||
unsigned int dwTextureBytes = 0;
|
unsigned int dwTextureBytes = 0;
|
||||||
app.GetMemFileDetails(textureName, &pbData, &dwTextureBytes);
|
app.GetMemFileDetails(textureName, &pbData, &dwTextureBytes);
|
||||||
DLCSkinFile* pDLCSkinFile = app.m_dlcManager.getSkinFile(textureName);
|
DLCSkinFile* pDLCSkinFile = app.m_dlcManager.getSkinFile(textureName);
|
||||||
|
|
@ -933,12 +933,12 @@ void PlayerConnection::handleTextureChange(
|
||||||
packet->path.c_str(), player->name.c_str());
|
packet->path.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
send(std::shared_ptr<TexturePacket>(
|
send(std::shared_ptr<TexturePacket>(
|
||||||
new TexturePacket(packet->path, NULL, 0)));
|
new TexturePacket(packet->path, nullptr, 0)));
|
||||||
}
|
}
|
||||||
} else if (!packet->path.empty() &&
|
} else if (!packet->path.empty() &&
|
||||||
app.IsFileInMemoryTextures(packet->path)) {
|
app.IsFileInMemoryTextures(packet->path)) {
|
||||||
// Update the ref count on the memory texture data
|
// Update the ref count on the memory texture data
|
||||||
app.AddMemoryTextureFile(packet->path, NULL, 0);
|
app.AddMemoryTextureFile(packet->path, nullptr, 0);
|
||||||
}
|
}
|
||||||
server->getPlayers()->broadcastAll(
|
server->getPlayers()->broadcastAll(
|
||||||
std::shared_ptr<TextureChangePacket>(
|
std::shared_ptr<TextureChangePacket>(
|
||||||
|
|
@ -968,12 +968,12 @@ void PlayerConnection::handleTextureAndGeometryChange(
|
||||||
packet->path.c_str(), player->name.c_str());
|
packet->path.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
send(std::shared_ptr<TextureAndGeometryPacket>(
|
send(std::shared_ptr<TextureAndGeometryPacket>(
|
||||||
new TextureAndGeometryPacket(packet->path, NULL, 0)));
|
new TextureAndGeometryPacket(packet->path, nullptr, 0)));
|
||||||
}
|
}
|
||||||
} else if (!packet->path.empty() &&
|
} else if (!packet->path.empty() &&
|
||||||
app.IsFileInMemoryTextures(packet->path)) {
|
app.IsFileInMemoryTextures(packet->path)) {
|
||||||
// Update the ref count on the memory texture data
|
// 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);
|
player->setCustomSkin(packet->dwSkinID);
|
||||||
|
|
||||||
|
|
@ -995,7 +995,7 @@ void PlayerConnection::handleServerSettingsChanged(
|
||||||
// individual setting?
|
// individual setting?
|
||||||
|
|
||||||
INetworkPlayer* networkPlayer = getNetworkPlayer();
|
INetworkPlayer* networkPlayer = getNetworkPlayer();
|
||||||
if ((networkPlayer != NULL && networkPlayer->IsHost()) ||
|
if ((networkPlayer != nullptr && networkPlayer->IsHost()) ||
|
||||||
player->isModerator()) {
|
player->isModerator()) {
|
||||||
app.SetGameHostOption(
|
app.SetGameHostOption(
|
||||||
eGameHostOption_FireSpreads,
|
eGameHostOption_FireSpreads,
|
||||||
|
|
@ -1047,7 +1047,7 @@ void PlayerConnection::handleServerSettingsChanged(
|
||||||
void PlayerConnection::handleKickPlayer(
|
void PlayerConnection::handleKickPlayer(
|
||||||
std::shared_ptr<KickPlayerPacket> packet) {
|
std::shared_ptr<KickPlayerPacket> packet) {
|
||||||
INetworkPlayer* networkPlayer = getNetworkPlayer();
|
INetworkPlayer* networkPlayer = getNetworkPlayer();
|
||||||
if ((networkPlayer != NULL && networkPlayer->IsHost()) ||
|
if ((networkPlayer != nullptr && networkPlayer->IsHost()) ||
|
||||||
player->isModerator()) {
|
player->isModerator()) {
|
||||||
server->getPlayers()->kickPlayerByShortId(packet->m_networkSmallId);
|
server->getPlayers()->kickPlayerByShortId(packet->m_networkSmallId);
|
||||||
}
|
}
|
||||||
|
|
@ -1111,8 +1111,8 @@ void PlayerConnection::handleContainerSetSlot(
|
||||||
packet->slot >= 36 && packet->slot < 36 + 9) {
|
packet->slot >= 36 && packet->slot < 36 + 9) {
|
||||||
std::shared_ptr<ItemInstance> lastItem =
|
std::shared_ptr<ItemInstance> lastItem =
|
||||||
player->inventoryMenu->getSlot(packet->slot)->getItem();
|
player->inventoryMenu->getSlot(packet->slot)->getItem();
|
||||||
if (packet->item != NULL) {
|
if (packet->item != nullptr) {
|
||||||
if (lastItem == NULL || lastItem->count < packet->item->count) {
|
if (lastItem == nullptr || lastItem->count < packet->item->count) {
|
||||||
packet->item->popTime = Inventory::POP_TIME_DURATION;
|
packet->item->popTime = Inventory::POP_TIME_DURATION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1185,7 +1185,7 @@ void PlayerConnection::handleSetCreativeModeSlot(
|
||||||
bool drop = packet->slotNum < 0;
|
bool drop = packet->slotNum < 0;
|
||||||
std::shared_ptr<ItemInstance> item = packet->item;
|
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;
|
int mapScale = 3;
|
||||||
#if defined(_LARGE_WORLDS)
|
#if defined(_LARGE_WORLDS)
|
||||||
int scale = MapItemSavedData::MAP_SIZE * 2 * (1 << mapScale);
|
int scale = MapItemSavedData::MAP_SIZE * 2 * (1 << mapScale);
|
||||||
|
|
@ -1208,7 +1208,7 @@ void PlayerConnection::handleSetCreativeModeSlot(
|
||||||
wchar_t buf[64];
|
wchar_t buf[64];
|
||||||
swprintf(buf, 64, L"map_%d", item->getAuxValue());
|
swprintf(buf, 64, L"map_%d", item->getAuxValue());
|
||||||
std::wstring id = std::wstring(buf);
|
std::wstring id = std::wstring(buf);
|
||||||
if (data == NULL) {
|
if (data == nullptr) {
|
||||||
data =
|
data =
|
||||||
std::shared_ptr<MapItemSavedData>(new MapItemSavedData(id));
|
std::shared_ptr<MapItemSavedData>(new MapItemSavedData(id));
|
||||||
}
|
}
|
||||||
|
|
@ -1227,13 +1227,13 @@ void PlayerConnection::handleSetCreativeModeSlot(
|
||||||
packet->slotNum < (InventoryMenu::USE_ROW_SLOT_START +
|
packet->slotNum < (InventoryMenu::USE_ROW_SLOT_START +
|
||||||
Inventory::getSelectionSize()));
|
Inventory::getSelectionSize()));
|
||||||
bool validItem =
|
bool validItem =
|
||||||
item == NULL || (item->id < Item::items.length && item->id >= 0 &&
|
item == nullptr || (item->id < Item::items.length && item->id >= 0 &&
|
||||||
Item::items[item->id] != NULL);
|
Item::items[item->id] != nullptr);
|
||||||
bool validData = item == NULL || (item->getAuxValue() >= 0 &&
|
bool validData = item == nullptr || (item->getAuxValue() >= 0 &&
|
||||||
item->count > 0 && item->count <= 64);
|
item->count > 0 && item->count <= 64);
|
||||||
|
|
||||||
if (validSlot && validItem && validData) {
|
if (validSlot && validItem && validData) {
|
||||||
if (item == NULL) {
|
if (item == nullptr) {
|
||||||
player->inventoryMenu->setItem(packet->slotNum, nullptr);
|
player->inventoryMenu->setItem(packet->slotNum, nullptr);
|
||||||
} else {
|
} else {
|
||||||
player->inventoryMenu->setItem(packet->slotNum, item);
|
player->inventoryMenu->setItem(packet->slotNum, item);
|
||||||
|
|
@ -1247,13 +1247,13 @@ void PlayerConnection::handleSetCreativeModeSlot(
|
||||||
dropSpamTickCount += SharedConstants::TICKS_PER_SECOND;
|
dropSpamTickCount += SharedConstants::TICKS_PER_SECOND;
|
||||||
// drop item
|
// drop item
|
||||||
std::shared_ptr<ItemEntity> dropped = player->drop(item);
|
std::shared_ptr<ItemEntity> dropped = player->drop(item);
|
||||||
if (dropped != NULL) {
|
if (dropped != nullptr) {
|
||||||
dropped->setShortLifeTime();
|
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
|
// 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,
|
// should always be assumed to be wrong This is how the Java works,
|
||||||
// as the client also incorrectly predicts the auxvalue of the
|
// as the client also incorrectly predicts the auxvalue of the
|
||||||
|
|
@ -1289,7 +1289,7 @@ void PlayerConnection::handleSignUpdate(
|
||||||
std::shared_ptr<TileEntity> te =
|
std::shared_ptr<TileEntity> te =
|
||||||
level->getTileEntity(packet->x, packet->y, packet->z);
|
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::shared_ptr<SignTileEntity> ste =
|
||||||
std::dynamic_pointer_cast<SignTileEntity>(te);
|
std::dynamic_pointer_cast<SignTileEntity>(te);
|
||||||
if (!ste->isEditable() || ste->getPlayerWhoMayEdit() != player) {
|
if (!ste->isEditable() || ste->getPlayerWhoMayEdit() != player) {
|
||||||
|
|
@ -1300,7 +1300,7 @@ void PlayerConnection::handleSignUpdate(
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J-JEV: Changed to allow characters to display as a [].
|
// 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 x = packet->x;
|
||||||
int y = packet->y;
|
int y = packet->y;
|
||||||
int z = packet->z;
|
int z = packet->z;
|
||||||
|
|
@ -1331,14 +1331,14 @@ void PlayerConnection::handlePlayerInfo(
|
||||||
// setting?
|
// setting?
|
||||||
|
|
||||||
INetworkPlayer* networkPlayer = getNetworkPlayer();
|
INetworkPlayer* networkPlayer = getNetworkPlayer();
|
||||||
if ((networkPlayer != NULL && networkPlayer->IsHost()) ||
|
if ((networkPlayer != nullptr && networkPlayer->IsHost()) ||
|
||||||
player->isModerator()) {
|
player->isModerator()) {
|
||||||
std::shared_ptr<ServerPlayer> serverPlayer;
|
std::shared_ptr<ServerPlayer> serverPlayer;
|
||||||
// Find the player being edited
|
// Find the player being edited
|
||||||
for (auto it = server->getPlayers()->players.begin();
|
for (auto it = server->getPlayers()->players.begin();
|
||||||
it != server->getPlayers()->players.end(); ++it) {
|
it != server->getPlayers()->players.end(); ++it) {
|
||||||
std::shared_ptr<ServerPlayer> checkingPlayer = *it;
|
std::shared_ptr<ServerPlayer> checkingPlayer = *it;
|
||||||
if (checkingPlayer->connection->getNetworkPlayer() != NULL &&
|
if (checkingPlayer->connection->getNetworkPlayer() != nullptr &&
|
||||||
checkingPlayer->connection->getNetworkPlayer()->GetSmallId() ==
|
checkingPlayer->connection->getNetworkPlayer()->GetSmallId() ==
|
||||||
packet->m_networkSmallId) {
|
packet->m_networkSmallId) {
|
||||||
serverPlayer = checkingPlayer;
|
serverPlayer = checkingPlayer;
|
||||||
|
|
@ -1346,7 +1346,7 @@ void PlayerConnection::handlePlayerInfo(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serverPlayer != NULL) {
|
if (serverPlayer != nullptr) {
|
||||||
unsigned int origPrivs = serverPlayer->getAllPlayerGamePrivileges();
|
unsigned int origPrivs = serverPlayer->getAllPlayerGamePrivileges();
|
||||||
|
|
||||||
bool trustPlayers =
|
bool trustPlayers =
|
||||||
|
|
@ -1564,7 +1564,7 @@ void PlayerConnection::handleCustomPayload(
|
||||||
player->level->getTileEntity(x, y, z);
|
player->level->getTileEntity(x, y, z);
|
||||||
std::shared_ptr<CommandBlockEntity> cbe =
|
std::shared_ptr<CommandBlockEntity> cbe =
|
||||||
std::dynamic_pointer_cast<CommandBlockEntity>(tileEntity);
|
std::dynamic_pointer_cast<CommandBlockEntity>(tileEntity);
|
||||||
if (tileEntity != NULL && cbe != NULL) {
|
if (tileEntity != nullptr && cbe != nullptr) {
|
||||||
cbe->setCommand(command);
|
cbe->setCommand(command);
|
||||||
player->level->sendTileUpdated(x, y, z);
|
player->level->sendTileUpdated(x, y, z);
|
||||||
// player->sendMessage(ChatMessageComponent.forTranslation("advMode.setCommand.success",
|
// player->sendMessage(ChatMessageComponent.forTranslation("advMode.setCommand.success",
|
||||||
|
|
@ -1575,7 +1575,7 @@ void PlayerConnection::handleCustomPayload(
|
||||||
}
|
}
|
||||||
} else if (CustomPayloadPacket::SET_BEACON_PACKET.compare(
|
} else if (CustomPayloadPacket::SET_BEACON_PACKET.compare(
|
||||||
customPayloadPacket->identifier) == 0) {
|
customPayloadPacket->identifier) == 0) {
|
||||||
if (dynamic_cast<BeaconMenu*>(player->containerMenu) != NULL) {
|
if (dynamic_cast<BeaconMenu*>(player->containerMenu) != nullptr) {
|
||||||
ByteArrayInputStream bais(customPayloadPacket->data);
|
ByteArrayInputStream bais(customPayloadPacket->data);
|
||||||
DataInputStream input(&bais);
|
DataInputStream input(&bais);
|
||||||
int primary = input.readInt();
|
int primary = input.readInt();
|
||||||
|
|
@ -1596,7 +1596,7 @@ void PlayerConnection::handleCustomPayload(
|
||||||
customPayloadPacket->identifier) == 0) {
|
customPayloadPacket->identifier) == 0) {
|
||||||
AnvilMenu* menu = dynamic_cast<AnvilMenu*>(player->containerMenu);
|
AnvilMenu* menu = dynamic_cast<AnvilMenu*>(player->containerMenu);
|
||||||
if (menu) {
|
if (menu) {
|
||||||
if (customPayloadPacket->data.data == NULL ||
|
if (customPayloadPacket->data.data == nullptr ||
|
||||||
customPayloadPacket->data.length < 1) {
|
customPayloadPacket->data.length < 1) {
|
||||||
menu->setItemName(L"");
|
menu->setItemName(L"");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1680,7 +1680,7 @@ void PlayerConnection::handleCraftItem(
|
||||||
|
|
||||||
// 4J Stu - Fix for #13097 - Bug: Milk Buckets are removed when
|
// 4J Stu - Fix for #13097 - Bug: Milk Buckets are removed when
|
||||||
// crafting Cake
|
// crafting Cake
|
||||||
if (ingItemInst != NULL) {
|
if (ingItemInst != nullptr) {
|
||||||
if (ingItemInst->getItem()->hasCraftingRemainingItem()) {
|
if (ingItemInst->getItem()->hasCraftingRemainingItem()) {
|
||||||
// replace item with remaining result
|
// replace item with remaining result
|
||||||
player->inventory->add(
|
player->inventory->add(
|
||||||
|
|
@ -1795,8 +1795,8 @@ void PlayerConnection::handleTradeItem(
|
||||||
|
|
||||||
int buyAMatches = player->inventory->countMatches(buyAItem);
|
int buyAMatches = player->inventory->countMatches(buyAItem);
|
||||||
int buyBMatches = player->inventory->countMatches(buyBItem);
|
int buyBMatches = player->inventory->countMatches(buyBItem);
|
||||||
if ((buyAItem != NULL && buyAMatches >= buyAItem->count) &&
|
if ((buyAItem != nullptr && buyAMatches >= buyAItem->count) &&
|
||||||
(buyBItem == NULL || buyBMatches >= buyBItem->count)) {
|
(buyBItem == nullptr || buyBMatches >= buyBItem->count)) {
|
||||||
menu->getMerchant()->notifyTrade(activeRecipe);
|
menu->getMerchant()->notifyTrade(activeRecipe);
|
||||||
|
|
||||||
// Remove the items we are purchasing with
|
// Remove the items we are purchasing with
|
||||||
|
|
@ -1825,14 +1825,14 @@ void PlayerConnection::handleTradeItem(
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer* PlayerConnection::getNetworkPlayer() {
|
INetworkPlayer* PlayerConnection::getNetworkPlayer() {
|
||||||
if (connection != NULL && connection->getSocket() != NULL)
|
if (connection != nullptr && connection->getSocket() != nullptr)
|
||||||
return connection->getSocket()->getPlayer();
|
return connection->getSocket()->getPlayer();
|
||||||
else
|
else
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayerConnection::isLocal() {
|
bool PlayerConnection::isLocal() {
|
||||||
if (connection->getSocket() == NULL) {
|
if (connection->getSocket() == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
bool isLocal = connection->getSocket()->isLocal();
|
bool isLocal = connection->getSocket()->isLocal();
|
||||||
|
|
@ -1841,12 +1841,12 @@ bool PlayerConnection::isLocal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayerConnection::isGuest() {
|
bool PlayerConnection::isGuest() {
|
||||||
if (connection->getSocket() == NULL) {
|
if (connection->getSocket() == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
INetworkPlayer* networkPlayer = connection->getSocket()->getPlayer();
|
INetworkPlayer* networkPlayer = connection->getSocket()->getPlayer();
|
||||||
bool isGuest = false;
|
bool isGuest = false;
|
||||||
if (networkPlayer != NULL) {
|
if (networkPlayer != nullptr) {
|
||||||
isGuest = networkPlayer->IsGuest() == TRUE;
|
isGuest = networkPlayer->IsGuest() == TRUE;
|
||||||
}
|
}
|
||||||
return isGuest;
|
return isGuest;
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,12 @@
|
||||||
// point in porting code for banning, whitelisting, ops etc.
|
// point in porting code for banning, whitelisting, ops etc.
|
||||||
|
|
||||||
PlayerList::PlayerList(MinecraftServer* server) {
|
PlayerList::PlayerList(MinecraftServer* server) {
|
||||||
playerIo = NULL;
|
playerIo = nullptr;
|
||||||
|
|
||||||
this->server = server;
|
this->server = server;
|
||||||
|
|
||||||
sendAllPlayerInfoIn = 0;
|
sendAllPlayerInfoIn = 0;
|
||||||
overrideGameMode = NULL;
|
overrideGameMode = nullptr;
|
||||||
allowCheatsForAllPlayers = false;
|
allowCheatsForAllPlayers = false;
|
||||||
|
|
||||||
#if defined(_LARGE_WORLDS)
|
#if defined(_LARGE_WORLDS)
|
||||||
|
|
@ -59,7 +59,7 @@ PlayerList::~PlayerList() {
|
||||||
// else there is a circular dependency
|
// else there is a circular dependency
|
||||||
delete (*it)->gameMode; // Gamemode also needs deleted as it references
|
delete (*it)->gameMode; // Gamemode also needs deleted as it references
|
||||||
// back to this player
|
// back to this player
|
||||||
(*it)->gameMode = NULL;
|
(*it)->gameMode = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteCriticalSection(&m_kickPlayersCS);
|
DeleteCriticalSection(&m_kickPlayersCS);
|
||||||
|
|
@ -71,14 +71,14 @@ void PlayerList::placeNewPlayer(Connection* connection,
|
||||||
std::shared_ptr<LoginPacket> packet) {
|
std::shared_ptr<LoginPacket> packet) {
|
||||||
CompoundTag* playerTag = load(player);
|
CompoundTag* playerTag = load(player);
|
||||||
|
|
||||||
bool newPlayer = playerTag == NULL;
|
bool newPlayer = playerTag == nullptr;
|
||||||
|
|
||||||
player->setLevel(server->getLevel(player->dimension));
|
player->setLevel(server->getLevel(player->dimension));
|
||||||
player->gameMode->setLevel((ServerLevel*)player->level);
|
player->gameMode->setLevel((ServerLevel*)player->level);
|
||||||
|
|
||||||
// Make sure these privileges are always turned off for the host player
|
// Make sure these privileges are always turned off for the host player
|
||||||
INetworkPlayer* networkPlayer = connection->getSocket()->getPlayer();
|
INetworkPlayer* networkPlayer = connection->getSocket()->getPlayer();
|
||||||
if (networkPlayer != NULL && networkPlayer->IsHost()) {
|
if (networkPlayer != nullptr && networkPlayer->IsHost()) {
|
||||||
player->enableAllPlayerPrivileges(true);
|
player->enableAllPlayerPrivileges(true);
|
||||||
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_HOST, 1);
|
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_HOST, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -140,7 +140,7 @@ void PlayerList::placeNewPlayer(Connection* connection,
|
||||||
Item::map_Id, 1,
|
Item::map_Id, 1,
|
||||||
level->getAuxValueForMap(player->getXuid(), 0, centreXC,
|
level->getAuxValueForMap(player->getXuid(), 0, centreXC,
|
||||||
centreZC, mapScale))));
|
centreZC, mapScale))));
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
app.getGameRuleDefinitions()->postProcessPlayer(player);
|
app.getGameRuleDefinitions()->postProcessPlayer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -157,13 +157,13 @@ void PlayerList::placeNewPlayer(Connection* connection,
|
||||||
player->customTextureUrl.c_str(), player->name.c_str());
|
player->customTextureUrl.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
playerConnection->send(std::shared_ptr<TextureAndGeometryPacket>(
|
playerConnection->send(std::shared_ptr<TextureAndGeometryPacket>(
|
||||||
new TextureAndGeometryPacket(player->customTextureUrl, NULL,
|
new TextureAndGeometryPacket(player->customTextureUrl, nullptr,
|
||||||
0)));
|
0)));
|
||||||
}
|
}
|
||||||
} else if (!player->customTextureUrl.empty() &&
|
} else if (!player->customTextureUrl.empty() &&
|
||||||
app.IsFileInMemoryTextures(player->customTextureUrl)) {
|
app.IsFileInMemoryTextures(player->customTextureUrl)) {
|
||||||
// Update the ref count on the memory texture data
|
// 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() &&
|
if (!player->customTextureUrl2.empty() &&
|
||||||
|
|
@ -178,12 +178,12 @@ void PlayerList::placeNewPlayer(Connection* connection,
|
||||||
player->customTextureUrl2.c_str(), player->name.c_str());
|
player->customTextureUrl2.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
playerConnection->send(std::shared_ptr<TexturePacket>(
|
playerConnection->send(std::shared_ptr<TexturePacket>(
|
||||||
new TexturePacket(player->customTextureUrl2, NULL, 0)));
|
new TexturePacket(player->customTextureUrl2, nullptr, 0)));
|
||||||
}
|
}
|
||||||
} else if (!player->customTextureUrl2.empty() &&
|
} else if (!player->customTextureUrl2.empty() &&
|
||||||
app.IsFileInMemoryTextures(player->customTextureUrl2)) {
|
app.IsFileInMemoryTextures(player->customTextureUrl2)) {
|
||||||
// Update the ref count on the memory texture data
|
// 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);
|
player->setIsGuest(packet->m_isGuest);
|
||||||
|
|
@ -277,11 +277,11 @@ void PlayerList::placeNewPlayer(Connection* connection,
|
||||||
|
|
||||||
player->initMenu();
|
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
|
// this player has been saved with a mount tag
|
||||||
std::shared_ptr<Entity> mount = EntityIO::loadStatic(
|
std::shared_ptr<Entity> mount = EntityIO::loadStatic(
|
||||||
playerTag->getCompound(Entity::RIDING_TAG), level);
|
playerTag->getCompound(Entity::RIDING_TAG), level);
|
||||||
if (mount != NULL) {
|
if (mount != nullptr) {
|
||||||
mount->forcedLoading = true;
|
mount->forcedLoading = true;
|
||||||
level->addEntity(mount);
|
level->addEntity(mount);
|
||||||
player->ride(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
|
// is travelling through the win portal, then we should set our wonGame flag
|
||||||
// to true so that respawning works when the EndPoem is closed
|
// to true so that respawning works when the EndPoem is closed
|
||||||
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
||||||
if (thisPlayer != NULL) {
|
if (thisPlayer != nullptr) {
|
||||||
for (auto it = players.begin(); it != players.end(); ++it) {
|
for (auto it = players.begin(); it != players.end(); ++it) {
|
||||||
std::shared_ptr<ServerPlayer> servPlayer = *it;
|
std::shared_ptr<ServerPlayer> servPlayer = *it;
|
||||||
INetworkPlayer* checkPlayer =
|
INetworkPlayer* checkPlayer =
|
||||||
servPlayer->connection->getNetworkPlayer();
|
servPlayer->connection->getNetworkPlayer();
|
||||||
if (thisPlayer != checkPlayer && checkPlayer != NULL &&
|
if (thisPlayer != checkPlayer && checkPlayer != nullptr &&
|
||||||
thisPlayer->IsSameSystem(checkPlayer) && servPlayer->wonGame) {
|
thisPlayer->IsSameSystem(checkPlayer) && servPlayer->wonGame) {
|
||||||
player->wonGame = true;
|
player->wonGame = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -321,7 +321,7 @@ void PlayerList::updateEntireScoreboard(ServerScoreboard* scoreboard,
|
||||||
//{
|
//{
|
||||||
// Objective objective = scoreboard->getDisplayObjective(slot);
|
// Objective objective = scoreboard->getDisplayObjective(slot);
|
||||||
|
|
||||||
// if (objective != NULL && !objectives->contains(objective))
|
// if (objective != nullptr && !objectives->contains(objective))
|
||||||
// {
|
// {
|
||||||
// vector<shared_ptr<Packet> > *packets =
|
// vector<shared_ptr<Packet> > *packets =
|
||||||
// scoreboard->getStartTrackingPackets(objective);
|
// scoreboard->getStartTrackingPackets(objective);
|
||||||
|
|
@ -344,7 +344,7 @@ void PlayerList::changeDimension(std::shared_ptr<ServerPlayer> player,
|
||||||
ServerLevel* from) {
|
ServerLevel* from) {
|
||||||
ServerLevel* to = player->getLevel();
|
ServerLevel* to = player->getLevel();
|
||||||
|
|
||||||
if (from != NULL) from->getChunkMap()->remove(player);
|
if (from != nullptr) from->getChunkMap()->remove(player);
|
||||||
to->getChunkMap()->add(player);
|
to->getChunkMap()->add(player);
|
||||||
|
|
||||||
to->cache->create(((int)player->x) >> 4, ((int)player->z) >> 4);
|
to->cache->create(((int)player->x) >> 4, ((int)player->z) >> 4);
|
||||||
|
|
@ -427,10 +427,10 @@ void PlayerList::validatePlayerSpawnPosition(
|
||||||
delete levelSpawn;
|
delete levelSpawn;
|
||||||
|
|
||||||
Pos* bedPosition = player->getRespawnPosition();
|
Pos* bedPosition = player->getRespawnPosition();
|
||||||
if (bedPosition != NULL) {
|
if (bedPosition != nullptr) {
|
||||||
Pos* respawnPosition = Player::checkBedValidRespawnPosition(
|
Pos* respawnPosition = Player::checkBedValidRespawnPosition(
|
||||||
server->getLevel(player->dimension), bedPosition, spawnForced);
|
server->getLevel(player->dimension), bedPosition, spawnForced);
|
||||||
if (respawnPosition != NULL) {
|
if (respawnPosition != nullptr) {
|
||||||
player->moveTo(respawnPosition->x + 0.5f,
|
player->moveTo(respawnPosition->x + 0.5f,
|
||||||
respawnPosition->y + 0.1f,
|
respawnPosition->y + 0.1f,
|
||||||
respawnPosition->z + 0.5f, 0, 0);
|
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
|
// 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 -
|
// packet way ahead of all the add tracked entity packets Fix for #9169 -
|
||||||
// ART : Sign text is replaced with the words Awaiting approval.
|
// ART : Sign text is replaced with the words Awaiting approval.
|
||||||
changeDimension(player, NULL);
|
changeDimension(player, nullptr);
|
||||||
level->addEntity(player);
|
level->addEntity(player);
|
||||||
|
|
||||||
for (int i = 0; i < players.size(); i++) {
|
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++) {
|
for (unsigned int i = 0; i < players.size(); i++) {
|
||||||
std::shared_ptr<ServerPlayer> thisPlayer = players[i];
|
std::shared_ptr<ServerPlayer> thisPlayer = players[i];
|
||||||
if (thisPlayer->isSleeping()) {
|
if (thisPlayer->isSleeping()) {
|
||||||
if (firstSleepingPlayer == NULL)
|
if (firstSleepingPlayer == nullptr)
|
||||||
firstSleepingPlayer = thisPlayer;
|
firstSleepingPlayer = thisPlayer;
|
||||||
thisPlayer->connection->send(
|
thisPlayer->connection->send(
|
||||||
std::shared_ptr<ChatPacket>(new ChatPacket(
|
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
|
// sure that the player is gone delete the map
|
||||||
if (player->isGuest()) playerIo->deleteMapFilesForPlayer(player);
|
if (player->isGuest()) playerIo->deleteMapFilesForPlayer(player);
|
||||||
ServerLevel* level = player->getLevel();
|
ServerLevel* level = player->getLevel();
|
||||||
if (player->riding != NULL) {
|
if (player->riding != nullptr) {
|
||||||
// remove mount first because the player unmounts when being
|
// remove mount first because the player unmounts when being
|
||||||
// removed, also remove mount because it's saved in the player's
|
// removed, also remove mount because it's saved in the player's
|
||||||
// save tag
|
// save tag
|
||||||
|
|
@ -533,11 +533,11 @@ void PlayerList::remove(std::shared_ptr<ServerPlayer> player) {
|
||||||
// else there is a circular dependency
|
// else there is a circular dependency
|
||||||
delete player->gameMode; // Gamemode also needs deleted as it references
|
delete player->gameMode; // Gamemode also needs deleted as it references
|
||||||
// back to this player
|
// back to this player
|
||||||
player->gameMode = NULL;
|
player->gameMode = nullptr;
|
||||||
|
|
||||||
// 4J Stu - Save all the players currently in the game, which will also free
|
// 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
|
// up unused map id slots if required, and remove old players
|
||||||
saveAll(NULL, false);
|
saveAll(nullptr, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ServerPlayer> PlayerList::getPlayerForLogin(
|
std::shared_ptr<ServerPlayer> PlayerList::getPlayerForLogin(
|
||||||
|
|
@ -559,14 +559,14 @@ std::shared_ptr<ServerPlayer> PlayerList::getPlayerForLogin(
|
||||||
// Work out the base server player settings
|
// Work out the base server player settings
|
||||||
INetworkPlayer* networkPlayer =
|
INetworkPlayer* networkPlayer =
|
||||||
pendingConnection->connection->getSocket()->getPlayer();
|
pendingConnection->connection->getSocket()->getPlayer();
|
||||||
if (networkPlayer != NULL && !networkPlayer->IsHost()) {
|
if (networkPlayer != nullptr && !networkPlayer->IsHost()) {
|
||||||
player->enableAllPlayerPrivileges(
|
player->enableAllPlayerPrivileges(
|
||||||
app.GetGameHostOption(eGameHostOption_TrustPlayers) > 0);
|
app.GetGameHostOption(eGameHostOption_TrustPlayers) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Added
|
// 4J Added
|
||||||
LevelRuleset* serverRuleDefs = app.getGameRuleDefinitions();
|
LevelRuleset* serverRuleDefs = app.getGameRuleDefinitions();
|
||||||
if (serverRuleDefs != NULL) {
|
if (serverRuleDefs != nullptr) {
|
||||||
player->gameMode->setGameRules(
|
player->gameMode->setGameRules(
|
||||||
GameRuleDefinition::generateNewGameRulesInstance(
|
GameRuleDefinition::generateNewGameRulesInstance(
|
||||||
GameRulesInstance::eGameRulesInstanceType_ServerPlayer,
|
GameRulesInstance::eGameRulesInstanceType_ServerPlayer,
|
||||||
|
|
@ -602,7 +602,7 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(
|
||||||
if (ep->dimension != oldDimension) continue;
|
if (ep->dimension != oldDimension) continue;
|
||||||
|
|
||||||
INetworkPlayer* otherPlayer = ep->connection->getNetworkPlayer();
|
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
|
// There's another player here in the same dimension - we're not
|
||||||
// the last one out
|
// the last one out
|
||||||
isEmptying = false;
|
isEmptying = false;
|
||||||
|
|
@ -704,7 +704,7 @@ std::shared_ptr<ServerPlayer> PlayerList::respawn(
|
||||||
// screen
|
// screen
|
||||||
player->moveTo(serverPlayer->x, serverPlayer->y, serverPlayer->z,
|
player->moveTo(serverPlayer->x, serverPlayer->y, serverPlayer->z,
|
||||||
serverPlayer->yRot, serverPlayer->xRot);
|
serverPlayer->yRot, serverPlayer->xRot);
|
||||||
if (bedPosition != NULL) {
|
if (bedPosition != nullptr) {
|
||||||
player->setRespawnPosition(bedPosition, spawnForced);
|
player->setRespawnPosition(bedPosition, spawnForced);
|
||||||
delete bedPosition;
|
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
|
// replaces the Player's currently held item with the first one from the
|
||||||
// Quickbar
|
// Quickbar
|
||||||
player->inventory->selected = serverPlayer->inventory->selected;
|
player->inventory->selected = serverPlayer->inventory->selected;
|
||||||
} else if (bedPosition != NULL) {
|
} else if (bedPosition != nullptr) {
|
||||||
Pos* respawnPosition = Player::checkBedValidRespawnPosition(
|
Pos* respawnPosition = Player::checkBedValidRespawnPosition(
|
||||||
server->getLevel(serverPlayer->dimension), bedPosition,
|
server->getLevel(serverPlayer->dimension), bedPosition,
|
||||||
spawnForced);
|
spawnForced);
|
||||||
if (respawnPosition != NULL) {
|
if (respawnPosition != nullptr) {
|
||||||
player->moveTo(respawnPosition->x + 0.5f, respawnPosition->y + 0.1f,
|
player->moveTo(respawnPosition->x + 0.5f, respawnPosition->y + 0.1f,
|
||||||
respawnPosition->z + 0.5f, 0, 0);
|
respawnPosition->z + 0.5f, 0, 0);
|
||||||
player->setRespawnPosition(bedPosition, spawnForced);
|
player->setRespawnPosition(bedPosition, spawnForced);
|
||||||
|
|
@ -807,7 +807,7 @@ void PlayerList::toggleDimension(std::shared_ptr<ServerPlayer> player,
|
||||||
if (ep->dimension != lastDimension) continue;
|
if (ep->dimension != lastDimension) continue;
|
||||||
|
|
||||||
INetworkPlayer* otherPlayer = ep->connection->getNetworkPlayer();
|
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
|
// There's another player here in the same dimension - we're not the
|
||||||
// last one out
|
// last one out
|
||||||
isEmptying = false;
|
isEmptying = false;
|
||||||
|
|
@ -1006,11 +1006,11 @@ void PlayerList::tick() {
|
||||||
|
|
||||||
for (unsigned int i = 0; i < players.size(); i++) {
|
for (unsigned int i = 0; i < players.size(); i++) {
|
||||||
std::shared_ptr<ServerPlayer> p = players.at(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
|
// checks, but adding late in TU7 so want to be safe
|
||||||
if (p != NULL && p->connection != NULL &&
|
if (p != nullptr && p->connection != nullptr &&
|
||||||
p->connection->connection != NULL &&
|
p->connection->connection != nullptr &&
|
||||||
p->connection->connection->getSocket() != NULL &&
|
p->connection->connection->getSocket() != nullptr &&
|
||||||
p->connection->connection->getSocket()->getSmallId() ==
|
p->connection->connection->getSocket()->getSmallId() ==
|
||||||
smallId) {
|
smallId) {
|
||||||
player = p;
|
player = p;
|
||||||
|
|
@ -1018,7 +1018,7 @@ void PlayerList::tick() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player != NULL) {
|
if (player != nullptr) {
|
||||||
player->connection->disconnect(
|
player->connection->disconnect(
|
||||||
DisconnectPacket::eDisconnect_Closed);
|
DisconnectPacket::eDisconnect_Closed);
|
||||||
}
|
}
|
||||||
|
|
@ -1031,7 +1031,7 @@ void PlayerList::tick() {
|
||||||
m_smallIdsToKick.pop_front();
|
m_smallIdsToKick.pop_front();
|
||||||
INetworkPlayer* selectedPlayer =
|
INetworkPlayer* selectedPlayer =
|
||||||
g_NetworkManager.GetPlayerBySmallId(smallId);
|
g_NetworkManager.GetPlayerBySmallId(smallId);
|
||||||
if (selectedPlayer != NULL) {
|
if (selectedPlayer != nullptr) {
|
||||||
if (selectedPlayer->IsLocal() != TRUE) {
|
if (selectedPlayer->IsLocal() != TRUE) {
|
||||||
// #if 0
|
// #if 0
|
||||||
PlayerUID xuid = selectedPlayer->GetUID();
|
PlayerUID xuid = selectedPlayer->GetUID();
|
||||||
|
|
@ -1041,14 +1041,14 @@ void PlayerList::tick() {
|
||||||
for (unsigned int i = 0; i < players.size(); i++) {
|
for (unsigned int i = 0; i < players.size(); i++) {
|
||||||
std::shared_ptr<ServerPlayer> p = players.at(i);
|
std::shared_ptr<ServerPlayer> p = players.at(i);
|
||||||
PlayerUID playersXuid = p->getOnlineXuid();
|
PlayerUID playersXuid = p->getOnlineXuid();
|
||||||
if (p != NULL &&
|
if (p != nullptr &&
|
||||||
ProfileManager.AreXUIDSEqual(playersXuid, xuid)) {
|
ProfileManager.AreXUIDSEqual(playersXuid, xuid)) {
|
||||||
player = p;
|
player = p;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player != NULL) {
|
if (player != nullptr) {
|
||||||
m_bannedXuids.push_back(player->getOnlineXuid());
|
m_bannedXuids.push_back(player->getOnlineXuid());
|
||||||
// 4J Stu - If we have kicked a player, make sure that they
|
// 4J Stu - If we have kicked a player, make sure that they
|
||||||
// have no privileges if they later try to join the world
|
// have no privileges if they later try to join the world
|
||||||
|
|
@ -1074,7 +1074,7 @@ void PlayerList::tick() {
|
||||||
if (currentPlayer->removed) {
|
if (currentPlayer->removed) {
|
||||||
std::shared_ptr<ServerPlayer> newPlayer =
|
std::shared_ptr<ServerPlayer> newPlayer =
|
||||||
findAlivePlayerOnSystem(currentPlayer);
|
findAlivePlayerOnSystem(currentPlayer);
|
||||||
if (newPlayer != NULL) {
|
if (newPlayer != nullptr) {
|
||||||
receiveAllPlayers[dim][i] = newPlayer;
|
receiveAllPlayers[dim][i] = newPlayer;
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"Replacing primary player %ls with %ls in dimension "
|
"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();
|
INetworkPlayer* networkPlayer = player->connection->getNetworkPlayer();
|
||||||
bool isOp =
|
bool isOp =
|
||||||
cheatsEnabled && (player->isModerator() ||
|
cheatsEnabled && (player->isModerator() ||
|
||||||
(networkPlayer != NULL && networkPlayer->IsHost()));
|
(networkPlayer != nullptr && networkPlayer->IsHost()));
|
||||||
return isOp;
|
return isOp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1167,7 +1167,7 @@ std::shared_ptr<ServerPlayer> PlayerList::getPlayer(PlayerUID uid) {
|
||||||
std::shared_ptr<ServerPlayer> PlayerList::getNearestPlayer(Pos* position,
|
std::shared_ptr<ServerPlayer> PlayerList::getNearestPlayer(Pos* position,
|
||||||
int range) {
|
int range) {
|
||||||
if (players.empty()) return nullptr;
|
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;
|
std::shared_ptr<ServerPlayer> current = nullptr;
|
||||||
double dist = -1;
|
double dist = -1;
|
||||||
int rangeSqr = range * range;
|
int rangeSqr = range * range;
|
||||||
|
|
@ -1194,9 +1194,9 @@ std::vector<ServerPlayer>* PlayerList::getPlayers(
|
||||||
const std::wstring& playerName, const std::wstring& teamName,
|
const std::wstring& playerName, const std::wstring& teamName,
|
||||||
Level* level) {
|
Level* level) {
|
||||||
app.DebugPrintf("getPlayers NOT IMPLEMENTED!");
|
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> > result = new
|
||||||
vector<shared_ptr<ServerPlayer> >(); bool reverse = count < 0; bool
|
vector<shared_ptr<ServerPlayer> >(); bool reverse = count < 0; bool
|
||||||
playerNameNot = !playerName.empty() && playerName.startsWith("!"); bool
|
playerNameNot = !playerName.empty() && playerName.startsWith("!"); bool
|
||||||
|
|
@ -1282,7 +1282,7 @@ bool PlayerList::meetsScoreRequirements(
|
||||||
void PlayerList::sendMessage(const std::wstring& name,
|
void PlayerList::sendMessage(const std::wstring& name,
|
||||||
const std::wstring& message) {
|
const std::wstring& message) {
|
||||||
std::shared_ptr<ServerPlayer> player = getPlayer(name);
|
std::shared_ptr<ServerPlayer> player = getPlayer(name);
|
||||||
if (player != NULL) {
|
if (player != nullptr) {
|
||||||
player->connection->send(
|
player->connection->send(
|
||||||
std::shared_ptr<ChatPacket>(new ChatPacket(message)));
|
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
|
// Add the source player to the machines we have "sent" to as it doesn't
|
||||||
// need to go to that machine either
|
// need to go to that machine either
|
||||||
std::vector<std::shared_ptr<ServerPlayer> > sentTo;
|
std::vector<std::shared_ptr<ServerPlayer> > sentTo;
|
||||||
if (except != NULL) {
|
if (except != nullptr) {
|
||||||
sentTo.push_back(std::dynamic_pointer_cast<ServerPlayer>(except));
|
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;
|
bool dontSend = false;
|
||||||
if (sentTo.size()) {
|
if (sentTo.size()) {
|
||||||
INetworkPlayer* thisPlayer = p->connection->getNetworkPlayer();
|
INetworkPlayer* thisPlayer = p->connection->getNetworkPlayer();
|
||||||
if (thisPlayer == NULL) {
|
if (thisPlayer == nullptr) {
|
||||||
dontSend = true;
|
dontSend = true;
|
||||||
} else {
|
} else {
|
||||||
for (unsigned int j = 0; j < sentTo.size(); j++) {
|
for (unsigned int j = 0; j < sentTo.size(); j++) {
|
||||||
std::shared_ptr<ServerPlayer> player2 = sentTo[j];
|
std::shared_ptr<ServerPlayer> player2 = sentTo[j];
|
||||||
INetworkPlayer* otherPlayer =
|
INetworkPlayer* otherPlayer =
|
||||||
player2->connection->getNetworkPlayer();
|
player2->connection->getNetworkPlayer();
|
||||||
if (otherPlayer != NULL &&
|
if (otherPlayer != nullptr &&
|
||||||
thisPlayer->IsSameSystem(otherPlayer)) {
|
thisPlayer->IsSameSystem(otherPlayer)) {
|
||||||
dontSend = true;
|
dontSend = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1343,9 +1343,9 @@ void PlayerList::broadcast(std::shared_ptr<Player> except, double x, double y,
|
||||||
|
|
||||||
void PlayerList::saveAll(ProgressListener* progressListener,
|
void PlayerList::saveAll(ProgressListener* progressListener,
|
||||||
bool bDeleteGuestMaps /*= false*/) {
|
bool bDeleteGuestMaps /*= false*/) {
|
||||||
if (progressListener != NULL)
|
if (progressListener != nullptr)
|
||||||
progressListener->progressStart(IDS_PROGRESS_SAVING_PLAYERS);
|
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
|
// due to network failure
|
||||||
if (playerIo) {
|
if (playerIo) {
|
||||||
playerIo->saveAllCachedData();
|
playerIo->saveAllCachedData();
|
||||||
|
|
@ -1357,7 +1357,7 @@ void PlayerList::saveAll(ProgressListener* progressListener,
|
||||||
if (bDeleteGuestMaps && players[i]->isGuest())
|
if (bDeleteGuestMaps && players[i]->isGuest())
|
||||||
playerIo->deleteMapFilesForPlayer(players[i]);
|
playerIo->deleteMapFilesForPlayer(players[i]);
|
||||||
|
|
||||||
if (progressListener != NULL)
|
if (progressListener != nullptr)
|
||||||
progressListener->progressStagePercentage(
|
progressListener->progressStagePercentage(
|
||||||
(i * 100) / ((int)players.size()));
|
(i * 100) / ((int)players.size()));
|
||||||
}
|
}
|
||||||
|
|
@ -1431,10 +1431,10 @@ void PlayerList::updatePlayerGameMode(std::shared_ptr<ServerPlayer> newPlayer,
|
||||||
Level* level) {
|
Level* level) {
|
||||||
// reset the player's game mode (first pick from old, then copy level if
|
// reset the player's game mode (first pick from old, then copy level if
|
||||||
// necessary)
|
// necessary)
|
||||||
if (oldPlayer != NULL) {
|
if (oldPlayer != nullptr) {
|
||||||
newPlayer->gameMode->setGameModeForPlayer(
|
newPlayer->gameMode->setGameModeForPlayer(
|
||||||
oldPlayer->gameMode->getGameModeForPlayer());
|
oldPlayer->gameMode->getGameModeForPlayer());
|
||||||
} else if (overrideGameMode != NULL) {
|
} else if (overrideGameMode != nullptr) {
|
||||||
newPlayer->gameMode->setGameModeForPlayer(overrideGameMode);
|
newPlayer->gameMode->setGameModeForPlayer(overrideGameMode);
|
||||||
}
|
}
|
||||||
newPlayer->gameMode->updateGameMode(level->getLevelData()->getGameType());
|
newPlayer->gameMode->updateGameMode(level->getLevelData()->getGameType());
|
||||||
|
|
@ -1454,7 +1454,7 @@ std::shared_ptr<ServerPlayer> PlayerList::findAlivePlayerOnSystem(
|
||||||
dimIndex = 2;
|
dimIndex = 2;
|
||||||
|
|
||||||
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
||||||
if (thisPlayer != NULL) {
|
if (thisPlayer != nullptr) {
|
||||||
for (auto itP = players.begin(); itP != players.end(); ++itP) {
|
for (auto itP = players.begin(); itP != players.end(); ++itP) {
|
||||||
std::shared_ptr<ServerPlayer> newPlayer = *itP;
|
std::shared_ptr<ServerPlayer> newPlayer = *itP;
|
||||||
|
|
||||||
|
|
@ -1462,7 +1462,7 @@ std::shared_ptr<ServerPlayer> PlayerList::findAlivePlayerOnSystem(
|
||||||
newPlayer->connection->getNetworkPlayer();
|
newPlayer->connection->getNetworkPlayer();
|
||||||
|
|
||||||
if (!newPlayer->removed && newPlayer != player &&
|
if (!newPlayer->removed && newPlayer != player &&
|
||||||
newPlayer->dimension == playerDim && otherPlayer != NULL &&
|
newPlayer->dimension == playerDim && otherPlayer != nullptr &&
|
||||||
otherPlayer->IsSameSystem(thisPlayer)) {
|
otherPlayer->IsSameSystem(thisPlayer)) {
|
||||||
return newPlayer;
|
return newPlayer;
|
||||||
}
|
}
|
||||||
|
|
@ -1501,7 +1501,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr<ServerPlayer> player,
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
||||||
if (thisPlayer != NULL && playerRemoved) {
|
if (thisPlayer != nullptr && playerRemoved) {
|
||||||
for (auto itP = players.begin(); itP != players.end(); ++itP) {
|
for (auto itP = players.begin(); itP != players.end(); ++itP) {
|
||||||
std::shared_ptr<ServerPlayer> newPlayer = *itP;
|
std::shared_ptr<ServerPlayer> newPlayer = *itP;
|
||||||
|
|
||||||
|
|
@ -1509,7 +1509,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr<ServerPlayer> player,
|
||||||
newPlayer->connection->getNetworkPlayer();
|
newPlayer->connection->getNetworkPlayer();
|
||||||
|
|
||||||
if (newPlayer != player && newPlayer->dimension == playerDim &&
|
if (newPlayer != player && newPlayer->dimension == playerDim &&
|
||||||
otherPlayer != NULL && otherPlayer->IsSameSystem(thisPlayer)) {
|
otherPlayer != nullptr && otherPlayer->IsSameSystem(thisPlayer)) {
|
||||||
#if !defined(_CONTENT_PACKAGE)
|
#if !defined(_CONTENT_PACKAGE)
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"Remove: Adding player %ls as primary in dimension %d\n",
|
"Remove: Adding player %ls as primary in dimension %d\n",
|
||||||
|
|
@ -1519,10 +1519,10 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr<ServerPlayer> player,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (thisPlayer == NULL) {
|
} else if (thisPlayer == nullptr) {
|
||||||
#if !defined(_CONTENT_PACKAGE)
|
#if !defined(_CONTENT_PACKAGE)
|
||||||
app.DebugPrintf(
|
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());
|
player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
// 4J Stu - Something went wrong, or possibly the QNet player left
|
// 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 =
|
INetworkPlayer* checkingPlayer =
|
||||||
newPlayer->connection->getNetworkPlayer();
|
newPlayer->connection->getNetworkPlayer();
|
||||||
|
|
||||||
if (checkingPlayer != NULL) {
|
if (checkingPlayer != nullptr) {
|
||||||
int newPlayerDim = 0;
|
int newPlayerDim = 0;
|
||||||
if (newPlayer->dimension == -1)
|
if (newPlayer->dimension == -1)
|
||||||
newPlayerDim = 1;
|
newPlayerDim = 1;
|
||||||
|
|
@ -1545,7 +1545,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr<ServerPlayer> player,
|
||||||
std::shared_ptr<ServerPlayer> primaryPlayer = *it;
|
std::shared_ptr<ServerPlayer> primaryPlayer = *it;
|
||||||
INetworkPlayer* primPlayer =
|
INetworkPlayer* primPlayer =
|
||||||
primaryPlayer->connection->getNetworkPlayer();
|
primaryPlayer->connection->getNetworkPlayer();
|
||||||
if (primPlayer != NULL &&
|
if (primPlayer != nullptr &&
|
||||||
checkingPlayer->IsSameSystem(primPlayer)) {
|
checkingPlayer->IsSameSystem(primPlayer)) {
|
||||||
foundPrimary = true;
|
foundPrimary = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1581,10 +1581,10 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr<ServerPlayer> player) {
|
||||||
|
|
||||||
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer();
|
||||||
|
|
||||||
if (thisPlayer == NULL) {
|
if (thisPlayer == nullptr) {
|
||||||
#if !defined(_CONTENT_PACKAGE)
|
#if !defined(_CONTENT_PACKAGE)
|
||||||
app.DebugPrintf(
|
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());
|
player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
shouldAddPlayer = false;
|
shouldAddPlayer = false;
|
||||||
|
|
@ -1594,7 +1594,7 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr<ServerPlayer> player) {
|
||||||
std::shared_ptr<ServerPlayer> oldPlayer = *it;
|
std::shared_ptr<ServerPlayer> oldPlayer = *it;
|
||||||
INetworkPlayer* checkingPlayer =
|
INetworkPlayer* checkingPlayer =
|
||||||
oldPlayer->connection->getNetworkPlayer();
|
oldPlayer->connection->getNetworkPlayer();
|
||||||
if (checkingPlayer != NULL &&
|
if (checkingPlayer != nullptr &&
|
||||||
checkingPlayer->IsSameSystem(thisPlayer)) {
|
checkingPlayer->IsSameSystem(thisPlayer)) {
|
||||||
shouldAddPlayer = false;
|
shouldAddPlayer = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ bool ServerChunkCache::hasChunk(int x, int z) {
|
||||||
if ((iz < 0) || (iz >= XZSIZE)) return true;
|
if ((iz < 0) || (iz >= XZSIZE)) return true;
|
||||||
int idx = ix * XZSIZE + iz;
|
int idx = ix * XZSIZE + iz;
|
||||||
LevelChunk* lc = cache[idx];
|
LevelChunk* lc = cache[idx];
|
||||||
if (lc == NULL) return false;
|
if (lc == nullptr) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,17 +145,17 @@ LevelChunk* ServerChunkCache::create(
|
||||||
LevelChunk* chunk = cache[idx];
|
LevelChunk* chunk = cache[idx];
|
||||||
LevelChunk* lastChunk = chunk;
|
LevelChunk* lastChunk = chunk;
|
||||||
|
|
||||||
if ((chunk == NULL) || (chunk->x != x) || (chunk->z != z)) {
|
if ((chunk == nullptr) || (chunk->x != x) || (chunk->z != z)) {
|
||||||
EnterCriticalSection(&m_csLoadCreate);
|
EnterCriticalSection(&m_csLoadCreate);
|
||||||
chunk = load(x, z);
|
chunk = load(x, z);
|
||||||
if (chunk == NULL) {
|
if (chunk == nullptr) {
|
||||||
if (source == NULL) {
|
if (source == nullptr) {
|
||||||
chunk = emptyChunk;
|
chunk = emptyChunk;
|
||||||
} else {
|
} else {
|
||||||
chunk = source->getChunk(x, z);
|
chunk = source->getChunk(x, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chunk != NULL) {
|
if (chunk != nullptr) {
|
||||||
chunk->load();
|
chunk->load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -349,7 +349,7 @@ void ServerChunkCache::overwriteLevelChunkFromSource(int x, int z) {
|
||||||
if ((iz < 0) || (iz >= XZSIZE)) assert(0);
|
if ((iz < 0) || (iz >= XZSIZE)) assert(0);
|
||||||
int idx = ix * XZSIZE + iz;
|
int idx = ix * XZSIZE + iz;
|
||||||
|
|
||||||
LevelChunk* chunk = NULL;
|
LevelChunk* chunk = nullptr;
|
||||||
chunk = source->getChunk(x, z);
|
chunk = source->getChunk(x, z);
|
||||||
assert(chunk);
|
assert(chunk);
|
||||||
if (chunk) {
|
if (chunk) {
|
||||||
|
|
@ -418,35 +418,35 @@ void ServerChunkCache::dontDrop(int x, int z) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LevelChunk* ServerChunkCache::load(int x, int z) {
|
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)
|
#if defined(_LARGE_WORLDS)
|
||||||
int ix = x + XZOFFSET;
|
int ix = x + XZOFFSET;
|
||||||
int iz = z + XZOFFSET;
|
int iz = z + XZOFFSET;
|
||||||
int idx = ix * XZSIZE + iz;
|
int idx = ix * XZSIZE + iz;
|
||||||
levelChunk = m_unloadedCache[idx];
|
levelChunk = m_unloadedCache[idx];
|
||||||
m_unloadedCache[idx] = NULL;
|
m_unloadedCache[idx] = nullptr;
|
||||||
if (levelChunk == NULL)
|
if (levelChunk == nullptr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
levelChunk = storage->load(level, x, z);
|
levelChunk = storage->load(level, x, z);
|
||||||
}
|
}
|
||||||
if (levelChunk != NULL) {
|
if (levelChunk != nullptr) {
|
||||||
levelChunk->lastSaveTime = level->getGameTime();
|
levelChunk->lastSaveTime = level->getGameTime();
|
||||||
}
|
}
|
||||||
return levelChunk;
|
return levelChunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerChunkCache::saveEntities(LevelChunk* levelChunk) {
|
void ServerChunkCache::saveEntities(LevelChunk* levelChunk) {
|
||||||
if (storage == NULL) return;
|
if (storage == nullptr) return;
|
||||||
|
|
||||||
storage->saveEntities(level, levelChunk);
|
storage->saveEntities(level, levelChunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerChunkCache::save(LevelChunk* levelChunk) {
|
void ServerChunkCache::save(LevelChunk* levelChunk) {
|
||||||
if (storage == NULL) return;
|
if (storage == nullptr) return;
|
||||||
|
|
||||||
levelChunk->lastSaveTime = level->getGameTime();
|
levelChunk->lastSaveTime = level->getGameTime();
|
||||||
storage->save(level, levelChunk);
|
storage->save(level, levelChunk);
|
||||||
|
|
@ -584,7 +584,7 @@ void ServerChunkCache::postProcess(ChunkSource* parent, int x, int z) {
|
||||||
LevelChunk* chunk = getChunk(x, z);
|
LevelChunk* chunk = getChunk(x, z);
|
||||||
if ((chunk->terrainPopulated & LevelChunk::sTerrainPopulatedFromHere) ==
|
if ((chunk->terrainPopulated & LevelChunk::sTerrainPopulatedFromHere) ==
|
||||||
0) {
|
0) {
|
||||||
if (source != NULL) {
|
if (source != nullptr) {
|
||||||
PIXBeginNamedEvent(0, "Main post processing");
|
PIXBeginNamedEvent(0, "Main post processing");
|
||||||
source->postProcess(parent, x, z);
|
source->postProcess(parent, x, z);
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
@ -675,7 +675,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) {
|
||||||
|
|
||||||
// 4J - added this to support progressListner
|
// 4J - added this to support progressListner
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (progressListener != NULL) {
|
if (progressListener != nullptr) {
|
||||||
auto itEnd = m_loadedChunkList.end();
|
auto itEnd = m_loadedChunkList.end();
|
||||||
for (auto it = m_loadedChunkList.begin(); it != itEnd; it++) {
|
for (auto it = m_loadedChunkList.begin(); it != itEnd; it++) {
|
||||||
LevelChunk* chunk = *it;
|
LevelChunk* chunk = *it;
|
||||||
|
|
@ -706,7 +706,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J - added this to support progressListener
|
// 4J - added this to support progressListener
|
||||||
if (progressListener != NULL) {
|
if (progressListener != nullptr) {
|
||||||
if (++cc % 10 == 0) {
|
if (++cc % 10 == 0) {
|
||||||
progressListener->progressStagePercentage(cc * 100 /
|
progressListener->progressStagePercentage(cc * 100 /
|
||||||
count);
|
count);
|
||||||
|
|
@ -756,7 +756,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J - added this to support progressListener
|
// 4J - added this to support progressListener
|
||||||
if (progressListener != NULL) {
|
if (progressListener != nullptr) {
|
||||||
if (++cc % 10 == 0) {
|
if (++cc % 10 == 0) {
|
||||||
progressListener->progressStagePercentage(cc * 100 /
|
progressListener->progressStagePercentage(cc * 100 /
|
||||||
count);
|
count);
|
||||||
|
|
@ -775,7 +775,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force) {
|
if (force) {
|
||||||
if (storage == NULL) {
|
if (storage == nullptr) {
|
||||||
LeaveCriticalSection(&m_csLoadCreate);
|
LeaveCriticalSection(&m_csLoadCreate);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -822,14 +822,14 @@ bool ServerChunkCache::tick() {
|
||||||
int iz = chunk->z + XZOFFSET;
|
int iz = chunk->z + XZOFFSET;
|
||||||
int idx = ix * XZSIZE + iz;
|
int idx = ix * XZSIZE + iz;
|
||||||
m_unloadedCache[idx] = chunk;
|
m_unloadedCache[idx] = chunk;
|
||||||
cache[idx] = NULL;
|
cache[idx] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_toDrop.pop_front();
|
m_toDrop.pop_front();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (storage != NULL) storage->tick();
|
if (storage != nullptr) storage->tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
return source->tick();
|
return source->tick();
|
||||||
|
|
@ -872,7 +872,7 @@ int ServerChunkCache::runSaveThreadProc(void* lpParam) {
|
||||||
|
|
||||||
// app.DebugPrintf("Save thread has started\n");
|
// app.DebugPrintf("Save thread has started\n");
|
||||||
|
|
||||||
while (params->chunkToSave != NULL) {
|
while (params->chunkToSave != nullptr) {
|
||||||
PIXBeginNamedEvent(0, "Saving entities");
|
PIXBeginNamedEvent(0, "Saving entities");
|
||||||
// app.DebugPrintf("Save thread has started processing a chunk\n");
|
// app.DebugPrintf("Save thread has started processing a chunk\n");
|
||||||
if (params->saveEntities)
|
if (params->saveEntities)
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ void ServerConnection::tick() {
|
||||||
// logger.log(Level.WARNING, "Failed to handle packet: "
|
// logger.log(Level.WARNING, "Failed to handle packet: "
|
||||||
// + e, e);
|
// + 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) {
|
if (packet->action == ServerSettingsChangedPacket::HOST_DIFFICULTY) {
|
||||||
for (unsigned int i = 0; i < pMinecraft->levels.length; ++i) {
|
for (unsigned int i = 0; i < pMinecraft->levels.length; ++i) {
|
||||||
if (pMinecraft->levels[i] != NULL) {
|
if (pMinecraft->levels[i] != nullptr) {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"ClientConnection::handleServerSettingsChanged - "
|
"ClientConnection::handleServerSettingsChanged - "
|
||||||
"Difficulty = %d",
|
"Difficulty = %d",
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ void ServerScoreboard::setDisplayObjective(int slot, Objective* objective) {
|
||||||
|
|
||||||
// Scoreboard::setDisplayObjective(slot, objective);
|
// Scoreboard::setDisplayObjective(slot, objective);
|
||||||
|
|
||||||
// if (old != objective && old != NULL)
|
// if (old != objective && old != nullptr)
|
||||||
//{
|
//{
|
||||||
// if (getObjectiveDisplaySlotCount(old) > 0)
|
// 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))
|
// if (trackedObjectives.contains(objective))
|
||||||
// {
|
// {
|
||||||
|
|
@ -144,7 +144,7 @@ void ServerScoreboard::setSaveData(ScoreboardSaveData* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerScoreboard::setDirty() {
|
void ServerScoreboard::setDirty() {
|
||||||
// if (saveData != NULL)
|
// if (saveData != nullptr)
|
||||||
//{
|
//{
|
||||||
// saveData->setDirty();
|
// saveData->setDirty();
|
||||||
// }
|
// }
|
||||||
|
|
@ -152,7 +152,7 @@ void ServerScoreboard::setDirty() {
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Packet> >*
|
std::vector<std::shared_ptr<Packet> >*
|
||||||
ServerScoreboard::getStartTrackingPackets(Objective* objective) {
|
ServerScoreboard::getStartTrackingPackets(Objective* objective) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
// vector<shared_ptr<Packet> > *packets = new vector<shared_ptr<Packet> >();
|
// vector<shared_ptr<Packet> > *packets = new vector<shared_ptr<Packet> >();
|
||||||
// packets.push_back( shared_ptr<SetObjectivePacket>( new
|
// packets.push_back( shared_ptr<SetObjectivePacket>( new
|
||||||
|
|
@ -191,7 +191,7 @@ void ServerScoreboard::startTrackingObjective(Objective* objective) {
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Packet> >* ServerScoreboard::getStopTrackingPackets(
|
std::vector<std::shared_ptr<Packet> >* ServerScoreboard::getStopTrackingPackets(
|
||||||
Objective* objective) {
|
Objective* objective) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
// vector<shared_ptr<Packet> > *packets = new ArrayList<Packet>();
|
// vector<shared_ptr<Packet> > *packets = new ArrayList<Packet>();
|
||||||
// packets->push_back( shared_ptr<SetObjectivePacket( new
|
// packets->push_back( shared_ptr<SetObjectivePacket( new
|
||||||
|
|
|
||||||
|
|
@ -822,7 +822,7 @@ void SoundEngine::init(Options* pOptions) {
|
||||||
|
|
||||||
m_hBank = AIL_add_soundbank(szBankName, 0);
|
m_hBank = AIL_add_soundbank(szBankName, 0);
|
||||||
|
|
||||||
if (m_hBank == NULL) {
|
if (m_hBank == nullptr) {
|
||||||
char* Error = AIL_last_error();
|
char* Error = AIL_last_error();
|
||||||
app.DebugPrintf("Couldn't open soundbank: %s (%s)\n", szBankName,
|
app.DebugPrintf("Couldn't open soundbank: %s (%s)\n", szBankName,
|
||||||
Error);
|
Error);
|
||||||
|
|
@ -852,7 +852,7 @@ void SoundEngine::init(Options* pOptions) {
|
||||||
|
|
||||||
m_bSystemMusicPlaying = false;
|
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) {
|
if (players) {
|
||||||
bool bListenerPostionSet = false;
|
bool bListenerPostionSet = false;
|
||||||
for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
||||||
if (players[i] != NULL) {
|
if (players[i] != nullptr) {
|
||||||
m_ListenerA[i].bValid = true;
|
m_ListenerA[i].bValid = true;
|
||||||
F32 x, y, z;
|
F32 x, y, z;
|
||||||
x = players[i]->xo + (players[i]->x - players[i]->xo) * a;
|
x = players[i]->xo + (players[i]->x - players[i]->xo) * a;
|
||||||
|
|
@ -1157,7 +1157,7 @@ SoundEngine::SoundEngine() {
|
||||||
m_iMusicDelay = 0;
|
m_iMusicDelay = 0;
|
||||||
m_validListenerCount = 0;
|
m_validListenerCount = 0;
|
||||||
|
|
||||||
m_bHeardTrackA = NULL;
|
m_bHeardTrackA = nullptr;
|
||||||
|
|
||||||
// Start the streaming music playing some music from the overworld
|
// Start the streaming music playing some music from the overworld
|
||||||
SetStreamingSounds(eStream_Overworld_Calm1, eStream_Overworld_piano3,
|
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;
|
bool playerInNether = false;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
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 ==
|
if (pMinecraft->localplayers[i]->dimension ==
|
||||||
LevelData::DIMENSION_END) {
|
LevelData::DIMENSION_END) {
|
||||||
playerInEnd = true;
|
playerInEnd = true;
|
||||||
|
|
@ -1511,7 +1511,7 @@ void SoundEngine::playMusicUpdate() {
|
||||||
// proceed to actually playing
|
// proceed to actually playing
|
||||||
if (!m_openStreamThread->isRunning()) {
|
if (!m_openStreamThread->isRunning()) {
|
||||||
delete m_openStreamThread;
|
delete m_openStreamThread;
|
||||||
m_openStreamThread = NULL;
|
m_openStreamThread = nullptr;
|
||||||
|
|
||||||
HSAMPLE hSample = AIL_stream_sample_handle(m_hStream);
|
HSAMPLE hSample = AIL_stream_sample_handle(m_hStream);
|
||||||
|
|
||||||
|
|
@ -1593,7 +1593,7 @@ void SoundEngine::playMusicUpdate() {
|
||||||
case eMusicStreamState_OpeningCancel:
|
case eMusicStreamState_OpeningCancel:
|
||||||
if (!m_openStreamThread->isRunning()) {
|
if (!m_openStreamThread->isRunning()) {
|
||||||
delete m_openStreamThread;
|
delete m_openStreamThread;
|
||||||
m_openStreamThread = NULL;
|
m_openStreamThread = nullptr;
|
||||||
m_StreamState = eMusicStreamState_Stop;
|
m_StreamState = eMusicStreamState_Stop;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1612,13 +1612,13 @@ void SoundEngine::playMusicUpdate() {
|
||||||
break;
|
break;
|
||||||
case eMusicStreamState_Playing:
|
case eMusicStreamState_Playing:
|
||||||
if (GetIsPlayingStreamingGameMusic()) {
|
if (GetIsPlayingStreamingGameMusic()) {
|
||||||
// if(m_MusicInfo.pCue!=NULL)
|
// if(m_MusicInfo.pCue!=nullptr)
|
||||||
{
|
{
|
||||||
bool playerInEnd = false;
|
bool playerInEnd = false;
|
||||||
bool playerInNether = false;
|
bool playerInNether = false;
|
||||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||||
for (unsigned int i = 0; i < MAX_LOCAL_PLAYERS; ++i) {
|
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 ==
|
if (pMinecraft->localplayers[i]->dimension ==
|
||||||
LevelData::DIMENSION_END) {
|
LevelData::DIMENSION_END) {
|
||||||
playerInEnd = true;
|
playerInEnd = true;
|
||||||
|
|
@ -1750,7 +1750,7 @@ void SoundEngine::playMusicUpdate() {
|
||||||
bool playerInNether = false;
|
bool playerInNether = false;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < MAX_LOCAL_PLAYERS; i++) {
|
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 ==
|
if (pMinecraft->localplayers[i]->dimension ==
|
||||||
LevelData::DIMENSION_END) {
|
LevelData::DIMENSION_END) {
|
||||||
playerInEnd = true;
|
playerInEnd = true;
|
||||||
|
|
@ -1901,7 +1901,7 @@ bool SoundEngine::isStreamingWavebankReady() { return true; }
|
||||||
// This is unused by the linux version, it'll need to be changed
|
// This is unused by the linux version, it'll need to be changed
|
||||||
char* SoundEngine::ConvertSoundPathToName(const std::wstring& name,
|
char* SoundEngine::ConvertSoundPathToName(const std::wstring& name,
|
||||||
bool bConvertSpaces) {
|
bool bConvertSpaces) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleSoundEngine::tick() {
|
void ConsoleSoundEngine::tick() {
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ public:
|
||||||
m_sizeOfEachBlock = 0;
|
m_sizeOfEachBlock = 0;
|
||||||
m_numFreeBlocks = 0;
|
m_numFreeBlocks = 0;
|
||||||
m_numInitialized = 0;
|
m_numInitialized = 0;
|
||||||
m_memStart = NULL;
|
m_memStart = nullptr;
|
||||||
m_memEnd = NULL;
|
m_memEnd = nullptr;
|
||||||
m_next = 0;
|
m_next = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,7 +65,7 @@ public:
|
||||||
void DestroyPool()
|
void DestroyPool()
|
||||||
{
|
{
|
||||||
delete[] m_memStart;
|
delete[] m_memStart;
|
||||||
m_memStart = NULL;
|
m_memStart = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
uchar* AddrFromIndex(uint i) const
|
uchar* AddrFromIndex(uint i) const
|
||||||
|
|
@ -89,7 +89,7 @@ public:
|
||||||
*p = m_numInitialized + 1;
|
*p = m_numInitialized + 1;
|
||||||
m_numInitialized++;
|
m_numInitialized++;
|
||||||
}
|
}
|
||||||
void* ret = NULL;
|
void* ret = nullptr;
|
||||||
if ( m_numFreeBlocks > 0 )
|
if ( m_numFreeBlocks > 0 )
|
||||||
{
|
{
|
||||||
ret = (void*)m_next;
|
ret = (void*)m_next;
|
||||||
|
|
@ -100,7 +100,7 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_next = NULL;
|
m_next = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// LeaveCriticalSection(&m_CS);
|
// LeaveCriticalSection(&m_CS);
|
||||||
|
|
@ -115,7 +115,7 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// EnterCriticalSection(&m_CS);
|
// EnterCriticalSection(&m_CS);
|
||||||
if (m_next != NULL)
|
if (m_next != nullptr)
|
||||||
{
|
{
|
||||||
(*(uint*)ptr) = IndexFromAddr( m_next );
|
(*(uint*)ptr) = IndexFromAddr( m_next );
|
||||||
m_next = (uchar*)ptr;
|
m_next = (uchar*)ptr;
|
||||||
|
|
|
||||||
|
|
@ -149,9 +149,9 @@ CMinecraftApp::CMinecraftApp() {
|
||||||
// m_bRead_TMS_XUIDS_XML=false;
|
// m_bRead_TMS_XUIDS_XML=false;
|
||||||
// m_bRead_TMS_DLCINFO_XML=false;
|
// m_bRead_TMS_DLCINFO_XML=false;
|
||||||
|
|
||||||
m_pDLCFileBuffer = NULL;
|
m_pDLCFileBuffer = nullptr;
|
||||||
m_dwDLCFileSize = 0;
|
m_dwDLCFileSize = 0;
|
||||||
m_pBannedListFileBuffer = NULL;
|
m_pBannedListFileBuffer = nullptr;
|
||||||
m_dwBannedListFileSize = 0;
|
m_dwBannedListFileSize = 0;
|
||||||
|
|
||||||
m_bDefaultCapeInstallAttempted = false;
|
m_bDefaultCapeInstallAttempted = false;
|
||||||
|
|
@ -708,7 +708,7 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS* pSettings,
|
||||||
SetGameSettings(iPad, eGameSetting_Gamma, 50);
|
SetGameSettings(iPad, eGameSetting_Gamma, 50);
|
||||||
|
|
||||||
// 4J-PB - Don't reset the difficult level if we're in-game
|
// 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");
|
app.DebugPrintf("SetDefaultOptions - Difficulty = 1\n");
|
||||||
SetGameSettings(iPad, eGameSetting_Difficulty, 1);
|
SetGameSettings(iPad, eGameSetting_Difficulty, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -1032,7 +1032,7 @@ void CMinecraftApp::ActionGameSettings(int iPad, eGameSetting eVal) {
|
||||||
pMinecraft->options->difficulty);
|
pMinecraft->options->difficulty);
|
||||||
|
|
||||||
// send this to the other players if we are in-game
|
// 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 Host only (and for now we can't change the diff while in
|
||||||
// game, so this shouldn't happen)
|
// game, so this shouldn't happen)
|
||||||
|
|
@ -1111,7 +1111,7 @@ void CMinecraftApp::ActionGameSettings(int iPad, eGameSetting eVal) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eGameSetting_GamertagsVisible: {
|
case eGameSetting_GamertagsVisible: {
|
||||||
bool bInGame = pMinecraft->level != NULL;
|
bool bInGame = pMinecraft->level != nullptr;
|
||||||
|
|
||||||
// Game Host only
|
// Game Host only
|
||||||
if (bInGame && g_NetworkManager.IsHost() &&
|
if (bInGame && g_NetworkManager.IsHost() &&
|
||||||
|
|
@ -1149,7 +1149,7 @@ void CMinecraftApp::ActionGameSettings(int iPad, eGameSetting eVal) {
|
||||||
|
|
||||||
case eGameSetting_DisplaySplitscreenGamertags:
|
case eGameSetting_DisplaySplitscreenGamertags:
|
||||||
for (std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) {
|
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 ==
|
if (pMinecraft->localplayers[idx]->m_iScreenSection ==
|
||||||
C4JRender::VIEWPORT_TYPE_FULLSCREEN) {
|
C4JRender::VIEWPORT_TYPE_FULLSCREEN) {
|
||||||
ui.DisplayGamertag(idx, false);
|
ui.DisplayGamertag(idx, false);
|
||||||
|
|
@ -1188,7 +1188,7 @@ void CMinecraftApp::ActionGameSettings(int iPad, eGameSetting eVal) {
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
break;
|
break;
|
||||||
case eGameSetting_BedrockFog: {
|
case eGameSetting_BedrockFog: {
|
||||||
bool bInGame = pMinecraft->level != NULL;
|
bool bInGame = pMinecraft->level != nullptr;
|
||||||
|
|
||||||
// Game Host only
|
// Game Host only
|
||||||
if (bInGame && g_NetworkManager.IsHost() &&
|
if (bInGame && g_NetworkManager.IsHost() &&
|
||||||
|
|
@ -1249,7 +1249,7 @@ void CMinecraftApp::SetPlayerSkin(int iPad, std::uint32_t dwSkinId) {
|
||||||
TelemetryManager->RecordSkinChanged(iPad,
|
TelemetryManager->RecordSkinChanged(iPad,
|
||||||
GameSettingsA[iPad]->dwSelectedSkin);
|
GameSettingsA[iPad]->dwSelectedSkin);
|
||||||
|
|
||||||
if (Minecraft::GetInstance()->localplayers[iPad] != NULL)
|
if (Minecraft::GetInstance()->localplayers[iPad] != nullptr)
|
||||||
Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin(
|
Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin(
|
||||||
dwSkinId);
|
dwSkinId);
|
||||||
}
|
}
|
||||||
|
|
@ -1261,8 +1261,8 @@ std::wstring CMinecraftApp::GetPlayerSkinName(int iPad) {
|
||||||
std::uint32_t CMinecraftApp::GetPlayerSkinId(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
|
// 4J-PB -check the user has rights to use this skin - they may have had at
|
||||||
// some point but the entitlement has been removed.
|
// some point but the entitlement has been removed.
|
||||||
DLCPack* Pack = NULL;
|
DLCPack* Pack = nullptr;
|
||||||
DLCSkinFile* skinFile = NULL;
|
DLCSkinFile* skinFile = nullptr;
|
||||||
std::uint32_t dwSkin = GameSettingsA[iPad]->dwSelectedSkin;
|
std::uint32_t dwSkin = GameSettingsA[iPad]->dwSelectedSkin;
|
||||||
wchar_t chars[256];
|
wchar_t chars[256];
|
||||||
|
|
||||||
|
|
@ -1312,7 +1312,7 @@ void CMinecraftApp::SetPlayerCape(int iPad, std::uint32_t dwCapeId) {
|
||||||
// SentientManager.RecordSkinChanged(iPad,
|
// SentientManager.RecordSkinChanged(iPad,
|
||||||
// GameSettingsA[iPad]->dwSelectedSkin);
|
// GameSettingsA[iPad]->dwSelectedSkin);
|
||||||
|
|
||||||
if (Minecraft::GetInstance()->localplayers[iPad] != NULL)
|
if (Minecraft::GetInstance()->localplayers[iPad] != nullptr)
|
||||||
Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape(
|
Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape(
|
||||||
dwCapeId);
|
dwCapeId);
|
||||||
}
|
}
|
||||||
|
|
@ -1373,7 +1373,7 @@ void CMinecraftApp::ValidateFavoriteSkins(int iPad) {
|
||||||
// Also check they haven't reverted to a trial pack
|
// Also check they haven't reverted to a trial pack
|
||||||
DLCPack* pDLCPack = app.m_dlcManager.getPackContainingSkin(chars);
|
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
|
// 4J-PB - We should let players add the free skins to their
|
||||||
// favourites as well!
|
// favourites as well!
|
||||||
// DLCFile
|
// DLCFile
|
||||||
|
|
@ -1416,7 +1416,7 @@ void CMinecraftApp::SetMinecraftLanguage(int iPad, unsigned char ucLanguage) {
|
||||||
|
|
||||||
unsigned char CMinecraftApp::GetMinecraftLanguage(int iPad) {
|
unsigned char CMinecraftApp::GetMinecraftLanguage(int iPad) {
|
||||||
// if there are no game settings read yet, return the default language
|
// if there are no game settings read yet, return the default language
|
||||||
if (GameSettingsA[iPad] == NULL) {
|
if (GameSettingsA[iPad] == nullptr) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return GameSettingsA[iPad]->ucLanguage;
|
return GameSettingsA[iPad]->ucLanguage;
|
||||||
|
|
@ -1430,7 +1430,7 @@ void CMinecraftApp::SetMinecraftLocale(int iPad, unsigned char ucLocale) {
|
||||||
|
|
||||||
unsigned char CMinecraftApp::GetMinecraftLocale(int iPad) {
|
unsigned char CMinecraftApp::GetMinecraftLocale(int iPad) {
|
||||||
// if there are no game settings read yet, return the default language
|
// if there are no game settings read yet, return the default language
|
||||||
if (GameSettingsA[iPad] == NULL) {
|
if (GameSettingsA[iPad] == nullptr) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return GameSettingsA[iPad]->ucLocale;
|
return GameSettingsA[iPad]->ucLocale;
|
||||||
|
|
@ -2044,7 +2044,7 @@ unsigned int CMinecraftApp::GetGameSettingsDebugMask(
|
||||||
std::shared_ptr<Player> player =
|
std::shared_ptr<Player> player =
|
||||||
Minecraft::GetInstance()->localplayers[iPad];
|
Minecraft::GetInstance()->localplayers[iPad];
|
||||||
|
|
||||||
if (bOverridePlayer || player == NULL) {
|
if (bOverridePlayer || player == nullptr) {
|
||||||
return GameSettingsA[iPad]->uiDebugBitmask;
|
return GameSettingsA[iPad]->uiDebugBitmask;
|
||||||
} else {
|
} else {
|
||||||
return player->GetDebugOptions();
|
return player->GetDebugOptions();
|
||||||
|
|
@ -2311,7 +2311,7 @@ void CMinecraftApp::HandleXuiActions(void) {
|
||||||
// Check that there is a name for the save - if we're saving
|
// Check that there is a name for the save - if we're saving
|
||||||
// from the tutorial and this is the first save from the
|
// from the tutorial and this is the first save from the
|
||||||
// tutorial, we'll not have a name
|
// tutorial, we'll not have a name
|
||||||
/*if(StorageManager.GetSaveName()==NULL)
|
/*if(StorageManager.GetSaveName()==nullptr)
|
||||||
{
|
{
|
||||||
app.NavigateToScene(i,eUIScene_SaveWorld);
|
app.NavigateToScene(i,eUIScene_SaveWorld);
|
||||||
}
|
}
|
||||||
|
|
@ -2385,7 +2385,7 @@ void CMinecraftApp::HandleXuiActions(void) {
|
||||||
// This just allows it to be shown
|
// This just allows it to be shown
|
||||||
if (pMinecraft
|
if (pMinecraft
|
||||||
->localgameModes[ProfileManager.GetPrimaryPad()] !=
|
->localgameModes[ProfileManager.GetPrimaryPad()] !=
|
||||||
NULL)
|
nullptr)
|
||||||
pMinecraft
|
pMinecraft
|
||||||
->localgameModes[ProfileManager.GetPrimaryPad()]
|
->localgameModes[ProfileManager.GetPrimaryPad()]
|
||||||
->getTutorial()
|
->getTutorial()
|
||||||
|
|
@ -2699,8 +2699,8 @@ void CMinecraftApp::HandleXuiActions(void) {
|
||||||
// Changed - Don't use the FullScreenProgressScreen for
|
// Changed - Don't use the FullScreenProgressScreen for
|
||||||
// action, use a dialog instead
|
// action, use a dialog instead
|
||||||
completionData->bRequiresUserAction =
|
completionData->bRequiresUserAction =
|
||||||
FALSE; //(param != NULL) ? TRUE : FALSE;
|
FALSE; //(param != nullptr) ? TRUE : FALSE;
|
||||||
completionData->bShowTips = (param != NULL) ? FALSE : TRUE;
|
completionData->bShowTips = (param != nullptr) ? FALSE : TRUE;
|
||||||
completionData->bShowBackground = TRUE;
|
completionData->bShowBackground = TRUE;
|
||||||
completionData->bShowLogo = TRUE;
|
completionData->bShowLogo = TRUE;
|
||||||
completionData->type =
|
completionData->type =
|
||||||
|
|
@ -2823,7 +2823,7 @@ void CMinecraftApp::HandleXuiActions(void) {
|
||||||
} break;
|
} break;
|
||||||
case eAppAction_WaitForRespawnComplete:
|
case eAppAction_WaitForRespawnComplete:
|
||||||
player = pMinecraft->localplayers[i];
|
player = pMinecraft->localplayers[i];
|
||||||
if (player != NULL && player->GetPlayerRespawned()) {
|
if (player != nullptr && player->GetPlayerRespawned()) {
|
||||||
SetAction(i, eAppAction_Idle);
|
SetAction(i, eAppAction_Idle);
|
||||||
|
|
||||||
if (ui.IsSceneInStack(i, eUIScene_EndPoem)) {
|
if (ui.IsSceneInStack(i, eUIScene_EndPoem)) {
|
||||||
|
|
@ -2842,7 +2842,7 @@ void CMinecraftApp::HandleXuiActions(void) {
|
||||||
break;
|
break;
|
||||||
case eAppAction_WaitForDimensionChangeComplete:
|
case eAppAction_WaitForDimensionChangeComplete:
|
||||||
player = pMinecraft->localplayers[i];
|
player = pMinecraft->localplayers[i];
|
||||||
if (player != NULL && player->connection &&
|
if (player != nullptr && player->connection &&
|
||||||
player->connection->isStarted()) {
|
player->connection->isStarted()) {
|
||||||
SetAction(i, eAppAction_Idle);
|
SetAction(i, eAppAction_Idle);
|
||||||
ui.CloseUIScenes(i);
|
ui.CloseUIScenes(i);
|
||||||
|
|
@ -2930,7 +2930,7 @@ void CMinecraftApp::HandleXuiActions(void) {
|
||||||
bool gameStarted = false;
|
bool gameStarted = false;
|
||||||
for (int j = 0; j < pMinecraft->levels.length;
|
for (int j = 0; j < pMinecraft->levels.length;
|
||||||
j++) {
|
j++) {
|
||||||
if (pMinecraft->levels.data[j] != NULL) {
|
if (pMinecraft->levels.data[j] != nullptr) {
|
||||||
gameStarted = true;
|
gameStarted = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -3187,7 +3187,7 @@ void CMinecraftApp::HandleXuiActions(void) {
|
||||||
// unmount the pack
|
// unmount the pack
|
||||||
TexturePack* pTexPack =
|
TexturePack* pTexPack =
|
||||||
Minecraft::GetInstance()->skins->getSelected();
|
Minecraft::GetInstance()->skins->getSelected();
|
||||||
DLCTexturePack* pDLCTexPack = NULL;
|
DLCTexturePack* pDLCTexPack = nullptr;
|
||||||
|
|
||||||
if (pTexPack->hasAudio()) {
|
if (pTexPack->hasAudio()) {
|
||||||
// get the dlc texture pack, and store it
|
// get the dlc texture pack, and store it
|
||||||
|
|
@ -3328,7 +3328,7 @@ void CMinecraftApp::HandleXuiActions(void) {
|
||||||
loadingParams->func =
|
loadingParams->func =
|
||||||
&CGameNetworkManager::
|
&CGameNetworkManager::
|
||||||
ChangeSessionTypeThreadProc;
|
ChangeSessionTypeThreadProc;
|
||||||
loadingParams->lpParam = NULL;
|
loadingParams->lpParam = nullptr;
|
||||||
|
|
||||||
UIFullscreenProgressCompletionData* completionData =
|
UIFullscreenProgressCompletionData* completionData =
|
||||||
new UIFullscreenProgressCompletionData();
|
new UIFullscreenProgressCompletionData();
|
||||||
|
|
@ -3391,7 +3391,7 @@ void CMinecraftApp::HandleXuiActions(void) {
|
||||||
LoadingInputParams* loadingParams =
|
LoadingInputParams* loadingParams =
|
||||||
new LoadingInputParams();
|
new LoadingInputParams();
|
||||||
loadingParams->func = &CMinecraftApp::RemoteSaveThreadProc;
|
loadingParams->func = &CMinecraftApp::RemoteSaveThreadProc;
|
||||||
loadingParams->lpParam = NULL;
|
loadingParams->lpParam = nullptr;
|
||||||
|
|
||||||
UIFullscreenProgressCompletionData* completionData =
|
UIFullscreenProgressCompletionData* completionData =
|
||||||
new UIFullscreenProgressCompletionData();
|
new UIFullscreenProgressCompletionData();
|
||||||
|
|
@ -3707,7 +3707,7 @@ void CMinecraftApp::loadMediaArchive() {
|
||||||
|
|
||||||
void CMinecraftApp::loadStringTable() {
|
void CMinecraftApp::loadStringTable() {
|
||||||
|
|
||||||
if (m_stringTable != NULL) {
|
if (m_stringTable != nullptr) {
|
||||||
// we need to unload the current std::string table, this is a reload
|
// we need to unload the current std::string table, this is a reload
|
||||||
delete m_stringTable;
|
delete m_stringTable;
|
||||||
}
|
}
|
||||||
|
|
@ -3717,7 +3717,7 @@ void CMinecraftApp::loadStringTable() {
|
||||||
m_stringTable = new StringTable(locFile.data, locFile.length);
|
m_stringTable = new StringTable(locFile.data, locFile.length);
|
||||||
delete[] locFile.data;
|
delete[] locFile.data;
|
||||||
} else {
|
} else {
|
||||||
m_stringTable = NULL;
|
m_stringTable = nullptr;
|
||||||
assert(false);
|
assert(false);
|
||||||
// AHHHHHHHHH.
|
// AHHHHHHHHH.
|
||||||
}
|
}
|
||||||
|
|
@ -3729,7 +3729,7 @@ int CMinecraftApp::PrimaryPlayerSignedOutReturned(
|
||||||
// Minecraft *pMinecraft=Minecraft::GetInstance();
|
// Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||||
|
|
||||||
// if the player is null, we're in the menus
|
// 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
|
// 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
|
// 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();
|
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||||
|
|
||||||
// if the player is null, we're in the menus
|
// 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(),
|
app.SetAction(pMinecraft->player->GetXboxPad(),
|
||||||
eAppAction_EthernetDisconnectedReturned);
|
eAppAction_EthernetDisconnectedReturned);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -3772,7 +3772,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc(void* lpParameter) {
|
||||||
|
|
||||||
bool saveStats = false;
|
bool saveStats = false;
|
||||||
if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession()) {
|
if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession()) {
|
||||||
if (lpParameter != NULL) {
|
if (lpParameter != nullptr) {
|
||||||
switch (app.GetDisconnectReason()) {
|
switch (app.GetDisconnectReason()) {
|
||||||
case DisconnectPacket::eDisconnect_Kicked:
|
case DisconnectPacket::eDisconnect_Kicked:
|
||||||
exitReasonStringId = IDS_DISCONNECTED_KICKED;
|
exitReasonStringId = IDS_DISCONNECTED_KICKED;
|
||||||
|
|
@ -3801,18 +3801,18 @@ int CMinecraftApp::SignoutExitWorldThreadProc(void* lpParameter) {
|
||||||
exitReasonStringId);
|
exitReasonStringId);
|
||||||
// 4J - Force a disconnection, this handles the situation that the
|
// 4J - Force a disconnection, this handles the situation that the
|
||||||
// server has already disconnected
|
// server has already disconnected
|
||||||
if (pMinecraft->levels[0] != NULL)
|
if (pMinecraft->levels[0] != nullptr)
|
||||||
pMinecraft->levels[0]->disconnect(false);
|
pMinecraft->levels[0]->disconnect(false);
|
||||||
if (pMinecraft->levels[1] != NULL)
|
if (pMinecraft->levels[1] != nullptr)
|
||||||
pMinecraft->levels[1]->disconnect(false);
|
pMinecraft->levels[1]->disconnect(false);
|
||||||
} else {
|
} else {
|
||||||
exitReasonStringId = IDS_EXITING_GAME;
|
exitReasonStringId = IDS_EXITING_GAME;
|
||||||
pMinecraft->progressRenderer->progressStartNoAbort(
|
pMinecraft->progressRenderer->progressStartNoAbort(
|
||||||
IDS_EXITING_GAME);
|
IDS_EXITING_GAME);
|
||||||
|
|
||||||
if (pMinecraft->levels[0] != NULL)
|
if (pMinecraft->levels[0] != nullptr)
|
||||||
pMinecraft->levels[0]->disconnect();
|
pMinecraft->levels[0]->disconnect();
|
||||||
if (pMinecraft->levels[1] != NULL)
|
if (pMinecraft->levels[1] != nullptr)
|
||||||
pMinecraft->levels[1]->disconnect();
|
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
|
// 4J Stu - Leave the session once the disconnect packet has been sent
|
||||||
g_NetworkManager.LeaveGame(FALSE);
|
g_NetworkManager.LeaveGame(FALSE);
|
||||||
} else {
|
} else {
|
||||||
if (lpParameter != NULL) {
|
if (lpParameter != nullptr) {
|
||||||
switch (app.GetDisconnectReason()) {
|
switch (app.GetDisconnectReason()) {
|
||||||
case DisconnectPacket::eDisconnect_Kicked:
|
case DisconnectPacket::eDisconnect_Kicked:
|
||||||
exitReasonStringId = IDS_DISCONNECTED_KICKED;
|
exitReasonStringId = IDS_DISCONNECTED_KICKED;
|
||||||
|
|
@ -3853,7 +3853,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc(void* lpParameter) {
|
||||||
exitReasonStringId);
|
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:
|
// 4J-JEV: Fix for #106402 - TCR #014 BAS Debug Output:
|
||||||
// TU12: Mass Effect Mash-UP: Save file "Default_DisplayName" is created on
|
// 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
|
// 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
|
// be in the main menus here, and we don't have a pMinecraft->player
|
||||||
|
|
||||||
if (pMinecraft->player == NULL) {
|
if (pMinecraft->player == nullptr) {
|
||||||
bNoPlayer = true;
|
bNoPlayer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4083,7 +4083,7 @@ void CMinecraftApp::SignInChangeCallback(void* pParam,
|
||||||
// invalidates all the guest players we have in the game
|
// invalidates all the guest players we have in the game
|
||||||
if (hasGuestIdChanged &&
|
if (hasGuestIdChanged &&
|
||||||
pApp->m_currentSigninInfo[i].dwGuestNumber != 0 &&
|
pApp->m_currentSigninInfo[i].dwGuestNumber != 0 &&
|
||||||
g_NetworkManager.GetLocalPlayerByUserIndex(i) != NULL) {
|
g_NetworkManager.GetLocalPlayerByUserIndex(i) != nullptr) {
|
||||||
pApp->DebugPrintf(
|
pApp->DebugPrintf(
|
||||||
"Recommending removal of player at index %d "
|
"Recommending removal of player at index %d "
|
||||||
"because their guest id changed\n",
|
"because their guest id changed\n",
|
||||||
|
|
@ -4123,9 +4123,9 @@ void CMinecraftApp::SignInChangeCallback(void* pParam,
|
||||||
// manager or in the game, need to exit player
|
// manager or in the game, need to exit player
|
||||||
// TODO: Do we need to check the network manager?
|
// TODO: Do we need to check the network manager?
|
||||||
if (g_NetworkManager.GetLocalPlayerByUserIndex(i) !=
|
if (g_NetworkManager.GetLocalPlayerByUserIndex(i) !=
|
||||||
NULL ||
|
nullptr ||
|
||||||
Minecraft::GetInstance()->localplayers[i] !=
|
Minecraft::GetInstance()->localplayers[i] !=
|
||||||
NULL) {
|
nullptr) {
|
||||||
pApp->DebugPrintf("Player %d signed out\n", i);
|
pApp->DebugPrintf("Player %d signed out\n", i);
|
||||||
pApp->SetAction(i, eAppAction_ExitPlayer);
|
pApp->SetAction(i, eAppAction_ExitPlayer);
|
||||||
}
|
}
|
||||||
|
|
@ -4200,7 +4200,7 @@ void CMinecraftApp::NotificationsCallback(void* pParam,
|
||||||
if (app.GetGameStarted() && g_NetworkManager.IsInSession()) {
|
if (app.GetGameStarted() && g_NetworkManager.IsInSession()) {
|
||||||
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
||||||
if (!InputManager.IsPadConnected(i) &&
|
if (!InputManager.IsPadConnected(i) &&
|
||||||
Minecraft::GetInstance()->localplayers[i] != NULL &&
|
Minecraft::GetInstance()->localplayers[i] != nullptr &&
|
||||||
!ui.IsPauseMenuDisplayed(i) &&
|
!ui.IsPauseMenuDisplayed(i) &&
|
||||||
!ui.IsSceneInStack(i, eUIScene_EndPoem)) {
|
!ui.IsSceneInStack(i, eUIScene_EndPoem)) {
|
||||||
ui.CloseUIScenes(i);
|
ui.CloseUIScenes(i);
|
||||||
|
|
@ -4296,7 +4296,7 @@ int CMinecraftApp::GetLocalPlayerCount(void) {
|
||||||
int iPlayerC = 0;
|
int iPlayerC = 0;
|
||||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||||
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
||||||
if (pMinecraft != NULL && pMinecraft->localplayers[i] != NULL) {
|
if (pMinecraft != nullptr && pMinecraft->localplayers[i] != nullptr) {
|
||||||
iPlayerC++;
|
iPlayerC++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4420,16 +4420,16 @@ int CMinecraftApp::DLCMountedCallback(void* pParam, int iPad,
|
||||||
DLCPack* pack =
|
DLCPack* pack =
|
||||||
app.m_dlcManager.getPack(CONTENT_DATA_DISPLAY_NAME(ContentData));
|
app.m_dlcManager.getPack(CONTENT_DATA_DISPLAY_NAME(ContentData));
|
||||||
|
|
||||||
if (pack != NULL && pack->IsCorrupt()) {
|
if (pack != nullptr && pack->IsCorrupt()) {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"Pack '%ls' is corrupt, removing it from the DLC Manager.\n",
|
"Pack '%ls' is corrupt, removing it from the DLC Manager.\n",
|
||||||
CONTENT_DATA_DISPLAY_NAME(ContentData));
|
CONTENT_DATA_DISPLAY_NAME(ContentData));
|
||||||
|
|
||||||
app.m_dlcManager.removePack(pack);
|
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",
|
app.DebugPrintf("Pack \"%ls\" is not installed, so adding it\n",
|
||||||
CONTENT_DATA_DISPLAY_NAME(ContentData));
|
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
|
// // if the file is not already in the memory textures, then read
|
||||||
// it from TMS if(!bRes)
|
// it from TMS if(!bRes)
|
||||||
// {
|
// {
|
||||||
// std::uint8_t *pBuffer=NULL;
|
// std::uint8_t *pBuffer=nullptr;
|
||||||
// std::uint32_t dwSize=0;
|
// std::uint32_t dwSize=0;
|
||||||
// // 4J-PB - out for now for DaveK so he doesn't get the
|
// // 4J-PB - out for now for DaveK so he doesn't get the
|
||||||
// birthday cape #ifdef _CONTENT_PACKAGE
|
// birthday cape #ifdef _CONTENT_PACKAGE
|
||||||
|
|
@ -4581,7 +4581,7 @@ void CMinecraftApp::AddMemoryTextureFile(const std::wstring& wName,
|
||||||
unsigned int byteCount) {
|
unsigned int byteCount) {
|
||||||
EnterCriticalSection(&csMemFilesLock);
|
EnterCriticalSection(&csMemFilesLock);
|
||||||
// check it's not already in
|
// check it's not already in
|
||||||
PMEMDATA pData = NULL;
|
PMEMDATA pData = nullptr;
|
||||||
auto it = m_MEM_Files.find(wName);
|
auto it = m_MEM_Files.find(wName);
|
||||||
if (it != m_MEM_Files.end()) {
|
if (it != m_MEM_Files.end()) {
|
||||||
#if !defined(_CONTENT_PACKAGE)
|
#if !defined(_CONTENT_PACKAGE)
|
||||||
|
|
@ -4591,8 +4591,8 @@ void CMinecraftApp::AddMemoryTextureFile(const std::wstring& wName,
|
||||||
pData = (*it).second;
|
pData = (*it).second;
|
||||||
|
|
||||||
if (pData->byteCount == 0 && byteCount != 0) {
|
if (pData->byteCount == 0 && byteCount != 0) {
|
||||||
// This should never be NULL if dwBytes is 0
|
// This should never be nullptr if dwBytes is 0
|
||||||
if (pData->pbData != NULL) delete[] pData->pbData;
|
if (pData->pbData != nullptr) delete[] pData->pbData;
|
||||||
|
|
||||||
pData->pbData = pbData;
|
pData->pbData = pbData;
|
||||||
pData->byteCount = byteCount;
|
pData->byteCount = byteCount;
|
||||||
|
|
@ -4685,7 +4685,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig, std::uint8_t* pbData,
|
||||||
unsigned int byteCount) {
|
unsigned int byteCount) {
|
||||||
EnterCriticalSection(&csMemTPDLock);
|
EnterCriticalSection(&csMemTPDLock);
|
||||||
// check it's not already in
|
// check it's not already in
|
||||||
PMEMDATA pData = NULL;
|
PMEMDATA pData = nullptr;
|
||||||
auto it = m_MEM_TPD.find(iConfig);
|
auto it = m_MEM_TPD.find(iConfig);
|
||||||
if (it == m_MEM_TPD.end()) {
|
if (it == m_MEM_TPD.end()) {
|
||||||
pData = new MEMDATA();
|
pData = new MEMDATA();
|
||||||
|
|
@ -4702,7 +4702,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig, std::uint8_t* pbData,
|
||||||
void CMinecraftApp::RemoveMemoryTPDFile(int iConfig) {
|
void CMinecraftApp::RemoveMemoryTPDFile(int iConfig) {
|
||||||
EnterCriticalSection(&csMemTPDLock);
|
EnterCriticalSection(&csMemTPDLock);
|
||||||
// check it's not already in
|
// check it's not already in
|
||||||
PMEMDATA pData = NULL;
|
PMEMDATA pData = nullptr;
|
||||||
auto it = m_MEM_TPD.find(iConfig);
|
auto it = m_MEM_TPD.find(iConfig);
|
||||||
if (it != m_MEM_TPD.end()) {
|
if (it != m_MEM_TPD.end()) {
|
||||||
pData = m_MEM_TPD[iConfig];
|
pData = m_MEM_TPD[iConfig];
|
||||||
|
|
@ -4908,7 +4908,7 @@ int CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned(
|
||||||
ui.RequestErrorMessage(
|
ui.RequestErrorMessage(
|
||||||
IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE,
|
IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE,
|
||||||
IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad,
|
IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad,
|
||||||
&CMinecraftApp::WarningTrialTexturePackReturned, NULL);
|
&CMinecraftApp::WarningTrialTexturePackReturned, nullptr);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -5438,10 +5438,10 @@ HRESULT CMinecraftApp::RegisterMojangData(WCHAR* pXuidName, PlayerUID xuid,
|
||||||
WCHAR* pSkin, WCHAR* pCape) {
|
WCHAR* pSkin, WCHAR* pCape) {
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
eXUID eTempXuid = eXUID_Undefined;
|
eXUID eTempXuid = eXUID_Undefined;
|
||||||
MOJANG_DATA* pMojangData = NULL;
|
MOJANG_DATA* pMojangData = nullptr;
|
||||||
|
|
||||||
// ignore the names if we don't recognize them
|
// ignore the names if we don't recognize them
|
||||||
if (pXuidName != NULL) {
|
if (pXuidName != nullptr) {
|
||||||
if (wcscmp(pXuidName, L"XUID_NOTCH") == 0) {
|
if (wcscmp(pXuidName, L"XUID_NOTCH") == 0) {
|
||||||
eTempXuid =
|
eTempXuid =
|
||||||
eXUID_Notch; // might be needed for the apple at some point
|
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;
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
// #ifdef 0
|
// #ifdef 0
|
||||||
// if(pType!=NULL)
|
// if(pType!=nullptr)
|
||||||
// {
|
// {
|
||||||
// if(wcscmp(pType,L"XboxOneTransfer")==0)
|
// 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);
|
wcsncpy_s(pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pType != NULL) {
|
if (pType != nullptr) {
|
||||||
if (wcscmp(pType, L"Skin") == 0) {
|
if (wcscmp(pType, L"Skin") == 0) {
|
||||||
pDLCData->eDLCType = e_DLC_SkinPack;
|
pDLCData->eDLCType = e_DLC_SkinPack;
|
||||||
} else if (wcscmp(pType, L"Gamerpic") == 0) {
|
} 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* CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial) {
|
||||||
// DLC_INFO *pDLCInfo=NULL;
|
// DLC_INFO *pDLCInfo=nullptr;
|
||||||
if (DLCInfo_Trial.size() > 0) {
|
if (DLCInfo_Trial.size() > 0) {
|
||||||
auto it = DLCInfo_Trial.find(ullOfferID_Trial);
|
auto it = DLCInfo_Trial.find(ullOfferID_Trial);
|
||||||
|
|
||||||
if (it == DLCInfo_Trial.end()) {
|
if (it == DLCInfo_Trial.end()) {
|
||||||
// nothing for this
|
// nothing for this
|
||||||
return NULL;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLC_INFO* CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) {
|
DLC_INFO* CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) {
|
||||||
|
|
@ -5682,12 +5682,12 @@ DLC_INFO* CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full) {
|
||||||
|
|
||||||
if (it == DLCInfo_Full.end()) {
|
if (it == DLCInfo_Full.end()) {
|
||||||
// nothing for this
|
// nothing for this
|
||||||
return NULL;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMinecraftApp::EnterSaveNotificationSection() {
|
void CMinecraftApp::EnterSaveNotificationSection() {
|
||||||
|
|
@ -5786,7 +5786,7 @@ void CMinecraftApp::ExitGameFromRemoteSave(void* lpParameter) {
|
||||||
|
|
||||||
ui.RequestAlertMessage(
|
ui.RequestAlertMessage(
|
||||||
IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad,
|
IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad,
|
||||||
&CMinecraftApp::ExitGameFromRemoteSaveDialogReturned, NULL);
|
&CMinecraftApp::ExitGameFromRemoteSaveDialogReturned, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(
|
int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(
|
||||||
|
|
@ -5811,7 +5811,7 @@ int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMinecraftApp::SetSpecialTutorialCompletionFlag(int iPad, int index) {
|
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);
|
GameSettingsA[iPad]->uiSpecialTutorialBitmask |= (1 << index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5832,7 +5832,7 @@ void CMinecraftApp::InvalidateBannedList(int iPad) {
|
||||||
|
|
||||||
if (BannedListA[iPad].pBannedList) {
|
if (BannedListA[iPad].pBannedList) {
|
||||||
delete[] 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();) {
|
it != m_vBannedListA[iPad]->end();) {
|
||||||
PBANNEDLISTDATA pBannedListData = *it;
|
PBANNEDLISTDATA pBannedListData = *it;
|
||||||
|
|
||||||
if (pBannedListData != NULL) {
|
if (pBannedListData != nullptr) {
|
||||||
if (IsEqualXUID(pBannedListData->xuid, xuid) &&
|
if (IsEqualXUID(pBannedListData->xuid, xuid) &&
|
||||||
(strcmp(pBannedListData->pszLevelName, pszLevelName) == 0))
|
(strcmp(pBannedListData->pszLevelName, pszLevelName) == 0))
|
||||||
{
|
{
|
||||||
|
|
@ -6321,7 +6321,7 @@ unsigned int CMinecraftApp::GetGameHostOption(unsigned int uiHostSettings,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMinecraftApp::CanRecordStatsAndAchievements() {
|
bool CMinecraftApp::CanRecordStatsAndAchievements() {
|
||||||
bool isTutorial = Minecraft::GetInstance() != NULL &&
|
bool isTutorial = Minecraft::GetInstance() != nullptr &&
|
||||||
Minecraft::GetInstance()->isTutorial();
|
Minecraft::GetInstance()->isTutorial();
|
||||||
// 4J Stu - All of these options give the host player some advantage, so
|
// 4J Stu - All of these options give the host player some advantage, so
|
||||||
// should not allow achievements
|
// 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
|
// set this to retrieved whether it found it or not
|
||||||
pCurrent->eState = e_TMS_ContentState_Retrieved;
|
pCurrent->eState = e_TMS_ContentState_Retrieved;
|
||||||
|
|
||||||
if (pFileData != NULL) {
|
if (pFileData != nullptr) {
|
||||||
switch (pCurrent->eType) {
|
switch (pCurrent->eType) {
|
||||||
case e_DLC_TexturePackData: {
|
case e_DLC_TexturePackData: {
|
||||||
app.DebugPrintf("--- Got texturepack data %ls\n",
|
app.DebugPrintf("--- Got texturepack data %ls\n",
|
||||||
|
|
@ -7190,7 +7190,7 @@ std::vector<ModelPart*>* CMinecraftApp::SetAdditionalSkinBoxes(
|
||||||
std::vector<ModelPart*>* CMinecraftApp::GetAdditionalModelParts(
|
std::vector<ModelPart*>* CMinecraftApp::GetAdditionalModelParts(
|
||||||
std::uint32_t dwSkinID) {
|
std::uint32_t dwSkinID) {
|
||||||
EnterCriticalSection(&csAdditionalModelParts);
|
EnterCriticalSection(&csAdditionalModelParts);
|
||||||
std::vector<ModelPart*>* pvModelParts = NULL;
|
std::vector<ModelPart*>* pvModelParts = nullptr;
|
||||||
if (m_AdditionalModelParts.size() > 0) {
|
if (m_AdditionalModelParts.size() > 0) {
|
||||||
auto it = m_AdditionalModelParts.find(dwSkinID);
|
auto it = m_AdditionalModelParts.find(dwSkinID);
|
||||||
if (it != m_AdditionalModelParts.end()) {
|
if (it != m_AdditionalModelParts.end()) {
|
||||||
|
|
@ -7205,7 +7205,7 @@ std::vector<ModelPart*>* CMinecraftApp::GetAdditionalModelParts(
|
||||||
std::vector<SKIN_BOX*>* CMinecraftApp::GetAdditionalSkinBoxes(
|
std::vector<SKIN_BOX*>* CMinecraftApp::GetAdditionalSkinBoxes(
|
||||||
std::uint32_t dwSkinID) {
|
std::uint32_t dwSkinID) {
|
||||||
EnterCriticalSection(&csAdditionalSkinBoxes);
|
EnterCriticalSection(&csAdditionalSkinBoxes);
|
||||||
std::vector<SKIN_BOX*>* pvSkinBoxes = NULL;
|
std::vector<SKIN_BOX*>* pvSkinBoxes = nullptr;
|
||||||
if (m_AdditionalSkinBoxes.size() > 0) {
|
if (m_AdditionalSkinBoxes.size() > 0) {
|
||||||
auto it = m_AdditionalSkinBoxes.find(dwSkinID);
|
auto it = m_AdditionalSkinBoxes.find(dwSkinID);
|
||||||
if (it != m_AdditionalSkinBoxes.end()) {
|
if (it != m_AdditionalSkinBoxes.end()) {
|
||||||
|
|
@ -7305,7 +7305,7 @@ int CMinecraftApp::TexturePackDialogReturned(
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMinecraftApp::getArchiveFileSize(const std::wstring& filename) {
|
int CMinecraftApp::getArchiveFileSize(const std::wstring& filename) {
|
||||||
TexturePack* tPack = NULL;
|
TexturePack* tPack = nullptr;
|
||||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||||
if (pMinecraft && pMinecraft->skins)
|
if (pMinecraft && pMinecraft->skins)
|
||||||
tPack = pMinecraft->skins->getSelected();
|
tPack = pMinecraft->skins->getSelected();
|
||||||
|
|
@ -7317,7 +7317,7 @@ int CMinecraftApp::getArchiveFileSize(const std::wstring& filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMinecraftApp::hasArchiveFile(const std::wstring& filename) {
|
bool CMinecraftApp::hasArchiveFile(const std::wstring& filename) {
|
||||||
TexturePack* tPack = NULL;
|
TexturePack* tPack = nullptr;
|
||||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||||
if (pMinecraft && pMinecraft->skins)
|
if (pMinecraft && pMinecraft->skins)
|
||||||
tPack = pMinecraft->skins->getSelected();
|
tPack = pMinecraft->skins->getSelected();
|
||||||
|
|
@ -7329,7 +7329,7 @@ bool CMinecraftApp::hasArchiveFile(const std::wstring& filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
byteArray CMinecraftApp::getArchiveFile(const std::wstring& filename) {
|
byteArray CMinecraftApp::getArchiveFile(const std::wstring& filename) {
|
||||||
TexturePack* tPack = NULL;
|
TexturePack* tPack = nullptr;
|
||||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||||
if (pMinecraft && pMinecraft->skins)
|
if (pMinecraft && pMinecraft->skins)
|
||||||
tPack = pMinecraft->skins->getSelected();
|
tPack = pMinecraft->skins->getSelected();
|
||||||
|
|
|
||||||
|
|
@ -950,7 +950,7 @@ public:
|
||||||
m_bRead_BannedListA[iPad] = bVal;
|
m_bRead_BannedListA[iPad] = bVal;
|
||||||
}
|
}
|
||||||
void ClearBanList(int iPad) {
|
void ClearBanList(int iPad) {
|
||||||
BannedListA[iPad].pBannedList = NULL;
|
BannedListA[iPad].pBannedList = nullptr;
|
||||||
BannedListA[iPad].byteCount = 0;
|
BannedListA[iPad].byteCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -964,7 +964,7 @@ public:
|
||||||
virtual void GetFileFromTPD(eTPDFileType eType, std::uint8_t* pbData,
|
virtual void GetFileFromTPD(eTPDFileType eType, std::uint8_t* pbData,
|
||||||
unsigned int byteCount, std::uint8_t** ppbData,
|
unsigned int byteCount, std::uint8_t** ppbData,
|
||||||
unsigned int* pByteCount) {
|
unsigned int* pByteCount) {
|
||||||
*ppbData = NULL;
|
*ppbData = nullptr;
|
||||||
*pByteCount = 0;
|
*pByteCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ inline std::wstring ReadAudioParamString(const std::uint8_t* data,
|
||||||
|
|
||||||
DLCAudioFile::DLCAudioFile(const std::wstring& path)
|
DLCAudioFile::DLCAudioFile(const std::wstring& path)
|
||||||
: DLCFile(DLCManager::e_DLCType_Audio, path) {
|
: DLCFile(DLCManager::e_DLCType_Audio, path) {
|
||||||
m_pbData = NULL;
|
m_pbData = nullptr;
|
||||||
m_dataBytes = 0;
|
m_dataBytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -181,7 +181,7 @@ bool DLCAudioFile::processDLCDataFile(std::uint8_t* pbData,
|
||||||
uiCurrentByte += sizeof(int);
|
uiCurrentByte += sizeof(int);
|
||||||
|
|
||||||
if (uiVersion < CURRENT_AUDIO_VERSION_NUM) {
|
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);
|
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@
|
||||||
|
|
||||||
DLCColourTableFile::DLCColourTableFile(const std::wstring& path)
|
DLCColourTableFile::DLCColourTableFile(const std::wstring& path)
|
||||||
: DLCFile(DLCManager::e_DLCType_ColourTable, path) {
|
: DLCFile(DLCManager::e_DLCType_ColourTable, path) {
|
||||||
m_colourTable = NULL;
|
m_colourTable = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLCColourTableFile::~DLCColourTableFile() {
|
DLCColourTableFile::~DLCColourTableFile() {
|
||||||
if (m_colourTable != NULL) {
|
if (m_colourTable != nullptr) {
|
||||||
app.DebugPrintf("Deleting DLCColourTableFile data\n");
|
app.DebugPrintf("Deleting DLCColourTableFile data\n");
|
||||||
delete m_colourTable;
|
delete m_colourTable;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public:
|
||||||
virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes) {}
|
virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes) {}
|
||||||
virtual std::uint8_t* getData(std::uint32_t& dataBytes) {
|
virtual std::uint8_t* getData(std::uint32_t& dataBytes) {
|
||||||
dataBytes = 0;
|
dataBytes = 0;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
virtual void addParameter(DLCManager::EDLCParameterType type,
|
virtual void addParameter(DLCManager::EDLCParameterType type,
|
||||||
const std::wstring& value) {}
|
const std::wstring& value) {}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
DLCGameRulesFile::DLCGameRulesFile(const std::wstring& path)
|
DLCGameRulesFile::DLCGameRulesFile(const std::wstring& path)
|
||||||
: DLCGameRules(DLCManager::e_DLCType_GameRules, path) {
|
: DLCGameRules(DLCManager::e_DLCType_GameRules, path) {
|
||||||
m_pbData = NULL;
|
m_pbData = nullptr;
|
||||||
m_dataBytes = 0;
|
m_dataBytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,14 @@
|
||||||
|
|
||||||
DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring& path)
|
DLCGameRulesHeader::DLCGameRulesHeader(const std::wstring& path)
|
||||||
: DLCGameRules(DLCManager::e_DLCType_GameRulesHeader, path) {
|
: DLCGameRules(DLCManager::e_DLCType_GameRulesHeader, path) {
|
||||||
m_pbData = NULL;
|
m_pbData = nullptr;
|
||||||
m_dataBytes = 0;
|
m_dataBytes = 0;
|
||||||
|
|
||||||
m_hasData = false;
|
m_hasData = false;
|
||||||
|
|
||||||
m_grfPath = path.substr(0, path.length() - 4) + L".grf";
|
m_grfPath = path.substr(0, path.length() - 4) + L".grf";
|
||||||
|
|
||||||
lgo = NULL;
|
lgo = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DLCGameRulesHeader::addData(std::uint8_t* pbData,
|
void DLCGameRulesHeader::addData(std::uint8_t* pbData,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
DLCLocalisationFile::DLCLocalisationFile(const std::wstring& path)
|
DLCLocalisationFile::DLCLocalisationFile(const std::wstring& path)
|
||||||
: DLCFile(DLCManager::e_DLCType_LocalisationData, path) {
|
: DLCFile(DLCManager::e_DLCType_LocalisationData, path) {
|
||||||
m_strings = NULL;
|
m_strings = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DLCLocalisationFile::addData(std::uint8_t* pbData,
|
void DLCLocalisationFile::addData(std::uint8_t* pbData,
|
||||||
|
|
|
||||||
|
|
@ -87,12 +87,12 @@ std::wstring getMountedDlcReadPath(const std::string& path) {
|
||||||
|
|
||||||
bool readOwnedDlcFile(const std::string& path, std::uint8_t** ppData,
|
bool readOwnedDlcFile(const std::string& path, std::uint8_t** ppData,
|
||||||
unsigned int* pBytesRead) {
|
unsigned int* pBytesRead) {
|
||||||
*ppData = NULL;
|
*ppData = nullptr;
|
||||||
*pBytesRead = 0;
|
*pBytesRead = 0;
|
||||||
|
|
||||||
const std::wstring readPath = getMountedDlcReadPath(path);
|
const std::wstring readPath = getMountedDlcReadPath(path);
|
||||||
std::FILE* file = PortableFileIO::OpenBinaryFileForRead(readPath);
|
std::FILE* file = PortableFileIO::OpenBinaryFileForRead(readPath);
|
||||||
if (file == NULL) {
|
if (file == nullptr) {
|
||||||
return false;
|
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::addPack(DLCPack* pack) { m_packs.push_back(pack); }
|
||||||
|
|
||||||
void DLCManager::removePack(DLCPack* pack) {
|
void DLCManager::removePack(DLCPack* pack) {
|
||||||
if (pack != NULL) {
|
if (pack != nullptr) {
|
||||||
auto it = find(m_packs.begin(), m_packs.end(), pack);
|
auto it = find(m_packs.begin(), m_packs.end(), pack);
|
||||||
if (it != m_packs.end()) m_packs.erase(it);
|
if (it != m_packs.end()) m_packs.erase(it);
|
||||||
delete pack;
|
delete pack;
|
||||||
|
|
@ -214,9 +214,9 @@ void DLCManager::LanguageChanged(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DLCPack* DLCManager::getPack(const std::wstring& name) {
|
DLCPack* DLCManager::getPack(const std::wstring& name) {
|
||||||
DLCPack* pack = NULL;
|
DLCPack* pack = nullptr;
|
||||||
// DWORD currentIndex = 0;
|
// DWORD currentIndex = 0;
|
||||||
DLCPack* currentPack = NULL;
|
DLCPack* currentPack = nullptr;
|
||||||
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
|
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
|
||||||
currentPack = *it;
|
currentPack = *it;
|
||||||
std::wstring wsName = currentPack->getName();
|
std::wstring wsName = currentPack->getName();
|
||||||
|
|
@ -232,10 +232,10 @@ DLCPack* DLCManager::getPack(const std::wstring& name) {
|
||||||
|
|
||||||
DLCPack* DLCManager::getPack(unsigned int index,
|
DLCPack* DLCManager::getPack(unsigned int index,
|
||||||
EDLCType type /*= e_DLCType_All*/) {
|
EDLCType type /*= e_DLCType_All*/) {
|
||||||
DLCPack* pack = NULL;
|
DLCPack* pack = nullptr;
|
||||||
if (type != e_DLCType_All) {
|
if (type != e_DLCType_All) {
|
||||||
unsigned int currentIndex = 0;
|
unsigned int currentIndex = 0;
|
||||||
DLCPack* currentPack = NULL;
|
DLCPack* currentPack = nullptr;
|
||||||
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
|
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
|
||||||
currentPack = *it;
|
currentPack = *it;
|
||||||
if (currentPack->getDLCItemsCount(type) > 0) {
|
if (currentPack->getDLCItemsCount(type) > 0) {
|
||||||
|
|
@ -263,9 +263,9 @@ unsigned int DLCManager::getPackIndex(DLCPack* pack, bool& found,
|
||||||
EDLCType type /*= e_DLCType_All*/) {
|
EDLCType type /*= e_DLCType_All*/) {
|
||||||
unsigned int foundIndex = 0;
|
unsigned int foundIndex = 0;
|
||||||
found = false;
|
found = false;
|
||||||
if (pack == NULL) {
|
if (pack == nullptr) {
|
||||||
app.DebugPrintf(
|
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();
|
//__debugbreak();
|
||||||
return foundIndex;
|
return foundIndex;
|
||||||
}
|
}
|
||||||
|
|
@ -317,7 +317,7 @@ unsigned int DLCManager::getPackIndexContainingSkin(const std::wstring& path,
|
||||||
}
|
}
|
||||||
|
|
||||||
DLCPack* DLCManager::getPackContainingSkin(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) {
|
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
|
||||||
DLCPack* pack = *it;
|
DLCPack* pack = *it;
|
||||||
if (pack->getDLCItemsCount(e_DLCType_Skin) > 0) {
|
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* DLCManager::getSkinFile(const std::wstring& path) {
|
||||||
DLCSkinFile* foundSkinfile = NULL;
|
DLCSkinFile* foundSkinfile = nullptr;
|
||||||
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
|
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
|
||||||
DLCPack* pack = *it;
|
DLCPack* pack = *it;
|
||||||
foundSkinfile = pack->getSkinFile(path);
|
foundSkinfile = pack->getSkinFile(path);
|
||||||
if (foundSkinfile != NULL) {
|
if (foundSkinfile != nullptr) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -345,14 +345,14 @@ DLCSkinFile* DLCManager::getSkinFile(const std::wstring& path) {
|
||||||
unsigned int DLCManager::checkForCorruptDLCAndAlert(
|
unsigned int DLCManager::checkForCorruptDLCAndAlert(
|
||||||
bool showMessage /*= true*/) {
|
bool showMessage /*= true*/) {
|
||||||
unsigned int corruptDLCCount = m_dwUnnamedCorruptDLCCount;
|
unsigned int corruptDLCCount = m_dwUnnamedCorruptDLCCount;
|
||||||
DLCPack* pack = NULL;
|
DLCPack* pack = nullptr;
|
||||||
DLCPack* firstCorruptPack = NULL;
|
DLCPack* firstCorruptPack = nullptr;
|
||||||
|
|
||||||
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
|
for (auto it = m_packs.begin(); it != m_packs.end(); ++it) {
|
||||||
pack = *it;
|
pack = *it;
|
||||||
if (pack->IsCorrupt()) {
|
if (pack->IsCorrupt()) {
|
||||||
++corruptDLCCount;
|
++corruptDLCCount;
|
||||||
if (firstCorruptPack == NULL) firstCorruptPack = pack;
|
if (firstCorruptPack == nullptr) firstCorruptPack = pack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -360,7 +360,7 @@ unsigned int DLCManager::checkForCorruptDLCAndAlert(
|
||||||
if (corruptDLCCount > 0 && showMessage) {
|
if (corruptDLCCount > 0 && showMessage) {
|
||||||
unsigned int uiIDA[1];
|
unsigned int uiIDA[1];
|
||||||
uiIDA[0] = IDS_CONFIRM_OK;
|
uiIDA[0] = IDS_CONFIRM_OK;
|
||||||
if (corruptDLCCount == 1 && firstCorruptPack != NULL) {
|
if (corruptDLCCount == 1 && firstCorruptPack != nullptr) {
|
||||||
// pass in the pack format string
|
// pass in the pack format string
|
||||||
WCHAR wchFormat[132];
|
WCHAR wchFormat[132];
|
||||||
swprintf(wchFormat, 132, L"%ls\n\n%%ls",
|
swprintf(wchFormat, 132, L"%ls\n\n%%ls",
|
||||||
|
|
@ -368,7 +368,7 @@ unsigned int DLCManager::checkForCorruptDLCAndAlert(
|
||||||
|
|
||||||
C4JStorage::EMessageResult result = ui.RequestErrorMessage(
|
C4JStorage::EMessageResult result = ui.RequestErrorMessage(
|
||||||
IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA, 1,
|
IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA, 1,
|
||||||
ProfileManager.GetPrimaryPad(), NULL, NULL, wchFormat);
|
ProfileManager.GetPrimaryPad(), nullptr, nullptr, wchFormat);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
C4JStorage::EMessageResult result = ui.RequestErrorMessage(
|
C4JStorage::EMessageResult result = ui.RequestErrorMessage(
|
||||||
|
|
@ -401,7 +401,7 @@ bool DLCManager::readDLCDataFile(unsigned int& dwFilesProcessed,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
unsigned int bytesRead = 0;
|
unsigned int bytesRead = 0;
|
||||||
std::uint8_t* pbData = NULL;
|
std::uint8_t* pbData = nullptr;
|
||||||
if (!readOwnedDlcFile(path, &pbData, &bytesRead)) {
|
if (!readOwnedDlcFile(path, &pbData, &bytesRead)) {
|
||||||
app.DebugPrintf("Failed to open DLC data file %s\n", path.c_str());
|
app.DebugPrintf("Failed to open DLC data file %s\n", path.c_str());
|
||||||
pack->SetIsCorrupt(true);
|
pack->SetIsCorrupt(true);
|
||||||
|
|
@ -462,7 +462,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
|
||||||
uiCurrentByte += sizeof(int);
|
uiCurrentByte += sizeof(int);
|
||||||
|
|
||||||
if (uiVersion < CURRENT_DLC_VERSION_NUM) {
|
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);
|
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -508,8 +508,8 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
|
||||||
for (unsigned int i = 0; i < uiFileCount; i++) {
|
for (unsigned int i = 0; i < uiFileCount; i++) {
|
||||||
DLCManager::EDLCType type = (DLCManager::EDLCType)fileBuf.dwType;
|
DLCManager::EDLCType type = (DLCManager::EDLCType)fileBuf.dwType;
|
||||||
|
|
||||||
DLCFile* dlcFile = NULL;
|
DLCFile* dlcFile = nullptr;
|
||||||
DLCPack* dlcTexturePack = NULL;
|
DLCPack* dlcTexturePack = nullptr;
|
||||||
|
|
||||||
if (type == e_DLCType_TexturePack) {
|
if (type == e_DLCType_TexturePack) {
|
||||||
dlcTexturePack =
|
dlcTexturePack =
|
||||||
|
|
@ -535,10 +535,10 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
|
||||||
if (type == e_DLCType_PackConfig) {
|
if (type == e_DLCType_PackConfig) {
|
||||||
pack->addParameter(it->second, DLC_PARAM_WSTR(pbTemp, 0));
|
pack->addParameter(it->second, DLC_PARAM_WSTR(pbTemp, 0));
|
||||||
} else {
|
} else {
|
||||||
if (dlcFile != NULL)
|
if (dlcFile != nullptr)
|
||||||
dlcFile->addParameter(it->second,
|
dlcFile->addParameter(it->second,
|
||||||
DLC_PARAM_WSTR(pbTemp, 0));
|
DLC_PARAM_WSTR(pbTemp, 0));
|
||||||
else if (dlcTexturePack != NULL)
|
else if (dlcTexturePack != nullptr)
|
||||||
dlcTexturePack->addParameter(it->second,
|
dlcTexturePack->addParameter(it->second,
|
||||||
DLC_PARAM_WSTR(pbTemp, 0));
|
DLC_PARAM_WSTR(pbTemp, 0));
|
||||||
}
|
}
|
||||||
|
|
@ -548,16 +548,16 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
|
||||||
}
|
}
|
||||||
// pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM);
|
// pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM);
|
||||||
|
|
||||||
if (dlcTexturePack != NULL) {
|
if (dlcTexturePack != nullptr) {
|
||||||
unsigned int texturePackFilesProcessed = 0;
|
unsigned int texturePackFilesProcessed = 0;
|
||||||
bool validPack =
|
bool validPack =
|
||||||
processDLCDataFile(texturePackFilesProcessed, pbTemp,
|
processDLCDataFile(texturePackFilesProcessed, pbTemp,
|
||||||
fileBuf.uiFileSize, dlcTexturePack);
|
fileBuf.uiFileSize, dlcTexturePack);
|
||||||
pack->SetDataPointer(
|
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) {
|
if (!validPack || texturePackFilesProcessed == 0) {
|
||||||
delete dlcTexturePack;
|
delete dlcTexturePack;
|
||||||
dlcTexturePack = NULL;
|
dlcTexturePack = nullptr;
|
||||||
} else {
|
} else {
|
||||||
pack->addChildPack(dlcTexturePack);
|
pack->addChildPack(dlcTexturePack);
|
||||||
|
|
||||||
|
|
@ -568,7 +568,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++dwFilesProcessed;
|
++dwFilesProcessed;
|
||||||
} else if (dlcFile != NULL) {
|
} else if (dlcFile != nullptr) {
|
||||||
// Data
|
// Data
|
||||||
dlcFile->addData(pbTemp, fileBuf.uiFileSize);
|
dlcFile->addData(pbTemp, fileBuf.uiFileSize);
|
||||||
|
|
||||||
|
|
@ -610,7 +610,7 @@ std::uint32_t DLCManager::retrievePackIDFromDLCDataFile(const std::string& path,
|
||||||
std::uint32_t packId = 0;
|
std::uint32_t packId = 0;
|
||||||
|
|
||||||
unsigned int bytesRead = 0;
|
unsigned int bytesRead = 0;
|
||||||
std::uint8_t* pbData = NULL;
|
std::uint8_t* pbData = nullptr;
|
||||||
if (!readOwnedDlcFile(path, &pbData, &bytesRead)) {
|
if (!readOwnedDlcFile(path, &pbData, &bytesRead)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,12 @@ DLCPack::DLCPack(const std::wstring& name, std::uint32_t dwLicenseMask) {
|
||||||
m_isCorrupt = false;
|
m_isCorrupt = false;
|
||||||
m_packId = 0;
|
m_packId = 0;
|
||||||
m_packVersion = 0;
|
m_packVersion = 0;
|
||||||
m_parentPack = NULL;
|
m_parentPack = nullptr;
|
||||||
m_dlcMountIndex = -1;
|
m_dlcMountIndex = -1;
|
||||||
|
|
||||||
// This pointer is for all the data used for this pack, so deleting it
|
// This pointer is for all the data used for this pack, so deleting it
|
||||||
// invalidates ALL of it's children.
|
// 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
|
// 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
|
// it just points to a region within the parent pack that has already
|
||||||
// been freed
|
// been freed
|
||||||
if (m_parentPack == NULL) {
|
if (m_parentPack == nullptr) {
|
||||||
delete[] m_data;
|
delete[] m_data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DLCPack::GetDLCMountIndex() {
|
int DLCPack::GetDLCMountIndex() {
|
||||||
if (m_parentPack != NULL) {
|
if (m_parentPack != nullptr) {
|
||||||
return m_parentPack->GetDLCMountIndex();
|
return m_parentPack->GetDLCMountIndex();
|
||||||
}
|
}
|
||||||
return m_dlcMountIndex;
|
return m_dlcMountIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
XCONTENTDEVICEID DLCPack::GetDLCDeviceID() {
|
XCONTENTDEVICEID DLCPack::GetDLCDeviceID() {
|
||||||
if (m_parentPack != NULL) {
|
if (m_parentPack != nullptr) {
|
||||||
return m_parentPack->GetDLCDeviceID();
|
return m_parentPack->GetDLCDeviceID();
|
||||||
}
|
}
|
||||||
return m_dlcDeviceID;
|
return m_dlcDeviceID;
|
||||||
|
|
@ -141,7 +141,7 @@ bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type,
|
||||||
}
|
}
|
||||||
|
|
||||||
DLCFile* DLCPack::addFile(DLCManager::EDLCType type, const std::wstring& path) {
|
DLCFile* DLCPack::addFile(DLCManager::EDLCType type, const std::wstring& path) {
|
||||||
DLCFile* newFile = NULL;
|
DLCFile* newFile = nullptr;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DLCManager::e_DLCType_Skin: {
|
case DLCManager::e_DLCType_Skin: {
|
||||||
|
|
@ -187,7 +187,7 @@ DLCFile* DLCPack::addFile(DLCManager::EDLCType type, const std::wstring& path) {
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (newFile != NULL) {
|
if (newFile != nullptr) {
|
||||||
m_files[newFile->getType()].push_back(newFile);
|
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
|
// MGH - added this comp func, as the embedded func in find_if was confusing the
|
||||||
// PS3 compiler
|
// PS3 compiler
|
||||||
static const std::wstring* g_pathCmpString = NULL;
|
static const std::wstring* g_pathCmpString = nullptr;
|
||||||
static bool pathCmp(DLCFile* val) {
|
static bool pathCmp(DLCFile* val) {
|
||||||
return (g_pathCmpString->compare(val->getPath()) == 0);
|
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* DLCPack::getFile(DLCManager::EDLCType type, unsigned int index) {
|
||||||
DLCFile* file = NULL;
|
DLCFile* file = nullptr;
|
||||||
if (type == DLCManager::e_DLCType_All) {
|
if (type == DLCManager::e_DLCType_All) {
|
||||||
for (DLCManager::EDLCType currentType = (DLCManager::EDLCType)0;
|
for (DLCManager::EDLCType currentType = (DLCManager::EDLCType)0;
|
||||||
currentType < DLCManager::e_DLCType_Max;
|
currentType < DLCManager::e_DLCType_Max;
|
||||||
currentType = (DLCManager::EDLCType)(currentType + 1)) {
|
currentType = (DLCManager::EDLCType)(currentType + 1)) {
|
||||||
file = getFile(currentType, index);
|
file = getFile(currentType, index);
|
||||||
if (file != NULL) break;
|
if (file != nullptr) break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_files[type].size() > index) file = m_files[type][index];
|
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* DLCPack::getFile(DLCManager::EDLCType type, const std::wstring& path) {
|
||||||
DLCFile* file = NULL;
|
DLCFile* file = nullptr;
|
||||||
if (type == DLCManager::e_DLCType_All) {
|
if (type == DLCManager::e_DLCType_All) {
|
||||||
for (DLCManager::EDLCType currentType = (DLCManager::EDLCType)0;
|
for (DLCManager::EDLCType currentType = (DLCManager::EDLCType)0;
|
||||||
currentType < DLCManager::e_DLCType_Max;
|
currentType < DLCManager::e_DLCType_Max;
|
||||||
currentType = (DLCManager::EDLCType)(currentType + 1)) {
|
currentType = (DLCManager::EDLCType)(currentType + 1)) {
|
||||||
file = getFile(currentType, path);
|
file = getFile(currentType, path);
|
||||||
if (file != NULL) break;
|
if (file != nullptr) break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g_pathCmpString = &path;
|
g_pathCmpString = &path;
|
||||||
|
|
@ -256,7 +256,7 @@ DLCFile* DLCPack::getFile(DLCManager::EDLCType type, const std::wstring& path) {
|
||||||
|
|
||||||
if (it == m_files[type].end()) {
|
if (it == m_files[type].end()) {
|
||||||
// Not found
|
// Not found
|
||||||
file = NULL;
|
file = nullptr;
|
||||||
} else {
|
} else {
|
||||||
file = *it;
|
file = *it;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ DLCTextureFile::DLCTextureFile(const std::wstring& path)
|
||||||
m_bIsAnim = false;
|
m_bIsAnim = false;
|
||||||
m_animString = L"";
|
m_animString = L"";
|
||||||
|
|
||||||
m_pbData = NULL;
|
m_pbData = nullptr;
|
||||||
m_dataBytes = 0;
|
m_dataBytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@
|
||||||
|
|
||||||
DLCUIDataFile::DLCUIDataFile(const std::wstring& path)
|
DLCUIDataFile::DLCUIDataFile(const std::wstring& path)
|
||||||
: DLCFile(DLCManager::e_DLCType_UIData, path) {
|
: DLCFile(DLCManager::e_DLCType_UIData, path) {
|
||||||
m_pbData = NULL;
|
m_pbData = nullptr;
|
||||||
m_dataBytes = 0;
|
m_dataBytes = 0;
|
||||||
m_canDeleteData = false;
|
m_canDeleteData = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLCUIDataFile::~DLCUIDataFile() {
|
DLCUIDataFile::~DLCUIDataFile() {
|
||||||
if (m_canDeleteData && m_pbData != NULL) {
|
if (m_canDeleteData && m_pbData != nullptr) {
|
||||||
app.DebugPrintf("Deleting DLCUIDataFile data\n");
|
app.DebugPrintf("Deleting DLCUIDataFile data\n");
|
||||||
delete[] m_pbData;
|
delete[] m_pbData;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ void AddEnchantmentRuleDefinition::addAttribute(
|
||||||
bool AddEnchantmentRuleDefinition::enchantItem(
|
bool AddEnchantmentRuleDefinition::enchantItem(
|
||||||
std::shared_ptr<ItemInstance> item) {
|
std::shared_ptr<ItemInstance> item) {
|
||||||
bool enchanted = false;
|
bool enchanted = false;
|
||||||
if (item != NULL) {
|
if (item != nullptr) {
|
||||||
// 4J-JEV: Ripped code from enchantmenthelpers
|
// 4J-JEV: Ripped code from enchantmenthelpers
|
||||||
// Maybe we want to add an addEnchantment method to EnchantmentHelpers
|
// Maybe we want to add an addEnchantment method to EnchantmentHelpers
|
||||||
if (item->id == Item::enchantedBook_Id) {
|
if (item->id == Item::enchantedBook_Id) {
|
||||||
|
|
@ -56,7 +56,7 @@ bool AddEnchantmentRuleDefinition::enchantItem(
|
||||||
} else if (item->isEnchantable()) {
|
} else if (item->isEnchantable()) {
|
||||||
Enchantment* e = Enchantment::enchantments[m_enchantmentId];
|
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);
|
int level = std::min(e->getMaxLevel(), m_enchantmentLevel);
|
||||||
item->enchant(e, m_enchantmentLevel);
|
item->enchant(e, m_enchantmentLevel);
|
||||||
enchanted = true;
|
enchanted = true;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ void AddItemRuleDefinition::getChildren(
|
||||||
|
|
||||||
GameRuleDefinition* AddItemRuleDefinition::addChild(
|
GameRuleDefinition* AddItemRuleDefinition::addChild(
|
||||||
ConsoleGameRules::EGameRuleType ruleType) {
|
ConsoleGameRules::EGameRuleType ruleType) {
|
||||||
GameRuleDefinition* rule = NULL;
|
GameRuleDefinition* rule = nullptr;
|
||||||
if (ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment) {
|
if (ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment) {
|
||||||
rule = new AddEnchantmentRuleDefinition();
|
rule = new AddEnchantmentRuleDefinition();
|
||||||
m_enchantments.push_back((AddEnchantmentRuleDefinition*)rule);
|
m_enchantments.push_back((AddEnchantmentRuleDefinition*)rule);
|
||||||
|
|
@ -88,7 +88,7 @@ void AddItemRuleDefinition::addAttribute(const std::wstring& attributeName,
|
||||||
bool AddItemRuleDefinition::addItemToContainer(
|
bool AddItemRuleDefinition::addItemToContainer(
|
||||||
std::shared_ptr<Container> container, int slotId) {
|
std::shared_ptr<Container> container, int slotId) {
|
||||||
bool added = false;
|
bool added = false;
|
||||||
if (Item::items[m_itemId] != NULL) {
|
if (Item::items[m_itemId] != nullptr) {
|
||||||
int quantity =
|
int quantity =
|
||||||
std::min(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
std::min(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
||||||
std::shared_ptr<ItemInstance> newItem = std::shared_ptr<ItemInstance>(
|
std::shared_ptr<ItemInstance> newItem = std::shared_ptr<ItemInstance>(
|
||||||
|
|
@ -106,7 +106,7 @@ bool AddItemRuleDefinition::addItemToContainer(
|
||||||
} else if (slotId >= 0 && slotId < container->getContainerSize()) {
|
} else if (slotId >= 0 && slotId < container->getContainerSize()) {
|
||||||
container->setItem(slotId, newItem);
|
container->setItem(slotId, newItem);
|
||||||
added = true;
|
added = true;
|
||||||
} else if (std::dynamic_pointer_cast<Inventory>(container) != NULL) {
|
} else if (std::dynamic_pointer_cast<Inventory>(container) != nullptr) {
|
||||||
added =
|
added =
|
||||||
std::dynamic_pointer_cast<Inventory>(container)->add(newItem);
|
std::dynamic_pointer_cast<Inventory>(container)->add(newItem);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,13 @@ ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(
|
||||||
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
|
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
|
||||||
m_completed = false;
|
m_completed = false;
|
||||||
m_dimension = 0;
|
m_dimension = 0;
|
||||||
m_schematic = NULL;
|
m_schematic = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition() {
|
ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition() {
|
||||||
app.DebugPrintf("Deleting ApplySchematicRuleDefinition.\n");
|
app.DebugPrintf("Deleting ApplySchematicRuleDefinition.\n");
|
||||||
if (!m_completed) m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
if (!m_completed) m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
||||||
m_schematic = NULL;
|
m_schematic = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream* dos,
|
void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream* dos,
|
||||||
|
|
@ -128,7 +128,7 @@ void ApplySchematicRuleDefinition::addAttribute(
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplySchematicRuleDefinition::updateLocationBox() {
|
void ApplySchematicRuleDefinition::updateLocationBox() {
|
||||||
if (m_schematic == NULL)
|
if (m_schematic == nullptr)
|
||||||
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||||
|
|
||||||
m_locationBox = AABB(0, 0, 0, 0, 0, 0);
|
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;
|
if (chunk->level->dimension->id != m_dimension) return;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition");
|
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition");
|
||||||
if (m_schematic == NULL)
|
if (m_schematic == nullptr)
|
||||||
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||||
|
|
||||||
if (!m_locationBox.has_value()) updateLocationBox();
|
if (!m_locationBox.has_value()) updateLocationBox();
|
||||||
|
|
@ -192,7 +192,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB* chunkBox,
|
||||||
(m_totalBlocksChangedLighting == targetBlocks)) {
|
(m_totalBlocksChangedLighting == targetBlocks)) {
|
||||||
m_completed = true;
|
m_completed = true;
|
||||||
// m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
// m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
||||||
// m_schematic = NULL;
|
// m_schematic = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
@ -204,7 +204,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox,
|
||||||
if (chunk->level->dimension->id != m_dimension) return;
|
if (chunk->level->dimension->id != m_dimension) return;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)");
|
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)");
|
||||||
if (m_schematic == NULL)
|
if (m_schematic == nullptr)
|
||||||
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||||
|
|
||||||
if (!m_locationBox.has_value()) updateLocationBox();
|
if (!m_locationBox.has_value()) updateLocationBox();
|
||||||
|
|
@ -230,7 +230,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox,
|
||||||
(m_totalBlocksChangedLighting == targetBlocks)) {
|
(m_totalBlocksChangedLighting == targetBlocks)) {
|
||||||
m_completed = true;
|
m_completed = true;
|
||||||
// m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
// m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
||||||
// m_schematic = NULL;
|
// m_schematic = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ void CollectItemRuleDefinition::populateGameRule(
|
||||||
bool CollectItemRuleDefinition::onCollectItem(
|
bool CollectItemRuleDefinition::onCollectItem(
|
||||||
GameRule* rule, std::shared_ptr<ItemInstance> item) {
|
GameRule* rule, std::shared_ptr<ItemInstance> item) {
|
||||||
bool statusChanged = false;
|
bool statusChanged = false;
|
||||||
if (item != NULL && item->id == m_itemId &&
|
if (item != nullptr && item->id == m_itemId &&
|
||||||
item->getAuxValue() == m_auxValue &&
|
item->getAuxValue() == m_auxValue &&
|
||||||
item->get4JData() == m_4JDataValue) {
|
item->get4JData() == m_4JDataValue) {
|
||||||
if (!getComplete(rule)) {
|
if (!getComplete(rule)) {
|
||||||
|
|
@ -83,12 +83,12 @@ bool CollectItemRuleDefinition::onCollectItem(
|
||||||
"auxValue:%d, quantity:%d, dataTag:%d\n",
|
"auxValue:%d, quantity:%d, dataTag:%d\n",
|
||||||
m_itemId, m_auxValue, m_quantity, m_4JDataValue);
|
m_itemId, m_auxValue, m_quantity, m_4JDataValue);
|
||||||
|
|
||||||
if (rule->getConnection() != NULL) {
|
if (rule->getConnection() != nullptr) {
|
||||||
rule->getConnection()->send(
|
rule->getConnection()->send(
|
||||||
std::shared_ptr<UpdateGameRuleProgressPacket>(
|
std::shared_ptr<UpdateGameRuleProgressPacket>(
|
||||||
new UpdateGameRuleProgressPacket(
|
new UpdateGameRuleProgressPacket(
|
||||||
getActionType(), this->m_descriptionId,
|
getActionType(), this->m_descriptionId,
|
||||||
m_itemId, m_auxValue, this->m_4JDataValue, NULL,
|
m_itemId, m_auxValue, this->m_4JDataValue, nullptr,
|
||||||
0)));
|
0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +101,7 @@ std::wstring CollectItemRuleDefinition::generateXml(
|
||||||
std::shared_ptr<ItemInstance> item) {
|
std::shared_ptr<ItemInstance> item) {
|
||||||
// 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd
|
// 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd
|
||||||
std::wstring xml = L"";
|
std::wstring xml = L"";
|
||||||
if (item != NULL) {
|
if (item != nullptr) {
|
||||||
xml = L"<CollectItemRule itemId=\"" + _toString<int>(item->id) +
|
xml = L"<CollectItemRule itemId=\"" + _toString<int>(item->id) +
|
||||||
L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" "
|
L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" "
|
||||||
L"promptName=\"OPTIONAL\"";
|
L"promptName=\"OPTIONAL\"";
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ void CompleteAllRuleDefinition::updateStatus(GameRule* rule) {
|
||||||
it->second.gr);
|
it->second.gr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rule->getConnection() != NULL) {
|
if (rule->getConnection() != nullptr) {
|
||||||
PacketData data;
|
PacketData data;
|
||||||
data.goal = goal;
|
data.goal = goal;
|
||||||
data.progress = progress;
|
data.progress = progress;
|
||||||
|
|
@ -44,10 +44,10 @@ void CompleteAllRuleDefinition::updateStatus(GameRule* rule) {
|
||||||
int icon = -1;
|
int icon = -1;
|
||||||
int auxValue = 0;
|
int auxValue = 0;
|
||||||
|
|
||||||
if (m_lastRuleStatusChanged != NULL) {
|
if (m_lastRuleStatusChanged != nullptr) {
|
||||||
icon = m_lastRuleStatusChanged->getIcon();
|
icon = m_lastRuleStatusChanged->getIcon();
|
||||||
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
||||||
m_lastRuleStatusChanged = NULL;
|
m_lastRuleStatusChanged = nullptr;
|
||||||
}
|
}
|
||||||
rule->getConnection()->send(
|
rule->getConnection()->send(
|
||||||
std::shared_ptr<UpdateGameRuleProgressPacket>(
|
std::shared_ptr<UpdateGameRuleProgressPacket>(
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include "ConsoleGameRules.h"
|
#include "ConsoleGameRules.h"
|
||||||
|
|
||||||
CompoundGameRuleDefinition::CompoundGameRuleDefinition() {
|
CompoundGameRuleDefinition::CompoundGameRuleDefinition() {
|
||||||
m_lastRuleStatusChanged = NULL;
|
m_lastRuleStatusChanged = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundGameRuleDefinition::~CompoundGameRuleDefinition() {
|
CompoundGameRuleDefinition::~CompoundGameRuleDefinition() {
|
||||||
|
|
@ -23,7 +23,7 @@ void CompoundGameRuleDefinition::getChildren(
|
||||||
|
|
||||||
GameRuleDefinition* CompoundGameRuleDefinition::addChild(
|
GameRuleDefinition* CompoundGameRuleDefinition::addChild(
|
||||||
ConsoleGameRules::EGameRuleType ruleType) {
|
ConsoleGameRules::EGameRuleType ruleType) {
|
||||||
GameRuleDefinition* rule = NULL;
|
GameRuleDefinition* rule = nullptr;
|
||||||
if (ruleType == ConsoleGameRules::eGameRuleType_CompleteAllRule) {
|
if (ruleType == ConsoleGameRules::eGameRuleType_CompleteAllRule) {
|
||||||
rule = new CompleteAllRuleDefinition();
|
rule = new CompleteAllRuleDefinition();
|
||||||
} else if (ruleType == ConsoleGameRules::eGameRuleType_CollectItemRule) {
|
} else if (ruleType == ConsoleGameRules::eGameRuleType_CollectItemRule) {
|
||||||
|
|
@ -40,13 +40,13 @@ GameRuleDefinition* CompoundGameRuleDefinition::addChild(
|
||||||
ruleType);
|
ruleType);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (rule != NULL) m_children.push_back(rule);
|
if (rule != nullptr) m_children.push_back(rule);
|
||||||
return rule;
|
return rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompoundGameRuleDefinition::populateGameRule(
|
void CompoundGameRuleDefinition::populateGameRule(
|
||||||
GameRulesInstance::EGameRulesInstanceType type, GameRule* rule) {
|
GameRulesInstance::EGameRulesInstanceType type, GameRule* rule) {
|
||||||
GameRule* newRule = NULL;
|
GameRule* newRule = nullptr;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (auto it = m_children.begin(); it != m_children.end(); ++it) {
|
for (auto it = m_children.begin(); it != m_children.end(); ++it) {
|
||||||
newRule = new GameRule(*it, rule->getConnection());
|
newRule = new GameRule(*it, rule->getConnection());
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) {
|
ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) {
|
||||||
m_x = m_y = m_z = 0;
|
m_x = m_y = m_z = 0;
|
||||||
boundingBox = NULL;
|
boundingBox = nullptr;
|
||||||
orientation = Direction::NORTH;
|
orientation = Direction::NORTH;
|
||||||
m_dimension = 0;
|
m_dimension = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -24,7 +24,7 @@ void ConsoleGenerateStructure::getChildren(
|
||||||
|
|
||||||
GameRuleDefinition* ConsoleGenerateStructure::addChild(
|
GameRuleDefinition* ConsoleGenerateStructure::addChild(
|
||||||
ConsoleGameRules::EGameRuleType ruleType) {
|
ConsoleGameRules::EGameRuleType ruleType) {
|
||||||
GameRuleDefinition* rule = NULL;
|
GameRuleDefinition* rule = nullptr;
|
||||||
if (ruleType == ConsoleGameRules::eGameRuleType_GenerateBox) {
|
if (ruleType == ConsoleGameRules::eGameRuleType_GenerateBox) {
|
||||||
rule = new XboxStructureActionGenerateBox();
|
rule = new XboxStructureActionGenerateBox();
|
||||||
m_actions.push_back((XboxStructureActionGenerateBox*)rule);
|
m_actions.push_back((XboxStructureActionGenerateBox*)rule);
|
||||||
|
|
@ -100,7 +100,7 @@ void ConsoleGenerateStructure::addAttribute(
|
||||||
}
|
}
|
||||||
|
|
||||||
BoundingBox* ConsoleGenerateStructure::getBoundingBox() {
|
BoundingBox* ConsoleGenerateStructure::getBoundingBox() {
|
||||||
if (boundingBox == NULL) {
|
if (boundingBox == nullptr) {
|
||||||
// Find the max bounds
|
// Find the max bounds
|
||||||
int maxX, maxY, maxZ;
|
int maxX, maxY, maxZ;
|
||||||
maxX = maxY = maxZ = 1;
|
maxX = maxY = maxZ = 1;
|
||||||
|
|
|
||||||
|
|
@ -15,16 +15,16 @@
|
||||||
ConsoleSchematicFile::ConsoleSchematicFile() {
|
ConsoleSchematicFile::ConsoleSchematicFile() {
|
||||||
m_xSize = m_ySize = m_zSize = 0;
|
m_xSize = m_ySize = m_zSize = 0;
|
||||||
m_refCount = 1;
|
m_refCount = 1;
|
||||||
m_data.data = NULL;
|
m_data.data = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleSchematicFile::~ConsoleSchematicFile() {
|
ConsoleSchematicFile::~ConsoleSchematicFile() {
|
||||||
app.DebugPrintf("Deleting schematic file\n");
|
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) {
|
void ConsoleSchematicFile::save(DataOutputStream* dos) {
|
||||||
if (dos != NULL) {
|
if (dos != nullptr) {
|
||||||
dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
|
dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
|
||||||
|
|
||||||
dos->writeByte(APPROPRIATE_COMPRESSION_TYPE);
|
dos->writeByte(APPROPRIATE_COMPRESSION_TYPE);
|
||||||
|
|
@ -47,7 +47,7 @@ void ConsoleSchematicFile::save(DataOutputStream* dos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleSchematicFile::load(DataInputStream* dis) {
|
void ConsoleSchematicFile::load(DataInputStream* dis) {
|
||||||
if (dis != NULL) {
|
if (dis != nullptr) {
|
||||||
// VERSION CHECK //
|
// VERSION CHECK //
|
||||||
int version = dis->readInt();
|
int version = dis->readInt();
|
||||||
|
|
||||||
|
|
@ -70,9 +70,9 @@ void ConsoleSchematicFile::load(DataInputStream* dis) {
|
||||||
byteArray compressedBuffer(compressedSize);
|
byteArray compressedBuffer(compressedSize);
|
||||||
dis->readFully(compressedBuffer);
|
dis->readFully(compressedBuffer);
|
||||||
|
|
||||||
if (m_data.data != NULL) {
|
if (m_data.data != nullptr) {
|
||||||
delete[] m_data.data;
|
delete[] m_data.data;
|
||||||
m_data.data = NULL;
|
m_data.data = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compressionType == Compression::eCompressionType_None) {
|
if (compressionType == Compression::eCompressionType_None) {
|
||||||
|
|
@ -114,15 +114,15 @@ void ConsoleSchematicFile::load(DataInputStream* dis) {
|
||||||
// and cast it to CompoundTag inside the loop
|
// and cast it to CompoundTag inside the loop
|
||||||
CompoundTag* tag = NbtIo::read(dis);
|
CompoundTag* tag = NbtIo::read(dis);
|
||||||
ListTag<Tag>* tileEntityTags = tag->getList(L"TileEntities");
|
ListTag<Tag>* tileEntityTags = tag->getList(L"TileEntities");
|
||||||
if (tileEntityTags != NULL) {
|
if (tileEntityTags != nullptr) {
|
||||||
for (int i = 0; i < tileEntityTags->size(); i++) {
|
for (int i = 0; i < tileEntityTags->size(); i++) {
|
||||||
CompoundTag* teTag = (CompoundTag*)tileEntityTags->get(i);
|
CompoundTag* teTag = (CompoundTag*)tileEntityTags->get(i);
|
||||||
std::shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
|
std::shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
|
||||||
|
|
||||||
if (te == NULL) {
|
if (te == nullptr) {
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"ConsoleSchematicFile has read a NULL tile entity\n");
|
"ConsoleSchematicFile has read a nullptr tile entity\n");
|
||||||
__debugbreak();
|
__debugbreak();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -134,7 +134,7 @@ void ConsoleSchematicFile::load(DataInputStream* dis) {
|
||||||
// 4jcraft, fixed cast of templated List to get the tag list
|
// 4jcraft, fixed cast of templated List to get the tag list
|
||||||
// and cast it to CompoundTag inside the loop
|
// and cast it to CompoundTag inside the loop
|
||||||
ListTag<Tag>* entityTags = tag->getList(L"Entities");
|
ListTag<Tag>* entityTags = tag->getList(L"Entities");
|
||||||
if (entityTags != NULL) {
|
if (entityTags != nullptr) {
|
||||||
for (int i = 0; i < entityTags->size(); i++) {
|
for (int i = 0; i < entityTags->size(); i++) {
|
||||||
CompoundTag* eTag = (CompoundTag*)entityTags->get(i);
|
CompoundTag* eTag = (CompoundTag*)entityTags->get(i);
|
||||||
eINSTANCEOF type = EntityIO::getType(eTag->getString(L"id"));
|
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(
|
std::shared_ptr<TileEntity> teCopy = chunk->getTileEntity(
|
||||||
(int)targetX & 15, (int)targetY & 15, (int)targetZ & 15);
|
(int)targetX & 15, (int)targetY & 15, (int)targetZ & 15);
|
||||||
|
|
||||||
if (teCopy != NULL) {
|
if (teCopy != nullptr) {
|
||||||
CompoundTag* teData = new CompoundTag();
|
CompoundTag* teData = new CompoundTag();
|
||||||
te->save(teData);
|
te->save(teData);
|
||||||
|
|
||||||
|
|
@ -517,7 +517,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk* chunk, AABB* chunkBox,
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundTag* eTag = it->second;
|
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) {
|
if (e->GetType() == eTYPE_PAINTING) {
|
||||||
std::shared_ptr<Painting> painting =
|
std::shared_ptr<Painting> painting =
|
||||||
|
|
@ -615,18 +615,18 @@ void ConsoleSchematicFile::generateSchematicFile(
|
||||||
"%dx%dx%d\n",
|
"%dx%dx%d\n",
|
||||||
xStart, yStart, zStart, xEnd, yEnd, zEnd, xSize, ySize, zSize);
|
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
|
// Write xSize
|
||||||
if (dos != NULL) dos->writeInt(xSize);
|
if (dos != nullptr) dos->writeInt(xSize);
|
||||||
|
|
||||||
// Write ySize
|
// Write ySize
|
||||||
if (dos != NULL) dos->writeInt(ySize);
|
if (dos != nullptr) dos->writeInt(ySize);
|
||||||
|
|
||||||
// Write zSize
|
// Write zSize
|
||||||
if (dos != NULL) dos->writeInt(zSize);
|
if (dos != nullptr) dos->writeInt(zSize);
|
||||||
|
|
||||||
// byteArray rawBuffer = level->getBlocksAndData(xStart, yStart, zStart,
|
// byteArray rawBuffer = level->getBlocksAndData(xStart, yStart, zStart,
|
||||||
// xSize, ySize, zSize, false);
|
// xSize, ySize, zSize, false);
|
||||||
|
|
@ -695,8 +695,8 @@ void ConsoleSchematicFile::generateSchematicFile(
|
||||||
delete[] result.data;
|
delete[] result.data;
|
||||||
byteArray buffer = byteArray(ucTemp, inputSize);
|
byteArray buffer = byteArray(ucTemp, inputSize);
|
||||||
|
|
||||||
if (dos != NULL) dos->writeInt(inputSize);
|
if (dos != nullptr) dos->writeInt(inputSize);
|
||||||
if (dos != NULL) dos->write(buffer);
|
if (dos != nullptr) dos->write(buffer);
|
||||||
delete[] buffer.data;
|
delete[] buffer.data;
|
||||||
|
|
||||||
CompoundTag tag;
|
CompoundTag tag;
|
||||||
|
|
@ -783,7 +783,7 @@ void ConsoleSchematicFile::generateSchematicFile(
|
||||||
|
|
||||||
tag.put(L"Entities", entitiesTag);
|
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,
|
void ConsoleSchematicFile::getBlocksAndData(LevelChunk* chunk, byteArray* data,
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public:
|
||||||
// maintain it's state
|
// maintain it's state
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GameRule(GameRuleDefinition* definition, Connection* connection = NULL);
|
GameRule(GameRuleDefinition* definition, Connection* connection = nullptr);
|
||||||
virtual ~GameRule();
|
virtual ~GameRule();
|
||||||
|
|
||||||
Connection* getConnection() { return m_connection; }
|
Connection* getConnection() { return m_connection; }
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ GameRuleDefinition* GameRuleDefinition::addChild(
|
||||||
wprintf(L"GameRuleDefinition: Attempted to add invalid child rule - %d\n",
|
wprintf(L"GameRuleDefinition: Attempted to add invalid child rule - %d\n",
|
||||||
ruleType);
|
ruleType);
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameRuleDefinition::addAttribute(const std::wstring& attributeName,
|
void GameRuleDefinition::addAttribute(const std::wstring& attributeName,
|
||||||
|
|
|
||||||
|
|
@ -77,5 +77,5 @@ public:
|
||||||
Connection* connection);
|
Connection* connection);
|
||||||
static std::wstring generateDescriptionString(
|
static std::wstring generateDescriptionString(
|
||||||
ConsoleGameRules::EGameRuleType defType,
|
ConsoleGameRules::EGameRuleType defType,
|
||||||
const std::wstring& description, void* data = NULL, int dataLength = 0);
|
const std::wstring& description, void* data = nullptr, int dataLength = 0);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -82,12 +82,12 @@ const WCHAR* GameRuleManager::wchAttrNameA[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
GameRuleManager::GameRuleManager() {
|
GameRuleManager::GameRuleManager() {
|
||||||
m_currentGameRuleDefinitions = NULL;
|
m_currentGameRuleDefinitions = nullptr;
|
||||||
m_currentLevelGenerationOptions = NULL;
|
m_currentLevelGenerationOptions = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameRuleManager::loadGameRules(DLCPack* pack) {
|
void GameRuleManager::loadGameRules(DLCPack* pack) {
|
||||||
StringTable* strings = NULL;
|
StringTable* strings = nullptr;
|
||||||
|
|
||||||
if (pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,
|
if (pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,
|
||||||
L"languages.loc")) {
|
L"languages.loc")) {
|
||||||
|
|
@ -240,10 +240,10 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions* lgo, uint8_t* dIn,
|
||||||
|
|
||||||
// 4J-JEV: Reverse of loadGameRules.
|
// 4J-JEV: Reverse of loadGameRules.
|
||||||
void GameRuleManager::saveGameRules(uint8_t** dOut, unsigned int* dSize) {
|
void GameRuleManager::saveGameRules(uint8_t** dOut, unsigned int* dSize) {
|
||||||
if (m_currentGameRuleDefinitions == NULL &&
|
if (m_currentGameRuleDefinitions == nullptr &&
|
||||||
m_currentLevelGenerationOptions == NULL) {
|
m_currentLevelGenerationOptions == nullptr) {
|
||||||
app.DebugPrintf("GameRuleManager:: Nothing here to save.");
|
app.DebugPrintf("GameRuleManager:: Nothing here to save.");
|
||||||
*dOut = NULL;
|
*dOut = nullptr;
|
||||||
*dSize = 0;
|
*dSize = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -269,7 +269,7 @@ void GameRuleManager::saveGameRules(uint8_t** dOut, unsigned int* dSize) {
|
||||||
ByteArrayOutputStream compr_baos;
|
ByteArrayOutputStream compr_baos;
|
||||||
DataOutputStream compr_dos(&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(0); // numStrings for StringTable
|
||||||
compr_dos.writeInt(version_number);
|
compr_dos.writeInt(version_number);
|
||||||
compr_dos.writeByte(
|
compr_dos.writeByte(
|
||||||
|
|
@ -281,9 +281,9 @@ void GameRuleManager::saveGameRules(uint8_t** dOut, unsigned int* dSize) {
|
||||||
} else {
|
} else {
|
||||||
StringTable* st = m_currentGameRuleDefinitions->getStringTable();
|
StringTable* st = m_currentGameRuleDefinitions->getStringTable();
|
||||||
|
|
||||||
if (st == NULL) {
|
if (st == nullptr) {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"GameRuleManager::saveGameRules: StringTable == NULL!");
|
"GameRuleManager::saveGameRules: StringTable == nullptr!");
|
||||||
} else {
|
} else {
|
||||||
// Write string table.
|
// Write string table.
|
||||||
byteArray stba;
|
byteArray stba;
|
||||||
|
|
@ -322,7 +322,7 @@ void GameRuleManager::saveGameRules(uint8_t** dOut, unsigned int* dSize) {
|
||||||
*dSize = baos.buf.length;
|
*dSize = baos.buf.length;
|
||||||
*dOut = baos.buf.data;
|
*dOut = baos.buf.data;
|
||||||
|
|
||||||
baos.buf.data = NULL;
|
baos.buf.data = nullptr;
|
||||||
|
|
||||||
dos.close();
|
dos.close();
|
||||||
baos.close();
|
baos.close();
|
||||||
|
|
@ -403,8 +403,8 @@ bool GameRuleManager::readRuleFile(
|
||||||
for (int i = 0; i < 8; ++i) dis.readBoolean();
|
for (int i = 0; i < 8; ++i) dis.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArrayInputStream* contentBais = NULL;
|
ByteArrayInputStream* contentBais = nullptr;
|
||||||
DataInputStream* contentDis = NULL;
|
DataInputStream* contentDis = nullptr;
|
||||||
|
|
||||||
if (compressionType == Compression::eCompressionType_None) {
|
if (compressionType == Compression::eCompressionType_None) {
|
||||||
// No compression
|
// No compression
|
||||||
|
|
@ -531,7 +531,7 @@ bool GameRuleManager::readRuleFile(
|
||||||
auto it = tagIdMap.find(tagId);
|
auto it = tagIdMap.find(tagId);
|
||||||
if (it != tagIdMap.end()) tagVal = it->second;
|
if (it != tagIdMap.end()) tagVal = it->second;
|
||||||
|
|
||||||
GameRuleDefinition* rule = NULL;
|
GameRuleDefinition* rule = nullptr;
|
||||||
|
|
||||||
if (tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions) {
|
if (tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions) {
|
||||||
rule = levelGenerator;
|
rule = levelGenerator;
|
||||||
|
|
@ -554,14 +554,14 @@ bool GameRuleManager::readRuleFile(
|
||||||
if (compressionType != 0) {
|
if (compressionType != 0) {
|
||||||
// Not default
|
// Not default
|
||||||
contentDis->close();
|
contentDis->close();
|
||||||
if (contentBais != NULL) delete contentBais;
|
if (contentBais != nullptr) delete contentBais;
|
||||||
delete contentDis;
|
delete contentDis;
|
||||||
}
|
}
|
||||||
|
|
||||||
dis.close();
|
dis.close();
|
||||||
bais.reset();
|
bais.reset();
|
||||||
|
|
||||||
// if(!levelGenAdded) { delete levelGenerator; levelGenerator = NULL; }
|
// if(!levelGenAdded) { delete levelGenerator; levelGenerator = nullptr; }
|
||||||
if (!gameRulesAdded) delete gameRules;
|
if (!gameRulesAdded) delete gameRules;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -587,7 +587,7 @@ void GameRuleManager::readAttributes(DataInputStream* dis,
|
||||||
int attID = dis->readInt();
|
int attID = dis->readInt();
|
||||||
std::wstring value = dis->readUTF();
|
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);
|
auto it = tagIdMap->find(tagId);
|
||||||
if (it != tagIdMap->end()) tagVal = it->second;
|
if (it != tagIdMap->end()) tagVal = it->second;
|
||||||
|
|
||||||
GameRuleDefinition* childRule = NULL;
|
GameRuleDefinition* childRule = nullptr;
|
||||||
if (rule != NULL) childRule = rule->addChild(tagVal);
|
if (rule != nullptr) childRule = rule->addChild(tagVal);
|
||||||
|
|
||||||
readAttributes(dis, tagsAndAtts, childRule);
|
readAttributes(dis, tagsAndAtts, childRule);
|
||||||
readChildren(dis, tagsAndAtts, tagIdMap, childRule);
|
readChildren(dis, tagsAndAtts, tagIdMap, childRule);
|
||||||
|
|
@ -613,14 +613,14 @@ void GameRuleManager::readChildren(
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameRuleManager::processSchematics(LevelChunk* levelChunk) {
|
void GameRuleManager::processSchematics(LevelChunk* levelChunk) {
|
||||||
if (getLevelGenerationOptions() != NULL) {
|
if (getLevelGenerationOptions() != nullptr) {
|
||||||
LevelGenerationOptions* levelGenOptions = getLevelGenerationOptions();
|
LevelGenerationOptions* levelGenOptions = getLevelGenerationOptions();
|
||||||
levelGenOptions->processSchematics(levelChunk);
|
levelGenOptions->processSchematics(levelChunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameRuleManager::processSchematicsLighting(LevelChunk* levelChunk) {
|
void GameRuleManager::processSchematicsLighting(LevelChunk* levelChunk) {
|
||||||
if (getLevelGenerationOptions() != NULL) {
|
if (getLevelGenerationOptions() != nullptr) {
|
||||||
LevelGenerationOptions* levelGenOptions = getLevelGenerationOptions();
|
LevelGenerationOptions* levelGenOptions = getLevelGenerationOptions();
|
||||||
levelGenOptions->processSchematicsLighting(levelChunk);
|
levelGenOptions->processSchematicsLighting(levelChunk);
|
||||||
}
|
}
|
||||||
|
|
@ -680,21 +680,21 @@ void GameRuleManager::setLevelGenerationOptions(
|
||||||
LevelGenerationOptions* levelGen) {
|
LevelGenerationOptions* levelGen) {
|
||||||
unloadCurrentGameRules();
|
unloadCurrentGameRules();
|
||||||
|
|
||||||
m_currentGameRuleDefinitions = NULL;
|
m_currentGameRuleDefinitions = nullptr;
|
||||||
m_currentLevelGenerationOptions = levelGen;
|
m_currentLevelGenerationOptions = levelGen;
|
||||||
|
|
||||||
if (m_currentLevelGenerationOptions != NULL &&
|
if (m_currentLevelGenerationOptions != nullptr &&
|
||||||
m_currentLevelGenerationOptions->requiresGameRules()) {
|
m_currentLevelGenerationOptions->requiresGameRules()) {
|
||||||
m_currentGameRuleDefinitions =
|
m_currentGameRuleDefinitions =
|
||||||
m_currentLevelGenerationOptions->getRequiredGameRules();
|
m_currentLevelGenerationOptions->getRequiredGameRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_currentLevelGenerationOptions != NULL)
|
if (m_currentLevelGenerationOptions != nullptr)
|
||||||
m_currentLevelGenerationOptions->reset_start();
|
m_currentLevelGenerationOptions->reset_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t* GameRuleManager::GetGameRulesString(const std::wstring& key) {
|
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);
|
return m_currentGameRuleDefinitions->getString(key);
|
||||||
} else {
|
} else {
|
||||||
return L"";
|
return L"";
|
||||||
|
|
@ -714,8 +714,8 @@ LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameRuleManager::unloadCurrentGameRules() {
|
void GameRuleManager::unloadCurrentGameRules() {
|
||||||
if (m_currentLevelGenerationOptions != NULL) {
|
if (m_currentLevelGenerationOptions != nullptr) {
|
||||||
if (m_currentGameRuleDefinitions != NULL &&
|
if (m_currentGameRuleDefinitions != nullptr &&
|
||||||
m_currentLevelGenerationOptions->isFromSave())
|
m_currentLevelGenerationOptions->isFromSave())
|
||||||
m_levelRules.removeLevelRule(m_currentGameRuleDefinitions);
|
m_levelRules.removeLevelRule(m_currentGameRuleDefinitions);
|
||||||
|
|
||||||
|
|
@ -729,6 +729,6 @@ void GameRuleManager::unloadCurrentGameRules() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currentGameRuleDefinitions = NULL;
|
m_currentGameRuleDefinitions = nullptr;
|
||||||
m_currentLevelGenerationOptions = NULL;
|
m_currentLevelGenerationOptions = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ void JustGrSource::setBaseSavePath(const std::wstring& x) {
|
||||||
bool JustGrSource::ready() { return true; }
|
bool JustGrSource::ready() { return true; }
|
||||||
|
|
||||||
LevelGenerationOptions::LevelGenerationOptions(DLCPack* parentPack) {
|
LevelGenerationOptions::LevelGenerationOptions(DLCPack* parentPack) {
|
||||||
m_spawnPos = NULL;
|
m_spawnPos = nullptr;
|
||||||
m_stringTable = NULL;
|
m_stringTable = nullptr;
|
||||||
|
|
||||||
m_hasLoadedData = false;
|
m_hasLoadedData = false;
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack* parentPack) {
|
||||||
m_minY = INT_MAX;
|
m_minY = INT_MAX;
|
||||||
m_bRequiresGameRules = false;
|
m_bRequiresGameRules = false;
|
||||||
|
|
||||||
m_pbBaseSaveData = NULL;
|
m_pbBaseSaveData = nullptr;
|
||||||
m_baseSaveSize = 0;
|
m_baseSaveSize = 0;
|
||||||
|
|
||||||
m_parentDLCPack = parentPack;
|
m_parentDLCPack = parentPack;
|
||||||
|
|
@ -73,7 +73,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack* parentPack) {
|
||||||
|
|
||||||
LevelGenerationOptions::~LevelGenerationOptions() {
|
LevelGenerationOptions::~LevelGenerationOptions() {
|
||||||
clearSchematics();
|
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();
|
for (auto it = m_schematicRules.begin(); it != m_schematicRules.end();
|
||||||
++it) {
|
++it) {
|
||||||
delete *it;
|
delete *it;
|
||||||
|
|
@ -143,7 +143,7 @@ void LevelGenerationOptions::getChildren(
|
||||||
|
|
||||||
GameRuleDefinition* LevelGenerationOptions::addChild(
|
GameRuleDefinition* LevelGenerationOptions::addChild(
|
||||||
ConsoleGameRules::EGameRuleType ruleType) {
|
ConsoleGameRules::EGameRuleType ruleType) {
|
||||||
GameRuleDefinition* rule = NULL;
|
GameRuleDefinition* rule = nullptr;
|
||||||
if (ruleType == ConsoleGameRules::eGameRuleType_ApplySchematic) {
|
if (ruleType == ConsoleGameRules::eGameRuleType_ApplySchematic) {
|
||||||
rule = new ApplySchematicRuleDefinition(this);
|
rule = new ApplySchematicRuleDefinition(this);
|
||||||
m_schematicRules.push_back((ApplySchematicRuleDefinition*)rule);
|
m_schematicRules.push_back((ApplySchematicRuleDefinition*)rule);
|
||||||
|
|
@ -174,19 +174,19 @@ void LevelGenerationOptions::addAttribute(const std::wstring& attributeName,
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"LevelGenerationOptions: Adding parameter m_seed=%I64d\n", m_seed);
|
"LevelGenerationOptions: Adding parameter m_seed=%I64d\n", m_seed);
|
||||||
} else if (attributeName.compare(L"spawnX") == 0) {
|
} 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);
|
int value = _fromString<int>(attributeValue);
|
||||||
m_spawnPos->x = value;
|
m_spawnPos->x = value;
|
||||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnX=%d\n",
|
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnX=%d\n",
|
||||||
value);
|
value);
|
||||||
} else if (attributeName.compare(L"spawnY") == 0) {
|
} 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);
|
int value = _fromString<int>(attributeValue);
|
||||||
m_spawnPos->y = value;
|
m_spawnPos->y = value;
|
||||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnY=%d\n",
|
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnY=%d\n",
|
||||||
value);
|
value);
|
||||||
} else if (attributeName.compare(L"spawnZ") == 0) {
|
} 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);
|
int value = _fromString<int>(attributeValue);
|
||||||
m_spawnPos->z = value;
|
m_spawnPos->z = value;
|
||||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnZ=%d\n",
|
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,
|
if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15,
|
||||||
cz + 15)) {
|
cz + 15)) {
|
||||||
BoundingBox* bb = new BoundingBox(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;
|
delete bb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -363,7 +363,7 @@ ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile(
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleSchematicFile* schematic = NULL;
|
ConsoleSchematicFile* schematic = nullptr;
|
||||||
byteArray data(pbData, dataLength);
|
byteArray data(pbData, dataLength);
|
||||||
ByteArrayInputStream bais(data);
|
ByteArrayInputStream bais(data);
|
||||||
DataInputStream dis(&bais);
|
DataInputStream dis(&bais);
|
||||||
|
|
@ -376,7 +376,7 @@ ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile(
|
||||||
|
|
||||||
ConsoleSchematicFile* LevelGenerationOptions::getSchematicFile(
|
ConsoleSchematicFile* LevelGenerationOptions::getSchematicFile(
|
||||||
const std::wstring& filename) {
|
const std::wstring& filename) {
|
||||||
ConsoleSchematicFile* schematic = NULL;
|
ConsoleSchematicFile* schematic = nullptr;
|
||||||
// If we have already loaded this, just return
|
// If we have already loaded this, just return
|
||||||
auto it = m_schematics.find(filename);
|
auto it = m_schematics.find(filename);
|
||||||
if (it != m_schematics.end()) {
|
if (it != m_schematics.end()) {
|
||||||
|
|
@ -407,7 +407,7 @@ void LevelGenerationOptions::loadStringTable(StringTable* table) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t* LevelGenerationOptions::getString(const std::wstring& key) {
|
const wchar_t* LevelGenerationOptions::getString(const std::wstring& key) {
|
||||||
if (m_stringTable == NULL) {
|
if (m_stringTable == nullptr) {
|
||||||
return L"";
|
return L"";
|
||||||
} else {
|
} else {
|
||||||
return m_stringTable->getString(key);
|
return m_stringTable->getString(key);
|
||||||
|
|
@ -462,7 +462,7 @@ LevelGenerationOptions::getUnfinishedSchematicFiles() {
|
||||||
|
|
||||||
void LevelGenerationOptions::loadBaseSaveData() {
|
void LevelGenerationOptions::loadBaseSaveData() {
|
||||||
int mountIndex = -1;
|
int mountIndex = -1;
|
||||||
if (m_parentDLCPack != NULL)
|
if (m_parentDLCPack != nullptr)
|
||||||
mountIndex = m_parentDLCPack->GetDLCMountIndex();
|
mountIndex = m_parentDLCPack->GetDLCMountIndex();
|
||||||
|
|
||||||
if (mountIndex > -1) {
|
if (mountIndex > -1) {
|
||||||
|
|
@ -518,12 +518,12 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, DWORD dwErr,
|
||||||
GENERIC_READ, // access mode
|
GENERIC_READ, // access mode
|
||||||
0, // share mode // TODO 4J Stu - Will we need to share
|
0, // share mode // TODO 4J Stu - Will we need to share
|
||||||
// file? Probably not but...
|
// file? Probably not but...
|
||||||
NULL, // Unused
|
nullptr, // Unused
|
||||||
OPEN_EXISTING, // how to create // TODO 4J Stu -
|
OPEN_EXISTING, // how to create // TODO 4J Stu -
|
||||||
// Assuming that the file already exists
|
// Assuming that the file already exists
|
||||||
// if we are opening to read from it
|
// if we are opening to read from it
|
||||||
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||||
NULL // Unsupported
|
nullptr // Unsupported
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
const char* pchFilename = wstringtofilename(grf.getPath());
|
const char* pchFilename = wstringtofilename(grf.getPath());
|
||||||
|
|
@ -532,12 +532,12 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, DWORD dwErr,
|
||||||
GENERIC_READ, // access mode
|
GENERIC_READ, // access mode
|
||||||
0, // share mode // TODO 4J Stu - Will we need to share
|
0, // share mode // TODO 4J Stu - Will we need to share
|
||||||
// file? Probably not but...
|
// file? Probably not but...
|
||||||
NULL, // Unused
|
nullptr, // Unused
|
||||||
OPEN_EXISTING, // how to create // TODO 4J Stu -
|
OPEN_EXISTING, // how to create // TODO 4J Stu -
|
||||||
// Assuming that the file already exists
|
// Assuming that the file already exists
|
||||||
// if we are opening to read from it
|
// if we are opening to read from it
|
||||||
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||||
NULL // Unsupported
|
nullptr // Unsupported
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -546,7 +546,7 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, DWORD dwErr,
|
||||||
DWORD bytesRead;
|
DWORD bytesRead;
|
||||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||||
bool bSuccess = ReadFile(fileHandle, pbData, dwFileSize,
|
bool bSuccess = ReadFile(fileHandle, pbData, dwFileSize,
|
||||||
&bytesRead, NULL);
|
&bytesRead, nullptr);
|
||||||
if (bSuccess == FALSE) {
|
if (bSuccess == FALSE) {
|
||||||
app.FatalLoadError();
|
app.FatalLoadError();
|
||||||
}
|
}
|
||||||
|
|
@ -576,12 +576,12 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, DWORD dwErr,
|
||||||
GENERIC_READ, // access mode
|
GENERIC_READ, // access mode
|
||||||
0, // share mode // TODO 4J Stu - Will we need to share
|
0, // share mode // TODO 4J Stu - Will we need to share
|
||||||
// file? Probably not but...
|
// file? Probably not but...
|
||||||
NULL, // Unused
|
nullptr, // Unused
|
||||||
OPEN_EXISTING, // how to create // TODO 4J Stu - Assuming
|
OPEN_EXISTING, // how to create // TODO 4J Stu - Assuming
|
||||||
// that the file already exists if we are
|
// that the file already exists if we are
|
||||||
// opening to read from it
|
// opening to read from it
|
||||||
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||||
NULL // Unsupported
|
nullptr // Unsupported
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
const char* pchFilename = wstringtofilename(save.getPath());
|
const char* pchFilename = wstringtofilename(save.getPath());
|
||||||
|
|
@ -590,20 +590,20 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, DWORD dwErr,
|
||||||
GENERIC_READ, // access mode
|
GENERIC_READ, // access mode
|
||||||
0, // share mode // TODO 4J Stu - Will we need to share
|
0, // share mode // TODO 4J Stu - Will we need to share
|
||||||
// file? Probably not but...
|
// file? Probably not but...
|
||||||
NULL, // Unused
|
nullptr, // Unused
|
||||||
OPEN_EXISTING, // how to create // TODO 4J Stu - Assuming
|
OPEN_EXISTING, // how to create // TODO 4J Stu - Assuming
|
||||||
// that the file already exists if we are
|
// that the file already exists if we are
|
||||||
// opening to read from it
|
// opening to read from it
|
||||||
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||||
NULL // Unsupported
|
nullptr // Unsupported
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (fileHandle != INVALID_HANDLE_VALUE) {
|
if (fileHandle != INVALID_HANDLE_VALUE) {
|
||||||
DWORD bytesRead, dwFileSize = GetFileSize(fileHandle, NULL);
|
DWORD bytesRead, dwFileSize = GetFileSize(fileHandle, nullptr);
|
||||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||||
bool bSuccess = ReadFile(fileHandle, pbData, dwFileSize,
|
bool bSuccess = ReadFile(fileHandle, pbData, dwFileSize,
|
||||||
&bytesRead, NULL);
|
&bytesRead, nullptr);
|
||||||
if (bSuccess == FALSE) {
|
if (bSuccess == FALSE) {
|
||||||
app.FatalLoadError();
|
app.FatalLoadError();
|
||||||
}
|
}
|
||||||
|
|
@ -632,8 +632,8 @@ void LevelGenerationOptions::reset_start() {
|
||||||
|
|
||||||
void LevelGenerationOptions::reset_finish() {
|
void LevelGenerationOptions::reset_finish() {
|
||||||
// if (m_spawnPos) { delete m_spawnPos; m_spawnPos
|
// if (m_spawnPos) { delete m_spawnPos; m_spawnPos
|
||||||
// = NULL; } if (m_stringTable) { delete m_stringTable;
|
// = nullptr; } if (m_stringTable) { delete m_stringTable;
|
||||||
// m_stringTable = NULL; }
|
// m_stringTable = nullptr; }
|
||||||
|
|
||||||
if (isFromDLC()) {
|
if (isFromDLC()) {
|
||||||
m_hasLoadedData = false;
|
m_hasLoadedData = false;
|
||||||
|
|
@ -739,11 +739,11 @@ std::uint8_t* LevelGenerationOptions::getBaseSaveData(unsigned int& size) {
|
||||||
return m_pbBaseSaveData;
|
return m_pbBaseSaveData;
|
||||||
}
|
}
|
||||||
bool LevelGenerationOptions::hasBaseSaveData() {
|
bool LevelGenerationOptions::hasBaseSaveData() {
|
||||||
return m_baseSaveSize > 0 && m_pbBaseSaveData != NULL;
|
return m_baseSaveSize > 0 && m_pbBaseSaveData != nullptr;
|
||||||
}
|
}
|
||||||
void LevelGenerationOptions::deleteBaseSaveData() {
|
void LevelGenerationOptions::deleteBaseSaveData() {
|
||||||
delete[] m_pbBaseSaveData;
|
delete[] m_pbBaseSaveData;
|
||||||
m_pbBaseSaveData = NULL;
|
m_pbBaseSaveData = nullptr;
|
||||||
m_baseSaveSize = 0;
|
m_baseSaveSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ private:
|
||||||
bool m_bLoadingData;
|
bool m_bLoadingData;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LevelGenerationOptions(DLCPack* parentPack = NULL);
|
LevelGenerationOptions(DLCPack* parentPack = nullptr);
|
||||||
~LevelGenerationOptions();
|
~LevelGenerationOptions();
|
||||||
|
|
||||||
virtual ConsoleGameRules::EGameRuleType getActionType();
|
virtual ConsoleGameRules::EGameRuleType getActionType();
|
||||||
|
|
@ -210,7 +210,7 @@ public:
|
||||||
std::uint8_t& topTile);
|
std::uint8_t& topTile);
|
||||||
bool isFeatureChunk(int chunkX, int chunkZ,
|
bool isFeatureChunk(int chunkX, int chunkZ,
|
||||||
StructureFeature::EFeatureTypes feature,
|
StructureFeature::EFeatureTypes feature,
|
||||||
int* orientation = NULL);
|
int* orientation = nullptr);
|
||||||
|
|
||||||
void loadStringTable(StringTable* table);
|
void loadStringTable(StringTable* table);
|
||||||
const wchar_t* getString(const std::wstring& key);
|
const wchar_t* getString(const std::wstring& key);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include "ConsoleGameRules.h"
|
#include "ConsoleGameRules.h"
|
||||||
#include "LevelRuleset.h"
|
#include "LevelRuleset.h"
|
||||||
|
|
||||||
LevelRuleset::LevelRuleset() { m_stringTable = NULL; }
|
LevelRuleset::LevelRuleset() { m_stringTable = nullptr; }
|
||||||
|
|
||||||
LevelRuleset::~LevelRuleset() {
|
LevelRuleset::~LevelRuleset() {
|
||||||
for (auto it = m_areas.begin(); it != m_areas.end(); ++it) {
|
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(
|
GameRuleDefinition* LevelRuleset::addChild(
|
||||||
ConsoleGameRules::EGameRuleType ruleType) {
|
ConsoleGameRules::EGameRuleType ruleType) {
|
||||||
GameRuleDefinition* rule = NULL;
|
GameRuleDefinition* rule = nullptr;
|
||||||
if (ruleType == ConsoleGameRules::eGameRuleType_NamedArea) {
|
if (ruleType == ConsoleGameRules::eGameRuleType_NamedArea) {
|
||||||
rule = new NamedAreaRuleDefinition();
|
rule = new NamedAreaRuleDefinition();
|
||||||
m_areas.push_back((NamedAreaRuleDefinition*)rule);
|
m_areas.push_back((NamedAreaRuleDefinition*)rule);
|
||||||
|
|
@ -35,7 +35,7 @@ void LevelRuleset::loadStringTable(StringTable* table) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t* LevelRuleset::getString(const std::wstring& key) {
|
const wchar_t* LevelRuleset::getString(const std::wstring& key) {
|
||||||
if (m_stringTable == NULL) {
|
if (m_stringTable == nullptr) {
|
||||||
return L"";
|
return L"";
|
||||||
} else {
|
} else {
|
||||||
return m_stringTable->getString(key);
|
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* LevelRuleset::getNamedArea(const std::wstring& areaName) {
|
||||||
AABB* area = NULL;
|
AABB* area = nullptr;
|
||||||
for (auto it = m_areas.begin(); it != m_areas.end(); ++it) {
|
for (auto it = m_areas.begin(); it != m_areas.end(); ++it) {
|
||||||
if ((*it)->getName().compare(areaName) == 0) {
|
if ((*it)->getName().compare(areaName) == 0) {
|
||||||
area = (*it)->getArea();
|
area = (*it)->getArea();
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,6 @@ void StartFeature::addAttribute(const std::wstring& attributeName,
|
||||||
bool StartFeature::isFeatureChunk(int chunkX, int chunkZ,
|
bool StartFeature::isFeatureChunk(int chunkX, int chunkZ,
|
||||||
StructureFeature::EFeatureTypes feature,
|
StructureFeature::EFeatureTypes feature,
|
||||||
int* orientation) {
|
int* orientation) {
|
||||||
if (orientation != NULL) *orientation = m_orientation;
|
if (orientation != nullptr) *orientation = m_orientation;
|
||||||
return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature;
|
return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature;
|
||||||
}
|
}
|
||||||
|
|
@ -12,7 +12,7 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition() {
|
||||||
;
|
;
|
||||||
m_health = 0;
|
m_health = 0;
|
||||||
m_food = 0;
|
m_food = 0;
|
||||||
m_spawnPos = NULL;
|
m_spawnPos = nullptr;
|
||||||
m_yRot = 0.0f;
|
m_yRot = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ void UpdatePlayerRuleDefinition::getChildren(
|
||||||
|
|
||||||
GameRuleDefinition* UpdatePlayerRuleDefinition::addChild(
|
GameRuleDefinition* UpdatePlayerRuleDefinition::addChild(
|
||||||
ConsoleGameRules::EGameRuleType ruleType) {
|
ConsoleGameRules::EGameRuleType ruleType) {
|
||||||
GameRuleDefinition* rule = NULL;
|
GameRuleDefinition* rule = nullptr;
|
||||||
if (ruleType == ConsoleGameRules::eGameRuleType_AddItem) {
|
if (ruleType == ConsoleGameRules::eGameRuleType_AddItem) {
|
||||||
rule = new AddItemRuleDefinition();
|
rule = new AddItemRuleDefinition();
|
||||||
m_items.push_back((AddItemRuleDefinition*)rule);
|
m_items.push_back((AddItemRuleDefinition*)rule);
|
||||||
|
|
@ -78,19 +78,19 @@ GameRuleDefinition* UpdatePlayerRuleDefinition::addChild(
|
||||||
void UpdatePlayerRuleDefinition::addAttribute(
|
void UpdatePlayerRuleDefinition::addAttribute(
|
||||||
const std::wstring& attributeName, const std::wstring& attributeValue) {
|
const std::wstring& attributeName, const std::wstring& attributeValue) {
|
||||||
if (attributeName.compare(L"spawnX") == 0) {
|
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);
|
int value = _fromString<int>(attributeValue);
|
||||||
m_spawnPos->x = value;
|
m_spawnPos->x = value;
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"UpdatePlayerRuleDefinition: Adding parameter spawnX=%d\n", value);
|
"UpdatePlayerRuleDefinition: Adding parameter spawnX=%d\n", value);
|
||||||
} else if (attributeName.compare(L"spawnY") == 0) {
|
} 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);
|
int value = _fromString<int>(attributeValue);
|
||||||
m_spawnPos->y = value;
|
m_spawnPos->y = value;
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"UpdatePlayerRuleDefinition: Adding parameter spawnY=%d\n", value);
|
"UpdatePlayerRuleDefinition: Adding parameter spawnY=%d\n", value);
|
||||||
} else if (attributeName.compare(L"spawnZ") == 0) {
|
} 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);
|
int value = _fromString<int>(attributeValue);
|
||||||
m_spawnPos->z = value;
|
m_spawnPos->z = value;
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
|
|
@ -134,7 +134,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(
|
||||||
double z = player->z;
|
double z = player->z;
|
||||||
float yRot = player->yRot;
|
float yRot = player->yRot;
|
||||||
float xRot = player->xRot;
|
float xRot = player->xRot;
|
||||||
if (m_spawnPos != NULL) {
|
if (m_spawnPos != nullptr) {
|
||||||
x = m_spawnPos->x;
|
x = m_spawnPos->x;
|
||||||
y = m_spawnPos->y;
|
y = m_spawnPos->y;
|
||||||
z = m_spawnPos->z;
|
z = m_spawnPos->z;
|
||||||
|
|
@ -144,7 +144,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(
|
||||||
yRot = m_yRot;
|
yRot = m_yRot;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_spawnPos != NULL || m_bUpdateYRot)
|
if (m_spawnPos != nullptr || m_bUpdateYRot)
|
||||||
player->absMoveTo(x, y, z, yRot, xRot);
|
player->absMoveTo(x, y, z, yRot, xRot);
|
||||||
|
|
||||||
for (auto it = m_items.begin(); it != m_items.end(); ++it) {
|
for (auto it = m_items.begin(); it != m_items.end(); ++it) {
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ void XboxStructureActionPlaceContainer::getChildren(
|
||||||
|
|
||||||
GameRuleDefinition* XboxStructureActionPlaceContainer::addChild(
|
GameRuleDefinition* XboxStructureActionPlaceContainer::addChild(
|
||||||
ConsoleGameRules::EGameRuleType ruleType) {
|
ConsoleGameRules::EGameRuleType ruleType) {
|
||||||
GameRuleDefinition* rule = NULL;
|
GameRuleDefinition* rule = nullptr;
|
||||||
if (ruleType == ConsoleGameRules::eGameRuleType_AddItem) {
|
if (ruleType == ConsoleGameRules::eGameRuleType_AddItem) {
|
||||||
rule = new AddItemRuleDefinition();
|
rule = new AddItemRuleDefinition();
|
||||||
m_items.push_back((AddItemRuleDefinition*)rule);
|
m_items.push_back((AddItemRuleDefinition*)rule);
|
||||||
|
|
@ -66,7 +66,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(
|
||||||
int worldZ = structure->getWorldZ(m_x, m_z);
|
int worldZ = structure->getWorldZ(m_x, m_z);
|
||||||
|
|
||||||
if (chunkBB->isInside(worldX, worldY, worldZ)) {
|
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
|
// Remove the current tile entity
|
||||||
level->removeTileEntity(worldX, worldY, worldZ);
|
level->removeTileEntity(worldX, worldY, worldZ);
|
||||||
level->setTileAndData(worldX, worldY, worldZ, 0, 0,
|
level->setTileAndData(worldX, worldY, worldZ, 0, 0,
|
||||||
|
|
@ -83,7 +83,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(
|
||||||
"XboxStructureActionPlaceContainer - placing a container at "
|
"XboxStructureActionPlaceContainer - placing a container at "
|
||||||
"(%d,%d,%d)\n",
|
"(%d,%d,%d)\n",
|
||||||
worldX, worldY, worldZ);
|
worldX, worldY, worldZ);
|
||||||
if (container != NULL) {
|
if (container != nullptr) {
|
||||||
level->setData(worldX, worldY, worldZ, m_data,
|
level->setData(worldX, worldY, worldZ, m_data,
|
||||||
Tile::UPDATE_CLIENTS);
|
Tile::UPDATE_CLIENTS);
|
||||||
// Add items
|
// Add items
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(
|
||||||
int worldZ = structure->getWorldZ(m_x, m_z);
|
int worldZ = structure->getWorldZ(m_x, m_z);
|
||||||
|
|
||||||
if (chunkBB->isInside(worldX, worldY, worldZ)) {
|
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
|
// Remove the current tile entity
|
||||||
level->removeTileEntity(worldX, worldY, worldZ);
|
level->removeTileEntity(worldX, worldY, worldZ);
|
||||||
level->setTileAndData(worldX, worldY, worldZ, 0, 0,
|
level->setTileAndData(worldX, worldY, worldZ, 0, 0,
|
||||||
|
|
@ -61,7 +61,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(
|
||||||
L"(%d,%d,%d)\n",
|
L"(%d,%d,%d)\n",
|
||||||
m_entityId.c_str(), worldX, worldY, worldZ);
|
m_entityId.c_str(), worldX, worldY, worldZ);
|
||||||
#endif
|
#endif
|
||||||
if (entity != NULL) {
|
if (entity != nullptr) {
|
||||||
entity->setEntityId(m_entityId);
|
entity->setEntityId(m_entityId);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ LeaderboardInterface::LeaderboardInterface(LeaderboardManager* man) {
|
||||||
m_pending = false;
|
m_pending = false;
|
||||||
|
|
||||||
m_filter = (LeaderboardManager::EFilterMode)-1;
|
m_filter = (LeaderboardManager::EFilterMode)-1;
|
||||||
m_callback = NULL;
|
m_callback = nullptr;
|
||||||
m_difficulty = 0;
|
m_difficulty = 0;
|
||||||
m_type = LeaderboardManager::eStatsType_UNDEFINED;
|
m_type = LeaderboardManager::eStatsType_UNDEFINED;
|
||||||
m_startIndex = 0;
|
m_startIndex = 0;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ const std::wstring LeaderboardManager::filterNames[eNumFilterModes] =
|
||||||
void LeaderboardManager::DeleteInstance()
|
void LeaderboardManager::DeleteInstance()
|
||||||
{
|
{
|
||||||
delete m_instance;
|
delete m_instance;
|
||||||
m_instance = NULL;
|
m_instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
LeaderboardManager::LeaderboardManager()
|
LeaderboardManager::LeaderboardManager()
|
||||||
|
|
@ -26,7 +26,7 @@ void LeaderboardManager::zeroReadParameters()
|
||||||
{
|
{
|
||||||
m_difficulty = -1;
|
m_difficulty = -1;
|
||||||
m_statsType = eStatsType_UNDEFINED;
|
m_statsType = eStatsType_UNDEFINED;
|
||||||
m_readListener = NULL;
|
m_readListener = nullptr;
|
||||||
m_startIndex = 0;
|
m_startIndex = 0;
|
||||||
m_readCount = 0;
|
m_readCount = 0;
|
||||||
m_eFilterMode = eFM_UNDEFINED;
|
m_eFilterMode = eFM_UNDEFINED;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ SonyLeaderboardManager::SonyLeaderboardManager() {
|
||||||
|
|
||||||
m_myXUID = INVALID_XUID;
|
m_myXUID = INVALID_XUID;
|
||||||
|
|
||||||
m_scores = NULL;
|
m_scores = nullptr;
|
||||||
|
|
||||||
m_statsType = eStatsType_Kills;
|
m_statsType = eStatsType_Kills;
|
||||||
m_difficulty = 0;
|
m_difficulty = 0;
|
||||||
|
|
@ -36,7 +36,7 @@ SonyLeaderboardManager::SonyLeaderboardManager() {
|
||||||
InitializeCriticalSection(&m_csViewsLock);
|
InitializeCriticalSection(&m_csViewsLock);
|
||||||
|
|
||||||
m_running = false;
|
m_running = false;
|
||||||
m_threadScoreboard = NULL;
|
m_threadScoreboard = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SonyLeaderboardManager::~SonyLeaderboardManager() {
|
SonyLeaderboardManager::~SonyLeaderboardManager() {
|
||||||
|
|
@ -204,7 +204,7 @@ bool SonyLeaderboardManager::getScoreByIds() {
|
||||||
SonyRtcTick last_sort_date;
|
SonyRtcTick last_sort_date;
|
||||||
SceNpScoreRankNumber mTotalRecord;
|
SceNpScoreRankNumber mTotalRecord;
|
||||||
|
|
||||||
SceNpId* npIds = NULL;
|
SceNpId* npIds = nullptr;
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
uint32_t num = 0;
|
uint32_t num = 0;
|
||||||
|
|
@ -236,8 +236,8 @@ bool SonyLeaderboardManager::getScoreByIds() {
|
||||||
|
|
||||||
/* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t
|
/* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t
|
||||||
boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\
|
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,
|
rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t nullptr,
|
||||||
0, NULL, 0,\n\t friendCount=%i,\n...\n", transaction, npId, friendCount,
|
0, nullptr, 0,\n\t friendCount=%i,\n...\n", transaction, npId, friendCount,
|
||||||
sizeof(SceNpId), friendCount*sizeof(SceNpId), rankData,
|
sizeof(SceNpId), friendCount*sizeof(SceNpId), rankData,
|
||||||
friendCount*sizeof(SceNpScorePlayerRankData), friendCount
|
friendCount*sizeof(SceNpScorePlayerRankData), friendCount
|
||||||
); */
|
); */
|
||||||
|
|
@ -254,9 +254,9 @@ bool SonyLeaderboardManager::getScoreByIds() {
|
||||||
|
|
||||||
destroyTransactionContext(ret);
|
destroyTransactionContext(ret);
|
||||||
|
|
||||||
if (npIds != NULL) delete[] npIds;
|
if (npIds != nullptr) delete[] npIds;
|
||||||
if (ptr != NULL) delete[] ptr;
|
if (ptr != nullptr) delete[] ptr;
|
||||||
if (comments != NULL) delete[] comments;
|
if (comments != nullptr) delete[] comments;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else if (ret < 0) {
|
} else if (ret < 0) {
|
||||||
|
|
@ -268,9 +268,9 @@ bool SonyLeaderboardManager::getScoreByIds() {
|
||||||
|
|
||||||
m_eStatsState = eStatsState_Failed;
|
m_eStatsState = eStatsState_Failed;
|
||||||
|
|
||||||
if (npIds != NULL) delete[] npIds;
|
if (npIds != nullptr) delete[] npIds;
|
||||||
if (ptr != NULL) delete[] ptr;
|
if (ptr != nullptr) delete[] ptr;
|
||||||
if (comments != NULL) delete[] comments;
|
if (comments != nullptr) delete[] comments;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -287,13 +287,13 @@ bool SonyLeaderboardManager::getScoreByIds() {
|
||||||
ptr, sizeof(SceNpScorePlayerRankData) * tmpNum, // OUT: Rank Data
|
ptr, sizeof(SceNpScorePlayerRankData) * tmpNum, // OUT: Rank Data
|
||||||
comments, sizeof(SceNpScoreComment) * tmpNum, // OUT: Comments
|
comments, sizeof(SceNpScoreComment) * tmpNum, // OUT: Comments
|
||||||
|
|
||||||
NULL, 0, // GameData. (unused)
|
nullptr, 0, // GameData. (unused)
|
||||||
|
|
||||||
tmpNum,
|
tmpNum,
|
||||||
|
|
||||||
&last_sort_date, &mTotalRecord,
|
&last_sort_date, &mTotalRecord,
|
||||||
|
|
||||||
NULL // Reserved, specify null.
|
nullptr // Reserved, specify null.
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) {
|
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) {
|
||||||
|
|
@ -322,7 +322,7 @@ bool SonyLeaderboardManager::getScoreByIds() {
|
||||||
m_readCount = num;
|
m_readCount = num;
|
||||||
|
|
||||||
// Filter scorers and construct output structure.
|
// 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];
|
m_scores = new ReadScore[m_readCount];
|
||||||
convertToOutput(m_readCount, m_scores, ptr, comments);
|
convertToOutput(m_readCount, m_scores, ptr, comments);
|
||||||
m_maxRank = m_readCount;
|
m_maxRank = m_readCount;
|
||||||
|
|
@ -352,7 +352,7 @@ error3:
|
||||||
delete[] ptr;
|
delete[] ptr;
|
||||||
delete[] comments;
|
delete[] comments;
|
||||||
error2:
|
error2:
|
||||||
if (npIds != NULL) delete[] npIds;
|
if (npIds != nullptr) delete[] npIds;
|
||||||
error1:
|
error1:
|
||||||
if (m_eStatsState != eStatsState_Canceled)
|
if (m_eStatsState != eStatsState_Canceled)
|
||||||
m_eStatsState = eStatsState_Failed;
|
m_eStatsState = eStatsState_Failed;
|
||||||
|
|
@ -406,7 +406,7 @@ bool SonyLeaderboardManager::getScoreByRange() {
|
||||||
|
|
||||||
comments, sizeof(SceNpScoreComment) * num, // OUT: Comment Data
|
comments, sizeof(SceNpScoreComment) * num, // OUT: Comment Data
|
||||||
|
|
||||||
NULL, 0, // GameData.
|
nullptr, 0, // GameData.
|
||||||
|
|
||||||
num,
|
num,
|
||||||
|
|
||||||
|
|
@ -414,7 +414,7 @@ bool SonyLeaderboardManager::getScoreByRange() {
|
||||||
&m_maxRank, // 'Total number of players registered in the target
|
&m_maxRank, // 'Total number of players registered in the target
|
||||||
// scoreboard.'
|
// scoreboard.'
|
||||||
|
|
||||||
NULL // Reserved, specify null.
|
nullptr // Reserved, specify null.
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) {
|
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) {
|
||||||
|
|
@ -437,7 +437,7 @@ bool SonyLeaderboardManager::getScoreByRange() {
|
||||||
delete[] ptr;
|
delete[] ptr;
|
||||||
delete[] comments;
|
delete[] comments;
|
||||||
|
|
||||||
m_scores = NULL;
|
m_scores = nullptr;
|
||||||
m_readCount = 0;
|
m_readCount = 0;
|
||||||
|
|
||||||
m_eStatsState = eStatsState_Ready;
|
m_eStatsState = eStatsState_Ready;
|
||||||
|
|
@ -457,7 +457,7 @@ bool SonyLeaderboardManager::getScoreByRange() {
|
||||||
|
|
||||||
// m_stats = ptr; //Maybe: addPadding(num,ptr);
|
// 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_readCount = ret;
|
||||||
m_scores = new ReadScore[m_readCount];
|
m_scores = new ReadScore[m_readCount];
|
||||||
for (int i = 0; i < m_readCount; i++) {
|
for (int i = 0; i < m_readCount; i++) {
|
||||||
|
|
@ -544,13 +544,13 @@ bool SonyLeaderboardManager::setScore() {
|
||||||
rscore.m_score, // IN: new score,
|
rscore.m_score, // IN: new score,
|
||||||
|
|
||||||
&comment, // Comments
|
&comment, // Comments
|
||||||
NULL, // GameInfo
|
nullptr, // GameInfo
|
||||||
|
|
||||||
&tmp, // OUT: current rank,
|
&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
|
if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_NOT_BEST_SCORE) // 0x8002A415
|
||||||
|
|
@ -593,7 +593,7 @@ void SonyLeaderboardManager::Tick() {
|
||||||
|
|
||||||
switch (m_eStatsState) {
|
switch (m_eStatsState) {
|
||||||
case eStatsState_Ready: {
|
case eStatsState_Ready: {
|
||||||
assert(m_scores != NULL || m_readCount == 0);
|
assert(m_scores != nullptr || m_readCount == 0);
|
||||||
|
|
||||||
view.m_numQueries = m_readCount;
|
view.m_numQueries = m_readCount;
|
||||||
view.m_queries = m_scores;
|
view.m_queries = m_scores;
|
||||||
|
|
@ -604,7 +604,7 @@ void SonyLeaderboardManager::Tick() {
|
||||||
eStatsReturn ret = eStatsReturn_NoResults;
|
eStatsReturn ret = eStatsReturn_NoResults;
|
||||||
if (view.m_numQueries > 0) ret = eStatsReturn_Success;
|
if (view.m_numQueries > 0) ret = eStatsReturn_Success;
|
||||||
|
|
||||||
if (m_readListener != NULL) {
|
if (m_readListener != nullptr) {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"[SonyLeaderboardManager] OnStatsReadComplete(%i, %i, _), "
|
"[SonyLeaderboardManager] OnStatsReadComplete(%i, %i, _), "
|
||||||
"m_readCount=%i.\n",
|
"m_readCount=%i.\n",
|
||||||
|
|
@ -615,14 +615,14 @@ void SonyLeaderboardManager::Tick() {
|
||||||
m_eStatsState = eStatsState_Idle;
|
m_eStatsState = eStatsState_Idle;
|
||||||
|
|
||||||
delete[] m_scores;
|
delete[] m_scores;
|
||||||
m_scores = NULL;
|
m_scores = nullptr;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case eStatsState_Failed: {
|
case eStatsState_Failed: {
|
||||||
view.m_numQueries = 0;
|
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,
|
m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError,
|
||||||
0, view);
|
0, view);
|
||||||
|
|
||||||
|
|
@ -640,7 +640,7 @@ void SonyLeaderboardManager::Tick() {
|
||||||
|
|
||||||
bool SonyLeaderboardManager::OpenSession() {
|
bool SonyLeaderboardManager::OpenSession() {
|
||||||
if (m_openSessions == 0) {
|
if (m_openSessions == 0) {
|
||||||
if (m_threadScoreboard == NULL) {
|
if (m_threadScoreboard == nullptr) {
|
||||||
m_threadScoreboard =
|
m_threadScoreboard =
|
||||||
new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard");
|
new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard");
|
||||||
m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS);
|
m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS);
|
||||||
|
|
@ -748,7 +748,7 @@ bool SonyLeaderboardManager::ReadStats_TopRank(
|
||||||
void SonyLeaderboardManager::FlushStats() {}
|
void SonyLeaderboardManager::FlushStats() {}
|
||||||
|
|
||||||
void SonyLeaderboardManager::CancelOperation() {
|
void SonyLeaderboardManager::CancelOperation() {
|
||||||
m_readListener = NULL;
|
m_readListener = nullptr;
|
||||||
m_eStatsState = eStatsState_Canceled;
|
m_eStatsState = eStatsState_Canceled;
|
||||||
|
|
||||||
if (m_requestId != 0) {
|
if (m_requestId != 0) {
|
||||||
|
|
@ -898,7 +898,7 @@ void SonyLeaderboardManager::fromBase32(void* out, SceNpScoreComment* in) {
|
||||||
char ch[2] = {0, 0};
|
char ch[2] = {0, 0};
|
||||||
for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++) {
|
for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++) {
|
||||||
ch[0] = getComment(in)[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 sByte = (i * 5) / 8;
|
||||||
int eByte = (5 + (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);
|
int ctx = createTransactionContext(m_titleContext);
|
||||||
if (ctx < 0) return false;
|
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) {
|
if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED) {
|
||||||
app.DebugPrintf("\n[TEST_STRING]: REJECTED ");
|
app.DebugPrintf("\n[TEST_STRING]: REJECTED ");
|
||||||
|
|
|
||||||
|
|
@ -115,13 +115,13 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||||
void* lpParameter) {
|
void* lpParameter) {
|
||||||
|
|
||||||
int64_t seed = 0;
|
int64_t seed = 0;
|
||||||
if (lpParameter != NULL) {
|
if (lpParameter != nullptr) {
|
||||||
NetworkGameInitData* param = (NetworkGameInitData*)lpParameter;
|
NetworkGameInitData* param = (NetworkGameInitData*)lpParameter;
|
||||||
seed = param->seed;
|
seed = param->seed;
|
||||||
|
|
||||||
app.setLevelGenerationOptions(param->levelGen);
|
app.setLevelGenerationOptions(param->levelGen);
|
||||||
if (param->levelGen != NULL) {
|
if (param->levelGen != nullptr) {
|
||||||
if (app.getLevelGenerationOptions() == NULL) {
|
if (app.getLevelGenerationOptions() == nullptr) {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"Game rule was not loaded, and seed is required. "
|
"Game rule was not loaded, and seed is required. "
|
||||||
"Exiting.\n");
|
"Exiting.\n");
|
||||||
|
|
@ -156,13 +156,13 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||||
GENERIC_READ, // access mode
|
GENERIC_READ, // access mode
|
||||||
0, // share mode // TODO 4J Stu - Will we need
|
0, // share mode // TODO 4J Stu - Will we need
|
||||||
// to share file? Probably not but...
|
// to share file? Probably not but...
|
||||||
NULL, // Unused
|
nullptr, // Unused
|
||||||
OPEN_EXISTING, // how to create // TODO 4J Stu
|
OPEN_EXISTING, // how to create // TODO 4J Stu
|
||||||
// - Assuming that the file
|
// - Assuming that the file
|
||||||
// already exists if we are
|
// already exists if we are
|
||||||
// opening to read from it
|
// opening to read from it
|
||||||
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||||
NULL // Unsupported
|
nullptr // Unsupported
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
const char* pchFilename =
|
const char* pchFilename =
|
||||||
|
|
@ -172,23 +172,23 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||||
GENERIC_READ, // access mode
|
GENERIC_READ, // access mode
|
||||||
0, // share mode // TODO 4J Stu - Will we need
|
0, // share mode // TODO 4J Stu - Will we need
|
||||||
// to share file? Probably not but...
|
// to share file? Probably not but...
|
||||||
NULL, // Unused
|
nullptr, // Unused
|
||||||
OPEN_EXISTING, // how to create // TODO 4J Stu
|
OPEN_EXISTING, // how to create // TODO 4J Stu
|
||||||
// - Assuming that the file
|
// - Assuming that the file
|
||||||
// already exists if we are
|
// already exists if we are
|
||||||
// opening to read from it
|
// opening to read from it
|
||||||
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||||
NULL // Unsupported
|
nullptr // Unsupported
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (fileHandle != INVALID_HANDLE_VALUE) {
|
if (fileHandle != INVALID_HANDLE_VALUE) {
|
||||||
DWORD bytesRead,
|
DWORD bytesRead,
|
||||||
dwFileSize = GetFileSize(fileHandle, NULL);
|
dwFileSize = GetFileSize(fileHandle, nullptr);
|
||||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||||
bool bSuccess =
|
bool bSuccess =
|
||||||
ReadFile(fileHandle, pbData, dwFileSize,
|
ReadFile(fileHandle, pbData, dwFileSize,
|
||||||
&bytesRead, NULL);
|
&bytesRead, nullptr);
|
||||||
if (bSuccess == FALSE) {
|
if (bSuccess == FALSE) {
|
||||||
app.FatalLoadError();
|
app.FatalLoadError();
|
||||||
}
|
}
|
||||||
|
|
@ -231,7 +231,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||||
|
|
||||||
// printf("Server ready to go!\n");
|
// printf("Server ready to go!\n");
|
||||||
} else {
|
} else {
|
||||||
Socket::Initialise(NULL);
|
Socket::Initialise(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||||
|
|
@ -286,17 +286,17 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||||
ClientConnection* connection;
|
ClientConnection* connection;
|
||||||
|
|
||||||
if (g_NetworkManager.IsHost()) {
|
if (g_NetworkManager.IsHost()) {
|
||||||
connection = new ClientConnection(minecraft, NULL);
|
connection = new ClientConnection(minecraft, nullptr);
|
||||||
app.DebugPrintf("[NET] ClientConnection created, createdOk=%d\n",
|
app.DebugPrintf("[NET] ClientConnection created, createdOk=%d\n",
|
||||||
connection->createdOk);
|
connection->createdOk);
|
||||||
} else {
|
} else {
|
||||||
INetworkPlayer* pNetworkPlayer =
|
INetworkPlayer* pNetworkPlayer =
|
||||||
g_NetworkManager.GetLocalPlayerByUserIndex(
|
g_NetworkManager.GetLocalPlayerByUserIndex(
|
||||||
ProfileManager.GetLockedProfile());
|
ProfileManager.GetLockedProfile());
|
||||||
if (pNetworkPlayer == NULL) {
|
if (pNetworkPlayer == nullptr) {
|
||||||
MinecraftServer::HaltServer();
|
MinecraftServer::HaltServer();
|
||||||
app.DebugPrintf("%d\n", ProfileManager.GetLockedProfile());
|
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
|
// session setup, and continuing will end up in a crash
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -305,10 +305,10 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||||
|
|
||||||
// Fix for #13259 - CRASH: Gameplay: loading process is halted when
|
// Fix for #13259 - CRASH: Gameplay: loading process is halted when
|
||||||
// player loads saved data
|
// player loads saved data
|
||||||
if (socket == NULL) {
|
if (socket == nullptr) {
|
||||||
assert(false);
|
assert(false);
|
||||||
MinecraftServer::HaltServer();
|
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
|
// session setup, and continuing will end up in a crash
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -319,7 +319,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||||
if (!connection->createdOk) {
|
if (!connection->createdOk) {
|
||||||
assert(false);
|
assert(false);
|
||||||
delete connection;
|
delete connection;
|
||||||
connection = NULL;
|
connection = nullptr;
|
||||||
MinecraftServer::HaltServer();
|
MinecraftServer::HaltServer();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -395,7 +395,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||||
// Already have setup the primary pad
|
// Already have setup the primary pad
|
||||||
if (idx == ProfileManager.GetPrimaryPad()) continue;
|
if (idx == ProfileManager.GetPrimaryPad()) continue;
|
||||||
|
|
||||||
if (GetLocalPlayerByUserIndex(idx) != NULL &&
|
if (GetLocalPlayerByUserIndex(idx) != nullptr &&
|
||||||
!ProfileManager.IsSignedIn(idx)) {
|
!ProfileManager.IsSignedIn(idx)) {
|
||||||
INetworkPlayer* pNetworkPlayer =
|
INetworkPlayer* pNetworkPlayer =
|
||||||
g_NetworkManager.GetLocalPlayerByUserIndex(idx);
|
g_NetworkManager.GetLocalPlayerByUserIndex(idx);
|
||||||
|
|
@ -416,7 +416,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||||
// them later
|
// them later
|
||||||
INetworkPlayer* pNetworkPlayer =
|
INetworkPlayer* pNetworkPlayer =
|
||||||
g_NetworkManager.GetLocalPlayerByUserIndex(idx);
|
g_NetworkManager.GetLocalPlayerByUserIndex(idx);
|
||||||
if (pNetworkPlayer == NULL) continue;
|
if (pNetworkPlayer == nullptr) continue;
|
||||||
|
|
||||||
ClientConnection* connection;
|
ClientConnection* connection;
|
||||||
|
|
||||||
|
|
@ -827,7 +827,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc(void* lpParameter) {
|
||||||
}
|
}
|
||||||
// If we failed before the server started, clear the game rules.
|
// If we failed before the server started, clear the game rules.
|
||||||
// Otherwise the server will clear it up.
|
// Otherwise the server will clear it up.
|
||||||
if (MinecraftServer::getInstance() == NULL)
|
if (MinecraftServer::getInstance() == nullptr)
|
||||||
app.m_gameRules.unloadCurrentGameRules();
|
app.m_gameRules.unloadCurrentGameRules();
|
||||||
Tile::ReleaseThreadStorage();
|
Tile::ReleaseThreadStorage();
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -840,14 +840,14 @@ int CGameNetworkManager::RunNetworkGameThreadProc(void* lpParameter) {
|
||||||
|
|
||||||
int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
|
int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
|
||||||
int64_t seed = 0;
|
int64_t seed = 0;
|
||||||
if (lpParameter != NULL) {
|
if (lpParameter != nullptr) {
|
||||||
NetworkGameInitData* param = (NetworkGameInitData*)lpParameter;
|
NetworkGameInitData* param = (NetworkGameInitData*)lpParameter;
|
||||||
seed = param->seed;
|
seed = param->seed;
|
||||||
app.SetGameHostOption(eGameHostOption_All, param->settings);
|
app.SetGameHostOption(eGameHostOption_All, param->settings);
|
||||||
|
|
||||||
// 4J Stu - If we are loading a DLC save that's separate from the
|
// 4J Stu - If we are loading a DLC save that's separate from the
|
||||||
// texture pack, load
|
// texture pack, load
|
||||||
if (param->levelGen != NULL &&
|
if (param->levelGen != nullptr &&
|
||||||
(param->texturePackId == 0 ||
|
(param->texturePackId == 0 ||
|
||||||
param->levelGen->getRequiredTexturePackId() !=
|
param->levelGen->getRequiredTexturePackId() !=
|
||||||
param->texturePackId)) {
|
param->texturePackId)) {
|
||||||
|
|
@ -874,7 +874,7 @@ int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
|
||||||
Tile::ReleaseThreadStorage();
|
Tile::ReleaseThreadStorage();
|
||||||
Level::destroyLightingCache();
|
Level::destroyLightingCache();
|
||||||
|
|
||||||
if (lpParameter != NULL) delete (NetworkGameInitData*)lpParameter;
|
if (lpParameter != nullptr) delete (NetworkGameInitData*)lpParameter;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -885,7 +885,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc(void* lpParam) {
|
||||||
Compression::UseDefaultThreadStorage();
|
Compression::UseDefaultThreadStorage();
|
||||||
|
|
||||||
// app.SetGameStarted(false);
|
// app.SetGameStarted(false);
|
||||||
UIScene_PauseMenu::_ExitWorld(NULL);
|
UIScene_PauseMenu::_ExitWorld(nullptr);
|
||||||
|
|
||||||
while (g_NetworkManager.IsInSession()) {
|
while (g_NetworkManager.IsInSession()) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
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
|
// 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
|
// them being removed from the server when removed from the session
|
||||||
if (pServer != NULL) {
|
if (pServer != nullptr) {
|
||||||
PlayerList* players = pServer->getPlayers();
|
PlayerList* players = pServer->getPlayers();
|
||||||
for (auto it = players->players.begin();
|
for (auto it = players->players.begin();
|
||||||
it < players->players.end(); ++it) {
|
it < players->players.end(); ++it) {
|
||||||
|
|
@ -946,7 +946,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
|
||||||
if (servPlayer->connection->isLocal() &&
|
if (servPlayer->connection->isLocal() &&
|
||||||
!servPlayer->connection->isGuest()) {
|
!servPlayer->connection->isGuest()) {
|
||||||
servPlayer->connection->connection->getSocket()->setPlayer(
|
servPlayer->connection->connection->getSocket()->setPlayer(
|
||||||
NULL);
|
nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -981,7 +981,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
|
||||||
char numLocalPlayers = 0;
|
char numLocalPlayers = 0;
|
||||||
for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) {
|
for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) {
|
||||||
if (ProfileManager.IsSignedIn(index) &&
|
if (ProfileManager.IsSignedIn(index) &&
|
||||||
pMinecraft->localplayers[index] != NULL) {
|
pMinecraft->localplayers[index] != nullptr) {
|
||||||
numLocalPlayers++;
|
numLocalPlayers++;
|
||||||
localUsersMask |= GetLocalPlayerMask(index);
|
localUsersMask |= GetLocalPlayerMask(index);
|
||||||
}
|
}
|
||||||
|
|
@ -997,10 +997,10 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore the network player of all the server players that are local
|
// 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) {
|
for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) {
|
||||||
if (ProfileManager.IsSignedIn(index) &&
|
if (ProfileManager.IsSignedIn(index) &&
|
||||||
pMinecraft->localplayers[index] != NULL) {
|
pMinecraft->localplayers[index] != nullptr) {
|
||||||
PlayerUID localPlayerXuid =
|
PlayerUID localPlayerXuid =
|
||||||
pMinecraft->localplayers[index]->getXuid();
|
pMinecraft->localplayers[index]->getXuid();
|
||||||
|
|
||||||
|
|
@ -1017,7 +1017,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player might have a pending connection
|
// Player might have a pending connection
|
||||||
if (pMinecraft->m_pendingLocalConnections[index] != NULL) {
|
if (pMinecraft->m_pendingLocalConnections[index] != nullptr) {
|
||||||
// Update the network player
|
// Update the network player
|
||||||
pMinecraft->m_pendingLocalConnections[index]
|
pMinecraft->m_pendingLocalConnections[index]
|
||||||
->getConnection()
|
->getConnection()
|
||||||
|
|
@ -1129,7 +1129,7 @@ void CGameNetworkManager::StateChange_AnyToStarting() {
|
||||||
if (!g_NetworkManager.IsHost()) {
|
if (!g_NetworkManager.IsHost()) {
|
||||||
LoadingInputParams* loadingParams = new LoadingInputParams();
|
LoadingInputParams* loadingParams = new LoadingInputParams();
|
||||||
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
|
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
|
||||||
loadingParams->lpParam = NULL;
|
loadingParams->lpParam = nullptr;
|
||||||
|
|
||||||
UIFullscreenProgressCompletionData* completionData =
|
UIFullscreenProgressCompletionData* completionData =
|
||||||
new UIFullscreenProgressCompletionData();
|
new UIFullscreenProgressCompletionData();
|
||||||
|
|
@ -1151,7 +1151,7 @@ void CGameNetworkManager::StateChange_AnyToEnding(bool bStateWasPlaying) {
|
||||||
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) {
|
||||||
INetworkPlayer* pNetworkPlayer =
|
INetworkPlayer* pNetworkPlayer =
|
||||||
g_NetworkManager.GetLocalPlayerByUserIndex(i);
|
g_NetworkManager.GetLocalPlayerByUserIndex(i);
|
||||||
if (pNetworkPlayer != NULL && ProfileManager.IsSignedIn(i)) {
|
if (pNetworkPlayer != nullptr && ProfileManager.IsSignedIn(i)) {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"Stats save for an offline game for the player at index "
|
"Stats save for an offline game for the player at index "
|
||||||
"%d\n",
|
"%d\n",
|
||||||
|
|
@ -1190,10 +1190,10 @@ void CGameNetworkManager::CreateSocket(INetworkPlayer* pNetworkPlayer,
|
||||||
bool localPlayer) {
|
bool localPlayer) {
|
||||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||||
|
|
||||||
Socket* socket = NULL;
|
Socket* socket = nullptr;
|
||||||
std::shared_ptr<MultiplayerLocalPlayer> mpPlayer =
|
std::shared_ptr<MultiplayerLocalPlayer> mpPlayer =
|
||||||
pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()];
|
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
|
// If we already have a MultiplayerLocalPlayer here then we are doing a
|
||||||
// session type change
|
// session type change
|
||||||
socket = mpPlayer->connection->getSocket();
|
socket = mpPlayer->connection->getSocket();
|
||||||
|
|
@ -1233,7 +1233,7 @@ void CGameNetworkManager::CreateSocket(INetworkPlayer* pNetworkPlayer,
|
||||||
idx,
|
idx,
|
||||||
DisconnectPacket::eDisconnect_ConnectionCreationFailed);
|
DisconnectPacket::eDisconnect_ConnectionCreationFailed);
|
||||||
delete connection;
|
delete connection;
|
||||||
connection = NULL;
|
connection = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1241,9 +1241,9 @@ void CGameNetworkManager::CreateSocket(INetworkPlayer* pNetworkPlayer,
|
||||||
|
|
||||||
void CGameNetworkManager::CloseConnection(INetworkPlayer* pNetworkPlayer) {
|
void CGameNetworkManager::CloseConnection(INetworkPlayer* pNetworkPlayer) {
|
||||||
MinecraftServer* server = MinecraftServer::getInstance();
|
MinecraftServer* server = MinecraftServer::getInstance();
|
||||||
if (server != NULL) {
|
if (server != nullptr) {
|
||||||
PlayerList* players = server->getPlayers();
|
PlayerList* players = server->getPlayers();
|
||||||
if (players != NULL) {
|
if (players != nullptr) {
|
||||||
players->closePlayerConnectionBySmallId(
|
players->closePlayerConnectionBySmallId(
|
||||||
pNetworkPlayer->GetSmallId());
|
pNetworkPlayer->GetSmallId());
|
||||||
}
|
}
|
||||||
|
|
@ -1261,7 +1261,7 @@ void CGameNetworkManager::PlayerJoining(INetworkPlayer* pNetworkPlayer) {
|
||||||
for (int iPad = 0; iPad < XUSER_MAX_COUNT; ++iPad) {
|
for (int iPad = 0; iPad < XUSER_MAX_COUNT; ++iPad) {
|
||||||
INetworkPlayer* pNetworkPlayer =
|
INetworkPlayer* pNetworkPlayer =
|
||||||
g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
|
g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
|
||||||
if (pNetworkPlayer == NULL) continue;
|
if (pNetworkPlayer == nullptr) continue;
|
||||||
|
|
||||||
app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BLANK);
|
app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BLANK);
|
||||||
if (multiplayer) {
|
if (multiplayer) {
|
||||||
|
|
@ -1321,7 +1321,7 @@ void CGameNetworkManager::GameInviteReceived(int userIndex,
|
||||||
// except for the invited player (who may be an inactive player) 4J
|
// 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
|
// Stu - If we are not in a game, then bring in all players signed
|
||||||
// in
|
// in
|
||||||
if (index == userIndex || pMinecraft->localplayers[index] != NULL) {
|
if (index == userIndex || pMinecraft->localplayers[index] != nullptr) {
|
||||||
++joiningUsers;
|
++joiningUsers;
|
||||||
if (!ProfileManager.AllowedToPlayMultiplayer(index))
|
if (!ProfileManager.AllowedToPlayMultiplayer(index))
|
||||||
noPrivileges = true;
|
noPrivileges = true;
|
||||||
|
|
@ -1357,7 +1357,7 @@ void CGameNetworkManager::GameInviteReceived(int userIndex,
|
||||||
// invite from the dashboard
|
// invite from the dashboard
|
||||||
// StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE,
|
// StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE,
|
||||||
// IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT,
|
// IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT,
|
||||||
// uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL,
|
// uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr,
|
||||||
// app.GetStringTable());
|
// app.GetStringTable());
|
||||||
ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE,
|
ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE,
|
||||||
IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1,
|
IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1,
|
||||||
|
|
@ -1507,49 +1507,49 @@ char* CGameNetworkManager::GetOnlineName(int playerIdx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameNetworkManager::ServerReadyCreate(bool create) {
|
void CGameNetworkManager::ServerReadyCreate(bool create) {
|
||||||
m_hServerReadyEvent = (create ? (new C4JThread::Event) : NULL);
|
m_hServerReadyEvent = (create ? (new C4JThread::Event) : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameNetworkManager::ServerReady() {
|
void CGameNetworkManager::ServerReady() {
|
||||||
if (m_hServerReadyEvent != NULL) {
|
if (m_hServerReadyEvent != nullptr) {
|
||||||
m_hServerReadyEvent->Set();
|
m_hServerReadyEvent->Set();
|
||||||
} else {
|
} else {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"[NET] Warning: ServerReady() called but m_hServerReadyEvent is "
|
"[NET] Warning: ServerReady() called but m_hServerReadyEvent is "
|
||||||
"NULL\n");
|
"nullptr\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameNetworkManager::ServerReadyWait() {
|
void CGameNetworkManager::ServerReadyWait() {
|
||||||
if (m_hServerReadyEvent != NULL) {
|
if (m_hServerReadyEvent != nullptr) {
|
||||||
m_hServerReadyEvent->WaitForSignal(INFINITE);
|
m_hServerReadyEvent->WaitForSignal(INFINITE);
|
||||||
} else {
|
} else {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"[NET] Warning: ServerReadyWait() called but m_hServerReadyEvent "
|
"[NET] Warning: ServerReadyWait() called but m_hServerReadyEvent "
|
||||||
"is NULL\n");
|
"is nullptr\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameNetworkManager::ServerReadyDestroy() {
|
void CGameNetworkManager::ServerReadyDestroy() {
|
||||||
delete m_hServerReadyEvent;
|
delete m_hServerReadyEvent;
|
||||||
m_hServerReadyEvent = NULL;
|
m_hServerReadyEvent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameNetworkManager::ServerReadyValid() {
|
bool CGameNetworkManager::ServerReadyValid() {
|
||||||
return (m_hServerReadyEvent != NULL);
|
return (m_hServerReadyEvent != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameNetworkManager::ServerStoppedCreate(bool create) {
|
void CGameNetworkManager::ServerStoppedCreate(bool create) {
|
||||||
m_hServerStoppedEvent = (create ? (new C4JThread::Event) : NULL);
|
m_hServerStoppedEvent = (create ? (new C4JThread::Event) : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameNetworkManager::ServerStopped() {
|
void CGameNetworkManager::ServerStopped() {
|
||||||
if (m_hServerStoppedEvent != NULL) {
|
if (m_hServerStoppedEvent != nullptr) {
|
||||||
m_hServerStoppedEvent->Set();
|
m_hServerStoppedEvent->Set();
|
||||||
} else {
|
} else {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"[NET] Warning: ServerStopped() called but m_hServerStoppedEvent "
|
"[NET] Warning: ServerStopped() called but m_hServerStoppedEvent "
|
||||||
"is NULL\n");
|
"is nullptr\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1574,23 +1574,23 @@ void CGameNetworkManager::ServerStoppedWait() {
|
||||||
RenderManager.Present();
|
RenderManager.Present();
|
||||||
} while (result == WAIT_TIMEOUT);
|
} while (result == WAIT_TIMEOUT);
|
||||||
} else {
|
} else {
|
||||||
if (m_hServerStoppedEvent != NULL) {
|
if (m_hServerStoppedEvent != nullptr) {
|
||||||
m_hServerStoppedEvent->WaitForSignal(INFINITE);
|
m_hServerStoppedEvent->WaitForSignal(INFINITE);
|
||||||
} else {
|
} else {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"[NET] Warning: ServerStoppedWait() called but "
|
"[NET] Warning: ServerStoppedWait() called but "
|
||||||
"m_hServerStoppedEvent is NULL\n");
|
"m_hServerStoppedEvent is nullptr\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameNetworkManager::ServerStoppedDestroy() {
|
void CGameNetworkManager::ServerStoppedDestroy() {
|
||||||
delete m_hServerStoppedEvent;
|
delete m_hServerStoppedEvent;
|
||||||
m_hServerStoppedEvent = NULL;
|
m_hServerStoppedEvent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameNetworkManager::ServerStoppedValid() {
|
bool CGameNetworkManager::ServerStoppedValid() {
|
||||||
return (m_hServerStoppedEvent != NULL);
|
return (m_hServerStoppedEvent != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CGameNetworkManager::GetJoiningReadyPercentage() {
|
int CGameNetworkManager::GetJoiningReadyPercentage() {
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ public:
|
||||||
static int JoinFromInvite_SignInReturned(void* pParam, bool bContinue,
|
static int JoinFromInvite_SignInReturned(void* pParam, bool bContinue,
|
||||||
int iPad);
|
int iPad);
|
||||||
void UpdateAndSetGameSessionData(
|
void UpdateAndSetGameSessionData(
|
||||||
INetworkPlayer* pNetworkPlayerLeaving = NULL);
|
INetworkPlayer* pNetworkPlayerLeaving = nullptr);
|
||||||
void SendInviteGUI(int iPad);
|
void SendInviteGUI(int iPad);
|
||||||
void ResetLeavingGame();
|
void ResetLeavingGame();
|
||||||
|
|
||||||
|
|
@ -133,17 +133,17 @@ public:
|
||||||
|
|
||||||
// Events
|
// 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 ServerReady(); // Signal that we are ready
|
||||||
void ServerReadyWait(); // Wait for the signal
|
void ServerReadyWait(); // Wait for the signal
|
||||||
void ServerReadyDestroy(); // Destroy signal
|
void ServerReadyDestroy(); // Destroy signal
|
||||||
bool ServerReadyValid(); // Is non-NULL
|
bool ServerReadyValid(); // Is non-nullptr
|
||||||
|
|
||||||
void ServerStoppedCreate(bool create); // Create the signal
|
void ServerStoppedCreate(bool create); // Create the signal
|
||||||
void ServerStopped(); // Signal that we are ready
|
void ServerStopped(); // Signal that we are ready
|
||||||
void ServerStoppedWait(); // Wait for the signal
|
void ServerStoppedWait(); // Wait for the signal
|
||||||
void ServerStoppedDestroy(); // Destroy signal
|
void ServerStoppedDestroy(); // Destroy signal
|
||||||
bool ServerStoppedValid(); // Is non-NULL
|
bool ServerStoppedValid(); // Is non-nullptr
|
||||||
|
|
||||||
// Debug output
|
// Debug output
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
NetworkPlayerQNet::NetworkPlayerQNet(IQNetPlayer* qnetPlayer) {
|
NetworkPlayerQNet::NetworkPlayerQNet(IQNetPlayer* qnetPlayer) {
|
||||||
m_qnetPlayer = qnetPlayer;
|
m_qnetPlayer = qnetPlayer;
|
||||||
m_pSocket = NULL;
|
m_pSocket = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char NetworkPlayerQNet::GetSmallId() {
|
unsigned char NetworkPlayerQNet::GetSmallId() {
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void UpdateAndSetGameSessionData(
|
virtual void UpdateAndSetGameSessionData(
|
||||||
INetworkPlayer* pNetworkPlayerLeaving = NULL) = 0;
|
INetworkPlayer* pNetworkPlayerLeaving = nullptr) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer) = 0;
|
virtual bool RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer) = 0;
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) {
|
for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) {
|
||||||
if (playerChangedCallback[idx] != NULL)
|
if (playerChangedCallback[idx] != nullptr)
|
||||||
playerChangedCallback[idx](playerChangedCallbackParam[idx],
|
playerChangedCallback[idx](playerChangedCallbackParam[idx],
|
||||||
networkPlayer, false);
|
networkPlayer, false);
|
||||||
}
|
}
|
||||||
|
|
@ -88,7 +88,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) {
|
||||||
if (m_pIQNet->GetState() == QNET_STATE_GAME_PLAY) {
|
if (m_pIQNet->GetState() == QNET_STATE_GAME_PLAY) {
|
||||||
int localPlayerCount = 0;
|
int localPlayerCount = 0;
|
||||||
for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) {
|
for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) {
|
||||||
if (m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL)
|
if (m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr)
|
||||||
++localPlayerCount;
|
++localPlayerCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ bool CPlatformNetworkManagerStub::Initialise(
|
||||||
// 4jcraft added this, as it was never called
|
// 4jcraft added this, as it was never called
|
||||||
m_pIQNet = new IQNet();
|
m_pIQNet = new IQNet();
|
||||||
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
|
||||||
playerChangedCallback[i] = NULL;
|
playerChangedCallback[i] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bLeavingGame = false;
|
m_bLeavingGame = false;
|
||||||
|
|
@ -126,10 +126,10 @@ bool CPlatformNetworkManagerStub::Initialise(
|
||||||
m_lastSearchStartTime[i] = 0;
|
m_lastSearchStartTime[i] = 0;
|
||||||
|
|
||||||
// The results that will be filled in with the current search
|
// The results that will be filled in with the current search
|
||||||
m_pSearchResults[i] = NULL;
|
m_pSearchResults[i] = nullptr;
|
||||||
m_pQoSResult[i] = NULL;
|
m_pQoSResult[i] = nullptr;
|
||||||
m_pCurrentSearchResults[i] = NULL;
|
m_pCurrentSearchResults[i] = nullptr;
|
||||||
m_pCurrentQoSResult[i] = NULL;
|
m_pCurrentQoSResult[i] = nullptr;
|
||||||
m_currentSearchResultsCount[i] = 0;
|
m_currentSearchResultsCount[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -266,8 +266,8 @@ void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback(
|
||||||
bool leaving),
|
bool leaving),
|
||||||
void* callbackParam) {
|
void* callbackParam) {
|
||||||
if (playerChangedCallbackParam[iPad] == callbackParam) {
|
if (playerChangedCallbackParam[iPad] == callbackParam) {
|
||||||
playerChangedCallback[iPad] = NULL;
|
playerChangedCallback[iPad] = nullptr;
|
||||||
playerChangedCallbackParam[iPad] = NULL;
|
playerChangedCallbackParam[iPad] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -276,13 +276,13 @@ void CPlatformNetworkManagerStub::HandleSignInChange() { return; }
|
||||||
bool CPlatformNetworkManagerStub::_RunNetworkGame() { return true; }
|
bool CPlatformNetworkManagerStub::_RunNetworkGame() { return true; }
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(
|
void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(
|
||||||
INetworkPlayer* pNetworkPlayerLeaving /*= NULL*/) {
|
INetworkPlayer* pNetworkPlayerLeaving /*= nullptr*/) {
|
||||||
// DWORD playerCount = m_pIQNet->GetPlayerCount();
|
// DWORD playerCount = m_pIQNet->GetPlayerCount();
|
||||||
//
|
//
|
||||||
// if( this->m_bLeavingGame )
|
// if( this->m_bLeavingGame )
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
// if( GetHostPlayer() == NULL )
|
// if( GetHostPlayer() == nullptr )
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
// for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
|
// for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
|
||||||
|
|
@ -305,13 +305,13 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// m_hostGameSessionData.players[i] = NULL;
|
// m_hostGameSessionData.players[i] = nullptr;
|
||||||
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
|
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// m_hostGameSessionData.players[i] = NULL;
|
// m_hostGameSessionData.players[i] = nullptr;
|
||||||
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
|
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
@ -328,13 +328,13 @@ int CPlatformNetworkManagerStub::RemovePlayerOnSocketClosedThreadProc(
|
||||||
|
|
||||||
Socket* socket = pNetworkPlayer->GetSocket();
|
Socket* socket = pNetworkPlayer->GetSocket();
|
||||||
|
|
||||||
if (socket != NULL) {
|
if (socket != nullptr) {
|
||||||
// printf("Waiting for socket closed event\n");
|
// printf("Waiting for socket closed event\n");
|
||||||
socket->m_socketClosedEvent->WaitForSignal(INFINITE);
|
socket->m_socketClosedEvent->WaitForSignal(INFINITE);
|
||||||
|
|
||||||
// printf("Socket closed event has fired\n");
|
// printf("Socket closed event has fired\n");
|
||||||
// 4J Stu - Clear our reference to this socket
|
// 4J Stu - Clear our reference to this socket
|
||||||
pNetworkPlayer->SetSocket(NULL);
|
pNetworkPlayer->SetSocket(nullptr);
|
||||||
delete socket;
|
delete socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -404,7 +404,7 @@ void CPlatformNetworkManagerStub::SystemFlagReset() {
|
||||||
void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer,
|
void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer,
|
||||||
int index) {
|
int index) {
|
||||||
if ((index < 0) || (index >= m_flagIndexSize)) return;
|
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++) {
|
for (unsigned int i = 0; i < m_playerFlags.size(); i++) {
|
||||||
if (pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer)) {
|
if (pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer)) {
|
||||||
|
|
@ -419,7 +419,7 @@ void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer,
|
||||||
bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer* pNetworkPlayer,
|
bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer* pNetworkPlayer,
|
||||||
int index) {
|
int index) {
|
||||||
if ((index < 0) || (index >= m_flagIndexSize)) return false;
|
if ((index < 0) || (index >= m_flagIndexSize)) return false;
|
||||||
if (pNetworkPlayer == NULL) {
|
if (pNetworkPlayer == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -497,7 +497,7 @@ void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh() {
|
||||||
m_searchResultsCount[i] = 0;
|
m_searchResultsCount[i] = 0;
|
||||||
m_lastSearchStartTime[i] = 0;
|
m_lastSearchStartTime[i] = 0;
|
||||||
delete m_pSearchResults[i];
|
delete m_pSearchResults[i];
|
||||||
m_pSearchResults[i] = NULL;
|
m_pSearchResults[i] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -524,7 +524,7 @@ void CPlatformNetworkManagerStub::removeNetworkPlayer(
|
||||||
INetworkPlayer* CPlatformNetworkManagerStub::getNetworkPlayer(
|
INetworkPlayer* CPlatformNetworkManagerStub::getNetworkPlayer(
|
||||||
IQNetPlayer* pQNetPlayer) {
|
IQNetPlayer* pQNetPlayer) {
|
||||||
return pQNetPlayer ? (INetworkPlayer*)(pQNetPlayer->GetCustomDataValue())
|
return pQNetPlayer ? (INetworkPlayer*)(pQNetPlayer->GetCustomDataValue())
|
||||||
: NULL;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer* CPlatformNetworkManagerStub::GetLocalPlayerByUserIndex(
|
INetworkPlayer* CPlatformNetworkManagerStub::GetLocalPlayerByUserIndex(
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void UpdateAndSetGameSessionData(
|
virtual void UpdateAndSetGameSessionData(
|
||||||
INetworkPlayer* pNetworkPlayerLeaving = NULL);
|
INetworkPlayer* pNetworkPlayerLeaving = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// TODO 4J Stu - Do we need to be able to have more than one of these?
|
// TODO 4J Stu - Do we need to be able to have more than one of these?
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,13 @@ public:
|
||||||
bool hasPartyMember;
|
bool hasPartyMember;
|
||||||
|
|
||||||
FriendSessionInfo() {
|
FriendSessionInfo() {
|
||||||
displayLabel = NULL;
|
displayLabel = nullptr;
|
||||||
displayLabelLength = 0;
|
displayLabelLength = 0;
|
||||||
displayLabelViewableStartIndex = 0;
|
displayLabelViewableStartIndex = 0;
|
||||||
hasPartyMember = false;
|
hasPartyMember = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
~FriendSessionInfo() {
|
~FriendSessionInfo() {
|
||||||
if (displayLabel != NULL) delete displayLabel;
|
if (displayLabel != nullptr) delete displayLabel;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ int CTelemetryManager::GetMode(int userId)
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
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();
|
GameType *gameType = pMinecraft->localplayers[userId]->level->getLevelData()->getGameType();
|
||||||
|
|
||||||
|
|
@ -235,7 +235,7 @@ int CTelemetryManager::GetSubLevelId(int userId)
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
|
|
||||||
if(pMinecraft->localplayers[userId] != NULL)
|
if(pMinecraft->localplayers[userId] != nullptr)
|
||||||
{
|
{
|
||||||
switch(pMinecraft->localplayers[userId]->dimension)
|
switch(pMinecraft->localplayers[userId]->dimension)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ void ChangeStateConstraint::tick(int iPad) {
|
||||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||||
std::shared_ptr<MultiplayerLocalPlayer> player =
|
std::shared_ptr<MultiplayerLocalPlayer> player =
|
||||||
minecraft->localplayers[iPad];
|
minecraft->localplayers[iPad];
|
||||||
if (player != NULL && player->connection &&
|
if (player != nullptr && player->connection &&
|
||||||
player->connection->getNetworkPlayer() != NULL) {
|
player->connection->getNetworkPlayer() != nullptr) {
|
||||||
player->connection->send(
|
player->connection->send(
|
||||||
std::shared_ptr<PlayerInfoPacket>(new PlayerInfoPacket(
|
std::shared_ptr<PlayerInfoPacket>(new PlayerInfoPacket(
|
||||||
player->connection->getNetworkPlayer()
|
player->connection->getNetworkPlayer()
|
||||||
|
|
@ -94,7 +94,7 @@ void ChangeStateConstraint::tick(int iPad) {
|
||||||
m_tutorial->changeTutorialState(m_targetState);
|
m_tutorial->changeTutorialState(m_targetState);
|
||||||
|
|
||||||
if (m_changeGameMode) {
|
if (m_changeGameMode) {
|
||||||
if (minecraft->localgameModes[iPad] != NULL) {
|
if (minecraft->localgameModes[iPad] != nullptr) {
|
||||||
m_changedFromGameMode =
|
m_changedFromGameMode =
|
||||||
minecraft->localplayers[iPad]->abilities.instabuild
|
minecraft->localplayers[iPad]->abilities.instabuild
|
||||||
? GameType::CREATIVE
|
? GameType::CREATIVE
|
||||||
|
|
@ -113,8 +113,8 @@ void ChangeStateConstraint::tick(int iPad) {
|
||||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||||
std::shared_ptr<MultiplayerLocalPlayer> player =
|
std::shared_ptr<MultiplayerLocalPlayer> player =
|
||||||
minecraft->localplayers[iPad];
|
minecraft->localplayers[iPad];
|
||||||
if (player != NULL && player->connection &&
|
if (player != nullptr && player->connection &&
|
||||||
player->connection->getNetworkPlayer() != NULL) {
|
player->connection->getNetworkPlayer() != nullptr) {
|
||||||
player->connection->send(
|
player->connection->send(
|
||||||
std::shared_ptr<PlayerInfoPacket>(
|
std::shared_ptr<PlayerInfoPacket>(
|
||||||
new PlayerInfoPacket(
|
new PlayerInfoPacket(
|
||||||
|
|
@ -144,8 +144,8 @@ void ChangeStateConstraint::tick(int iPad) {
|
||||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||||
std::shared_ptr<MultiplayerLocalPlayer> player =
|
std::shared_ptr<MultiplayerLocalPlayer> player =
|
||||||
minecraft->localplayers[iPad];
|
minecraft->localplayers[iPad];
|
||||||
if (player != NULL && player->connection &&
|
if (player != nullptr && player->connection &&
|
||||||
player->connection->getNetworkPlayer() != NULL) {
|
player->connection->getNetworkPlayer() != nullptr) {
|
||||||
player->connection->send(
|
player->connection->send(
|
||||||
std::shared_ptr<PlayerInfoPacket>(new PlayerInfoPacket(
|
std::shared_ptr<PlayerInfoPacket>(new PlayerInfoPacket(
|
||||||
player->connection->getNetworkPlayer()
|
player->connection->getNetworkPlayer()
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ public:
|
||||||
std::size_t sourceStatesCount, double x0, double y0,
|
std::size_t sourceStatesCount, double x0, double y0,
|
||||||
double z0, double x1, double y1, double z1,
|
double z0, double x1, double y1, double z1,
|
||||||
bool contains = true, bool changeGameMode = false,
|
bool contains = true, bool changeGameMode = false,
|
||||||
GameType* targetGameMode = NULL);
|
GameType* targetGameMode = nullptr);
|
||||||
~ChangeStateConstraint();
|
~ChangeStateConstraint();
|
||||||
|
|
||||||
virtual void tick(int iPad);
|
virtual void tick(int iPad);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ ChoiceTask::ChoiceTask(
|
||||||
int iCancelMapping /*= 0*/,
|
int iCancelMapping /*= 0*/,
|
||||||
eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/,
|
eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/,
|
||||||
ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
||||||
: TutorialTask(tutorial, descriptionId, false, NULL, true, false, false) {
|
: TutorialTask(tutorial, descriptionId, false, nullptr, true, false, false) {
|
||||||
if (requiresUserInput == true) {
|
if (requiresUserInput == true) {
|
||||||
constraints.push_back(new InputConstraint(iConfirmMapping));
|
constraints.push_back(new InputConstraint(iConfirmMapping));
|
||||||
constraints.push_back(new InputConstraint(iCancelMapping));
|
constraints.push_back(new InputConstraint(iCancelMapping));
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ CompleteUsingItemTask::CompleteUsingItemTask(Tutorial* tutorial,
|
||||||
int descriptionId, int itemIds[],
|
int descriptionId, int itemIds[],
|
||||||
unsigned int itemIdsLength,
|
unsigned int itemIdsLength,
|
||||||
bool enablePreCompletion)
|
bool enablePreCompletion)
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, NULL) {
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion, nullptr) {
|
||||||
m_iValidItemsA = new int[itemIdsLength];
|
m_iValidItemsA = new int[itemIdsLength];
|
||||||
for (int i = 0; i < itemIdsLength; i++) {
|
for (int i = 0; i < itemIdsLength; i++) {
|
||||||
m_iValidItemsA[i] = itemIds[i];
|
m_iValidItemsA[i] = itemIds[i];
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ ControllerTask::ControllerTask(Tutorial* tutorial, int descriptionId,
|
||||||
int iCompletionMaskACount,
|
int iCompletionMaskACount,
|
||||||
int iSouthpawMappings[],
|
int iSouthpawMappings[],
|
||||||
unsigned int uiSouthpawMappingsCount)
|
unsigned int uiSouthpawMappingsCount)
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, NULL,
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion, nullptr,
|
||||||
showMinimumTime) {
|
showMinimumTime) {
|
||||||
for (unsigned int i = 0; i < mappingsLength; ++i) {
|
for (unsigned int i = 0; i < mappingsLength; ++i) {
|
||||||
constraints.push_back(new InputConstraint(mappings[i]));
|
constraints.push_back(new InputConstraint(mappings[i]));
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ public:
|
||||||
ControllerTask(Tutorial* tutorial, int descriptionId,
|
ControllerTask(Tutorial* tutorial, int descriptionId,
|
||||||
bool enablePreCompletion, bool showMinimumTime,
|
bool enablePreCompletion, bool showMinimumTime,
|
||||||
int mappings[], unsigned int mappingsLength,
|
int mappings[], unsigned int mappingsLength,
|
||||||
int iCompletionMaskA[] = NULL, int iCompletionMaskACount = 0,
|
int iCompletionMaskA[] = nullptr, int iCompletionMaskACount = 0,
|
||||||
int iSouthpawMappings[] = NULL,
|
int iSouthpawMappings[] = nullptr,
|
||||||
unsigned int uiSouthpawMappingsCount = 0);
|
unsigned int uiSouthpawMappingsCount = 0);
|
||||||
~ControllerTask();
|
~ControllerTask();
|
||||||
virtual bool isCompleted();
|
virtual bool isCompleted();
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
CraftTask::CraftTask(int itemId, int auxValue, int quantity, Tutorial* tutorial,
|
CraftTask::CraftTask(int itemId, int auxValue, int quantity, Tutorial* tutorial,
|
||||||
int descriptionId, bool enablePreCompletion /*= true*/,
|
int descriptionId, bool enablePreCompletion /*= true*/,
|
||||||
std::vector<TutorialConstraint*>* inConstraints /*= NULL*/,
|
std::vector<TutorialConstraint*>* inConstraints /*= nullptr*/,
|
||||||
bool bShowMinimumTime /*=false*/,
|
bool bShowMinimumTime /*=false*/,
|
||||||
bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/)
|
bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/)
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints,
|
: 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,
|
CraftTask::CraftTask(int* items, int* auxValues, int numItems, int quantity,
|
||||||
Tutorial* tutorial, int descriptionId,
|
Tutorial* tutorial, int descriptionId,
|
||||||
bool enablePreCompletion /*= true*/,
|
bool enablePreCompletion /*= true*/,
|
||||||
std::vector<TutorialConstraint*>* inConstraints /*= NULL*/,
|
std::vector<TutorialConstraint*>* inConstraints /*= nullptr*/,
|
||||||
bool bShowMinimumTime /*=false*/,
|
bool bShowMinimumTime /*=false*/,
|
||||||
bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/)
|
bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/)
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints,
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints,
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@ class CraftTask : public TutorialTask {
|
||||||
public:
|
public:
|
||||||
CraftTask(int itemId, int auxValue, int quantity, Tutorial* tutorial,
|
CraftTask(int itemId, int auxValue, int quantity, Tutorial* tutorial,
|
||||||
int descriptionId, bool enablePreCompletion = true,
|
int descriptionId, bool enablePreCompletion = true,
|
||||||
std::vector<TutorialConstraint*>* inConstraints = NULL,
|
std::vector<TutorialConstraint*>* inConstraints = nullptr,
|
||||||
bool bShowMinimumTime = false, bool bAllowFade = true,
|
bool bShowMinimumTime = false, bool bAllowFade = true,
|
||||||
bool m_bTaskReminders = true);
|
bool m_bTaskReminders = true);
|
||||||
CraftTask(int* items, int* auxValues, int numItems, int quantity,
|
CraftTask(int* items, int* auxValues, int numItems, int quantity,
|
||||||
Tutorial* tutorial, int descriptionId,
|
Tutorial* tutorial, int descriptionId,
|
||||||
bool enablePreCompletion = true,
|
bool enablePreCompletion = true,
|
||||||
std::vector<TutorialConstraint*>* inConstraints = NULL,
|
std::vector<TutorialConstraint*>* inConstraints = nullptr,
|
||||||
bool bShowMinimumTime = false, bool bAllowFade = true,
|
bool bShowMinimumTime = false, bool bAllowFade = true,
|
||||||
bool m_bTaskReminders = true);
|
bool m_bTaskReminders = true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial* tutorial,
|
||||||
|
|
||||||
int DiggerItemHint::startDestroyBlock(std::shared_ptr<ItemInstance> item,
|
int DiggerItemHint::startDestroyBlock(std::shared_ptr<ItemInstance> item,
|
||||||
Tile* tile) {
|
Tile* tile) {
|
||||||
if (item != NULL) {
|
if (item != nullptr) {
|
||||||
bool itemFound = false;
|
bool itemFound = false;
|
||||||
for (unsigned int i = 0; i < m_iItemsCount; i++) {
|
for (unsigned int i = 0; i < m_iItemsCount; i++) {
|
||||||
if (item->id == m_iItems[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,
|
int DiggerItemHint::attack(std::shared_ptr<ItemInstance> item,
|
||||||
std::shared_ptr<Entity> entity) {
|
std::shared_ptr<Entity> entity) {
|
||||||
if (item != NULL) {
|
if (item != nullptr) {
|
||||||
bool itemFound = false;
|
bool itemFound = false;
|
||||||
for (unsigned int i = 0; i < m_iItemsCount; i++) {
|
for (unsigned int i = 0; i < m_iItemsCount; i++) {
|
||||||
if (item->id == m_iItems[i]) {
|
if (item->id == m_iItems[i]) {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ EffectChangedTask::EffectChangedTask(Tutorial* tutorial, int descriptionId,
|
||||||
bool enablePreCompletion,
|
bool enablePreCompletion,
|
||||||
bool bShowMinimumTime, bool bAllowFade,
|
bool bShowMinimumTime, bool bAllowFade,
|
||||||
bool bTaskReminders)
|
bool bTaskReminders)
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, NULL,
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion, nullptr,
|
||||||
bShowMinimumTime, bAllowFade, bTaskReminders) {
|
bShowMinimumTime, bAllowFade, bTaskReminders) {
|
||||||
m_effect = effect;
|
m_effect = effect;
|
||||||
m_apply = apply;
|
m_apply = apply;
|
||||||
|
|
|
||||||
|
|
@ -267,10 +267,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
new CraftTask(Tile::torch_Id, -1, 1, this,
|
new CraftTask(Tile::torch_Id, -1, 1, this,
|
||||||
IDS_TUTORIAL_TASK_CREATE_TORCH));
|
IDS_TUTORIAL_TASK_CREATE_TORCH));
|
||||||
|
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area =
|
AABB* area =
|
||||||
app.getGameRuleDefinitions()->getNamedArea(L"tutorialArea");
|
app.getGameRuleDefinitions()->getNamedArea(L"tutorialArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
std::vector<TutorialConstraint*>* areaConstraints =
|
std::vector<TutorialConstraint*>* areaConstraints =
|
||||||
new std::vector<TutorialConstraint*>();
|
new std::vector<TutorialConstraint*>();
|
||||||
areaConstraints->push_back(new AreaConstraint(
|
areaConstraints->push_back(new AreaConstraint(
|
||||||
|
|
@ -483,10 +483,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* MINECART
|
* MINECART
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area =
|
AABB* area =
|
||||||
app.getGameRuleDefinitions()->getNamedArea(L"minecartArea");
|
app.getGameRuleDefinitions()->getNamedArea(L"minecartArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
addHint(e_Tutorial_State_Gameplay,
|
addHint(e_Tutorial_State_Gameplay,
|
||||||
new AreaHint(e_Tutorial_Hint_Always_On, this,
|
new AreaHint(e_Tutorial_Hint_Always_On, this,
|
||||||
e_Tutorial_State_Gameplay,
|
e_Tutorial_State_Gameplay,
|
||||||
|
|
@ -502,9 +502,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* BOAT
|
* BOAT
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"boatArea");
|
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"boatArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
addHint(e_Tutorial_State_Gameplay,
|
addHint(e_Tutorial_State_Gameplay,
|
||||||
new AreaHint(e_Tutorial_Hint_Always_On, this,
|
new AreaHint(e_Tutorial_Hint_Always_On, this,
|
||||||
e_Tutorial_State_Gameplay,
|
e_Tutorial_State_Gameplay,
|
||||||
|
|
@ -520,9 +520,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* FISHING
|
* FISHING
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"fishingArea");
|
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"fishingArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
addHint(e_Tutorial_State_Gameplay,
|
addHint(e_Tutorial_State_Gameplay,
|
||||||
new AreaHint(e_Tutorial_Hint_Always_On, this,
|
new AreaHint(e_Tutorial_Hint_Always_On, this,
|
||||||
e_Tutorial_State_Gameplay,
|
e_Tutorial_State_Gameplay,
|
||||||
|
|
@ -538,10 +538,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* PISTON - SELF-REPAIRING BRIDGE
|
* PISTON - SELF-REPAIRING BRIDGE
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area =
|
AABB* area =
|
||||||
app.getGameRuleDefinitions()->getNamedArea(L"pistonBridgeArea");
|
app.getGameRuleDefinitions()->getNamedArea(L"pistonBridgeArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
addHint(
|
addHint(
|
||||||
e_Tutorial_State_Gameplay,
|
e_Tutorial_State_Gameplay,
|
||||||
new AreaHint(e_Tutorial_Hint_Always_On, this,
|
new AreaHint(e_Tutorial_Hint_Always_On, this,
|
||||||
|
|
@ -558,9 +558,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* PISTON - PISTON AND REDSTONE CIRCUITS
|
* PISTON - PISTON AND REDSTONE CIRCUITS
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"pistonArea");
|
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"pistonArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State redstoneAndPistonStates[] = {
|
eTutorial_State redstoneAndPistonStates[] = {
|
||||||
e_Tutorial_State_Gameplay};
|
e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
|
|
@ -614,9 +614,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* PORTAL
|
* PORTAL
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"portalArea");
|
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"portalArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State portalStates[] = {e_Tutorial_State_Gameplay};
|
eTutorial_State portalStates[] = {e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
this, e_Tutorial_State_Portal, portalStates, 1, area->x0,
|
this, e_Tutorial_State_Portal, portalStates, 1, area->x0,
|
||||||
|
|
@ -659,10 +659,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* CREATIVE
|
* CREATIVE
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area =
|
AABB* area =
|
||||||
app.getGameRuleDefinitions()->getNamedArea(L"creativeArea");
|
app.getGameRuleDefinitions()->getNamedArea(L"creativeArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State creativeStates[] = {e_Tutorial_State_Gameplay};
|
eTutorial_State creativeStates[] = {e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
this, e_Tutorial_State_CreativeMode, creativeStates, 1,
|
this, e_Tutorial_State_CreativeMode, creativeStates, 1,
|
||||||
|
|
@ -701,7 +701,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
|
|
||||||
AABB* exitArea =
|
AABB* exitArea =
|
||||||
app.getGameRuleDefinitions()->getNamedArea(L"creativeExitArea");
|
app.getGameRuleDefinitions()->getNamedArea(L"creativeExitArea");
|
||||||
if (exitArea != NULL) {
|
if (exitArea != nullptr) {
|
||||||
std::vector<TutorialConstraint*>* creativeExitAreaConstraints =
|
std::vector<TutorialConstraint*>* creativeExitAreaConstraints =
|
||||||
new std::vector<TutorialConstraint*>();
|
new std::vector<TutorialConstraint*>();
|
||||||
creativeExitAreaConstraints->push_back(new AreaConstraint(
|
creativeExitAreaConstraints->push_back(new AreaConstraint(
|
||||||
|
|
@ -737,9 +737,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* BREWING
|
* BREWING
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"brewingArea");
|
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"brewingArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State brewingStates[] = {e_Tutorial_State_Gameplay};
|
eTutorial_State brewingStates[] = {e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
this, e_Tutorial_State_Brewing, brewingStates, 1, area->x0,
|
this, e_Tutorial_State_Brewing, brewingStates, 1, area->x0,
|
||||||
|
|
@ -800,10 +800,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* ENCHANTING
|
* ENCHANTING
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area =
|
AABB* area =
|
||||||
app.getGameRuleDefinitions()->getNamedArea(L"enchantingArea");
|
app.getGameRuleDefinitions()->getNamedArea(L"enchantingArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
|
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
this, e_Tutorial_State_Enchanting, enchantingStates, 1,
|
this, e_Tutorial_State_Enchanting, enchantingStates, 1,
|
||||||
|
|
@ -852,9 +852,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* ANVIL
|
* ANVIL
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"anvilArea");
|
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"anvilArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
|
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
this, e_Tutorial_State_Anvil, enchantingStates, 1, area->x0,
|
this, e_Tutorial_State_Anvil, enchantingStates, 1, area->x0,
|
||||||
|
|
@ -902,9 +902,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* TRADING
|
* TRADING
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"tradingArea");
|
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"tradingArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State tradingStates[] = {e_Tutorial_State_Gameplay};
|
eTutorial_State tradingStates[] = {e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
this, e_Tutorial_State_Trading, tradingStates, 1, area->x0,
|
this, e_Tutorial_State_Trading, tradingStates, 1, area->x0,
|
||||||
|
|
@ -950,10 +950,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* FIREWORKS
|
* FIREWORKS
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area =
|
AABB* area =
|
||||||
app.getGameRuleDefinitions()->getNamedArea(L"fireworksArea");
|
app.getGameRuleDefinitions()->getNamedArea(L"fireworksArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State fireworkStates[] = {e_Tutorial_State_Gameplay};
|
eTutorial_State fireworkStates[] = {e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
this, e_Tutorial_State_Fireworks, fireworkStates, 1, area->x0,
|
this, e_Tutorial_State_Fireworks, fireworkStates, 1, area->x0,
|
||||||
|
|
@ -989,9 +989,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* BEACON
|
* BEACON
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"beaconArea");
|
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"beaconArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State beaconStates[] = {e_Tutorial_State_Gameplay};
|
eTutorial_State beaconStates[] = {e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
this, e_Tutorial_State_Beacon, beaconStates, 1, area->x0,
|
this, e_Tutorial_State_Beacon, beaconStates, 1, area->x0,
|
||||||
|
|
@ -1027,9 +1027,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* HOPPER
|
* HOPPER
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"hopperArea");
|
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"hopperArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State hopperStates[] = {e_Tutorial_State_Gameplay};
|
eTutorial_State hopperStates[] = {e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
this, e_Tutorial_State_Hopper, hopperStates, 1, area->x0,
|
this, e_Tutorial_State_Hopper, hopperStates, 1, area->x0,
|
||||||
|
|
@ -1077,10 +1077,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* ENDERCHEST
|
* ENDERCHEST
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area =
|
AABB* area =
|
||||||
app.getGameRuleDefinitions()->getNamedArea(L"enderchestArea");
|
app.getGameRuleDefinitions()->getNamedArea(L"enderchestArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
|
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
this, e_Tutorial_State_Enderchests, enchantingStates, 1,
|
this, e_Tutorial_State_Enderchests, enchantingStates, 1,
|
||||||
|
|
@ -1116,9 +1116,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* FARMING
|
* FARMING
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"farmingArea");
|
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"farmingArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State farmingStates[] = {e_Tutorial_State_Gameplay};
|
eTutorial_State farmingStates[] = {e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
this, e_Tutorial_State_Farming, farmingStates, 1, area->x0,
|
this, e_Tutorial_State_Farming, farmingStates, 1, area->x0,
|
||||||
|
|
@ -1184,10 +1184,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* BREEDING
|
* BREEDING
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area =
|
AABB* area =
|
||||||
app.getGameRuleDefinitions()->getNamedArea(L"breedingArea");
|
app.getGameRuleDefinitions()->getNamedArea(L"breedingArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State breedingStates[] = {e_Tutorial_State_Gameplay};
|
eTutorial_State breedingStates[] = {e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
this, e_Tutorial_State_Breeding, breedingStates, 1, area->x0,
|
this, e_Tutorial_State_Breeding, breedingStates, 1, area->x0,
|
||||||
|
|
@ -1247,9 +1247,9 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||||
* SNOW AND IRON GOLEM
|
* SNOW AND IRON GOLEM
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (app.getGameRuleDefinitions() != NULL) {
|
if (app.getGameRuleDefinitions() != nullptr) {
|
||||||
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"golemArea");
|
AABB* area = app.getGameRuleDefinitions()->getNamedArea(L"golemArea");
|
||||||
if (area != NULL) {
|
if (area != nullptr) {
|
||||||
eTutorial_State golemStates[] = {e_Tutorial_State_Gameplay};
|
eTutorial_State golemStates[] = {e_Tutorial_State_Gameplay};
|
||||||
AddGlobalConstraint(new ChangeStateConstraint(
|
AddGlobalConstraint(new ChangeStateConstraint(
|
||||||
this, e_Tutorial_State_Golem, golemStates, 1, area->x0,
|
this, e_Tutorial_State_Golem, golemStates, 1, area->x0,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
FullTutorialActiveTask::FullTutorialActiveTask(
|
FullTutorialActiveTask::FullTutorialActiveTask(
|
||||||
Tutorial* tutorial,
|
Tutorial* tutorial,
|
||||||
eTutorial_CompletionAction completeAction /*= e_Tutorial_Completion_None*/)
|
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;
|
m_completeAction = completeAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ InfoTask::InfoTask(
|
||||||
Tutorial* tutorial, int descriptionId, int promptId /*= -1*/,
|
Tutorial* tutorial, int descriptionId, int promptId /*= -1*/,
|
||||||
bool requiresUserInput /*= false*/, int iMapping /*= 0*/,
|
bool requiresUserInput /*= false*/, int iMapping /*= 0*/,
|
||||||
ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
||||||
: TutorialTask(tutorial, descriptionId, false, NULL, true, false, false) {
|
: TutorialTask(tutorial, descriptionId, false, nullptr, true, false, false) {
|
||||||
if (requiresUserInput == true) {
|
if (requiresUserInput == true) {
|
||||||
constraints.push_back(new InputConstraint(iMapping));
|
constraints.push_back(new InputConstraint(iMapping));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ public:
|
||||||
PickupTask(int itemId, unsigned int quantity, int auxValue,
|
PickupTask(int itemId, unsigned int quantity, int auxValue,
|
||||||
Tutorial* tutorial, int descriptionId,
|
Tutorial* tutorial, int descriptionId,
|
||||||
bool enablePreCompletion = true,
|
bool enablePreCompletion = true,
|
||||||
std::vector<TutorialConstraint*>* inConstraints = NULL,
|
std::vector<TutorialConstraint*>* inConstraints = nullptr,
|
||||||
bool bShowMinimumTime = false, bool bAllowFade = true,
|
bool bShowMinimumTime = false, bool bAllowFade = true,
|
||||||
bool m_bTaskReminders = true)
|
bool m_bTaskReminders = true)
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion,
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ ProcedureCompoundTask::~ProcedureCompoundTask() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcedureCompoundTask::AddTask(TutorialTask* task) {
|
void ProcedureCompoundTask::AddTask(TutorialTask* task) {
|
||||||
if (task != NULL) {
|
if (task != nullptr) {
|
||||||
m_taskSequence.push_back(task);
|
m_taskSequence.push_back(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
class ProcedureCompoundTask : public TutorialTask {
|
class ProcedureCompoundTask : public TutorialTask {
|
||||||
public:
|
public:
|
||||||
ProcedureCompoundTask(Tutorial* tutorial)
|
ProcedureCompoundTask(Tutorial* tutorial)
|
||||||
: TutorialTask(tutorial, -1, false, NULL, false, true, false) {}
|
: TutorialTask(tutorial, -1, false, nullptr, false, true, false) {}
|
||||||
|
|
||||||
~ProcedureCompoundTask();
|
~ProcedureCompoundTask();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ private:
|
||||||
public:
|
public:
|
||||||
ProgressFlagTask(char* flags, char mask, EProgressFlagType type,
|
ProgressFlagTask(char* flags, char mask, EProgressFlagType type,
|
||||||
Tutorial* tutorial)
|
Tutorial* tutorial)
|
||||||
: TutorialTask(tutorial, -1, false, NULL),
|
: TutorialTask(tutorial, -1, false, nullptr),
|
||||||
flags(flags),
|
flags(flags),
|
||||||
m_mask(mask),
|
m_mask(mask),
|
||||||
m_type(type) {}
|
m_type(type) {}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
RideEntityTask(const int eTYPE, Tutorial* tutorial, int descriptionId,
|
RideEntityTask(const int eTYPE, Tutorial* tutorial, int descriptionId,
|
||||||
bool enablePreCompletion = false,
|
bool enablePreCompletion = false,
|
||||||
std::vector<TutorialConstraint*>* inConstraints = NULL,
|
std::vector<TutorialConstraint*>* inConstraints = nullptr,
|
||||||
bool bShowMinimumTime = false, bool bAllowFade = true,
|
bool bShowMinimumTime = false, bool bAllowFade = true,
|
||||||
bool bTaskReminders = true);
|
bool bTaskReminders = true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
StatTask::StatTask(Tutorial* tutorial, int descriptionId,
|
StatTask::StatTask(Tutorial* tutorial, int descriptionId,
|
||||||
bool enablePreCompletion, Stat* stat, int variance /*= 1*/)
|
bool enablePreCompletion, Stat* stat, int variance /*= 1*/)
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, NULL) {
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion, nullptr) {
|
||||||
this->stat = stat;
|
this->stat = stat;
|
||||||
|
|
||||||
Minecraft* minecraft = Minecraft::GetInstance();
|
Minecraft* minecraft = Minecraft::GetInstance();
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ private:
|
||||||
public:
|
public:
|
||||||
StateChangeTask(eTutorial_State state, Tutorial* tutorial,
|
StateChangeTask(eTutorial_State state, Tutorial* tutorial,
|
||||||
int descriptionId = -1, bool enablePreCompletion = false,
|
int descriptionId = -1, bool enablePreCompletion = false,
|
||||||
std::vector<TutorialConstraint*>* inConstraints = NULL,
|
std::vector<TutorialConstraint*>* inConstraints = nullptr,
|
||||||
bool bShowMinimumTime = false, bool bAllowFade = true,
|
bool bShowMinimumTime = false, bool bAllowFade = true,
|
||||||
bool m_bTaskReminders = true)
|
bool m_bTaskReminders = true)
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion,
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion,
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial* tutorial, int items[],
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TakeItemHint::onTake(std::shared_ptr<ItemInstance> item) {
|
bool TakeItemHint::onTake(std::shared_ptr<ItemInstance> item) {
|
||||||
if (item != NULL) {
|
if (item != nullptr) {
|
||||||
bool itemFound = false;
|
bool itemFound = false;
|
||||||
for (unsigned int i = 0; i < m_iItemsCount; i++) {
|
for (unsigned int i = 0; i < m_iItemsCount; i++) {
|
||||||
if (item->id == m_iItems[i]) {
|
if (item->id == m_iItems[i]) {
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ int Tutorial::m_iTutorialConstraintDelayRemoveTicks = 15;
|
||||||
int Tutorial::m_iTutorialFreezeTimeValue = 8000;
|
int Tutorial::m_iTutorialFreezeTimeValue = 8000;
|
||||||
|
|
||||||
bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails* other) {
|
bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails* other) {
|
||||||
if (other == NULL) return false;
|
if (other == nullptr) return false;
|
||||||
|
|
||||||
bool textTheSame = (m_messageId == other->m_messageId) &&
|
bool textTheSame = (m_messageId == other->m_messageId) &&
|
||||||
(m_messageString.compare(other->m_messageString) == 0);
|
(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_hintDisplayed = false;
|
||||||
m_freezeTime = false;
|
m_freezeTime = false;
|
||||||
m_timeFrozen = false;
|
m_timeFrozen = false;
|
||||||
m_UIScene = NULL;
|
m_UIScene = nullptr;
|
||||||
m_allowShow = true;
|
m_allowShow = true;
|
||||||
m_bHasTickedOnce = false;
|
m_bHasTickedOnce = false;
|
||||||
m_firstTickTime = 0;
|
m_firstTickTime = 0;
|
||||||
|
|
@ -370,7 +370,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) {
|
||||||
// 4jcraft added, not initialized
|
// 4jcraft added, not initialized
|
||||||
m_bSceneIsSplitscreen = false;
|
m_bSceneIsSplitscreen = false;
|
||||||
|
|
||||||
m_lastMessage = NULL;
|
m_lastMessage = nullptr;
|
||||||
|
|
||||||
lastMessageTime = 0;
|
lastMessageTime = 0;
|
||||||
m_iTaskReminders = 0;
|
m_iTaskReminders = 0;
|
||||||
|
|
@ -380,8 +380,8 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) {
|
||||||
m_hasStateChanged = false;
|
m_hasStateChanged = false;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < e_Tutorial_State_Max; ++i) {
|
for (unsigned int i = 0; i < e_Tutorial_State_Max; ++i) {
|
||||||
currentTask[i] = NULL;
|
currentTask[i] = nullptr;
|
||||||
currentFailedConstraint[i] = NULL;
|
currentFailedConstraint[i] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEFAULT TASKS THAT ALL TUTORIALS SHARE
|
// DEFAULT TASKS THAT ALL TUTORIALS SHARE
|
||||||
|
|
@ -1683,7 +1683,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) {
|
||||||
if (isFullTutorial)
|
if (isFullTutorial)
|
||||||
addTask(e_Tutorial_State_Horse,
|
addTask(e_Tutorial_State_Horse,
|
||||||
new RideEntityTask(eTYPE_HORSE, this,
|
new RideEntityTask(eTYPE_HORSE, this,
|
||||||
IDS_TUTORIAL_TASK_HORSE_RIDE, true, NULL,
|
IDS_TUTORIAL_TASK_HORSE_RIDE, true, nullptr,
|
||||||
false, false, false));
|
false, false, false));
|
||||||
else
|
else
|
||||||
addTask(e_Tutorial_State_Horse,
|
addTask(e_Tutorial_State_Horse,
|
||||||
|
|
@ -1947,8 +1947,8 @@ Tutorial::~Tutorial() {
|
||||||
delete (*it);
|
delete (*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentTask[i] = NULL;
|
currentTask[i] = nullptr;
|
||||||
currentFailedConstraint[i] = NULL;
|
currentFailedConstraint[i] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2115,7 +2115,7 @@ void Tutorial::tick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_allowShow) {
|
if (!m_allowShow) {
|
||||||
if (currentTask[m_CurrentState] != NULL &&
|
if (currentTask[m_CurrentState] != nullptr &&
|
||||||
(!currentTask[m_CurrentState]->AllowFade() ||
|
(!currentTask[m_CurrentState]->AllowFade() ||
|
||||||
(lastMessageTime + m_iTutorialDisplayMessageTime) >
|
(lastMessageTime + m_iTutorialDisplayMessageTime) >
|
||||||
GetTickCount())) {
|
GetTickCount())) {
|
||||||
|
|
@ -2136,7 +2136,7 @@ void Tutorial::tick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ui.IsPauseMenuDisplayed(m_iPad)) {
|
if (ui.IsPauseMenuDisplayed(m_iPad)) {
|
||||||
if (currentTask[m_CurrentState] != NULL &&
|
if (currentTask[m_CurrentState] != nullptr &&
|
||||||
(!currentTask[m_CurrentState]->AllowFade() ||
|
(!currentTask[m_CurrentState]->AllowFade() ||
|
||||||
(lastMessageTime + m_iTutorialDisplayMessageTime) >
|
(lastMessageTime + m_iTutorialDisplayMessageTime) >
|
||||||
GetTickCount())) {
|
GetTickCount())) {
|
||||||
|
|
@ -2186,14 +2186,14 @@ void Tutorial::tick() {
|
||||||
// Check constraints
|
// Check constraints
|
||||||
// Only need to update these if we aren't already failing something
|
// Only need to update these if we aren't already failing something
|
||||||
if (!m_allTutorialsComplete &&
|
if (!m_allTutorialsComplete &&
|
||||||
(currentFailedConstraint[m_CurrentState] == NULL ||
|
(currentFailedConstraint[m_CurrentState] == nullptr ||
|
||||||
currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(
|
currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(
|
||||||
m_iPad))) {
|
m_iPad))) {
|
||||||
if (currentFailedConstraint[m_CurrentState] != NULL &&
|
if (currentFailedConstraint[m_CurrentState] != nullptr &&
|
||||||
currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(
|
currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(
|
||||||
m_iPad)) {
|
m_iPad)) {
|
||||||
constraintChanged = true;
|
constraintChanged = true;
|
||||||
currentFailedConstraint[m_CurrentState] = NULL;
|
currentFailedConstraint[m_CurrentState] = nullptr;
|
||||||
}
|
}
|
||||||
for (auto it = constraints[m_CurrentState].begin();
|
for (auto it = constraints[m_CurrentState].begin();
|
||||||
it < constraints[m_CurrentState].end(); ++it) {
|
it < constraints[m_CurrentState].end(); ++it) {
|
||||||
|
|
@ -2207,7 +2207,7 @@ void Tutorial::tick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_allTutorialsComplete &&
|
if (!m_allTutorialsComplete &&
|
||||||
currentFailedConstraint[m_CurrentState] == NULL) {
|
currentFailedConstraint[m_CurrentState] == nullptr) {
|
||||||
// Update tasks
|
// Update tasks
|
||||||
bool isCurrentTask = true;
|
bool isCurrentTask = true;
|
||||||
auto it = activeTasks[m_CurrentState].begin();
|
auto it = activeTasks[m_CurrentState].begin();
|
||||||
|
|
@ -2225,7 +2225,7 @@ void Tutorial::tick() {
|
||||||
task->getCompletionAction();
|
task->getCompletionAction();
|
||||||
it = activeTasks[m_CurrentState].erase(it);
|
it = activeTasks[m_CurrentState].erase(it);
|
||||||
delete task;
|
delete task;
|
||||||
task = NULL;
|
task = nullptr;
|
||||||
|
|
||||||
if (activeTasks[m_CurrentState].size() > 0) {
|
if (activeTasks[m_CurrentState].size() > 0) {
|
||||||
switch (compAction) {
|
switch (compAction) {
|
||||||
|
|
@ -2297,20 +2297,20 @@ void Tutorial::tick() {
|
||||||
} else {
|
} else {
|
||||||
setStateCompleted(m_CurrentState);
|
setStateCompleted(m_CurrentState);
|
||||||
|
|
||||||
currentTask[m_CurrentState] = NULL;
|
currentTask[m_CurrentState] = nullptr;
|
||||||
}
|
}
|
||||||
taskChanged = true;
|
taskChanged = true;
|
||||||
|
|
||||||
// If we can complete this early, check if we can complete
|
// If we can complete this early, check if we can complete
|
||||||
// it right now
|
// it right now
|
||||||
if (currentTask[m_CurrentState] != NULL &&
|
if (currentTask[m_CurrentState] != nullptr &&
|
||||||
currentTask[m_CurrentState]->isPreCompletionEnabled()) {
|
currentTask[m_CurrentState]->isPreCompletionEnabled()) {
|
||||||
isCurrentTask = true;
|
isCurrentTask = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
if (task != NULL && task->ShowMinimumTime() &&
|
if (task != nullptr && task->ShowMinimumTime() &&
|
||||||
task->hasBeenActivated() &&
|
task->hasBeenActivated() &&
|
||||||
(lastMessageTime + m_iTutorialMinimumDisplayMessageTime) <
|
(lastMessageTime + m_iTutorialMinimumDisplayMessageTime) <
|
||||||
GetTickCount()) {
|
GetTickCount()) {
|
||||||
|
|
@ -2331,7 +2331,7 @@ void Tutorial::tick() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentTask[m_CurrentState] == NULL &&
|
if (currentTask[m_CurrentState] == nullptr &&
|
||||||
activeTasks[m_CurrentState].size() > 0) {
|
activeTasks[m_CurrentState].size() > 0) {
|
||||||
currentTask[m_CurrentState] = activeTasks[m_CurrentState][0];
|
currentTask[m_CurrentState] = activeTasks[m_CurrentState][0];
|
||||||
currentTask[m_CurrentState]->setAsCurrentTask();
|
currentTask[m_CurrentState]->setAsCurrentTask();
|
||||||
|
|
@ -2355,19 +2355,19 @@ void Tutorial::tick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (constraintChanged || taskChanged || m_hasStateChanged ||
|
if (constraintChanged || taskChanged || m_hasStateChanged ||
|
||||||
(currentFailedConstraint[m_CurrentState] == NULL &&
|
(currentFailedConstraint[m_CurrentState] == nullptr &&
|
||||||
currentTask[m_CurrentState] != NULL &&
|
currentTask[m_CurrentState] != nullptr &&
|
||||||
(m_lastMessage == NULL ||
|
(m_lastMessage == nullptr ||
|
||||||
currentTask[m_CurrentState]->getDescriptionId() !=
|
currentTask[m_CurrentState]->getDescriptionId() !=
|
||||||
m_lastMessage->m_messageId) &&
|
m_lastMessage->m_messageId) &&
|
||||||
!m_hintDisplayed)) {
|
!m_hintDisplayed)) {
|
||||||
if (currentFailedConstraint[m_CurrentState] != NULL) {
|
if (currentFailedConstraint[m_CurrentState] != nullptr) {
|
||||||
PopupMessageDetails* message = new PopupMessageDetails();
|
PopupMessageDetails* message = new PopupMessageDetails();
|
||||||
message->m_messageId =
|
message->m_messageId =
|
||||||
currentFailedConstraint[m_CurrentState]->getDescriptionId();
|
currentFailedConstraint[m_CurrentState]->getDescriptionId();
|
||||||
message->m_allowFade = false;
|
message->m_allowFade = false;
|
||||||
setMessage(message);
|
setMessage(message);
|
||||||
} else if (currentTask[m_CurrentState] != NULL) {
|
} else if (currentTask[m_CurrentState] != nullptr) {
|
||||||
PopupMessageDetails* message = new PopupMessageDetails();
|
PopupMessageDetails* message = new PopupMessageDetails();
|
||||||
message->m_messageId =
|
message->m_messageId =
|
||||||
currentTask[m_CurrentState]->getDescriptionId();
|
currentTask[m_CurrentState]->getDescriptionId();
|
||||||
|
|
@ -2377,7 +2377,7 @@ void Tutorial::tick() {
|
||||||
currentTask[m_CurrentState]->TaskReminders() ? m_iTaskReminders = 1
|
currentTask[m_CurrentState]->TaskReminders() ? m_iTaskReminders = 1
|
||||||
: m_iTaskReminders = 0;
|
: m_iTaskReminders = 0;
|
||||||
} else {
|
} else {
|
||||||
setMessage(NULL);
|
setMessage(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2386,8 +2386,8 @@ void Tutorial::tick() {
|
||||||
m_hintDisplayed = false;
|
m_hintDisplayed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentFailedConstraint[m_CurrentState] == NULL &&
|
if (currentFailedConstraint[m_CurrentState] == nullptr &&
|
||||||
currentTask[m_CurrentState] != NULL && (m_iTaskReminders != 0) &&
|
currentTask[m_CurrentState] != nullptr && (m_iTaskReminders != 0) &&
|
||||||
(lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime)) <
|
(lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime)) <
|
||||||
GetTickCount()) {
|
GetTickCount()) {
|
||||||
// Reminder
|
// Reminder
|
||||||
|
|
@ -2413,7 +2413,7 @@ void Tutorial::tick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Tutorial::setMessage(PopupMessageDetails* message) {
|
bool Tutorial::setMessage(PopupMessageDetails* message) {
|
||||||
if (message != NULL && !message->m_forceDisplay &&
|
if (message != nullptr && !message->m_forceDisplay &&
|
||||||
m_lastMessageState == m_CurrentState &&
|
m_lastMessageState == m_CurrentState &&
|
||||||
message->isSameContent(m_lastMessage) &&
|
message->isSameContent(m_lastMessage) &&
|
||||||
(!message->m_isReminder ||
|
(!message->m_isReminder ||
|
||||||
|
|
@ -2423,7 +2423,7 @@ bool Tutorial::setMessage(PopupMessageDetails* message) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message != NULL &&
|
if (message != nullptr &&
|
||||||
(message->m_messageId > 0 || !message->m_messageString.empty())) {
|
(message->m_messageId > 0 || !message->m_messageString.empty())) {
|
||||||
m_lastMessageState = m_CurrentState;
|
m_lastMessageState = m_CurrentState;
|
||||||
|
|
||||||
|
|
@ -2434,7 +2434,7 @@ bool Tutorial::setMessage(PopupMessageDetails* message) {
|
||||||
text = message->m_messageString;
|
text = message->m_messageString;
|
||||||
} else {
|
} else {
|
||||||
auto it = messages.find(message->m_messageId);
|
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;
|
TutorialMessage* messageString = it->second;
|
||||||
text = std::wstring(messageString->getMessageForDisplay());
|
text = std::wstring(messageString->getMessageForDisplay());
|
||||||
|
|
||||||
|
|
@ -2458,7 +2458,7 @@ bool Tutorial::setMessage(PopupMessageDetails* message) {
|
||||||
text.append(message->m_promptString);
|
text.append(message->m_promptString);
|
||||||
} else if (message->m_promptId >= 0) {
|
} else if (message->m_promptId >= 0) {
|
||||||
auto it = messages.find(message->m_promptId);
|
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;
|
TutorialMessage* prompt = it->second;
|
||||||
text.append(prompt->getMessageForDisplay());
|
text.append(prompt->getMessageForDisplay());
|
||||||
}
|
}
|
||||||
|
|
@ -2484,7 +2484,7 @@ bool Tutorial::setMessage(PopupMessageDetails* message) {
|
||||||
} else {
|
} else {
|
||||||
ui.SetTutorialDescription(m_iPad, &popupInfo);
|
ui.SetTutorialDescription(m_iPad, &popupInfo);
|
||||||
}
|
}
|
||||||
} else if ((m_lastMessage != NULL &&
|
} else if ((m_lastMessage != nullptr &&
|
||||||
m_lastMessage->m_messageId !=
|
m_lastMessage->m_messageId !=
|
||||||
-1)) //&& (lastMessageTime + m_iTutorialReminderTime ) >
|
-1)) //&& (lastMessageTime + m_iTutorialReminderTime ) >
|
||||||
// GetTickCount() )
|
// GetTickCount() )
|
||||||
|
|
@ -2496,7 +2496,7 @@ bool Tutorial::setMessage(PopupMessageDetails* message) {
|
||||||
ui.SetTutorialDescription(m_iPad, &popupInfo);
|
ui.SetTutorialDescription(m_iPad, &popupInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_lastMessage != NULL) delete m_lastMessage;
|
if (m_lastMessage != nullptr) delete m_lastMessage;
|
||||||
m_lastMessage = message;
|
m_lastMessage = message;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -2511,7 +2511,7 @@ bool Tutorial::setMessage(TutorialHint* hint, PopupMessageDetails* message) {
|
||||||
|
|
||||||
bool messageShown = false;
|
bool messageShown = false;
|
||||||
std::uint32_t time = GetTickCount();
|
std::uint32_t time = GetTickCount();
|
||||||
if (message != NULL && (message->m_forceDisplay || hintsOn) &&
|
if (message != nullptr && (message->m_forceDisplay || hintsOn) &&
|
||||||
(!message->m_delay ||
|
(!message->m_delay ||
|
||||||
((m_hintDisplayed &&
|
((m_hintDisplayed &&
|
||||||
(time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime) ||
|
(time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime) ||
|
||||||
|
|
@ -2522,7 +2522,7 @@ bool Tutorial::setMessage(TutorialHint* hint, PopupMessageDetails* message) {
|
||||||
if (messageShown) {
|
if (messageShown) {
|
||||||
m_lastHintDisplayedTime = time;
|
m_lastHintDisplayedTime = time;
|
||||||
m_hintDisplayed = true;
|
m_hintDisplayed = true;
|
||||||
if (hint != NULL) setHintCompleted(hint);
|
if (hint != nullptr) setHintCompleted(hint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return messageShown;
|
return messageShown;
|
||||||
|
|
@ -2543,7 +2543,7 @@ void Tutorial::showTutorialPopup(bool show) {
|
||||||
m_allowShow = show;
|
m_allowShow = show;
|
||||||
|
|
||||||
if (!show) {
|
if (!show) {
|
||||||
if (currentTask[m_CurrentState] != NULL &&
|
if (currentTask[m_CurrentState] != nullptr &&
|
||||||
(!currentTask[m_CurrentState]->AllowFade() ||
|
(!currentTask[m_CurrentState]->AllowFade() ||
|
||||||
(lastMessageTime + m_iTutorialDisplayMessageTime) >
|
(lastMessageTime + m_iTutorialDisplayMessageTime) >
|
||||||
GetTickCount())) {
|
GetTickCount())) {
|
||||||
|
|
@ -2660,7 +2660,7 @@ void Tutorial::handleUIInput(int iAction) {
|
||||||
// TutorialTask *task = *it;
|
// TutorialTask *task = *it;
|
||||||
// task->handleUIInput(iAction);
|
// task->handleUIInput(iAction);
|
||||||
// }
|
// }
|
||||||
if (currentTask[m_CurrentState] != NULL)
|
if (currentTask[m_CurrentState] != nullptr)
|
||||||
currentTask[m_CurrentState]->handleUIInput(iAction);
|
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
|
// the selected item Menus and states like riding in a minecart will NOT
|
||||||
// allow this
|
// allow this
|
||||||
if (isSelectedItemState()) {
|
if (isSelectedItemState()) {
|
||||||
if (item != NULL) {
|
if (item != nullptr) {
|
||||||
switch (item->id) {
|
switch (item->id) {
|
||||||
case Item::fishingRod_Id:
|
case Item::fishingRod_Id:
|
||||||
changeTutorialState(e_Tutorial_State_Fishing);
|
changeTutorialState(e_Tutorial_State_Fishing);
|
||||||
|
|
@ -2871,7 +2871,7 @@ void Tutorial::AddConstraint(TutorialConstraint* c) {
|
||||||
void Tutorial::RemoveConstraint(TutorialConstraint* c,
|
void Tutorial::RemoveConstraint(TutorialConstraint* c,
|
||||||
bool delayedRemove /*= false*/) {
|
bool delayedRemove /*= false*/) {
|
||||||
if (currentFailedConstraint[m_CurrentState] == c)
|
if (currentFailedConstraint[m_CurrentState] == c)
|
||||||
currentFailedConstraint[m_CurrentState] = NULL;
|
currentFailedConstraint[m_CurrentState] = nullptr;
|
||||||
|
|
||||||
if (c->getQueuedForRemoval()) {
|
if (c->getQueuedForRemoval()) {
|
||||||
// If it is already queued for removal, remove it on the next tick
|
// 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,
|
void Tutorial::changeTutorialState(eTutorial_State newState,
|
||||||
UIScene* scene /*= NULL*/)
|
UIScene* scene /*= nullptr*/)
|
||||||
{
|
{
|
||||||
if (newState == m_CurrentState) {
|
if (newState == m_CurrentState) {
|
||||||
// If clearing the scene, make sure that the tutorial popup has its
|
// If clearing the scene, make sure that the tutorial popup has its
|
||||||
// reference to this scene removed
|
// reference to this scene removed
|
||||||
if (scene == NULL) {
|
if (scene == nullptr) {
|
||||||
ui.RemoveInteractSceneReference(m_iPad, m_UIScene);
|
ui.RemoveInteractSceneReference(m_iPad, m_UIScene);
|
||||||
}
|
}
|
||||||
m_UIScene = scene;
|
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 action that caused the change of state may also have completed
|
||||||
// the current task
|
// the current task
|
||||||
if (currentTask[m_CurrentState] != NULL &&
|
if (currentTask[m_CurrentState] != nullptr &&
|
||||||
currentTask[m_CurrentState]->isCompleted()) {
|
currentTask[m_CurrentState]->isCompleted()) {
|
||||||
activeTasks[m_CurrentState].erase(
|
activeTasks[m_CurrentState].erase(
|
||||||
find(activeTasks[m_CurrentState].begin(),
|
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] = activeTasks[m_CurrentState][0];
|
||||||
currentTask[m_CurrentState]->setAsCurrentTask();
|
currentTask[m_CurrentState]->setAsCurrentTask();
|
||||||
} else {
|
} else {
|
||||||
currentTask[m_CurrentState] = NULL;
|
currentTask[m_CurrentState] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentTask[m_CurrentState] != NULL) {
|
if (currentTask[m_CurrentState] != nullptr) {
|
||||||
currentTask[m_CurrentState]->onStateChange(newState);
|
currentTask[m_CurrentState]->onStateChange(newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that the current message is cleared
|
// Make sure that the current message is cleared
|
||||||
setMessage(NULL);
|
setMessage(nullptr);
|
||||||
|
|
||||||
// If clearing the scene, make sure that the tutorial popup has its
|
// If clearing the scene, make sure that the tutorial popup has its
|
||||||
// reference to this scene removed
|
// reference to this scene removed
|
||||||
if (scene == NULL) {
|
if (scene == nullptr) {
|
||||||
ui.RemoveInteractSceneReference(m_iPad, m_UIScene);
|
ui.RemoveInteractSceneReference(m_iPad, m_UIScene);
|
||||||
}
|
}
|
||||||
m_UIScene = scene;
|
m_UIScene = scene;
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ public:
|
||||||
void setCompleted(int completableId);
|
void setCompleted(int completableId);
|
||||||
bool getCompleted(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 isSelectedItemState();
|
||||||
|
|
||||||
bool setMessage(PopupMessageDetails* message);
|
bool setMessage(PopupMessageDetails* message);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial* tutorial,
|
||||||
m_descriptionId(descriptionId),
|
m_descriptionId(descriptionId),
|
||||||
m_type(type),
|
m_type(type),
|
||||||
m_counter(0),
|
m_counter(0),
|
||||||
m_lastTile(NULL),
|
m_lastTile(nullptr),
|
||||||
m_hintNeeded(true),
|
m_hintNeeded(true),
|
||||||
m_allowFade(allowFade) {
|
m_allowFade(allowFade) {
|
||||||
tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients);
|
tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ TutorialMode::TutorialMode(int iPad, Minecraft* minecraft,
|
||||||
: MultiPlayerGameMode(minecraft, connection), m_iPad(iPad) {}
|
: MultiPlayerGameMode(minecraft, connection), m_iPad(iPad) {}
|
||||||
|
|
||||||
TutorialMode::~TutorialMode() {
|
TutorialMode::~TutorialMode() {
|
||||||
if (tutorial != NULL) delete tutorial;
|
if (tutorial != nullptr) delete tutorial;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TutorialMode::startDestroyBlock(int x, int y, int z, int face) {
|
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();
|
std::shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem();
|
||||||
int damageBefore;
|
int damageBefore;
|
||||||
if (item != NULL) {
|
if (item != nullptr) {
|
||||||
damageBefore = item->getDamageValue();
|
damageBefore = item->getDamageValue();
|
||||||
}
|
}
|
||||||
bool changed = MultiPlayerGameMode::destroyBlock(x, y, z, face);
|
bool changed = MultiPlayerGameMode::destroyBlock(x, y, z, face);
|
||||||
|
|
||||||
if (!tutorial->m_allTutorialsComplete) {
|
if (!tutorial->m_allTutorialsComplete) {
|
||||||
if (item != NULL && item->isDamageableItem()) {
|
if (item != nullptr && item->isDamageableItem()) {
|
||||||
int max = item->getMaxDamage();
|
int max = item->getMaxDamage();
|
||||||
int damageNow = item->getDamageValue();
|
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);
|
tutorial->useItemOn(level, item, x, y, z, bTestUseOnly);
|
||||||
|
|
||||||
if (!bTestUseOnly) {
|
if (!bTestUseOnly) {
|
||||||
if (item != NULL) {
|
if (item != nullptr) {
|
||||||
haveItem = true;
|
haveItem = true;
|
||||||
itemCount = item->count;
|
itemCount = item->count;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public:
|
||||||
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
|
virtual bool useItemOn(std::shared_ptr<Player> player, Level* level,
|
||||||
std::shared_ptr<ItemInstance> item, int x, int y,
|
std::shared_ptr<ItemInstance> item, int x, int y,
|
||||||
int z, int face, Vec3* hit,
|
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,
|
virtual void attack(std::shared_ptr<Player> player,
|
||||||
std::shared_ptr<Entity> entity);
|
std::shared_ptr<Entity> entity);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ TutorialTask::TutorialTask(Tutorial* tutorial, int descriptionId,
|
||||||
m_bTaskReminders(bTaskReminders),
|
m_bTaskReminders(bTaskReminders),
|
||||||
m_bShowMinimumTime(bShowMinimumTime),
|
m_bShowMinimumTime(bShowMinimumTime),
|
||||||
m_bShownForMinimumTime(false) {
|
m_bShownForMinimumTime(false) {
|
||||||
if (inConstraints != NULL) {
|
if (inConstraints != nullptr) {
|
||||||
for (auto it = inConstraints->begin(); it < inConstraints->end();
|
for (auto it = inConstraints->begin(); it < inConstraints->end();
|
||||||
++it) {
|
++it) {
|
||||||
TutorialConstraint* constraint = *it;
|
TutorialConstraint* constraint = *it;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ private:
|
||||||
public:
|
public:
|
||||||
UseItemTask(const int itemId, Tutorial* tutorial, int descriptionId,
|
UseItemTask(const int itemId, Tutorial* tutorial, int descriptionId,
|
||||||
bool enablePreCompletion = false,
|
bool enablePreCompletion = false,
|
||||||
std::vector<TutorialConstraint*>* inConstraints = NULL,
|
std::vector<TutorialConstraint*>* inConstraints = nullptr,
|
||||||
bool bShowMinimumTime = false, bool bAllowFade = true,
|
bool bShowMinimumTime = false, bool bAllowFade = true,
|
||||||
bool bTaskReminders = true);
|
bool bTaskReminders = true);
|
||||||
virtual bool isCompleted();
|
virtual bool isCompleted();
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,12 @@ private:
|
||||||
public:
|
public:
|
||||||
UseTileTask(const int tileId, int x, int y, int z, Tutorial* tutorial,
|
UseTileTask(const int tileId, int x, int y, int z, Tutorial* tutorial,
|
||||||
int descriptionId, bool enablePreCompletion = false,
|
int descriptionId, bool enablePreCompletion = false,
|
||||||
std::vector<TutorialConstraint*>* inConstraints = NULL,
|
std::vector<TutorialConstraint*>* inConstraints = nullptr,
|
||||||
bool bShowMinimumTime = false, bool bAllowFade = true,
|
bool bShowMinimumTime = false, bool bAllowFade = true,
|
||||||
bool bTaskReminders = true);
|
bool bTaskReminders = true);
|
||||||
UseTileTask(const int tileId, Tutorial* tutorial, int descriptionId,
|
UseTileTask(const int tileId, Tutorial* tutorial, int descriptionId,
|
||||||
bool enablePreCompletion = false,
|
bool enablePreCompletion = false,
|
||||||
std::vector<TutorialConstraint*>* inConstraints = NULL,
|
std::vector<TutorialConstraint*>* inConstraints = nullptr,
|
||||||
bool bShowMinimumTime = false, bool bAllowFade = true,
|
bool bShowMinimumTime = false, bool bAllowFade = true,
|
||||||
bool bTaskReminders = true);
|
bool bTaskReminders = true);
|
||||||
virtual bool isCompleted();
|
virtual bool isCompleted();
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,13 @@ bool XuiCraftingTask::isCompleted() {
|
||||||
|
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case e_Crafting_SelectGroup:
|
case e_Crafting_SelectGroup:
|
||||||
if (craftScene != NULL &&
|
if (craftScene != nullptr &&
|
||||||
craftScene->getCurrentGroup() == m_group) {
|
craftScene->getCurrentGroup() == m_group) {
|
||||||
completed = true;
|
completed = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case e_Crafting_SelectItem:
|
case e_Crafting_SelectItem:
|
||||||
if (craftScene != NULL && craftScene->isItemSelected(m_item)) {
|
if (craftScene != nullptr && craftScene->isItemSelected(m_item)) {
|
||||||
completed = true;
|
completed = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ public:
|
||||||
XuiCraftingTask(Tutorial* tutorial, int descriptionId,
|
XuiCraftingTask(Tutorial* tutorial, int descriptionId,
|
||||||
Recipy::_eGroupType groupToSelect,
|
Recipy::_eGroupType groupToSelect,
|
||||||
bool enablePreCompletion = false,
|
bool enablePreCompletion = false,
|
||||||
std::vector<TutorialConstraint*>* inConstraints = NULL,
|
std::vector<TutorialConstraint*>* inConstraints = nullptr,
|
||||||
bool bShowMinimumTime = false, bool bAllowFade = true,
|
bool bShowMinimumTime = false, bool bAllowFade = true,
|
||||||
bool m_bTaskReminders = true)
|
bool m_bTaskReminders = true)
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion,
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion,
|
||||||
|
|
@ -25,7 +25,7 @@ public:
|
||||||
// Select Item
|
// Select Item
|
||||||
XuiCraftingTask(Tutorial* tutorial, int descriptionId, int itemId,
|
XuiCraftingTask(Tutorial* tutorial, int descriptionId, int itemId,
|
||||||
bool enablePreCompletion = false,
|
bool enablePreCompletion = false,
|
||||||
std::vector<TutorialConstraint*>* inConstraints = NULL,
|
std::vector<TutorialConstraint*>* inConstraints = nullptr,
|
||||||
bool bShowMinimumTime = false, bool bAllowFade = true,
|
bool bShowMinimumTime = false, bool bAllowFade = true,
|
||||||
bool m_bTaskReminders = true)
|
bool m_bTaskReminders = true)
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion,
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion,
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue