dynamic_pointer_cast -> std::dynamic_pointer_cast
This commit is contained in:
@@ -446,7 +446,7 @@ void ClientConnection::handleAddEntity(std::shared_ptr<AddEntityPacket> packet)
|
||||
}
|
||||
}
|
||||
}
|
||||
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(owner);
|
||||
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(owner);
|
||||
if (player != NULL)
|
||||
{
|
||||
std::shared_ptr<FishingHook> hook = std::shared_ptr<FishingHook>( new FishingHook(level, x, y, z, player) );
|
||||
@@ -547,7 +547,7 @@ void ClientConnection::handleAddEntity(std::shared_ptr<AddEntityPacket> packet)
|
||||
}
|
||||
}
|
||||
}
|
||||
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(owner);
|
||||
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(owner);
|
||||
if (player != NULL)
|
||||
{
|
||||
std::shared_ptr<FishingHook> hook = std::shared_ptr<FishingHook>( new FishingHook(level, x, y, z, player) );
|
||||
@@ -653,9 +653,9 @@ void ClientConnection::handleAddEntity(std::shared_ptr<AddEntityPacket> packet)
|
||||
}
|
||||
}
|
||||
|
||||
if (dynamic_pointer_cast<Mob>(owner) != NULL)
|
||||
if (std::dynamic_pointer_cast<Mob>(owner) != NULL)
|
||||
{
|
||||
dynamic_pointer_cast<Arrow>(e)->owner = dynamic_pointer_cast<Mob>(owner);
|
||||
std::dynamic_pointer_cast<Arrow>(e)->owner = std::dynamic_pointer_cast<Mob>(owner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1207,7 +1207,7 @@ void ClientConnection::send(std::shared_ptr<Packet> packet)
|
||||
void ClientConnection::handleTakeItemEntity(std::shared_ptr<TakeItemEntityPacket> packet)
|
||||
{
|
||||
std::shared_ptr<Entity> from = getEntity(packet->itemId);
|
||||
std::shared_ptr<Mob> to = dynamic_pointer_cast<Mob>(getEntity(packet->playerId));
|
||||
std::shared_ptr<Mob> to = std::dynamic_pointer_cast<Mob>(getEntity(packet->playerId));
|
||||
|
||||
// 4J - the original game could assume that if getEntity didn't find the player, it must be the local player. We
|
||||
// need to search all local players
|
||||
@@ -1240,7 +1240,7 @@ void ClientConnection::handleTakeItemEntity(std::shared_ptr<TakeItemEntityPacket
|
||||
// "from" reference if we've already removed the item for an earlier processed connection
|
||||
if( isLocalPlayer )
|
||||
{
|
||||
std::shared_ptr<LocalPlayer> player = dynamic_pointer_cast<LocalPlayer>(to);
|
||||
std::shared_ptr<LocalPlayer> player = std::dynamic_pointer_cast<LocalPlayer>(to);
|
||||
|
||||
// 4J Stu - Fix for #10213 - UI: Local clients cannot progress through the tutorial normally.
|
||||
// We only send this packet once if many local players can see the event, so make sure we update
|
||||
@@ -1571,7 +1571,7 @@ void ClientConnection::handleAnimate(std::shared_ptr<AnimatePacket> packet)
|
||||
if (e == NULL) return;
|
||||
if (packet->action == AnimatePacket::SWING)
|
||||
{
|
||||
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
|
||||
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
|
||||
if(player != NULL) player->swing();
|
||||
}
|
||||
else if (packet->action == AnimatePacket::HURT)
|
||||
@@ -1580,7 +1580,7 @@ void ClientConnection::handleAnimate(std::shared_ptr<AnimatePacket> packet)
|
||||
}
|
||||
else if (packet->action == AnimatePacket::WAKE_UP)
|
||||
{
|
||||
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
|
||||
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
|
||||
if(player != NULL) player->stopSleepInBed(false, false, false);
|
||||
}
|
||||
else if (packet->action == AnimatePacket::RESPAWN)
|
||||
@@ -1598,7 +1598,7 @@ void ClientConnection::handleAnimate(std::shared_ptr<AnimatePacket> packet)
|
||||
critParticle->CritParticlePostConstructor();
|
||||
minecraft->particleEngine->add(critParticle);
|
||||
}
|
||||
else if (packet->action == AnimatePacket::EAT && dynamic_pointer_cast<RemotePlayer>(e) != NULL)
|
||||
else if (packet->action == AnimatePacket::EAT && std::dynamic_pointer_cast<RemotePlayer>(e) != NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1610,7 +1610,7 @@ void ClientConnection::handleEntityActionAtPosition(std::shared_ptr<EntityAction
|
||||
if (e == NULL) return;
|
||||
if (packet->action == EntityActionAtPositionPacket::START_SLEEP)
|
||||
{
|
||||
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
|
||||
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
|
||||
player->startSleepInBed(packet->x, packet->y, packet->z);
|
||||
|
||||
if( player == minecraft->localplayers[m_userIndex] )
|
||||
@@ -2113,7 +2113,7 @@ void ClientConnection::handleAddMob(std::shared_ptr<AddMobPacket> packet)
|
||||
float yRot = packet->yRot * 360 / 256.0f;
|
||||
float xRot = packet->xRot * 360 / 256.0f;
|
||||
|
||||
std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(EntityIO::newById(packet->type, level));
|
||||
std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>(EntityIO::newById(packet->type, level));
|
||||
mob->xp = packet->x;
|
||||
mob->yp = packet->y;
|
||||
mob->zp = packet->z;
|
||||
@@ -2153,7 +2153,7 @@ void ClientConnection::handleAddMob(std::shared_ptr<AddMobPacket> packet)
|
||||
// 4J Stu - Slimes have a different BB depending on their size which is set in the entity data, so update the BB
|
||||
if(mob->GetType() == eTYPE_SLIME || mob->GetType() == eTYPE_LAVASLIME)
|
||||
{
|
||||
std::shared_ptr<Slime> slime = dynamic_pointer_cast<Slime>(mob);
|
||||
std::shared_ptr<Slime> slime = std::dynamic_pointer_cast<Slime>(mob);
|
||||
slime->setSize( slime->getSize() );
|
||||
}
|
||||
}
|
||||
@@ -2176,7 +2176,7 @@ void ClientConnection::handleRidePacket(std::shared_ptr<SetRidingPacket> packet)
|
||||
std::shared_ptr<Entity> rider = getEntity(packet->riderId);
|
||||
std::shared_ptr<Entity> ridden = getEntity(packet->riddenId);
|
||||
|
||||
std::shared_ptr<Boat> boat = dynamic_pointer_cast<Boat>(ridden);
|
||||
std::shared_ptr<Boat> boat = std::dynamic_pointer_cast<Boat>(ridden);
|
||||
//if (packet->riderId == minecraft->player->entityId) rider = minecraft->player;
|
||||
if (packet->riderId == minecraft->localplayers[m_userIndex]->entityId)
|
||||
{
|
||||
@@ -2327,7 +2327,7 @@ void ClientConnection::handleTextureChange(std::shared_ptr<TextureChangePacket>
|
||||
{
|
||||
std::shared_ptr<Entity> e = getEntity(packet->id);
|
||||
if (e == NULL) return;
|
||||
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
|
||||
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
|
||||
if( e == NULL) return;
|
||||
|
||||
bool isLocalPlayer = false;
|
||||
@@ -2382,7 +2382,7 @@ void ClientConnection::handleTextureAndGeometryChange(std::shared_ptr<TextureAnd
|
||||
{
|
||||
std::shared_ptr<Entity> e = getEntity(packet->id);
|
||||
if (e == NULL) return;
|
||||
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
|
||||
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
|
||||
if( e == NULL) return;
|
||||
|
||||
bool isLocalPlayer = false;
|
||||
@@ -2765,9 +2765,9 @@ void ClientConnection::handleSignUpdate(std::shared_ptr<SignUpdatePacket> packet
|
||||
std::shared_ptr<TileEntity> te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z);
|
||||
|
||||
// 4J-PB - on a client connecting, the line below fails
|
||||
if (dynamic_pointer_cast<SignTileEntity>(te) != NULL)
|
||||
if (std::dynamic_pointer_cast<SignTileEntity>(te) != NULL)
|
||||
{
|
||||
std::shared_ptr<SignTileEntity> ste = dynamic_pointer_cast<SignTileEntity>(te);
|
||||
std::shared_ptr<SignTileEntity> ste = std::dynamic_pointer_cast<SignTileEntity>(te);
|
||||
for (int i = 0; i < MAX_SIGN_LINES; i++)
|
||||
{
|
||||
ste->SetMessage(i,packet->lines[i]);
|
||||
@@ -2781,7 +2781,7 @@ void ClientConnection::handleSignUpdate(std::shared_ptr<SignUpdatePacket> packet
|
||||
}
|
||||
else
|
||||
{
|
||||
app.DebugPrintf("dynamic_pointer_cast<SignTileEntity>(te) == NULL\n");
|
||||
app.DebugPrintf("std::dynamic_pointer_cast<SignTileEntity>(te) == NULL\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2798,9 +2798,9 @@ void ClientConnection::handleTileEntityData(std::shared_ptr<TileEntityDataPacket
|
||||
|
||||
if (te != NULL)
|
||||
{
|
||||
if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER && dynamic_pointer_cast<MobSpawnerTileEntity>(te) != NULL)
|
||||
if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER && std::dynamic_pointer_cast<MobSpawnerTileEntity>(te) != NULL)
|
||||
{
|
||||
dynamic_pointer_cast<MobSpawnerTileEntity>(te)->load(packet->tag);
|
||||
std::dynamic_pointer_cast<MobSpawnerTileEntity>(te)->load(packet->tag);
|
||||
}
|
||||
//else if (packet.type == TileEntityDataPacket.TYPE_ADV_COMMAND && (te instanceof CommandBlockEntity))
|
||||
//{
|
||||
@@ -2810,9 +2810,9 @@ void ClientConnection::handleTileEntityData(std::shared_ptr<TileEntityDataPacket
|
||||
//{
|
||||
// ((BeaconTileEntity) te).load(packet.tag);
|
||||
//}
|
||||
else if (packet->type == TileEntityDataPacket::TYPE_SKULL && dynamic_pointer_cast<SkullTileEntity>(te) != NULL)
|
||||
else if (packet->type == TileEntityDataPacket::TYPE_SKULL && std::dynamic_pointer_cast<SkullTileEntity>(te) != NULL)
|
||||
{
|
||||
dynamic_pointer_cast<SkullTileEntity>(te)->load(packet->tag);
|
||||
std::dynamic_pointer_cast<SkullTileEntity>(te)->load(packet->tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2971,17 +2971,17 @@ void ClientConnection::handleAwardStat(std::shared_ptr<AwardStatPacket> packet)
|
||||
void ClientConnection::handleUpdateMobEffect(std::shared_ptr<UpdateMobEffectPacket> packet)
|
||||
{
|
||||
std::shared_ptr<Entity> e = getEntity(packet->entityId);
|
||||
if (e == NULL || dynamic_pointer_cast<Mob>(e) == NULL) return;
|
||||
if (e == NULL || std::dynamic_pointer_cast<Mob>(e) == NULL) return;
|
||||
|
||||
( dynamic_pointer_cast<Mob>(e) )->addEffect(new MobEffectInstance(packet->effectId, packet->effectDurationTicks, packet->effectAmplifier));
|
||||
( std::dynamic_pointer_cast<Mob>(e) )->addEffect(new MobEffectInstance(packet->effectId, packet->effectDurationTicks, packet->effectAmplifier));
|
||||
}
|
||||
|
||||
void ClientConnection::handleRemoveMobEffect(std::shared_ptr<RemoveMobEffectPacket> packet)
|
||||
{
|
||||
std::shared_ptr<Entity> e = getEntity(packet->entityId);
|
||||
if (e == NULL || dynamic_pointer_cast<Mob>(e) == NULL) return;
|
||||
if (e == NULL || std::dynamic_pointer_cast<Mob>(e) == NULL) return;
|
||||
|
||||
( dynamic_pointer_cast<Mob>(e) )->removeEffectNoUpdate(packet->effectId);
|
||||
( std::dynamic_pointer_cast<Mob>(e) )->removeEffectNoUpdate(packet->effectId);
|
||||
}
|
||||
|
||||
bool ClientConnection::isServerPacketListener()
|
||||
@@ -3008,7 +3008,7 @@ void ClientConnection::handlePlayerInfo(std::shared_ptr<PlayerInfoPacket> packet
|
||||
std::shared_ptr<Entity> entity = getEntity(packet->m_entityId);
|
||||
if(entity != NULL && entity->GetType() == eTYPE_PLAYER)
|
||||
{
|
||||
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
|
||||
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(entity);
|
||||
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_playerPrivileges);
|
||||
}
|
||||
if(networkPlayer != NULL && networkPlayer->IsLocal())
|
||||
|
||||
Reference in New Issue
Block a user