Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.
This reverts commit a9be52c41a.
This commit is contained in:
@@ -101,7 +101,7 @@ ServerPlayer::ServerPlayer(MinecraftServer *server, Level *level, const wstring&
|
||||
waterDepth++;
|
||||
}
|
||||
attemptCount++;
|
||||
playerNear = ( level->getNearestPlayer(xx + 0.5, yy, zz + 0.5,3) != nullptr );
|
||||
playerNear = ( level->getNearestPlayer(xx + 0.5, yy, zz + 0.5,3) != NULL );
|
||||
} while ( ( waterDepth > 1 ) && (!playerNear) && ( attemptCount < 20 ) );
|
||||
xx = xx2;
|
||||
yy = yy2;
|
||||
@@ -180,7 +180,7 @@ void ServerPlayer::readAdditionalSaveData(CompoundTag *entityTag)
|
||||
}
|
||||
|
||||
GameRulesInstance *grs = gameMode->getGameRules();
|
||||
if (entityTag->contains(L"GameRules") && grs != nullptr)
|
||||
if (entityTag->contains(L"GameRules") && grs != NULL)
|
||||
{
|
||||
byteArray ba = entityTag->getByteArray(L"GameRules");
|
||||
ByteArrayInputStream bais(ba);
|
||||
@@ -197,13 +197,13 @@ void ServerPlayer::addAdditonalSaveData(CompoundTag *entityTag)
|
||||
Player::addAdditonalSaveData(entityTag);
|
||||
|
||||
GameRulesInstance *grs = gameMode->getGameRules();
|
||||
if (grs != nullptr)
|
||||
if (grs != NULL)
|
||||
{
|
||||
ByteArrayOutputStream baos;
|
||||
DataOutputStream dos(&baos);
|
||||
grs->write(&dos);
|
||||
entityTag->putByteArray(L"GameRules", baos.buf);
|
||||
baos.buf.data = nullptr;
|
||||
baos.buf.data = NULL;
|
||||
dos.close();
|
||||
baos.close();
|
||||
}
|
||||
@@ -280,7 +280,7 @@ void ServerPlayer::flushEntitiesToRemove()
|
||||
it = entitiesToRemove.erase(it);
|
||||
}
|
||||
|
||||
connection->send(std::make_shared<RemoveEntitiesPacket>(ids));
|
||||
connection->send(shared_ptr<RemoveEntitiesPacket>(new RemoveEntitiesPacket(ids)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,14 +308,14 @@ void ServerPlayer::doTickA()
|
||||
for (unsigned int i = 0; i < inventory->getContainerSize(); i++)
|
||||
{
|
||||
shared_ptr<ItemInstance> ie = inventory->getItem(i);
|
||||
if (ie != nullptr)
|
||||
if (ie != NULL)
|
||||
{
|
||||
// 4J - removed condition. These were getting lower priority than tile update packets etc. on the slow outbound queue, and so were extremely slow to send sometimes,
|
||||
// particularly at the start of a game. They don't typically seem to be massive and shouldn't be send when there isn't actually any updating to do.
|
||||
if (Item::items[ie->id]->isComplex() ) // && connection->countDelayedPackets() <= 2)
|
||||
{
|
||||
shared_ptr<Packet> packet = (dynamic_cast<ComplexItem *>(Item::items[ie->id])->getUpdatePacket(ie, level, dynamic_pointer_cast<Player>( shared_from_this() ) ) );
|
||||
if (packet != nullptr)
|
||||
if (packet != NULL)
|
||||
{
|
||||
connection->send(packet);
|
||||
}
|
||||
@@ -352,7 +352,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks)
|
||||
}
|
||||
}
|
||||
|
||||
// if (nearest != nullptr) // 4J - removed as we don't have references here
|
||||
// if (nearest != NULL) // 4J - removed as we don't have references here
|
||||
if( nearestValid )
|
||||
{
|
||||
bool okToSend = false;
|
||||
@@ -372,7 +372,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks)
|
||||
// app.DebugPrintf("%d: canSendToPlayer %d, countDelayedPackets %d GetSendQueueSizeBytes %d done: %d\n",
|
||||
// connection->getNetworkPlayer()->GetSmallId(),
|
||||
// canSendToPlayer, connection->countDelayedPackets(),
|
||||
// g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( nullptr, true ),
|
||||
// g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( NULL, true ),
|
||||
// connection->done);
|
||||
// }
|
||||
|
||||
@@ -381,12 +381,12 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks)
|
||||
#ifdef _XBOX_ONE
|
||||
// The network manager on xbox one doesn't currently split data into slow & fast queues - since we can only measure
|
||||
// both together then bytes provides a better metric than count of data items to determine if we should avoid queueing too much up
|
||||
(g_NetworkManager.GetHostPlayer()->GetSendQueueSizeBytes( nullptr, true ) < 8192 )&&
|
||||
(g_NetworkManager.GetHostPlayer()->GetSendQueueSizeBytes( NULL, true ) < 8192 )&&
|
||||
#elif defined _XBOX
|
||||
(g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( nullptr, true ) < 4 )&&
|
||||
(g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( NULL, true ) < 4 )&&
|
||||
#else
|
||||
(connection->countDelayedPackets() < 4 )&&
|
||||
(g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( nullptr, true ) < 4 )&&
|
||||
(g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( NULL, true ) < 4 )&&
|
||||
#endif
|
||||
//(tickCount - lastBrupSendTickCount) > (connection->getNetworkPlayer()->GetCurrentRtt()>>4) &&
|
||||
!connection->done) )
|
||||
@@ -429,7 +429,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks)
|
||||
// app.DebugPrintf("Creating BRUP for %d %d\n",nearest.x, nearest.z);
|
||||
PIXBeginNamedEvent(0,"Creation BRUP for sending\n");
|
||||
int64_t before = System::currentTimeMillis();
|
||||
const auto packet = std::make_shared<BlockRegionUpdatePacket>(nearest.x * 16, 0, nearest.z * 16, 16, Level::maxBuildHeight, 16, level);
|
||||
shared_ptr<BlockRegionUpdatePacket> packet = shared_ptr<BlockRegionUpdatePacket>( new BlockRegionUpdatePacket(nearest.x * 16, 0, nearest.z * 16, 16, Level::maxBuildHeight, 16, level) );
|
||||
int64_t after = System::currentTimeMillis();
|
||||
// app.DebugPrintf(">>><<< %d ms\n",after-before);
|
||||
PIXEndNamedEvent();
|
||||
@@ -523,7 +523,7 @@ void ServerPlayer::doTickB()
|
||||
if (getHealth() != lastSentHealth || lastSentFood != foodData.getFoodLevel() || ((foodData.getSaturationLevel() == 0) != lastFoodSaturationZero))
|
||||
{
|
||||
// 4J Stu - Added m_lastDamageSource for telemetry
|
||||
connection->send(std::make_shared<SetHealthPacket>(getHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel(), m_lastDamageSource));
|
||||
connection->send( shared_ptr<SetHealthPacket>( new SetHealthPacket(getHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel(), m_lastDamageSource) ) );
|
||||
lastSentHealth = getHealth();
|
||||
lastSentFood = foodData.getFoodLevel();
|
||||
lastFoodSaturationZero = foodData.getSaturationLevel() == 0;
|
||||
@@ -550,7 +550,7 @@ void ServerPlayer::doTickB()
|
||||
if (totalExperience != lastSentExp)
|
||||
{
|
||||
lastSentExp = totalExperience;
|
||||
connection->send(std::make_shared<SetExperiencePacket>(experienceProgress, totalExperience, experienceLevel));
|
||||
connection->send( shared_ptr<SetExperiencePacket>( new SetExperiencePacket(experienceProgress, totalExperience, experienceLevel) ) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -584,7 +584,7 @@ void ServerPlayer::die(DamageSource *source)
|
||||
}
|
||||
|
||||
shared_ptr<LivingEntity> killer = getKillCredit();
|
||||
if (killer != nullptr) killer->awardKillScore(shared_from_this(), deathScore);
|
||||
if (killer != NULL) killer->awardKillScore(shared_from_this(), deathScore);
|
||||
//awardStat(Stats::deaths, 1);
|
||||
}
|
||||
|
||||
@@ -597,10 +597,10 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, float dmg)
|
||||
//bool allowFallDamage = server->isPvpAllowed() && server->isDedicatedServer() && server->isPvpAllowed() && (dmgSource->msgId.compare(L"fall") == 0);
|
||||
if (!server->isPvpAllowed() && invulnerableTime > 0 && dmgSource != DamageSource::outOfWorld) return false;
|
||||
|
||||
if (dynamic_cast<EntityDamageSource *>(dmgSource) != nullptr)
|
||||
if (dynamic_cast<EntityDamageSource *>(dmgSource) != NULL)
|
||||
{
|
||||
// 4J Stu - Fix for #46422 - TU5: Crash: Gameplay: Crash when being hit by a trap using a dispenser
|
||||
// getEntity returns the owner of projectiles, and this would never be the arrow. The owner is sometimes nullptr.
|
||||
// getEntity returns the owner of projectiles, and this would never be the arrow. The owner is sometimes NULL.
|
||||
shared_ptr<Entity> source = dmgSource->getDirectEntity();
|
||||
|
||||
if (source->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast<Player>(source)->canHarmPlayer(dynamic_pointer_cast<Player>(shared_from_this())))
|
||||
@@ -608,10 +608,10 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, float dmg)
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( (source != nullptr) && source->instanceof(eTYPE_ARROW) )
|
||||
if ( (source != NULL) && source->instanceof(eTYPE_ARROW) )
|
||||
{
|
||||
shared_ptr<Arrow> arrow = dynamic_pointer_cast<Arrow>(source);
|
||||
if ( (arrow->owner != nullptr) && arrow->owner->instanceof(eTYPE_PLAYER) && !canHarmPlayer(dynamic_pointer_cast<Player>(arrow->owner)) )
|
||||
if ( (arrow->owner != NULL) && arrow->owner->instanceof(eTYPE_PLAYER) && !canHarmPlayer(dynamic_pointer_cast<Player>(arrow->owner)) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -634,7 +634,7 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, float dmg)
|
||||
else
|
||||
{
|
||||
shared_ptr<Entity> source = dmgSource->getEntity();
|
||||
if( source != nullptr )
|
||||
if( source != NULL )
|
||||
{
|
||||
switch(source->GetType())
|
||||
{
|
||||
@@ -670,10 +670,10 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, float dmg)
|
||||
m_lastDamageSource = eTelemetryPlayerDeathSource_Explosion_Tnt;
|
||||
break;
|
||||
case eTYPE_ARROW:
|
||||
if ((dynamic_pointer_cast<Arrow>(source))->owner != nullptr)
|
||||
if ((dynamic_pointer_cast<Arrow>(source))->owner != NULL)
|
||||
{
|
||||
shared_ptr<Entity> attacker = (dynamic_pointer_cast<Arrow>(source))->owner;
|
||||
if (attacker != nullptr)
|
||||
if (attacker != NULL)
|
||||
{
|
||||
switch(attacker->GetType())
|
||||
{
|
||||
@@ -712,7 +712,7 @@ bool ServerPlayer::canHarmPlayer(wstring targetName)
|
||||
bool canHarm = true;
|
||||
|
||||
shared_ptr<ServerPlayer> owner = server->getPlayers()->getPlayer(targetName);
|
||||
if (owner != nullptr)
|
||||
if (owner != NULL)
|
||||
{
|
||||
if ((shared_from_this() != owner) && canHarmPlayer(owner)) canHarm = false;
|
||||
}
|
||||
@@ -741,7 +741,7 @@ void ServerPlayer::changeDimension(int i)
|
||||
level->removeEntity(shared_from_this());
|
||||
wonGame = true;
|
||||
m_enteredEndExitPortal = true; // We only flag this for the player in the portal
|
||||
connection->send(std::make_shared<GameEventPacket>(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()));
|
||||
connection->send( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()) ) );
|
||||
app.DebugPrintf("Sending packet to %d\n", thisPlayer->GetUserIndex());
|
||||
}
|
||||
if(thisPlayer)
|
||||
@@ -749,10 +749,10 @@ void ServerPlayer::changeDimension(int i)
|
||||
for(auto& servPlayer : MinecraftServer::getInstance()->getPlayers()->players)
|
||||
{
|
||||
INetworkPlayer *checkPlayer = servPlayer->connection->getNetworkPlayer();
|
||||
if(thisPlayer != checkPlayer && checkPlayer != nullptr && thisPlayer->IsSameSystem( checkPlayer ) && !servPlayer->wonGame )
|
||||
if(thisPlayer != checkPlayer && checkPlayer != NULL && thisPlayer->IsSameSystem( checkPlayer ) && !servPlayer->wonGame )
|
||||
{
|
||||
servPlayer->wonGame = true;
|
||||
servPlayer->connection->send(std::make_shared<GameEventPacket>(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()));
|
||||
servPlayer->connection->send( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex() ) ) );
|
||||
app.DebugPrintf("Sending packet to %d\n", thisPlayer->GetUserIndex());
|
||||
}
|
||||
}
|
||||
@@ -766,7 +766,7 @@ void ServerPlayer::changeDimension(int i)
|
||||
awardStat(GenericStats::theEnd(), GenericStats::param_theEnd());
|
||||
|
||||
Pos *pos = server->getLevel(i)->getDimensionSpecificSpawn();
|
||||
if (pos != nullptr)
|
||||
if (pos != NULL)
|
||||
{
|
||||
connection->teleport(pos->x, pos->y, pos->z, 0, 0);
|
||||
delete pos;
|
||||
@@ -789,10 +789,10 @@ void ServerPlayer::changeDimension(int i)
|
||||
// 4J Added delay param
|
||||
void ServerPlayer::broadcast(shared_ptr<TileEntity> te, bool delay /*= false*/)
|
||||
{
|
||||
if (te != nullptr)
|
||||
if (te != NULL)
|
||||
{
|
||||
shared_ptr<Packet> p = te->getUpdatePacket();
|
||||
if (p != nullptr)
|
||||
if (p != NULL)
|
||||
{
|
||||
p->shouldDelay = delay;
|
||||
if(delay) connection->queueSend(p);
|
||||
@@ -812,7 +812,7 @@ Player::BedSleepingResult ServerPlayer::startSleepInBed(int x, int y, int z, boo
|
||||
BedSleepingResult result = Player::startSleepInBed(x, y, z, bTestUse);
|
||||
if (result == OK)
|
||||
{
|
||||
shared_ptr<Packet> p = std::make_shared<EntityActionAtPositionPacket>(shared_from_this(), EntityActionAtPositionPacket::START_SLEEP, x, y, z);
|
||||
shared_ptr<Packet> p = shared_ptr<EntityActionAtPositionPacket>( new EntityActionAtPositionPacket(shared_from_this(), EntityActionAtPositionPacket::START_SLEEP, x, y, z) );
|
||||
getLevel()->getTracker()->broadcast(shared_from_this(), p);
|
||||
connection->teleport(this->x, this->y, this->z, yRot, xRot);
|
||||
connection->send(p);
|
||||
@@ -824,16 +824,16 @@ void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, boo
|
||||
{
|
||||
if (isSleeping())
|
||||
{
|
||||
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::make_shared<AnimatePacket>(shared_from_this(), AnimatePacket::WAKE_UP));
|
||||
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr<AnimatePacket>( new AnimatePacket(shared_from_this(), AnimatePacket::WAKE_UP) ) );
|
||||
}
|
||||
Player::stopSleepInBed(forcefulWakeUp, updateLevelList, saveRespawnPoint);
|
||||
if (connection != nullptr) connection->teleport(x, y, z, yRot, xRot);
|
||||
if (connection != NULL) connection->teleport(x, y, z, yRot, xRot);
|
||||
}
|
||||
|
||||
void ServerPlayer::ride(shared_ptr<Entity> e)
|
||||
{
|
||||
Player::ride(e);
|
||||
connection->send(std::make_shared<SetEntityLinkPacket>(SetEntityLinkPacket::RIDING, shared_from_this(), riding));
|
||||
connection->send( shared_ptr<SetEntityLinkPacket>( new SetEntityLinkPacket(SetEntityLinkPacket::RIDING, shared_from_this(), riding) ) );
|
||||
|
||||
// 4J Removed this - The act of riding will be handled on the client and will change the position
|
||||
// of the player. If we also teleport it then we can end up with a repeating movements, e.g. bouncing
|
||||
@@ -853,10 +853,10 @@ void ServerPlayer::doCheckFallDamage(double ya, bool onGround)
|
||||
void ServerPlayer::openTextEdit(shared_ptr<TileEntity> sign)
|
||||
{
|
||||
shared_ptr<SignTileEntity> signTE = dynamic_pointer_cast<SignTileEntity>(sign);
|
||||
if (signTE != nullptr)
|
||||
if (signTE != NULL)
|
||||
{
|
||||
signTE->setAllowedPlayerEditor(dynamic_pointer_cast<Player>(shared_from_this()));
|
||||
connection->send(std::make_shared<TileEditorOpenPacket>(TileEditorOpenPacket::SIGN, sign->x, sign->y, sign->z));
|
||||
connection->send( shared_ptr<TileEditorOpenPacket>( new TileEditorOpenPacket(TileEditorOpenPacket::SIGN, sign->x, sign->y, sign->z)) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,7 +870,7 @@ bool ServerPlayer::startCrafting(int x, int y, int z)
|
||||
if(containerMenu == inventoryMenu)
|
||||
{
|
||||
nextContainerCounter();
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::WORKBENCH, L"", 9, false));
|
||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::WORKBENCH, L"", 9, false) ) );
|
||||
containerMenu = new CraftingMenu(inventory, level, x, y, z);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
@@ -888,17 +888,17 @@ bool ServerPlayer::openFireworks(int x, int y, int z)
|
||||
if(containerMenu == inventoryMenu)
|
||||
{
|
||||
nextContainerCounter();
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false));
|
||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false) ) );
|
||||
containerMenu = new FireworksMenu(inventory, level, x, y, z);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
}
|
||||
else if(dynamic_cast<CraftingMenu *>(containerMenu) != nullptr)
|
||||
else if(dynamic_cast<CraftingMenu *>(containerMenu) != NULL)
|
||||
{
|
||||
closeContainer();
|
||||
|
||||
nextContainerCounter();
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false));
|
||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false) ) );
|
||||
containerMenu = new FireworksMenu(inventory, level, x, y, z);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
@@ -916,7 +916,7 @@ bool ServerPlayer::startEnchanting(int x, int y, int z, const wstring &name)
|
||||
if(containerMenu == inventoryMenu)
|
||||
{
|
||||
nextContainerCounter();
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::ENCHANTMENT, name.empty() ? L"" : name, 9, !name.empty()));
|
||||
connection->send(shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::ENCHANTMENT, name.empty()? L"" : name, 9, !name.empty() ) ));
|
||||
containerMenu = new EnchantmentMenu(inventory, level, x, y, z);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
@@ -934,7 +934,7 @@ bool ServerPlayer::startRepairing(int x, int y, int z)
|
||||
if(containerMenu == inventoryMenu)
|
||||
{
|
||||
nextContainerCounter();
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::REPAIR_TABLE, L"", 9, false));
|
||||
connection->send(shared_ptr<ContainerOpenPacket> ( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::REPAIR_TABLE, L"", 9, false)) );
|
||||
containerMenu = new AnvilMenu(inventory, level, x, y, z, dynamic_pointer_cast<Player>(shared_from_this()));
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
@@ -957,7 +957,7 @@ bool ServerPlayer::openContainer(shared_ptr<Container> container)
|
||||
int containerType = container->getContainerType();
|
||||
assert(containerType >= 0);
|
||||
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, containerType, container->getCustomName(), container->getContainerSize(), container->hasCustomName()));
|
||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, containerType, container->getCustomName(), container->getContainerSize(), container->hasCustomName()) ) );
|
||||
|
||||
containerMenu = new ContainerMenu(inventory, container);
|
||||
containerMenu->containerId = containerCounter;
|
||||
@@ -976,7 +976,7 @@ bool ServerPlayer::openHopper(shared_ptr<HopperTileEntity> container)
|
||||
if(containerMenu == inventoryMenu)
|
||||
{
|
||||
nextContainerCounter();
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName()));
|
||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName())) );
|
||||
containerMenu = new HopperMenu(inventory, container);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
@@ -994,7 +994,7 @@ bool ServerPlayer::openHopper(shared_ptr<MinecartHopper> container)
|
||||
if(containerMenu == inventoryMenu)
|
||||
{
|
||||
nextContainerCounter();
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName()));
|
||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName())) );
|
||||
containerMenu = new HopperMenu(inventory, container);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
@@ -1012,7 +1012,7 @@ bool ServerPlayer::openFurnace(shared_ptr<FurnaceTileEntity> furnace)
|
||||
if(containerMenu == inventoryMenu)
|
||||
{
|
||||
nextContainerCounter();
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::FURNACE, furnace->getCustomName(), furnace->getContainerSize(), furnace->hasCustomName()));
|
||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::FURNACE, furnace->getCustomName(), furnace->getContainerSize(), furnace->hasCustomName()) ) );
|
||||
containerMenu = new FurnaceMenu(inventory, furnace);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
@@ -1030,7 +1030,7 @@ bool ServerPlayer::openTrap(shared_ptr<DispenserTileEntity> trap)
|
||||
if(containerMenu == inventoryMenu)
|
||||
{
|
||||
nextContainerCounter();
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, trap->GetType() == eTYPE_DROPPERTILEENTITY ? ContainerOpenPacket::DROPPER : ContainerOpenPacket::TRAP, trap->getCustomName(), trap->getContainerSize(), trap->hasCustomName()));
|
||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, trap->GetType() == eTYPE_DROPPERTILEENTITY ? ContainerOpenPacket::DROPPER : ContainerOpenPacket::TRAP, trap->getCustomName(), trap->getContainerSize(), trap->hasCustomName() ) ) );
|
||||
containerMenu = new TrapMenu(inventory, trap);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
@@ -1048,7 +1048,7 @@ bool ServerPlayer::openBrewingStand(shared_ptr<BrewingStandTileEntity> brewingSt
|
||||
if(containerMenu == inventoryMenu)
|
||||
{
|
||||
nextContainerCounter();
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::BREWING_STAND, brewingStand->getCustomName(), brewingStand->getContainerSize(), brewingStand->hasCustomName()));
|
||||
connection->send(shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::BREWING_STAND, brewingStand->getCustomName(), brewingStand->getContainerSize(), brewingStand->hasCustomName() )));
|
||||
containerMenu = new BrewingStandMenu(inventory, brewingStand);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
@@ -1066,7 +1066,7 @@ bool ServerPlayer::openBeacon(shared_ptr<BeaconTileEntity> beacon)
|
||||
if(containerMenu == inventoryMenu)
|
||||
{
|
||||
nextContainerCounter();
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::BEACON, beacon->getCustomName(), beacon->getContainerSize(), beacon->hasCustomName()));
|
||||
connection->send(shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::BEACON, beacon->getCustomName(), beacon->getContainerSize(), beacon->hasCustomName() )));
|
||||
containerMenu = new BeaconMenu(inventory, beacon);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
@@ -1087,12 +1087,12 @@ bool ServerPlayer::openTrading(shared_ptr<Merchant> traderTarget, const wstring
|
||||
containerMenu = new MerchantMenu(inventory, traderTarget, level);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
shared_ptr<Container> container = static_cast<MerchantMenu *>(containerMenu)->getTradeContainer();
|
||||
shared_ptr<Container> container = ((MerchantMenu *) containerMenu)->getTradeContainer();
|
||||
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::TRADER_NPC, name.empty() ? L"" : name, container->getContainerSize(), !name.empty()));
|
||||
connection->send(shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(containerCounter, ContainerOpenPacket::TRADER_NPC, name.empty()?L"":name, container->getContainerSize(), !name.empty())));
|
||||
|
||||
MerchantRecipeList *offers = traderTarget->getOffers(dynamic_pointer_cast<Player>(shared_from_this()));
|
||||
if (offers != nullptr)
|
||||
if (offers != NULL)
|
||||
{
|
||||
ByteArrayOutputStream rawOutput;
|
||||
DataOutputStream output(&rawOutput);
|
||||
@@ -1101,7 +1101,7 @@ bool ServerPlayer::openTrading(shared_ptr<Merchant> traderTarget, const wstring
|
||||
output.writeInt(containerCounter);
|
||||
offers->writeToStream(&output);
|
||||
|
||||
connection->send(std::make_shared<CustomPayloadPacket>(CustomPayloadPacket::TRADER_LIST_PACKET, rawOutput.toByteArray()));
|
||||
connection->send(shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_LIST_PACKET, rawOutput.toByteArray())));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1119,7 +1119,7 @@ bool ServerPlayer::openHorseInventory(shared_ptr<EntityHorse> horse, shared_ptr<
|
||||
closeContainer();
|
||||
}
|
||||
nextContainerCounter();
|
||||
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::HORSE, horse->getCustomName(), container->getContainerSize(), container->hasCustomName(), horse->entityId));
|
||||
connection->send(shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(containerCounter, ContainerOpenPacket::HORSE, horse->getCustomName(), container->getContainerSize(), container->hasCustomName(), horse->entityId )));
|
||||
containerMenu = new HorseInventoryMenu(inventory, container, horse);
|
||||
containerMenu->containerId = containerCounter;
|
||||
containerMenu->addSlotListener(this);
|
||||
@@ -1144,7 +1144,7 @@ void ServerPlayer::slotChanged(AbstractContainerMenu *container, int slotIndex,
|
||||
return;
|
||||
}
|
||||
|
||||
connection->send(std::make_shared<ContainerSetSlotPacket>(container->containerId, slotIndex, item));
|
||||
connection->send( shared_ptr<ContainerSetSlotPacket>( new ContainerSetSlotPacket(container->containerId, slotIndex, item) ) );
|
||||
|
||||
}
|
||||
|
||||
@@ -1157,8 +1157,8 @@ void ServerPlayer::refreshContainer(AbstractContainerMenu *menu)
|
||||
|
||||
void ServerPlayer::refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items)
|
||||
{
|
||||
connection->send(std::make_shared<ContainerSetContentPacket>(container->containerId, items));
|
||||
connection->send(std::make_shared<ContainerSetSlotPacket>(-1, -1, inventory->getCarried()));
|
||||
connection->send( shared_ptr<ContainerSetContentPacket>( new ContainerSetContentPacket(container->containerId, items) ) );
|
||||
connection->send( shared_ptr<ContainerSetSlotPacket>( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) );
|
||||
}
|
||||
|
||||
void ServerPlayer::setContainerData(AbstractContainerMenu *container, int id, int value)
|
||||
@@ -1173,12 +1173,12 @@ void ServerPlayer::setContainerData(AbstractContainerMenu *container, int id, in
|
||||
// client again.
|
||||
return;
|
||||
}
|
||||
connection->send(std::make_shared<ContainerSetDataPacket>(container->containerId, id, value));
|
||||
connection->send( shared_ptr<ContainerSetDataPacket>( new ContainerSetDataPacket(container->containerId, id, value) ) );
|
||||
}
|
||||
|
||||
void ServerPlayer::closeContainer()
|
||||
{
|
||||
connection->send(std::make_shared<ContainerClosePacket>(containerMenu->containerId));
|
||||
connection->send( shared_ptr<ContainerClosePacket>( new ContainerClosePacket(containerMenu->containerId) ) );
|
||||
doCloseContainer();
|
||||
}
|
||||
|
||||
@@ -1192,7 +1192,7 @@ void ServerPlayer::broadcastCarriedItem()
|
||||
// client again.
|
||||
return;
|
||||
}
|
||||
connection->send(std::make_shared<ContainerSetSlotPacket>(-1, -1, inventory->getCarried()));
|
||||
connection->send( shared_ptr<ContainerSetSlotPacket>( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) );
|
||||
}
|
||||
|
||||
void ServerPlayer::doCloseContainer()
|
||||
@@ -1203,7 +1203,7 @@ void ServerPlayer::doCloseContainer()
|
||||
|
||||
void ServerPlayer::setPlayerInput(float xxa, float yya, bool jumping, bool sneaking)
|
||||
{
|
||||
if(riding != nullptr)
|
||||
if(riding != NULL)
|
||||
{
|
||||
if (xxa >= -1 && xxa <= 1) this->xxa = xxa;
|
||||
if (yya >= -1 && yya <= 1) this->yya = yya;
|
||||
@@ -1214,7 +1214,7 @@ void ServerPlayer::setPlayerInput(float xxa, float yya, bool jumping, bool sneak
|
||||
|
||||
void ServerPlayer::awardStat(Stat *stat, byteArray param)
|
||||
{
|
||||
if (stat == nullptr)
|
||||
if (stat == NULL)
|
||||
{
|
||||
delete [] param.data;
|
||||
return;
|
||||
@@ -1226,7 +1226,7 @@ void ServerPlayer::awardStat(Stat *stat, byteArray param)
|
||||
int count = *((int*)param.data);
|
||||
delete [] param.data;
|
||||
|
||||
connection->send(std::make_shared<AwardStatPacket>(stat->id, count));
|
||||
connection->send( shared_ptr<AwardStatPacket>( new AwardStatPacket(stat->id, count) ) );
|
||||
#else
|
||||
connection->send( shared_ptr<AwardStatPacket>( new AwardStatPacket(stat->id, param) ) );
|
||||
// byteArray deleted in AwardStatPacket destructor.
|
||||
@@ -1237,7 +1237,7 @@ void ServerPlayer::awardStat(Stat *stat, byteArray param)
|
||||
|
||||
void ServerPlayer::disconnect()
|
||||
{
|
||||
if (rider.lock() != nullptr) rider.lock()->ride(shared_from_this() );
|
||||
if (rider.lock() != NULL) rider.lock()->ride(shared_from_this() );
|
||||
if (m_isSleeping)
|
||||
{
|
||||
stopSleepInBed(true, false, false);
|
||||
@@ -1257,19 +1257,19 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
{
|
||||
case IDS_TILE_BED_OCCUPIED:
|
||||
messageType = ChatPacket::e_ChatBedOccupied;
|
||||
connection->send(std::make_shared<ChatPacket>(L"", messageType));
|
||||
connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"", messageType) ) );
|
||||
break;
|
||||
case IDS_TILE_BED_NO_SLEEP:
|
||||
messageType = ChatPacket::e_ChatBedNoSleep;
|
||||
connection->send(std::make_shared<ChatPacket>(L"", messageType));
|
||||
connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"", messageType) ) );
|
||||
break;
|
||||
case IDS_TILE_BED_NOT_VALID:
|
||||
messageType = ChatPacket::e_ChatBedNotValid;
|
||||
connection->send(std::make_shared<ChatPacket>(L"", messageType));
|
||||
connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"", messageType) ) );
|
||||
break;
|
||||
case IDS_TILE_BED_NOTSAFE:
|
||||
messageType = ChatPacket::e_ChatBedNotSafe;
|
||||
connection->send(std::make_shared<ChatPacket>(L"", messageType));
|
||||
connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"", messageType) ) );
|
||||
break;
|
||||
case IDS_TILE_BED_PLAYERSLEEP:
|
||||
messageType = ChatPacket::e_ChatBedPlayerSleep;
|
||||
@@ -1279,11 +1279,11 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()!=player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatBedPlayerSleep));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatBedPlayerSleep)));
|
||||
}
|
||||
else
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatBedMeSleep));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatBedMeSleep)));
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -1294,7 +1294,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()!=player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerEnteredEnd));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerEnteredEnd)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1304,13 +1304,13 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()!=player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerLeftEnd));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerLeftEnd)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IDS_TILE_BED_MESLEEP:
|
||||
messageType = ChatPacket::e_ChatBedMeSleep;
|
||||
connection->send(std::make_shared<ChatPacket>(L"", messageType));
|
||||
connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"", messageType) ) );
|
||||
break;
|
||||
|
||||
case IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED:
|
||||
@@ -1319,7 +1319,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxPigsSheepCows));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxPigsSheepCows)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1329,7 +1329,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxChickens));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxChickens)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1339,7 +1339,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxSquid));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxSquid)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1349,7 +1349,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxBats));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBats)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1359,7 +1359,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxWolves));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxWolves)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1369,7 +1369,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxMooshrooms));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxMooshrooms)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1379,7 +1379,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxEnemies));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxEnemies)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1390,7 +1390,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxVillagers));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxVillagers)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1400,7 +1400,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxBredPigsSheepCows));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredPigsSheepCows)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1410,7 +1410,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxBredChickens));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredChickens)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1420,7 +1420,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxBredMooshrooms));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredMooshrooms)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1431,7 +1431,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxBredWolves));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredWolves)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1442,7 +1442,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerCantShearMooshroom));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerCantShearMooshroom)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1454,7 +1454,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxHangingEntities));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxHangingEntities)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1464,7 +1464,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerCantSpawnInPeaceful));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerCantSpawnInPeaceful)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1475,7 +1475,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||
if(shared_from_this()==player)
|
||||
{
|
||||
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxBoats));
|
||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBoats)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1493,7 +1493,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||
|
||||
void ServerPlayer::completeUsingItem()
|
||||
{
|
||||
connection->send(std::make_shared<EntityEventPacket>(entityId, EntityEvent::USE_ITEM_COMPLETE));
|
||||
connection->send(shared_ptr<EntityEventPacket>( new EntityEventPacket(entityId, EntityEvent::USE_ITEM_COMPLETE) ) );
|
||||
Player::completeUsingItem();
|
||||
}
|
||||
|
||||
@@ -1501,9 +1501,9 @@ void ServerPlayer::startUsingItem(shared_ptr<ItemInstance> instance, int duratio
|
||||
{
|
||||
Player::startUsingItem(instance, duration);
|
||||
|
||||
if (instance != nullptr && instance->getItem() != nullptr && instance->getItem()->getUseAnimation(instance) == UseAnim_eat)
|
||||
if (instance != NULL && instance->getItem() != NULL && instance->getItem()->getUseAnimation(instance) == UseAnim_eat)
|
||||
{
|
||||
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::make_shared<AnimatePacket>(shared_from_this(), AnimatePacket::EAT));
|
||||
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr<AnimatePacket>( new AnimatePacket(shared_from_this(), AnimatePacket::EAT) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1519,21 +1519,21 @@ void ServerPlayer::restoreFrom(shared_ptr<Player> oldPlayer, bool restoreAll)
|
||||
void ServerPlayer::onEffectAdded(MobEffectInstance *effect)
|
||||
{
|
||||
Player::onEffectAdded(effect);
|
||||
connection->send(std::make_shared<UpdateMobEffectPacket>(entityId, effect));
|
||||
connection->send(shared_ptr<UpdateMobEffectPacket>( new UpdateMobEffectPacket(entityId, effect) ) );
|
||||
}
|
||||
|
||||
|
||||
void ServerPlayer::onEffectUpdated(MobEffectInstance *effect, bool doRefreshAttributes)
|
||||
{
|
||||
Player::onEffectUpdated(effect, doRefreshAttributes);
|
||||
connection->send(std::make_shared<UpdateMobEffectPacket>(entityId, effect));
|
||||
connection->send(shared_ptr<UpdateMobEffectPacket>( new UpdateMobEffectPacket(entityId, effect) ) );
|
||||
}
|
||||
|
||||
|
||||
void ServerPlayer::onEffectRemoved(MobEffectInstance *effect)
|
||||
{
|
||||
Player::onEffectRemoved(effect);
|
||||
connection->send(std::make_shared<RemoveMobEffectPacket>(entityId, effect));
|
||||
connection->send(shared_ptr<RemoveMobEffectPacket>( new RemoveMobEffectPacket(entityId, effect) ) );
|
||||
}
|
||||
|
||||
void ServerPlayer::teleportTo(double x, double y, double z)
|
||||
@@ -1543,34 +1543,34 @@ void ServerPlayer::teleportTo(double x, double y, double z)
|
||||
|
||||
void ServerPlayer::crit(shared_ptr<Entity> entity)
|
||||
{
|
||||
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::make_shared<AnimatePacket>(entity, AnimatePacket::CRITICAL_HIT));
|
||||
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr<AnimatePacket>( new AnimatePacket(entity, AnimatePacket::CRITICAL_HIT) ));
|
||||
}
|
||||
|
||||
void ServerPlayer::magicCrit(shared_ptr<Entity> entity)
|
||||
{
|
||||
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::make_shared<AnimatePacket>(entity, AnimatePacket::MAGIC_CRITICAL_HIT));
|
||||
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr<AnimatePacket>( new AnimatePacket(entity, AnimatePacket::MAGIC_CRITICAL_HIT) ));
|
||||
}
|
||||
|
||||
void ServerPlayer::onUpdateAbilities()
|
||||
{
|
||||
if (connection == nullptr) return;
|
||||
connection->send(std::make_shared<PlayerAbilitiesPacket>(&abilities));
|
||||
if (connection == NULL) return;
|
||||
connection->send(shared_ptr<PlayerAbilitiesPacket>(new PlayerAbilitiesPacket(&abilities)));
|
||||
}
|
||||
|
||||
ServerLevel *ServerPlayer::getLevel()
|
||||
{
|
||||
return static_cast<ServerLevel *>(level);
|
||||
return (ServerLevel *) level;
|
||||
}
|
||||
|
||||
void ServerPlayer::setGameMode(GameType *mode)
|
||||
{
|
||||
gameMode->setGameModeForPlayer(mode);
|
||||
connection->send(std::make_shared<GameEventPacket>(GameEventPacket::CHANGE_GAME_MODE, mode->getId()));
|
||||
connection->send(shared_ptr<GameEventPacket>(new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, mode->getId())));
|
||||
}
|
||||
|
||||
void ServerPlayer::sendMessage(const wstring& message, ChatPacket::EChatPacketMessage type /*= e_ChatCustom*/, int customData /*= -1*/, const wstring& additionalMessage /*= L""*/)
|
||||
{
|
||||
connection->send(std::make_shared<ChatPacket>(message, type, customData, additionalMessage));
|
||||
connection->send(shared_ptr<ChatPacket>(new ChatPacket(message,type,customData,additionalMessage)));
|
||||
}
|
||||
|
||||
bool ServerPlayer::hasPermission(EGameCommand command)
|
||||
@@ -1651,7 +1651,7 @@ int ServerPlayer::getPlayerViewDistanceModifier()
|
||||
{
|
||||
INetworkPlayer *player = connection->getNetworkPlayer();
|
||||
|
||||
if( player != nullptr )
|
||||
if( player != NULL )
|
||||
{
|
||||
DWORD rtt = player->GetCurrentRtt();
|
||||
|
||||
@@ -1666,7 +1666,7 @@ int ServerPlayer::getPlayerViewDistanceModifier()
|
||||
|
||||
void ServerPlayer::handleCollectItem(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
if(gameMode->getGameRules() != nullptr) gameMode->getGameRules()->onCollectItem(item);
|
||||
if(gameMode->getGameRules() != NULL) gameMode->getGameRules()->onCollectItem(item);
|
||||
}
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
|
||||
Reference in New Issue
Block a user