mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Modernized and fixed a few bugs
- Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.
This commit is contained in:
parent
6d1d3b59cb
commit
50a606f9cd
|
|
@ -3,6 +3,7 @@
|
||||||
#include "AbstractTexturePack.h"
|
#include "AbstractTexturePack.h"
|
||||||
#include "..\Minecraft.World\InputOutputStream.h"
|
#include "..\Minecraft.World\InputOutputStream.h"
|
||||||
#include "..\Minecraft.World\StringHelpers.h"
|
#include "..\Minecraft.World\StringHelpers.h"
|
||||||
|
#include "Common/UI/UI.h"
|
||||||
|
|
||||||
AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback) : id(id), name(name)
|
AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback) : id(id), name(name)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -452,7 +452,7 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
if (owner != nullptr && owner->instanceof(eTYPE_PLAYER))
|
if (owner != nullptr && owner->instanceof(eTYPE_PLAYER))
|
||||||
{
|
{
|
||||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(owner);
|
shared_ptr<Player> player = dynamic_pointer_cast<Player>(owner);
|
||||||
shared_ptr<FishingHook> hook = shared_ptr<FishingHook>( new FishingHook(level, x, y, z, player) );
|
shared_ptr<FishingHook> hook = std::make_shared<FishingHook>(level, x, y, z, player);
|
||||||
e = hook;
|
e = hook;
|
||||||
// 4J Stu - Move the player->fishing out of the ctor as we cannot reference 'this'
|
// 4J Stu - Move the player->fishing out of the ctor as we cannot reference 'this'
|
||||||
player->fishing = hook;
|
player->fishing = hook;
|
||||||
|
|
@ -461,10 +461,10 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::ARROW:
|
case AddEntityPacket::ARROW:
|
||||||
e = shared_ptr<Entity>( new Arrow(level, x, y, z) );
|
e = std::make_shared<Arrow>(level, x, y, z);
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::SNOWBALL:
|
case AddEntityPacket::SNOWBALL:
|
||||||
e = shared_ptr<Entity>( new Snowball(level, x, y, z) );
|
e = std::make_shared<Snowball>(level, x, y, z);
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::ITEM_FRAME:
|
case AddEntityPacket::ITEM_FRAME:
|
||||||
{
|
{
|
||||||
|
|
@ -473,64 +473,64 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
int iz = (int) z;
|
int iz = (int) z;
|
||||||
app.DebugPrintf("ClientConnection ITEM_FRAME xyz %d,%d,%d\n",ix,iy,iz);
|
app.DebugPrintf("ClientConnection ITEM_FRAME xyz %d,%d,%d\n",ix,iy,iz);
|
||||||
}
|
}
|
||||||
e = shared_ptr<Entity>(new ItemFrame(level, (int) x, (int) y, (int) z, packet->data));
|
e = std::make_shared<ItemFrame>(level, (int)x, (int)y, (int)z, packet->data);
|
||||||
packet->data = 0;
|
packet->data = 0;
|
||||||
setRot = false;
|
setRot = false;
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::THROWN_ENDERPEARL:
|
case AddEntityPacket::THROWN_ENDERPEARL:
|
||||||
e = shared_ptr<Entity>( new ThrownEnderpearl(level, x, y, z) );
|
e = std::make_shared<ThrownEnderpearl>(level, x, y, z);
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::EYEOFENDERSIGNAL:
|
case AddEntityPacket::EYEOFENDERSIGNAL:
|
||||||
e = shared_ptr<Entity>( new EyeOfEnderSignal(level, x, y, z) );
|
e = std::make_shared<EyeOfEnderSignal>(level, x, y, z);
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::FIREBALL:
|
case AddEntityPacket::FIREBALL:
|
||||||
e = shared_ptr<Entity>( new LargeFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) );
|
e = std::make_shared<LargeFireball>(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0);
|
||||||
packet->data = 0;
|
packet->data = 0;
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::SMALL_FIREBALL:
|
case AddEntityPacket::SMALL_FIREBALL:
|
||||||
e = shared_ptr<Entity>( new SmallFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) );
|
e = std::make_shared<SmallFireball>(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0);
|
||||||
packet->data = 0;
|
packet->data = 0;
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::DRAGON_FIRE_BALL:
|
case AddEntityPacket::DRAGON_FIRE_BALL:
|
||||||
e = shared_ptr<Entity>( new DragonFireball(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0) );
|
e = std::make_shared<DragonFireball>(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0);
|
||||||
packet->data = 0;
|
packet->data = 0;
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::EGG:
|
case AddEntityPacket::EGG:
|
||||||
e = shared_ptr<Entity>( new ThrownEgg(level, x, y, z) );
|
e = std::make_shared<ThrownEgg>(level, x, y, z);
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::THROWN_POTION:
|
case AddEntityPacket::THROWN_POTION:
|
||||||
e = shared_ptr<Entity>( new ThrownPotion(level, x, y, z, packet->data) );
|
e = std::make_shared<ThrownPotion>(level, x, y, z, packet->data);
|
||||||
packet->data = 0;
|
packet->data = 0;
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::THROWN_EXPBOTTLE:
|
case AddEntityPacket::THROWN_EXPBOTTLE:
|
||||||
e = shared_ptr<Entity>( new ThrownExpBottle(level, x, y, z) );
|
e = std::make_shared<ThrownExpBottle>(level, x, y, z);
|
||||||
packet->data = 0;
|
packet->data = 0;
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::BOAT:
|
case AddEntityPacket::BOAT:
|
||||||
e = shared_ptr<Entity>( new Boat(level, x, y, z) );
|
e = std::make_shared<Boat>(level, x, y, z);
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::PRIMED_TNT:
|
case AddEntityPacket::PRIMED_TNT:
|
||||||
e = shared_ptr<Entity>( new PrimedTnt(level, x, y, z, nullptr) );
|
e = std::make_shared<PrimedTnt>(level, x, y, z, std::shared_ptr<LivingEntity>());
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::ENDER_CRYSTAL:
|
case AddEntityPacket::ENDER_CRYSTAL:
|
||||||
e = shared_ptr<Entity>( new EnderCrystal(level, x, y, z) );
|
e = std::make_shared<EnderCrystal>(level, x, y, z);
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::ITEM:
|
case AddEntityPacket::ITEM:
|
||||||
e = shared_ptr<Entity>( new ItemEntity(level, x, y, z) );
|
e = std::make_shared<ItemEntity>(level, x, y, z);
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::FALLING:
|
case AddEntityPacket::FALLING:
|
||||||
e = shared_ptr<Entity>( new FallingTile(level, x, y, z, packet->data & 0xFFFF, packet->data >> 16) );
|
e = std::make_shared<FallingTile>(level, x, y, z, packet->data & 0xFFFF, packet->data >> 16);
|
||||||
packet->data = 0;
|
packet->data = 0;
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::WITHER_SKULL:
|
case AddEntityPacket::WITHER_SKULL:
|
||||||
e = shared_ptr<Entity>(new WitherSkull(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0));
|
e = std::make_shared<WitherSkull>(level, x, y, z, packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0);
|
||||||
packet->data = 0;
|
packet->data = 0;
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::FIREWORKS:
|
case AddEntityPacket::FIREWORKS:
|
||||||
e = shared_ptr<Entity>(new FireworksRocketEntity(level, x, y, z, nullptr));
|
e = std::make_shared<FireworksRocketEntity>(level, x, y, z, std::shared_ptr<ItemInstance>());
|
||||||
break;
|
break;
|
||||||
case AddEntityPacket::LEASH_KNOT:
|
case AddEntityPacket::LEASH_KNOT:
|
||||||
e = shared_ptr<Entity>(new LeashFenceKnotEntity(level, (int) x, (int) y, (int) z));
|
e = std::make_shared<LeashFenceKnotEntity>(level, (int)x, (int)y, (int)z);
|
||||||
packet->data = 0;
|
packet->data = 0;
|
||||||
break;
|
break;
|
||||||
#ifndef _FINAL_BUILD
|
#ifndef _FINAL_BUILD
|
||||||
|
|
@ -692,7 +692,7 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
|
|
||||||
void ClientConnection::handleAddExperienceOrb(shared_ptr<AddExperienceOrbPacket> packet)
|
void ClientConnection::handleAddExperienceOrb(shared_ptr<AddExperienceOrbPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = shared_ptr<ExperienceOrb>( new ExperienceOrb(level, packet->x / 32.0, packet->y / 32.0, packet->z / 32.0, packet->value) );
|
shared_ptr<Entity> e = std::make_shared<ExperienceOrb>(level, packet->x / 32.0, packet->y / 32.0, packet->z / 32.0, packet->value);
|
||||||
e->xp = packet->x;
|
e->xp = packet->x;
|
||||||
e->yp = packet->y;
|
e->yp = packet->y;
|
||||||
e->zp = packet->z;
|
e->zp = packet->z;
|
||||||
|
|
@ -708,7 +708,7 @@ void ClientConnection::handleAddGlobalEntity(shared_ptr<AddGlobalEntityPacket> p
|
||||||
double y = packet->y / 32.0;
|
double y = packet->y / 32.0;
|
||||||
double z = packet->z / 32.0;
|
double z = packet->z / 32.0;
|
||||||
shared_ptr<Entity> e;// = nullptr;
|
shared_ptr<Entity> e;// = nullptr;
|
||||||
if (packet->type == AddGlobalEntityPacket::LIGHTNING) e = shared_ptr<LightningBolt>( new LightningBolt(level, x, y, z) );
|
if (packet->type == AddGlobalEntityPacket::LIGHTNING) e = std::make_shared<LightningBolt>(level, x, y, z);
|
||||||
if (e != nullptr)
|
if (e != nullptr)
|
||||||
{
|
{
|
||||||
e->xp = packet->x;
|
e->xp = packet->x;
|
||||||
|
|
@ -723,7 +723,7 @@ void ClientConnection::handleAddGlobalEntity(shared_ptr<AddGlobalEntityPacket> p
|
||||||
|
|
||||||
void ClientConnection::handleAddPainting(shared_ptr<AddPaintingPacket> packet)
|
void ClientConnection::handleAddPainting(shared_ptr<AddPaintingPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Painting> painting = shared_ptr<Painting>( new Painting(level, packet->x, packet->y, packet->z, packet->dir, packet->motive) );
|
shared_ptr<Painting> painting = std::make_shared<Painting>(level, packet->x, packet->y, packet->z, packet->dir, packet->motive);
|
||||||
level->putEntity(packet->id, painting);
|
level->putEntity(packet->id, painting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -792,7 +792,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
double z = packet->z / 32.0;
|
double z = packet->z / 32.0;
|
||||||
float yRot = packet->yRot * 360 / 256.0f;
|
float yRot = packet->yRot * 360 / 256.0f;
|
||||||
float xRot = packet->xRot * 360 / 256.0f;
|
float xRot = packet->xRot * 360 / 256.0f;
|
||||||
shared_ptr<RemotePlayer> player = shared_ptr<RemotePlayer>( new RemotePlayer(minecraft->level, packet->name) );
|
shared_ptr<RemotePlayer> player = std::make_shared<RemotePlayer>(minecraft->level, packet->name);
|
||||||
player->xo = player->xOld = player->xp = packet->x;
|
player->xo = player->xOld = player->xp = packet->x;
|
||||||
player->yo = player->yOld = player->yp = packet->y;
|
player->yo = player->yOld = player->yp = packet->y;
|
||||||
player->zo = player->zOld = player->zp = packet->z;
|
player->zo = player->zOld = player->zp = packet->z;
|
||||||
|
|
@ -868,7 +868,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player->inventory->items[player->inventory->selected] = shared_ptr<ItemInstance>( new ItemInstance(item, 1, 0) );
|
player->inventory->items[player->inventory->selected] = std::make_shared<ItemInstance>(item, 1, 0);
|
||||||
}
|
}
|
||||||
player->absMoveTo(x, y, z, yRot, xRot);
|
player->absMoveTo(x, y, z, yRot, xRot);
|
||||||
|
|
||||||
|
|
@ -877,15 +877,18 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
player->setCustomCape( packet->m_capeId );
|
player->setCustomCape( packet->m_capeId );
|
||||||
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges);
|
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges);
|
||||||
|
|
||||||
if(!player->customTextureUrl.empty() && player->customTextureUrl.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl))
|
if (!player->customTextureUrl.empty() && player->customTextureUrl.substr(0, 3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl))
|
||||||
{
|
{
|
||||||
if( minecraft->addPendingClientTextureRequest(player->customTextureUrl) )
|
if (minecraft->addPendingClientTextureRequest(player->customTextureUrl))
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Client sending TextureAndGeometryPacket to get custom skin %ls for player %ls\n",player->customTextureUrl.c_str(), player->name.c_str());
|
app.DebugPrintf("Client sending TextureAndGeometryPacket to get custom skin %ls for player %ls\n", player->customTextureUrl.c_str(), player->name.c_str());
|
||||||
|
|
||||||
send(shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(player->customTextureUrl,nullptr,0) ) );
|
send(std::make_shared<TextureAndGeometryPacket>(
|
||||||
}
|
player->customTextureUrl,
|
||||||
}
|
nullptr,
|
||||||
|
static_cast<DWORD>(0)));
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl))
|
else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl))
|
||||||
{
|
{
|
||||||
// Update the ref count on the memory texture data
|
// Update the ref count on the memory texture data
|
||||||
|
|
@ -899,7 +902,11 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
if( minecraft->addPendingClientTextureRequest(player->customTextureUrl2) )
|
if( minecraft->addPendingClientTextureRequest(player->customTextureUrl2) )
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Client sending texture packet to get custom cape %ls for player %ls\n",player->customTextureUrl2.c_str(), player->name.c_str());
|
app.DebugPrintf("Client sending texture packet to get custom cape %ls for player %ls\n",player->customTextureUrl2.c_str(), player->name.c_str());
|
||||||
send(shared_ptr<TexturePacket>( new TexturePacket(player->customTextureUrl2,nullptr,0) ) );
|
send(std::make_shared<TexturePacket>(
|
||||||
|
player->customTextureUrl2,
|
||||||
|
nullptr,
|
||||||
|
static_cast<DWORD>(0)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2))
|
else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2))
|
||||||
|
|
@ -1402,7 +1409,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr<TakeItemEntityPacket> pac
|
||||||
level->playSound(from, eSoundType_RANDOM_POP, 0.2f, ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f);
|
level->playSound(from, eSoundType_RANDOM_POP, 0.2f, ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft->particleEngine->add( shared_ptr<TakeAnimationParticle>( new TakeAnimationParticle(minecraft->level, from, to, -0.5f) ) );
|
minecraft->particleEngine->add(std::make_shared<TakeAnimationParticle>(minecraft->level, from, to, -0.5f));
|
||||||
level->removeEntity(packet->itemId);
|
level->removeEntity(packet->itemId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1415,7 +1422,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr<TakeItemEntityPacket> pac
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
level->playSound(from, eSoundType_RANDOM_POP, 0.2f, ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f);
|
level->playSound(from, eSoundType_RANDOM_POP, 0.2f, ((random->nextFloat() - random->nextFloat()) * 0.7f + 1.0f) * 2.0f);
|
||||||
minecraft->particleEngine->add( shared_ptr<TakeAnimationParticle>( new TakeAnimationParticle(minecraft->level, from, to, -0.5f) ) );
|
minecraft->particleEngine->add(std::make_shared<TakeAnimationParticle>(minecraft->level, from, to, -0.5f));
|
||||||
level->removeEntity(packet->itemId);
|
level->removeEntity(packet->itemId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1848,13 +1855,13 @@ void ClientConnection::handleAnimate(shared_ptr<AnimatePacket> packet)
|
||||||
}
|
}
|
||||||
else if (packet->action == AnimatePacket::CRITICAL_HIT)
|
else if (packet->action == AnimatePacket::CRITICAL_HIT)
|
||||||
{
|
{
|
||||||
shared_ptr<CritParticle> critParticle = shared_ptr<CritParticle>( new CritParticle(minecraft->level, e) );
|
shared_ptr<CritParticle> critParticle = std::make_shared<CritParticle>(minecraft->level, e);
|
||||||
critParticle->CritParticlePostConstructor();
|
critParticle->CritParticlePostConstructor();
|
||||||
minecraft->particleEngine->add( critParticle );
|
minecraft->particleEngine->add( critParticle );
|
||||||
}
|
}
|
||||||
else if (packet->action == AnimatePacket::MAGIC_CRITICAL_HIT)
|
else if (packet->action == AnimatePacket::MAGIC_CRITICAL_HIT)
|
||||||
{
|
{
|
||||||
shared_ptr<CritParticle> critParticle = shared_ptr<CritParticle>( new CritParticle(minecraft->level, e, eParticleType_magicCrit) );
|
shared_ptr<CritParticle> critParticle = std::make_shared<CritParticle>(minecraft->level, e, eParticleType_magicCrit);
|
||||||
critParticle->CritParticlePostConstructor();
|
critParticle->CritParticlePostConstructor();
|
||||||
minecraft->particleEngine->add(critParticle);
|
minecraft->particleEngine->add(critParticle);
|
||||||
}
|
}
|
||||||
|
|
@ -2326,8 +2333,8 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
}
|
}
|
||||||
BOOL allAllowed, friendsAllowed;
|
BOOL allAllowed, friendsAllowed;
|
||||||
ProfileManager.AllowedPlayerCreatedContent(m_userIndex,true,&allAllowed,&friendsAllowed);
|
ProfileManager.AllowedPlayerCreatedContent(m_userIndex,true,&allAllowed,&friendsAllowed);
|
||||||
send( shared_ptr<LoginPacket>( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE),
|
send(std::make_shared<LoginPacket>(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed != TRUE && friendsAllowed == TRUE),
|
||||||
packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), app.GetPlayerCapeId(m_userIndex), ProfileManager.IsGuest( m_userIndex ))));
|
packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), app.GetPlayerCapeId(m_userIndex), ProfileManager.IsGuest(m_userIndex)));
|
||||||
|
|
||||||
if(!g_NetworkManager.IsHost() )
|
if(!g_NetworkManager.IsHost() )
|
||||||
{
|
{
|
||||||
|
|
@ -2550,7 +2557,7 @@ void ClientConnection::handleTexture(shared_ptr<TexturePacket> packet)
|
||||||
|
|
||||||
if(dwBytes!=0)
|
if(dwBytes!=0)
|
||||||
{
|
{
|
||||||
send( shared_ptr<TexturePacket>( new TexturePacket(packet->textureName,pbData,dwBytes) ) );
|
send(std::make_shared<TexturePacket>(packet->textureName, pbData, dwBytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -2587,18 +2594,18 @@ void ClientConnection::handleTextureAndGeometry(shared_ptr<TextureAndGeometryPac
|
||||||
{
|
{
|
||||||
if(pDLCSkinFile->getAdditionalBoxesCount()!=0)
|
if(pDLCSkinFile->getAdditionalBoxesCount()!=0)
|
||||||
{
|
{
|
||||||
send( shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes,pDLCSkinFile) ) );
|
send(std::make_shared<TextureAndGeometryPacket>(packet->textureName, pbData, dwBytes, pDLCSkinFile));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
send( shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes) ) );
|
send(std::make_shared<TextureAndGeometryPacket>(packet->textureName, pbData, dwBytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(packet->dwSkinID);
|
unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(packet->dwSkinID);
|
||||||
|
|
||||||
send( shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(packet->textureName,pbData,dwBytes,app.GetAdditionalSkinBoxes(packet->dwSkinID),uiAnimOverrideBitmask) ) );
|
send(std::make_shared<TextureAndGeometryPacket>(packet->textureName, pbData, dwBytes, app.GetAdditionalSkinBoxes(packet->dwSkinID), uiAnimOverrideBitmask));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2667,7 +2674,10 @@ void ClientConnection::handleTextureChange(shared_ptr<TextureChangePacket> packe
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"handleTextureChange - Client sending texture packet to get custom skin %ls for player %ls\n",packet->path.c_str(), player->name.c_str());
|
wprintf(L"handleTextureChange - Client sending texture packet to get custom skin %ls for player %ls\n",packet->path.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
send(shared_ptr<TexturePacket>( new TexturePacket(packet->path,nullptr,0) ) );
|
send(std::make_shared<TexturePacket>(
|
||||||
|
player->customTextureUrl,
|
||||||
|
nullptr,
|
||||||
|
static_cast<DWORD>(0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path))
|
else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path))
|
||||||
|
|
@ -2712,7 +2722,10 @@ void ClientConnection::handleTextureAndGeometryChange(shared_ptr<TextureAndGeome
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"handleTextureAndGeometryChange - Client sending TextureAndGeometryPacket to get custom skin %ls for player %ls\n",packet->path.c_str(), player->name.c_str());
|
wprintf(L"handleTextureAndGeometryChange - Client sending TextureAndGeometryPacket to get custom skin %ls for player %ls\n",packet->path.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
send(shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(packet->path,nullptr,0) ) );
|
send(std::make_shared<TextureAndGeometryPacket>(
|
||||||
|
packet->path,
|
||||||
|
nullptr,
|
||||||
|
static_cast<DWORD>(0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path))
|
else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path))
|
||||||
|
|
@ -2895,7 +2908,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
default: assert(false); chestString = -1; break;
|
default: assert(false); chestString = -1; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( player->openContainer(shared_ptr<SimpleContainer>( new SimpleContainer(chestString, packet->title, packet->customName, packet->size) )))
|
if( player->openContainer(std::make_shared<SimpleContainer>(chestString, packet->title, packet->customName, packet->size)))
|
||||||
{
|
{
|
||||||
player->containerMenu->containerId = packet->containerId;
|
player->containerMenu->containerId = packet->containerId;
|
||||||
}
|
}
|
||||||
|
|
@ -2907,7 +2920,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
break;
|
break;
|
||||||
case ContainerOpenPacket::HOPPER:
|
case ContainerOpenPacket::HOPPER:
|
||||||
{
|
{
|
||||||
shared_ptr<HopperTileEntity> hopper = shared_ptr<HopperTileEntity>(new HopperTileEntity());
|
shared_ptr<HopperTileEntity> hopper = std::make_shared<HopperTileEntity>();
|
||||||
if (packet->customName) hopper->setCustomName(packet->title);
|
if (packet->customName) hopper->setCustomName(packet->title);
|
||||||
if(player->openHopper(hopper))
|
if(player->openHopper(hopper))
|
||||||
{
|
{
|
||||||
|
|
@ -2921,7 +2934,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
break;
|
break;
|
||||||
case ContainerOpenPacket::FURNACE:
|
case ContainerOpenPacket::FURNACE:
|
||||||
{
|
{
|
||||||
shared_ptr<FurnaceTileEntity> furnace = shared_ptr<FurnaceTileEntity>(new FurnaceTileEntity());
|
shared_ptr<FurnaceTileEntity> furnace = std::make_shared<FurnaceTileEntity>();
|
||||||
if (packet->customName) furnace->setCustomName(packet->title);
|
if (packet->customName) furnace->setCustomName(packet->title);
|
||||||
if(player->openFurnace(furnace))
|
if(player->openFurnace(furnace))
|
||||||
{
|
{
|
||||||
|
|
@ -2935,7 +2948,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
break;
|
break;
|
||||||
case ContainerOpenPacket::BREWING_STAND:
|
case ContainerOpenPacket::BREWING_STAND:
|
||||||
{
|
{
|
||||||
shared_ptr<BrewingStandTileEntity> brewingStand = shared_ptr<BrewingStandTileEntity>(new BrewingStandTileEntity());
|
shared_ptr<BrewingStandTileEntity> brewingStand = std::make_shared<BrewingStandTileEntity>();
|
||||||
if (packet->customName) brewingStand->setCustomName(packet->title);
|
if (packet->customName) brewingStand->setCustomName(packet->title);
|
||||||
|
|
||||||
if( player->openBrewingStand(brewingStand))
|
if( player->openBrewingStand(brewingStand))
|
||||||
|
|
@ -2950,7 +2963,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
break;
|
break;
|
||||||
case ContainerOpenPacket::DROPPER:
|
case ContainerOpenPacket::DROPPER:
|
||||||
{
|
{
|
||||||
shared_ptr<DropperTileEntity> dropper = shared_ptr<DropperTileEntity>(new DropperTileEntity());
|
shared_ptr<DropperTileEntity> dropper = std::make_shared<DropperTileEntity>();
|
||||||
if (packet->customName) dropper->setCustomName(packet->title);
|
if (packet->customName) dropper->setCustomName(packet->title);
|
||||||
|
|
||||||
if( player->openTrap(dropper))
|
if( player->openTrap(dropper))
|
||||||
|
|
@ -2965,7 +2978,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
break;
|
break;
|
||||||
case ContainerOpenPacket::TRAP:
|
case ContainerOpenPacket::TRAP:
|
||||||
{
|
{
|
||||||
shared_ptr<DispenserTileEntity> dispenser = shared_ptr<DispenserTileEntity>(new DispenserTileEntity());
|
shared_ptr<DispenserTileEntity> dispenser = std::make_shared<DispenserTileEntity>();
|
||||||
if (packet->customName) dispenser->setCustomName(packet->title);
|
if (packet->customName) dispenser->setCustomName(packet->title);
|
||||||
|
|
||||||
if( player->openTrap(dispenser))
|
if( player->openTrap(dispenser))
|
||||||
|
|
@ -3004,7 +3017,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
break;
|
break;
|
||||||
case ContainerOpenPacket::TRADER_NPC:
|
case ContainerOpenPacket::TRADER_NPC:
|
||||||
{
|
{
|
||||||
shared_ptr<ClientSideMerchant> csm = shared_ptr<ClientSideMerchant>(new ClientSideMerchant(player, packet->title));
|
shared_ptr<ClientSideMerchant> csm = std::make_shared<ClientSideMerchant>(player, packet->title);
|
||||||
csm->createContainer();
|
csm->createContainer();
|
||||||
if(player->openTrading(csm, packet->customName ? packet->title : L""))
|
if(player->openTrading(csm, packet->customName ? packet->title : L""))
|
||||||
{
|
{
|
||||||
|
|
@ -3018,7 +3031,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
break;
|
break;
|
||||||
case ContainerOpenPacket::BEACON:
|
case ContainerOpenPacket::BEACON:
|
||||||
{
|
{
|
||||||
shared_ptr<BeaconTileEntity> beacon = shared_ptr<BeaconTileEntity>(new BeaconTileEntity());
|
shared_ptr<BeaconTileEntity> beacon = std::make_shared<BeaconTileEntity>();
|
||||||
if (packet->customName) beacon->setCustomName(packet->title);
|
if (packet->customName) beacon->setCustomName(packet->title);
|
||||||
|
|
||||||
if(player->openBeacon(beacon))
|
if(player->openBeacon(beacon))
|
||||||
|
|
@ -3056,7 +3069,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
iTitle = IDS_MULE;
|
iTitle = IDS_MULE;
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
if(player->openHorseInventory(dynamic_pointer_cast<EntityHorse>(entity), shared_ptr<AnimalChest>(new AnimalChest(iTitle, packet->title, packet->customName, packet->size))))
|
if(player->openHorseInventory(dynamic_pointer_cast<EntityHorse>(entity), std::make_shared<AnimalChest>(iTitle, packet->title, packet->customName, packet->size)))
|
||||||
{
|
{
|
||||||
player->containerMenu->containerId = packet->containerId;
|
player->containerMenu->containerId = packet->containerId;
|
||||||
}
|
}
|
||||||
|
|
@ -3091,7 +3104,7 @@ void ClientConnection::handleContainerOpen(shared_ptr<ContainerOpenPacket> packe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
send(shared_ptr<ContainerClosePacket>(new ContainerClosePacket(packet->containerId)));
|
send(std::make_shared<ContainerClosePacket>(packet->containerId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3144,7 +3157,7 @@ void ClientConnection::handleContainerAck(shared_ptr<ContainerAckPacket> packet)
|
||||||
{
|
{
|
||||||
if (!packet->accepted)
|
if (!packet->accepted)
|
||||||
{
|
{
|
||||||
send( shared_ptr<ContainerAckPacket>( new ContainerAckPacket(packet->containerId, packet->uid, true) ));
|
send(std::make_shared<ContainerAckPacket>(packet->containerId, packet->uid, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3171,7 +3184,7 @@ void ClientConnection::handleTileEditorOpen(shared_ptr<TileEditorOpenPacket> pac
|
||||||
}
|
}
|
||||||
else if (packet->editorType == TileEditorOpenPacket::SIGN)
|
else if (packet->editorType == TileEditorOpenPacket::SIGN)
|
||||||
{
|
{
|
||||||
shared_ptr<SignTileEntity> localSignDummy = shared_ptr<SignTileEntity>(new SignTileEntity());
|
shared_ptr<SignTileEntity> localSignDummy = std::make_shared<SignTileEntity>();
|
||||||
localSignDummy->setLevel(level);
|
localSignDummy->setLevel(level);
|
||||||
localSignDummy->x = packet->x;
|
localSignDummy->x = packet->x;
|
||||||
localSignDummy->y = packet->y;
|
localSignDummy->y = packet->y;
|
||||||
|
|
@ -3576,7 +3589,7 @@ void ClientConnection::displayPrivilegeChanges(shared_ptr<MultiplayerLocalPlayer
|
||||||
|
|
||||||
void ClientConnection::handleKeepAlive(shared_ptr<KeepAlivePacket> packet)
|
void ClientConnection::handleKeepAlive(shared_ptr<KeepAlivePacket> packet)
|
||||||
{
|
{
|
||||||
send(shared_ptr<KeepAlivePacket>(new KeepAlivePacket(packet->id)));
|
send(std::make_shared<KeepAlivePacket>(packet->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::handlePlayerAbilities(shared_ptr<PlayerAbilitiesPacket> playerAbilitiesPacket)
|
void ClientConnection::handlePlayerAbilities(shared_ptr<PlayerAbilitiesPacket> playerAbilitiesPacket)
|
||||||
|
|
|
||||||
|
|
@ -3843,11 +3843,6 @@ typedef void* ma_proc;
|
||||||
typedef ma_uint16 wchar_t;
|
typedef ma_uint16 wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define nullptr for some compilers. */
|
|
||||||
#ifndef nullptr
|
|
||||||
#define nullptr 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SIZE_MAX)
|
#if defined(SIZE_MAX)
|
||||||
#define MA_SIZE_MAX SIZE_MAX
|
#define MA_SIZE_MAX SIZE_MAX
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||||
#include "..\..\Minecraft.h"
|
#include "..\..\Minecraft.h"
|
||||||
#include "..\..\TexturePackRepository.h"
|
#include "..\..\TexturePackRepository.h"
|
||||||
|
#include "Common/UI/UI.h"
|
||||||
|
|
||||||
WCHAR *DLCManager::wchTypeNamesA[]=
|
WCHAR *DLCManager::wchTypeNamesA[]=
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container,
|
||||||
if(Item::items[m_itemId] != nullptr)
|
if(Item::items[m_itemId] != nullptr)
|
||||||
{
|
{
|
||||||
int quantity = std::min<int>(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
int quantity = std::min<int>(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
||||||
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
|
shared_ptr<ItemInstance> newItem = std::make_shared<ItemInstance>(m_itemId, quantity, m_auxValue);
|
||||||
newItem->set4JData(m_dataTag);
|
newItem->set4JData(m_dataTag);
|
||||||
|
|
||||||
for( auto& it : m_enchantments )
|
for( auto& it : m_enchantments )
|
||||||
|
|
|
||||||
|
|
@ -90,13 +90,21 @@ bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIns
|
||||||
if(quantityCollected >= m_quantity)
|
if(quantityCollected >= m_quantity)
|
||||||
{
|
{
|
||||||
setComplete(rule, true);
|
setComplete(rule, true);
|
||||||
app.DebugPrintf("Completed CollectItemRule with info - itemId:%d, auxValue:%d, quantity:%d, dataTag:%d\n", m_itemId,m_auxValue,m_quantity,m_4JDataValue);
|
app.DebugPrintf("Completed CollectItemRule with info - itemId:%d, auxValue:%d, quantity:%d, dataTag:%d\n", m_itemId, m_auxValue, m_quantity, m_4JDataValue);
|
||||||
|
|
||||||
if(rule->getConnection() != nullptr)
|
if (rule->getConnection() != nullptr)
|
||||||
{
|
{
|
||||||
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,nullptr,0)));
|
rule->getConnection()->send(std::make_shared<UpdateGameRuleProgressPacket>(
|
||||||
}
|
getActionType(),
|
||||||
}
|
this->m_descriptionId,
|
||||||
|
m_itemId,
|
||||||
|
m_auxValue,
|
||||||
|
this->m_4JDataValue,
|
||||||
|
nullptr,
|
||||||
|
static_cast<DWORD>(0)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return statusChanged;
|
return statusChanged;
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
||||||
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
||||||
m_lastRuleStatusChanged = nullptr;
|
m_lastRuleStatusChanged = nullptr;
|
||||||
}
|
}
|
||||||
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData))));
|
rule->getConnection()->send(std::make_shared<UpdateGameRuleProgressPacket>(getActionType(), this->m_descriptionId, icon, auxValue, 0, &data, sizeof(PacketData)));
|
||||||
}
|
}
|
||||||
app.DebugPrintf("Updated CompleteAllRule - Completed %d of %d\n", progress, goal);
|
app.DebugPrintf("Updated CompleteAllRule - Completed %d of %d\n", progress, goal);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -394,7 +394,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(minecraft->user->name) ) );
|
connection->send(std::make_shared<PreLoginPacket>(minecraft->user->name));
|
||||||
|
|
||||||
// Tick connection until we're ready to go. The stages involved in this are:
|
// Tick connection until we're ready to go. The stages involved in this are:
|
||||||
// (1) Creating the ClientConnection sends a prelogin packet to the server
|
// (1) Creating the ClientConnection sends a prelogin packet to the server
|
||||||
|
|
@ -481,7 +481,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
// Open the socket on the server end to accept incoming data
|
// Open the socket on the server end to accept incoming data
|
||||||
Socket::addIncomingSocket(socket);
|
Socket::addIncomingSocket(socket);
|
||||||
|
|
||||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(convStringToWstring( ProfileManager.GetGamertag(idx) )) ) );
|
connection->send(std::make_shared<PreLoginPacket>(convStringToWstring(ProfileManager.GetGamertag(idx))));
|
||||||
|
|
||||||
createdConnections.push_back( connection );
|
createdConnections.push_back( connection );
|
||||||
|
|
||||||
|
|
@ -1523,7 +1523,7 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
|
||||||
|
|
||||||
if( connection->createdOk )
|
if( connection->createdOk )
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket( pNetworkPlayer->GetOnlineName() ) ) );
|
connection->send(std::make_shared<PreLoginPacket>(pNetworkPlayer->GetOnlineName()));
|
||||||
pMinecraft->addPendingLocalConnection(idx, connection);
|
pMinecraft->addPendingLocalConnection(idx, connection);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ void ChangeStateConstraint::tick(int iPad)
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||||
if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr)
|
if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
player->connection->send(std::make_shared<PlayerInfoPacket>(player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +104,7 @@ void ChangeStateConstraint::tick(int iPad)
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||||
if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr)
|
if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
player->connection->send(std::make_shared<PlayerInfoPacket>(player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -128,7 +128,7 @@ void ChangeStateConstraint::tick(int iPad)
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||||
if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr)
|
if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
player->connection->send(std::make_shared<PlayerInfoPacket>(player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,11 @@
|
||||||
#include "ChoiceTask.h"
|
#include "ChoiceTask.h"
|
||||||
#include "..\..\..\Minecraft.World\Material.h"
|
#include "..\..\..\Minecraft.World\Material.h"
|
||||||
#include "..\..\Windows64\KeyboardMouseInput.h"
|
#include "..\..\Windows64\KeyboardMouseInput.h"
|
||||||
|
#include "Common/UI/UI.h"
|
||||||
|
|
||||||
ChoiceTask::ChoiceTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
ChoiceTask::ChoiceTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
||||||
int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/,
|
int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/,
|
||||||
eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
||||||
: TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false )
|
: TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false )
|
||||||
{
|
{
|
||||||
if(requiresUserInput == true)
|
if(requiresUserInput == true)
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,10 @@
|
||||||
#include "InfoTask.h"
|
#include "InfoTask.h"
|
||||||
#include "..\..\..\Minecraft.World\Material.h"
|
#include "..\..\..\Minecraft.World\Material.h"
|
||||||
#include "..\..\Windows64\KeyboardMouseInput.h"
|
#include "..\..\Windows64\KeyboardMouseInput.h"
|
||||||
|
#include "Common/UI/UI.h"
|
||||||
|
|
||||||
InfoTask::InfoTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
InfoTask::InfoTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
||||||
int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
||||||
: TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false )
|
: TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false )
|
||||||
{
|
{
|
||||||
if(requiresUserInput == true)
|
if(requiresUserInput == true)
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
#include "TutorialTasks.h"
|
#include "TutorialTasks.h"
|
||||||
#include "TutorialConstraints.h"
|
#include "TutorialConstraints.h"
|
||||||
#include "TutorialHints.h"
|
#include "TutorialHints.h"
|
||||||
|
#include "Common/UI/UI.h"
|
||||||
|
|
||||||
vector<int> Tutorial::s_completableTasks;
|
vector<int> Tutorial::s_completableTasks;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "IUIScene_AbstractContainerMenu.h"
|
#include "IUIScene_AbstractContainerMenu.h"
|
||||||
|
|
||||||
|
#include "UI.h"
|
||||||
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
|
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
|
||||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
||||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.crafting.h"
|
#include "..\..\..\Minecraft.World\net.minecraft.world.item.crafting.h"
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ void IUIScene_AnvilMenu::updateItemName()
|
||||||
ByteArrayOutputStream baos;
|
ByteArrayOutputStream baos;
|
||||||
DataOutputStream dos(&baos);
|
DataOutputStream dos(&baos);
|
||||||
dos.writeUTF(m_itemName);
|
dos.writeUTF(m_itemName);
|
||||||
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray())));
|
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(std::make_shared<CustomPayloadPacket>(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items)
|
void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items)
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ void IUIScene_BeaconMenu::handleOtherClicked(int iPad, ESceneSection eSection, i
|
||||||
dos.writeInt(m_beacon->getPrimaryPower());
|
dos.writeInt(m_beacon->getPrimaryPower());
|
||||||
dos.writeInt(m_beacon->getSecondaryPower());
|
dos.writeInt(m_beacon->getSecondaryPower());
|
||||||
|
|
||||||
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(CustomPayloadPacket::SET_BEACON_PACKET, baos.toByteArray())));
|
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(std::make_shared<CustomPayloadPacket>(CustomPayloadPacket::SET_BEACON_PACKET, baos.toByteArray()));
|
||||||
|
|
||||||
if (m_beacon->getPrimaryPower() > 0)
|
if (m_beacon->getPrimaryPower() > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,6 @@ void IUIScene_CommandBlockMenu::ConfirmButtonClicked()
|
||||||
dos.writeInt(m_commandBlock->z);
|
dos.writeInt(m_commandBlock->z);
|
||||||
dos.writeUTF(GetCommand());
|
dos.writeUTF(GetCommand());
|
||||||
|
|
||||||
Minecraft::GetInstance()->localplayers[GetPad()]->connection->send(shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET, baos.toByteArray())));
|
Minecraft::GetInstance()->localplayers[GetPad()]->connection->send(std::make_shared<CustomPayloadPacket>(CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET, baos.toByteArray()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
#include "..\..\LocalPlayer.h"
|
#include "..\..\LocalPlayer.h"
|
||||||
#include "IUIScene_CraftingMenu.h"
|
#include "IUIScene_CraftingMenu.h"
|
||||||
|
|
||||||
|
#include "UI.h"
|
||||||
|
|
||||||
Recipy::_eGroupType IUIScene_CraftingMenu::m_GroupTypeMapping4GridA[IUIScene_CraftingMenu::m_iMaxGroup2x2]=
|
Recipy::_eGroupType IUIScene_CraftingMenu::m_GroupTypeMapping4GridA[IUIScene_CraftingMenu::m_iMaxGroup2x2]=
|
||||||
{
|
{
|
||||||
Recipy::eGroupType_Structure,
|
Recipy::eGroupType_Structure,
|
||||||
|
|
@ -293,7 +295,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
if (ingItemInst->getItem()->hasCraftingRemainingItem())
|
if (ingItemInst->getItem()->hasCraftingRemainingItem())
|
||||||
{
|
{
|
||||||
// replace item with remaining result
|
// replace item with remaining result
|
||||||
m_pPlayer->inventory->add( shared_ptr<ItemInstance>( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) );
|
m_pPlayer->inventory->add(std::make_shared<ItemInstance>(ingItemInst->getItem()->getCraftingRemainingItem()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1071,7 +1073,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
||||||
int iAuxVal=pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i];
|
int iAuxVal=pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i];
|
||||||
Item *item = Item::items[id];
|
Item *item = Item::items[id];
|
||||||
|
|
||||||
shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],iAuxVal));
|
shared_ptr<ItemInstance> itemInst= std::make_shared<ItemInstance>(item, pRecipeIngredientsRequired[iRecipe].iIngValA[i], iAuxVal);
|
||||||
|
|
||||||
// 4J-PB - a very special case - the bed can use any kind of wool, so we can't use the item description
|
// 4J-PB - a very special case - the bed can use any kind of wool, so we can't use the item description
|
||||||
// and the same goes for the painting
|
// and the same goes for the painting
|
||||||
|
|
@ -1156,7 +1158,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
||||||
{
|
{
|
||||||
iAuxVal = 1;
|
iAuxVal = 1;
|
||||||
}
|
}
|
||||||
shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(id,1,iAuxVal));
|
shared_ptr<ItemInstance> itemInst= std::make_shared<ItemInstance>(id, 1, iAuxVal);
|
||||||
setIngredientSlotItem(getPad(),index,itemInst);
|
setIngredientSlotItem(getPad(),index,itemInst);
|
||||||
// show the ingredients we don't have if we can't make the recipe
|
// show the ingredients we don't have if we can't make the recipe
|
||||||
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything))
|
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "IUIScene_CreativeMenu.h"
|
#include "IUIScene_CreativeMenu.h"
|
||||||
|
|
||||||
|
#include "UI.h"
|
||||||
#include "..\..\Minecraft.h"
|
#include "..\..\Minecraft.h"
|
||||||
#include "..\..\MultiplayerLocalPlayer.h"
|
#include "..\..\MultiplayerLocalPlayer.h"
|
||||||
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
|
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
|
||||||
|
|
@ -21,7 +22,6 @@ vector< shared_ptr<ItemInstance> > IUIScene_CreativeMenu::categoryGroups[eCreati
|
||||||
#define ITEM_AUX(id, aux) list->push_back( shared_ptr<ItemInstance>(new ItemInstance(id, 1, aux)) );
|
#define ITEM_AUX(id, aux) list->push_back( shared_ptr<ItemInstance>(new ItemInstance(id, 1, aux)) );
|
||||||
#define DEF(index) list = &categoryGroups[index];
|
#define DEF(index) list = &categoryGroups[index];
|
||||||
|
|
||||||
|
|
||||||
void IUIScene_CreativeMenu::staticCtor()
|
void IUIScene_CreativeMenu::staticCtor()
|
||||||
{
|
{
|
||||||
vector< shared_ptr<ItemInstance> > *list;
|
vector< shared_ptr<ItemInstance> > *list;
|
||||||
|
|
@ -495,7 +495,7 @@ void IUIScene_CreativeMenu::staticCtor()
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
if(app.DebugSettingsOn())
|
if(app.DebugSettingsOn())
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> debugSword = shared_ptr<ItemInstance>(new ItemInstance(Item::sword_diamond_Id, 1, 0));
|
shared_ptr<ItemInstance> debugSword = std::make_shared<ItemInstance>(Item::sword_diamond_Id, 1, 0);
|
||||||
debugSword->enchant( Enchantment::damageBonus, 50 );
|
debugSword->enchant( Enchantment::damageBonus, 50 );
|
||||||
debugSword->setHoverName(L"Sword of Debug");
|
debugSword->setHoverName(L"Sword of Debug");
|
||||||
list->push_back(debugSword);
|
list->push_back(debugSword);
|
||||||
|
|
@ -1362,7 +1362,7 @@ void IUIScene_CreativeMenu::BuildFirework(vector<shared_ptr<ItemInstance> > *lis
|
||||||
shared_ptr<ItemInstance> firework;
|
shared_ptr<ItemInstance> firework;
|
||||||
|
|
||||||
{
|
{
|
||||||
firework = shared_ptr<ItemInstance>( new ItemInstance(Item::fireworks) );
|
firework = std::make_shared<ItemInstance>(Item::fireworks);
|
||||||
CompoundTag *itemTag = new CompoundTag();
|
CompoundTag *itemTag = new CompoundTag();
|
||||||
CompoundTag *fireTag = new CompoundTag(FireworksItem::TAG_FIREWORKS);
|
CompoundTag *fireTag = new CompoundTag(FireworksItem::TAG_FIREWORKS);
|
||||||
ListTag<CompoundTag> *expTags = new ListTag<CompoundTag>(FireworksItem::TAG_EXPLOSIONS);
|
ListTag<CompoundTag> *expTags = new ListTag<CompoundTag>(FireworksItem::TAG_EXPLOSIONS);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@
|
||||||
#include "..\..\..\Minecraft.World\net.minecraft.world.entity.monster.h"
|
#include "..\..\..\Minecraft.World\net.minecraft.world.entity.monster.h"
|
||||||
#include "IUIScene_HUD.h"
|
#include "IUIScene_HUD.h"
|
||||||
|
|
||||||
|
#include "UI.h"
|
||||||
|
|
||||||
IUIScene_HUD::IUIScene_HUD()
|
IUIScene_HUD::IUIScene_HUD()
|
||||||
{
|
{
|
||||||
m_lastActiveSlot = -1;
|
m_lastActiveSlot = -1;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
#include "..\..\ClientConnection.h"
|
#include "..\..\ClientConnection.h"
|
||||||
#include "IUIScene_TradingMenu.h"
|
#include "IUIScene_TradingMenu.h"
|
||||||
|
|
||||||
|
#include "UI.h"
|
||||||
|
|
||||||
IUIScene_TradingMenu::IUIScene_TradingMenu()
|
IUIScene_TradingMenu::IUIScene_TradingMenu()
|
||||||
{
|
{
|
||||||
m_validOffersCount = 0;
|
m_validOffersCount = 0;
|
||||||
|
|
@ -95,7 +97,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a packet to the server
|
// Send a packet to the server
|
||||||
player->connection->send( shared_ptr<TradeItemPacket>( new TradeItemPacket(m_menu->containerId, actualShopItem) ) );
|
player->connection->send(std::make_shared<TradeItemPacket>(m_menu->containerId, actualShopItem));
|
||||||
|
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
@ -152,7 +154,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
||||||
ByteArrayOutputStream rawOutput;
|
ByteArrayOutputStream rawOutput;
|
||||||
DataOutputStream output(&rawOutput);
|
DataOutputStream output(&rawOutput);
|
||||||
output.writeInt(actualShopItem);
|
output.writeInt(actualShopItem);
|
||||||
Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
|
Minecraft::GetInstance()->getConnection(getPad())->send(std::make_shared<CustomPayloadPacket>(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return handled;
|
return handled;
|
||||||
|
|
@ -205,7 +207,7 @@ void IUIScene_TradingMenu::updateDisplay()
|
||||||
ByteArrayOutputStream rawOutput;
|
ByteArrayOutputStream rawOutput;
|
||||||
DataOutputStream output(&rawOutput);
|
DataOutputStream output(&rawOutput);
|
||||||
output.writeInt(firstValidTrade);
|
output.writeInt(firstValidTrade);
|
||||||
Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
|
Minecraft::GetInstance()->getConnection(getPad())->send(std::make_shared<CustomPayloadPacket>(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,3 +124,5 @@
|
||||||
#include "UIScene_EndPoem.h"
|
#include "UIScene_EndPoem.h"
|
||||||
#include "UIScene_EULA.h"
|
#include "UIScene_EULA.h"
|
||||||
#include "UIScene_NewUpdateMessage.h"
|
#include "UIScene_NewUpdateMessage.h"
|
||||||
|
|
||||||
|
extern ConsoleUIController ui;
|
||||||
|
|
@ -212,7 +212,7 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
|
||||||
if( icon != TUTORIAL_NO_ICON )
|
if( icon != TUTORIAL_NO_ICON )
|
||||||
{
|
{
|
||||||
m_iconIsFoil = false;
|
m_iconIsFoil = false;
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(icon,1,iAuxVal));
|
m_iconItem = std::make_shared<ItemInstance>(icon, 1, iAuxVal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -241,7 +241,7 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
|
||||||
{
|
{
|
||||||
iAuxVal = 0;
|
iAuxVal = 0;
|
||||||
}
|
}
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(iconId,1,iAuxVal));
|
m_iconItem = std::make_shared<ItemInstance>(iconId, 1, iAuxVal);
|
||||||
|
|
||||||
temp.replace(iconTagStartPos, iconEndPos - iconTagStartPos + closeTag.length(), L"");
|
temp.replace(iconTagStartPos, iconEndPos - iconTagStartPos + closeTag.length(), L"");
|
||||||
}
|
}
|
||||||
|
|
@ -250,63 +250,63 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
|
||||||
// remove any icon text
|
// remove any icon text
|
||||||
else if(temp.find(L"{*CraftingTableIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*CraftingTableIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::workBench_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Tile::workBench_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*SticksIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*SticksIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::stick_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Item::stick_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*PlanksIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*PlanksIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::wood_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Tile::wood_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*WoodenShovelIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*WoodenShovelIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::shovel_wood_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Item::shovel_wood_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*WoodenHatchetIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*WoodenHatchetIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::hatchet_wood_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Item::hatchet_wood_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*WoodenPickaxeIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*WoodenPickaxeIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::pickAxe_wood_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Item::pickAxe_wood_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*FurnaceIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*FurnaceIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::furnace_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Tile::furnace_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*WoodenDoorIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*WoodenDoorIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::door_wood,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Item::door_wood, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*TorchIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*TorchIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::torch_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Tile::torch_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*BoatIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*BoatIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::boat_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Item::boat_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*FishingRodIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*FishingRodIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Item::fishingRod_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*FishIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*FishIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::fish_raw_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Item::fish_raw_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*MinecartIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*MinecartIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::minecart_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Item::minecart_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*RailIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*RailIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::rail_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Tile::rail_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*PoweredRailIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*PoweredRailIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::goldenRail_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Tile::goldenRail_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*StructuresIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*StructuresIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
|
|
@ -320,7 +320,7 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*StoneIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*StoneIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::stone_Id,1,0));
|
m_iconItem = std::make_shared<ItemInstance>(Tile::stone_Id, 1, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "UIGroup.h"
|
#include "UIGroup.h"
|
||||||
|
|
||||||
|
#include "UI.h"
|
||||||
|
|
||||||
UIGroup::UIGroup(EUIGroup group, int iPad)
|
UIGroup::UIGroup(EUIGroup group, int iPad)
|
||||||
{
|
{
|
||||||
m_group = group;
|
m_group = group;
|
||||||
|
|
|
||||||
|
|
@ -389,21 +389,22 @@ void UIScene::loadMovie()
|
||||||
|
|
||||||
void UIScene::getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUseInfo &memoryInfo)
|
void UIScene::getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUseInfo &memoryInfo)
|
||||||
{
|
{
|
||||||
rrbool res;
|
rrbool res;
|
||||||
IggyMemoryUseInfo internalMemoryInfo;
|
IggyMemoryUseInfo internalMemoryInfo;
|
||||||
int internalIteration = 0;
|
int internalIteration = 0;
|
||||||
while(res = IggyDebugGetMemoryUseInfo ( swf ,
|
while (res = IggyDebugGetMemoryUseInfo(swf,
|
||||||
nullptr ,
|
0,
|
||||||
memoryInfo.subcategory ,
|
memoryInfo.subcategory,
|
||||||
memoryInfo.subcategory_stringlen ,
|
memoryInfo.subcategory_stringlen,
|
||||||
internalIteration ,
|
internalIteration,
|
||||||
&internalMemoryInfo ))
|
&internalMemoryInfo))
|
||||||
{
|
{
|
||||||
app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), internalMemoryInfo.subcategory_stringlen, internalMemoryInfo.subcategory,
|
app.DebugPrintf(app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n", moviePath.c_str(), internalMemoryInfo.subcategory_stringlen, internalMemoryInfo.subcategory,
|
||||||
internalMemoryInfo.static_allocation_bytes, internalMemoryInfo.static_allocation_count, internalMemoryInfo.dynamic_allocation_bytes, internalMemoryInfo.dynamic_allocation_count);
|
internalMemoryInfo.static_allocation_bytes, internalMemoryInfo.static_allocation_count, internalMemoryInfo.dynamic_allocation_bytes, internalMemoryInfo.dynamic_allocation_count);
|
||||||
++internalIteration;
|
++internalIteration;
|
||||||
if(internalMemoryInfo.subcategory_stringlen > memoryInfo.subcategory_stringlen) getDebugMemoryUseRecursive(moviePath, internalMemoryInfo);
|
if (internalMemoryInfo.subcategory_stringlen > memoryInfo.subcategory_stringlen)
|
||||||
}
|
getDebugMemoryUseRecursive(moviePath, internalMemoryInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
|
void UIScene::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
|
||||||
|
|
@ -416,7 +417,7 @@ void UIScene::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
|
||||||
__int64 sceneStatic = 0;
|
__int64 sceneStatic = 0;
|
||||||
__int64 sceneDynamic = 0;
|
__int64 sceneDynamic = 0;
|
||||||
while(res = IggyDebugGetMemoryUseInfo ( swf ,
|
while(res = IggyDebugGetMemoryUseInfo ( swf ,
|
||||||
nullptr ,
|
0 ,
|
||||||
"" ,
|
"" ,
|
||||||
0 ,
|
0 ,
|
||||||
iteration ,
|
iteration ,
|
||||||
|
|
|
||||||
|
|
@ -336,16 +336,16 @@ void UIScene_BeaconMenu::customDraw(IggyCustomDrawCallbackRegion *region)
|
||||||
switch(icon)
|
switch(icon)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
item = shared_ptr<ItemInstance>(new ItemInstance(Item::emerald) );
|
item = std::make_shared<ItemInstance>(Item::emerald);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
item = shared_ptr<ItemInstance>(new ItemInstance(Item::diamond) );
|
item = std::make_shared<ItemInstance>(Item::diamond);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
item = shared_ptr<ItemInstance>(new ItemInstance(Item::goldIngot) );
|
item = std::make_shared<ItemInstance>(Item::goldIngot);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
item = shared_ptr<ItemInstance>(new ItemInstance(Item::ironIngot) );
|
item = std::make_shared<ItemInstance>(Item::ironIngot);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void *_initData, UILayer *p
|
||||||
|
|
||||||
InventoryScreenInput *initData = static_cast<InventoryScreenInput *>(_initData);
|
InventoryScreenInput *initData = static_cast<InventoryScreenInput *>(_initData);
|
||||||
|
|
||||||
shared_ptr<SimpleContainer> creativeContainer = shared_ptr<SimpleContainer>(new SimpleContainer( 0, L"", false, TabSpec::MAX_SIZE ));
|
shared_ptr<SimpleContainer> creativeContainer = std::make_shared<SimpleContainer>(0, L"", false, TabSpec::MAX_SIZE);
|
||||||
itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory);
|
itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory);
|
||||||
|
|
||||||
Initialize( initData->iPad, itemPickerMenu, false, -1, eSectionInventoryCreativeUsing, eSectionInventoryCreativeMax, initData->bNavigateBack);
|
Initialize( initData->iPad, itemPickerMenu, false, -1, eSectionInventoryCreativeUsing, eSectionInventoryCreativeMax, initData->bNavigateBack);
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ void UIScene_DebugOverlay::customDraw(IggyCustomDrawCallbackRegion *region)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> item = shared_ptr<ItemInstance>( new ItemInstance(itemId,1,0) );
|
shared_ptr<ItemInstance> item = std::make_shared<ItemInstance>(itemId, 1, 0);
|
||||||
if(item != nullptr) customDrawSlotControl(region,m_iPad,item,1.0f,false,false);
|
if(item != nullptr) customDrawSlotControl(region,m_iPad,item,1.0f,false,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
#include "..\..\Minecraft.h"
|
#include "..\..\Minecraft.h"
|
||||||
#include "..\..\ProgressRenderer.h"
|
#include "..\..\ProgressRenderer.h"
|
||||||
|
|
||||||
|
|
||||||
UIScene_FullscreenProgress::UIScene_FullscreenProgress(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
UIScene_FullscreenProgress::UIScene_FullscreenProgress(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
||||||
{
|
{
|
||||||
// Setup all the Iggy references we need for this scene
|
// Setup all the Iggy references we need for this scene
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ void UIScene_InGameHostOptionsMenu::handleInput(int iPad, int key, bool repeat,
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
||||||
if(player->connection)
|
if(player->connection)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<ServerSettingsChangedPacket>( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions) ) );
|
player->connection->send(std::make_shared<ServerSettingsChangedPacket>(ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -448,7 +448,7 @@ int UIScene_InGameInfoMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage:
|
||||||
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
|
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
|
||||||
if(localPlayer->connection)
|
if(localPlayer->connection)
|
||||||
{
|
{
|
||||||
localPlayer->connection->send( shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
|
localPlayer->connection->send(std::make_shared<KickPlayerPacket>(smallId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
#include "..\..\ClientConnection.h"
|
#include "..\..\ClientConnection.h"
|
||||||
#include "..\..\..\Minecraft.World\net.minecraft.network.packet.h"
|
#include "..\..\..\Minecraft.World\net.minecraft.network.packet.h"
|
||||||
|
|
||||||
|
|
||||||
#define CHECKBOXES_TIMER_ID 0
|
#define CHECKBOXES_TIMER_ID 0
|
||||||
#define CHECKBOXES_TIMER_TIME 100
|
#define CHECKBOXES_TIMER_TIME 100
|
||||||
|
|
||||||
|
|
@ -405,7 +404,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
||||||
if(player->connection)
|
if(player->connection)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) );
|
player->connection->send(std::make_shared<PlayerInfoPacket>(m_networkSmallId, -1, m_playerPrivileges));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
navigateBack();
|
navigateBack();
|
||||||
|
|
@ -455,7 +454,7 @@ int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4
|
||||||
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
|
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
|
||||||
if(localPlayer->connection)
|
if(localPlayer->connection)
|
||||||
{
|
{
|
||||||
localPlayer->connection->send( shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
|
localPlayer->connection->send(std::make_shared<KickPlayerPacket>(smallId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game.
|
// Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game.
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@
|
||||||
// if the value is greater than 32000, it's an xzp icon that needs displayed, rather than the game icon
|
// if the value is greater than 32000, it's an xzp icon that needs displayed, rather than the game icon
|
||||||
const int UIScene_LeaderboardsMenu::TitleIcons[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][7] =
|
const int UIScene_LeaderboardsMenu::TitleIcons[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][7] =
|
||||||
{
|
{
|
||||||
{ UIControl_LeaderboardList::e_ICON_TYPE_WALKED, UIControl_LeaderboardList::e_ICON_TYPE_FALLEN, Item::minecart_Id, Item::boat_Id, nullptr },
|
{UIControl_LeaderboardList::e_ICON_TYPE_WALKED, UIControl_LeaderboardList::e_ICON_TYPE_FALLEN, Item::minecart_Id, Item::boat_Id, -1},
|
||||||
{ Tile::dirt_Id, Tile::cobblestone_Id, Tile::sand_Id, Tile::stone_Id, Tile::gravel_Id, Tile::clay_Id, Tile::obsidian_Id },
|
{Tile::dirt_Id, Tile::cobblestone_Id, Tile::sand_Id, Tile::stone_Id, Tile::gravel_Id, Tile::clay_Id, Tile::obsidian_Id},
|
||||||
{ Item::egg_Id, Item::wheat_Id, Tile::mushroom_brown_Id, Tile::reeds_Id, Item::bucket_milk_Id, Tile::pumpkin_Id, nullptr },
|
{Item::egg_Id, Item::wheat_Id, Tile::mushroom_brown_Id, Tile::reeds_Id, Item::bucket_milk_Id, Tile::pumpkin_Id, -1},
|
||||||
{ UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIE, UIControl_LeaderboardList::e_ICON_TYPE_SKELETON, UIControl_LeaderboardList::e_ICON_TYPE_CREEPER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDERJOKEY, UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIEPIGMAN, UIControl_LeaderboardList::e_ICON_TYPE_SLIME },
|
{UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIE, UIControl_LeaderboardList::e_ICON_TYPE_SKELETON, UIControl_LeaderboardList::e_ICON_TYPE_CREEPER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDERJOKEY, UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIEPIGMAN, UIControl_LeaderboardList::e_ICON_TYPE_SLIME},
|
||||||
};
|
};
|
||||||
const UIScene_LeaderboardsMenu::LeaderboardDescriptor UIScene_LeaderboardsMenu::LEADERBOARD_DESCRIPTORS[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][4] = {
|
const UIScene_LeaderboardsMenu::LeaderboardDescriptor UIScene_LeaderboardsMenu::LEADERBOARD_DESCRIPTORS[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][4] = {
|
||||||
{
|
{
|
||||||
|
|
@ -971,7 +971,7 @@ void UIScene_LeaderboardsMenu::customDraw(IggyCustomDrawCallbackRegion *region)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> item = shared_ptr<ItemInstance>( new ItemInstance(TitleIcons[m_currentLeaderboard][slotId], 1, 0) );
|
shared_ptr<ItemInstance> item = std::make_shared<ItemInstance>(TitleIcons[m_currentLeaderboard][slotId], 1, 0);
|
||||||
customDrawSlotControl(region,m_iPad,item,1.0f,false,false);
|
customDrawSlotControl(region,m_iPad,item,1.0f,false,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ void UIScene_SignEntryMenu::tick()
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
||||||
if(player != nullptr && player->connection && player->connection->isStarted())
|
if(player != nullptr && player->connection && player->connection->isStarted())
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<SignUpdatePacket>( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) );
|
player->connection->send(std::make_shared<SignUpdatePacket>(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ui.CloseUIScenes(m_iPad);
|
ui.CloseUIScenes(m_iPad);
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa
|
||||||
{
|
{
|
||||||
HXUIDC hDC = pRenderData->hDC;
|
HXUIDC hDC = pRenderData->hDC;
|
||||||
CXuiControl xuiControl(m_hObj);
|
CXuiControl xuiControl(m_hObj);
|
||||||
if(m_item == nullptr) m_item = shared_ptr<ItemInstance>( new ItemInstance(m_iID, m_iCount, m_iAuxVal) );
|
if(m_item == nullptr) m_item = std::make_shared<ItemInstance>(m_iID, m_iCount, m_iAuxVal);
|
||||||
|
|
||||||
// build and render with the game call
|
// build and render with the game call
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ HRESULT CScene_DebugItemEditor::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfH
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
||||||
if(player != nullptr && player->connection) player->connection->send( shared_ptr<ContainerSetSlotPacket>( new ContainerSetSlotPacket(m_menu->containerId, m_slot->index, m_item) ) );
|
if(player != nullptr && player->connection) player->connection->send(std::make_shared<ContainerSetSlotPacket>(m_menu->containerId, m_slot->index, m_item));
|
||||||
}
|
}
|
||||||
// kill the crafting xui
|
// kill the crafting xui
|
||||||
app.NavigateBack(m_iPad);
|
app.NavigateBack(m_iPad);
|
||||||
|
|
@ -76,7 +76,7 @@ HRESULT CScene_DebugItemEditor::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfH
|
||||||
|
|
||||||
HRESULT CScene_DebugItemEditor::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled)
|
HRESULT CScene_DebugItemEditor::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled)
|
||||||
{
|
{
|
||||||
if(m_item == nullptr) m_item = shared_ptr<ItemInstance>( new ItemInstance(0,1,0) );
|
if(m_item == nullptr) m_item = std::make_shared<ItemInstance>(0, 1, 0);
|
||||||
if(hObjSource == m_itemId)
|
if(hObjSource == m_itemId)
|
||||||
{
|
{
|
||||||
int id = 0;
|
int id = 0;
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ HRESULT CScene_InGameHostOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& r
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
||||||
if(player != nullptr && player->connection)
|
if(player != nullptr && player->connection)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<ServerSettingsChangedPacket>( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions) ) );
|
player->connection->send(std::make_shared<ServerSettingsChangedPacket>(ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -529,7 +529,7 @@ int CScene_InGameInfo::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMes
|
||||||
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
|
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
|
||||||
if(localPlayer != nullptr && localPlayer->connection)
|
if(localPlayer != nullptr && localPlayer->connection)
|
||||||
{
|
{
|
||||||
localPlayer->connection->send( shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
|
localPlayer->connection->send(std::make_shared<KickPlayerPacket>(smallId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ HRESULT CScene_InGamePlayerOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL&
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
||||||
if(player != nullptr && player->connection)
|
if(player != nullptr && player->connection)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) );
|
player->connection->send(std::make_shared<PlayerInfoPacket>(m_networkSmallId, -1, m_playerPrivileges));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -339,7 +339,7 @@ int CScene_InGamePlayerOptions::KickPlayerReturned(void *pParam,int iPad,C4JStor
|
||||||
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
|
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
|
||||||
if(localPlayer != nullptr && localPlayer->connection)
|
if(localPlayer != nullptr && localPlayer->connection)
|
||||||
{
|
{
|
||||||
localPlayer->connection->send( shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
|
localPlayer->connection->send(std::make_shared<KickPlayerPacket>(smallId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game.
|
// Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game.
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ HRESULT CXuiSceneInventoryCreative::OnInit( XUIMessageInit *pInitData, BOOL &bHa
|
||||||
initData->player->awardStat(GenericStats::openInventory(), GenericStats::param_noArgs());
|
initData->player->awardStat(GenericStats::openInventory(), GenericStats::param_noArgs());
|
||||||
|
|
||||||
// 4J JEV - Item Picker Menu
|
// 4J JEV - Item Picker Menu
|
||||||
shared_ptr<SimpleContainer> creativeContainer = shared_ptr<SimpleContainer>(new SimpleContainer( 0, TabSpec::MAX_SIZE + 9 ));
|
shared_ptr<SimpleContainer> creativeContainer = std::make_shared<SimpleContainer>(0, TabSpec::MAX_SIZE + 9);
|
||||||
itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory);
|
itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory);
|
||||||
|
|
||||||
// 4J JEV - InitDataAssociations.
|
// 4J JEV - InitDataAssociations.
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ HRESULT CScene_SignEntry::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* p
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[pNotifyPressData->UserIndex];
|
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[pNotifyPressData->UserIndex];
|
||||||
if(player != nullptr && player->connection && player->connection->isStarted())
|
if(player != nullptr && player->connection && player->connection->isStarted())
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<SignUpdatePacket>( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) );
|
player->connection->send(std::make_shared<SignUpdatePacket>(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
app.CloseXuiScenes(pNotifyPressData->UserIndex);
|
app.CloseXuiScenes(pNotifyPressData->UserIndex);
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS
|
||||||
if( icon != TUTORIAL_NO_ICON )
|
if( icon != TUTORIAL_NO_ICON )
|
||||||
{
|
{
|
||||||
bool itemIsFoil = false;
|
bool itemIsFoil = false;
|
||||||
itemIsFoil = (shared_ptr<ItemInstance>(new ItemInstance(icon,1,iAuxVal)))->isFoil();
|
itemIsFoil = (std::make_shared<ItemInstance>(icon, 1, iAuxVal))->isFoil();
|
||||||
if(!itemIsFoil) itemIsFoil = isFoil;
|
if(!itemIsFoil) itemIsFoil = isFoil;
|
||||||
|
|
||||||
m_pCraftingPic->SetIcon(m_iPad, icon,iAuxVal,1,10,31,false,itemIsFoil);
|
m_pCraftingPic->SetIcon(m_iPad, icon,iAuxVal,1,10,31,false,itemIsFoil);
|
||||||
|
|
@ -322,7 +322,7 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS
|
||||||
}
|
}
|
||||||
|
|
||||||
bool itemIsFoil = false;
|
bool itemIsFoil = false;
|
||||||
itemIsFoil = (shared_ptr<ItemInstance>(new ItemInstance(iconId,1,iAuxVal)))->isFoil();
|
itemIsFoil = (std::make_shared<ItemInstance>(iconId, 1, iAuxVal))->isFoil();
|
||||||
if(!itemIsFoil) itemIsFoil = isFoil;
|
if(!itemIsFoil) itemIsFoil = isFoil;
|
||||||
|
|
||||||
m_pCraftingPic->SetIcon(m_iPad, iconId,iAuxVal,1,10,31,false,itemIsFoil);
|
m_pCraftingPic->SetIcon(m_iPad, iconId,iAuxVal,1,10,31,false,itemIsFoil);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ ConnectScreen::ConnectScreen(Minecraft *minecraft, const wstring& ip, int port)
|
||||||
// 4J - removed from separate thread, but need to investigate what we actually need here
|
// 4J - removed from separate thread, but need to investigate what we actually need here
|
||||||
connection = new ClientConnection(minecraft, ip, port);
|
connection = new ClientConnection(minecraft, ip, port);
|
||||||
if (aborted) return;
|
if (aborted) return;
|
||||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(minecraft->user->name) ) );
|
connection->send(std::make_shared<PreLoginPacket>(minecraft->user->name));
|
||||||
#else
|
#else
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include "Common\DLC\DLCLocalisationFile.h"
|
#include "Common\DLC\DLCLocalisationFile.h"
|
||||||
#include "..\Minecraft.World\StringHelpers.h"
|
#include "..\Minecraft.World\StringHelpers.h"
|
||||||
#include "StringTable.h"
|
#include "StringTable.h"
|
||||||
|
#include "Common/UI/UI.h"
|
||||||
#include "Common\DLC\DLCAudioFile.h"
|
#include "Common\DLC\DLCAudioFile.h"
|
||||||
|
|
||||||
#if defined _XBOX || defined _WINDOWS64
|
#if defined _XBOX || defined _WINDOWS64
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ EntityTileRenderer *EntityTileRenderer::instance = new EntityTileRenderer;
|
||||||
|
|
||||||
EntityTileRenderer::EntityTileRenderer()
|
EntityTileRenderer::EntityTileRenderer()
|
||||||
{
|
{
|
||||||
chest = shared_ptr<ChestTileEntity>(new ChestTileEntity());
|
chest = std::make_shared<ChestTileEntity>();
|
||||||
trappedChest = shared_ptr<ChestTileEntity>(new ChestTileEntity(ChestTile::TYPE_TRAP));
|
trappedChest = std::make_shared<ChestTileEntity>(ChestTile::TYPE_TRAP);
|
||||||
enderChest = shared_ptr<EnderChestTileEntity>(new EnderChestTileEntity());
|
enderChest = std::make_shared<EnderChestTileEntity>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTileRenderer::render(Tile *tile, int data, float brightness, float alpha, bool setColor, bool useCompiled)
|
void EntityTileRenderer::render(Tile *tile, int data, float brightness, float alpha, bool setColor, bool useCompiled)
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ void EntityTracker::addEntity(shared_ptr<Entity> e, int range, int updateInterva
|
||||||
{
|
{
|
||||||
__debugbreak();
|
__debugbreak();
|
||||||
}
|
}
|
||||||
shared_ptr<TrackedEntity> te = shared_ptr<TrackedEntity>( new TrackedEntity(e, range, updateInterval, trackDeltas) );
|
shared_ptr<TrackedEntity> te = std::make_shared<TrackedEntity>(e, range, updateInterval, trackDeltas);
|
||||||
entities.insert(te);
|
entities.insert(te);
|
||||||
entityMap[e->entityId] = te;
|
entityMap[e->entityId] = te;
|
||||||
te->updatePlayers(this, &level->players);
|
te->updatePlayers(this, &level->players);
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ void FireworksParticles::FireworksStarter::tick()
|
||||||
float r = static_cast<float>((rgb & 0xff0000) >> 16) / 255.0f;
|
float r = static_cast<float>((rgb & 0xff0000) >> 16) / 255.0f;
|
||||||
float g = static_cast<float>((rgb & 0x00ff00) >> 8) / 255.0f;
|
float g = static_cast<float>((rgb & 0x00ff00) >> 8) / 255.0f;
|
||||||
float b = static_cast<float>((rgb & 0x0000ff) >> 0) / 255.0f;
|
float b = static_cast<float>((rgb & 0x0000ff) >> 0) / 255.0f;
|
||||||
shared_ptr<FireworksOverlayParticle> fireworksOverlayParticle = shared_ptr<FireworksOverlayParticle>(new FireworksParticles::FireworksOverlayParticle(level, x, y, z));
|
shared_ptr<FireworksOverlayParticle> fireworksOverlayParticle = std::make_shared<FireworksOverlayParticle>(level, x, y, z);
|
||||||
fireworksOverlayParticle->setColor(r, g, b);
|
fireworksOverlayParticle->setColor(r, g, b);
|
||||||
fireworksOverlayParticle->setAlpha(0.99f); // 4J added
|
fireworksOverlayParticle->setAlpha(0.99f); // 4J added
|
||||||
engine->add(fireworksOverlayParticle);
|
engine->add(fireworksOverlayParticle);
|
||||||
|
|
@ -224,7 +224,7 @@ bool FireworksParticles::FireworksStarter::isFarAwayFromCamera()
|
||||||
|
|
||||||
void FireworksParticles::FireworksStarter::createParticle(double x, double y, double z, double xa, double ya, double za, intArray rgbColors, intArray fadeColors, bool trail, bool flicker)
|
void FireworksParticles::FireworksStarter::createParticle(double x, double y, double z, double xa, double ya, double za, intArray rgbColors, intArray fadeColors, bool trail, bool flicker)
|
||||||
{
|
{
|
||||||
shared_ptr<FireworksSparkParticle> fireworksSparkParticle = shared_ptr<FireworksSparkParticle>(new FireworksSparkParticle(level, x, y, z, xa, ya, za, engine));
|
shared_ptr<FireworksSparkParticle> fireworksSparkParticle = std::make_shared<FireworksSparkParticle>(level, x, y, z, xa, ya, za, engine);
|
||||||
fireworksSparkParticle->setAlpha(0.99f);
|
fireworksSparkParticle->setAlpha(0.99f);
|
||||||
fireworksSparkParticle->setTrail(trail);
|
fireworksSparkParticle->setTrail(trail);
|
||||||
fireworksSparkParticle->setFlicker(flicker);
|
fireworksSparkParticle->setFlicker(flicker);
|
||||||
|
|
@ -433,7 +433,7 @@ void FireworksParticles::FireworksSparkParticle::tick()
|
||||||
|
|
||||||
if (trail && (age < lifetime / 2) && ((age + lifetime) % 2) == 0)
|
if (trail && (age < lifetime / 2) && ((age + lifetime) % 2) == 0)
|
||||||
{
|
{
|
||||||
shared_ptr<FireworksSparkParticle> fireworksSparkParticle = shared_ptr<FireworksSparkParticle>(new FireworksParticles::FireworksSparkParticle(level, x, y, z, 0, 0, 0, engine));
|
shared_ptr<FireworksSparkParticle> fireworksSparkParticle = std::make_shared<FireworksSparkParticle>(level, x, y, z, 0, 0, 0, engine);
|
||||||
fireworksSparkParticle->setAlpha(0.99f);
|
fireworksSparkParticle->setAlpha(0.99f);
|
||||||
fireworksSparkParticle->setColor(rCol, gCol, bCol);
|
fireworksSparkParticle->setColor(rCol, gCol, bCol);
|
||||||
fireworksSparkParticle->age = fireworksSparkParticle->lifetime / 2;
|
fireworksSparkParticle->age = fireworksSparkParticle->lifetime / 2;
|
||||||
|
|
|
||||||
|
|
@ -327,13 +327,14 @@ void GameRenderer::pick(float a)
|
||||||
else if (p != nullptr)
|
else if (p != nullptr)
|
||||||
{
|
{
|
||||||
double dd = from->distanceTo(p->pos);
|
double dd = from->distanceTo(p->pos);
|
||||||
if (e == mc->cameraTargetPlayer->riding != nullptr)
|
auto const riding = mc->cameraTargetPlayer->riding;
|
||||||
{
|
if (riding != nullptr && e == riding)
|
||||||
if (nearest == 0)
|
{
|
||||||
{
|
if (nearest == 0)
|
||||||
hovered = e;
|
{
|
||||||
}
|
hovered = e;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hovered = e;
|
hovered = e;
|
||||||
|
|
@ -1672,7 +1673,7 @@ void GameRenderer::tickRain()
|
||||||
{
|
{
|
||||||
if (Tile::tiles[t]->material == Material::lava)
|
if (Tile::tiles[t]->material == Material::lava)
|
||||||
{
|
{
|
||||||
mc->particleEngine->add( shared_ptr<SmokeParticle>( new SmokeParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0) ) );
|
mc->particleEngine->add(std::make_shared<SmokeParticle>(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1682,7 +1683,7 @@ void GameRenderer::tickRain()
|
||||||
rainPosY = y + 0.1f - Tile::tiles[t]->getShapeY0();
|
rainPosY = y + 0.1f - Tile::tiles[t]->getShapeY0();
|
||||||
rainPosZ = z + za;
|
rainPosZ = z + za;
|
||||||
}
|
}
|
||||||
mc->particleEngine->add( shared_ptr<WaterDropParticle>( new WaterDropParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za) ) );
|
mc->particleEngine->add(std::make_shared<WaterDropParticle>(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include "..\Minecraft.World\net.minecraft.world.h"
|
#include "..\Minecraft.World\net.minecraft.world.h"
|
||||||
#include "..\Minecraft.World\LevelChunk.h"
|
#include "..\Minecraft.World\LevelChunk.h"
|
||||||
#include "..\Minecraft.World\Biome.h"
|
#include "..\Minecraft.World\Biome.h"
|
||||||
|
#include "Common/UI/UI.h"
|
||||||
|
|
||||||
ResourceLocation Gui::PUMPKIN_BLUR_LOCATION = ResourceLocation(TN__BLUR__MISC_PUMPKINBLUR);
|
ResourceLocation Gui::PUMPKIN_BLUR_LOCATION = ResourceLocation(TN__BLUR__MISC_PUMPKINBLUR);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ void ItemFrameRenderer::drawItem(shared_ptr<ItemFrame> entity)
|
||||||
shared_ptr<ItemInstance> instance = entity->getItem();
|
shared_ptr<ItemInstance> instance = entity->getItem();
|
||||||
if (instance == nullptr) return;
|
if (instance == nullptr) return;
|
||||||
|
|
||||||
shared_ptr<ItemEntity> itemEntity = shared_ptr<ItemEntity>(new ItemEntity(entity->level, 0, 0, 0, instance));
|
shared_ptr<ItemEntity> itemEntity = std::make_shared<ItemEntity>(entity->level, 0, 0, 0, instance);
|
||||||
itemEntity->getItem()->count = 1;
|
itemEntity->getItem()->count = 1;
|
||||||
itemEntity->bobOffs = 0;
|
itemEntity->bobOffs = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2736,32 +2736,32 @@ shared_ptr<Particle> LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle
|
||||||
switch(eParticleType)
|
switch(eParticleType)
|
||||||
{
|
{
|
||||||
case eParticleType_hugeexplosion:
|
case eParticleType_hugeexplosion:
|
||||||
particle = shared_ptr<Particle>(new HugeExplosionSeedParticle(lev, x, y, z, xa, ya, za));
|
particle = std::make_shared<HugeExplosionSeedParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_largeexplode:
|
case eParticleType_largeexplode:
|
||||||
particle = shared_ptr<Particle>(new HugeExplosionParticle(textures, lev, x, y, z, xa, ya, za));
|
particle = std::make_shared<HugeExplosionParticle>(textures, lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_fireworksspark:
|
case eParticleType_fireworksspark:
|
||||||
particle = shared_ptr<Particle>(new FireworksParticles::FireworksSparkParticle(lev, x, y, z, xa, ya, za, mc->particleEngine));
|
particle = std::make_shared<FireworksParticles::FireworksSparkParticle>(lev, x, y, z, xa, ya, za, mc->particleEngine);
|
||||||
particle->setAlpha(0.99f);
|
particle->setAlpha(0.99f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eParticleType_bubble:
|
case eParticleType_bubble:
|
||||||
particle = shared_ptr<Particle>( new BubbleParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<BubbleParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eParticleType_suspended:
|
case eParticleType_suspended:
|
||||||
particle = shared_ptr<Particle>( new SuspendedParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<SuspendedParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_depthsuspend:
|
case eParticleType_depthsuspend:
|
||||||
particle = shared_ptr<Particle>( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<SuspendedTownParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_townaura:
|
case eParticleType_townaura:
|
||||||
particle = shared_ptr<Particle>( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<SuspendedTownParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_crit:
|
case eParticleType_crit:
|
||||||
{
|
{
|
||||||
shared_ptr<CritParticle2> critParticle2 = shared_ptr<CritParticle2>(new CritParticle2(lev, x, y, z, xa, ya, za));
|
shared_ptr<CritParticle2> critParticle2 = std::make_shared<CritParticle2>(lev, x, y, z, xa, ya, za);
|
||||||
critParticle2->CritParticle2PostConstructor();
|
critParticle2->CritParticle2PostConstructor();
|
||||||
particle = shared_ptr<Particle>( critParticle2 );
|
particle = shared_ptr<Particle>( critParticle2 );
|
||||||
// request from 343 to set pink for the needler in the Halo Texture Pack
|
// request from 343 to set pink for the needler in the Halo Texture Pack
|
||||||
|
|
@ -2787,7 +2787,7 @@ shared_ptr<Particle> LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle
|
||||||
break;
|
break;
|
||||||
case eParticleType_magicCrit:
|
case eParticleType_magicCrit:
|
||||||
{
|
{
|
||||||
shared_ptr<CritParticle2> critParticle2 = shared_ptr<CritParticle2>(new CritParticle2(lev, x, y, z, xa, ya, za));
|
shared_ptr<CritParticle2> critParticle2 = std::make_shared<CritParticle2>(lev, x, y, z, xa, ya, za);
|
||||||
critParticle2->CritParticle2PostConstructor();
|
critParticle2->CritParticle2PostConstructor();
|
||||||
particle = shared_ptr<Particle>(critParticle2);
|
particle = shared_ptr<Particle>(critParticle2);
|
||||||
particle->setColor(particle->getRedCol() * 0.3f, particle->getGreenCol() * 0.8f, particle->getBlueCol());
|
particle->setColor(particle->getRedCol() * 0.3f, particle->getGreenCol() * 0.8f, particle->getBlueCol());
|
||||||
|
|
@ -2795,7 +2795,7 @@ shared_ptr<Particle> LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eParticleType_smoke:
|
case eParticleType_smoke:
|
||||||
particle = shared_ptr<Particle>( new SmokeParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<SmokeParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_endportal: // 4J - Added.
|
case eParticleType_endportal: // 4J - Added.
|
||||||
{
|
{
|
||||||
|
|
@ -2809,103 +2809,103 @@ shared_ptr<Particle> LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eParticleType_mobSpell:
|
case eParticleType_mobSpell:
|
||||||
particle = shared_ptr<Particle>(new SpellParticle(lev, x, y, z, 0, 0, 0));
|
particle = std::make_shared<SpellParticle>(lev, x, y, z, 0, 0, 0);
|
||||||
particle->setColor(static_cast<float>(xa), static_cast<float>(ya), static_cast<float>(za));
|
particle->setColor(static_cast<float>(xa), static_cast<float>(ya), static_cast<float>(za));
|
||||||
break;
|
break;
|
||||||
case eParticleType_mobSpellAmbient:
|
case eParticleType_mobSpellAmbient:
|
||||||
particle = shared_ptr<SpellParticle>(new SpellParticle(lev, x, y, z, 0, 0, 0));
|
particle = std::make_shared<SpellParticle>(lev, x, y, z, 0, 0, 0);
|
||||||
particle->setAlpha(0.15f);
|
particle->setAlpha(0.15f);
|
||||||
particle->setColor(static_cast<float>(xa), static_cast<float>(ya), static_cast<float>(za));
|
particle->setColor(static_cast<float>(xa), static_cast<float>(ya), static_cast<float>(za));
|
||||||
break;
|
break;
|
||||||
case eParticleType_spell:
|
case eParticleType_spell:
|
||||||
particle = shared_ptr<Particle>( new SpellParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<SpellParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_witchMagic:
|
case eParticleType_witchMagic:
|
||||||
{
|
{
|
||||||
particle = shared_ptr<SpellParticle>(new SpellParticle(lev, x, y, z, xa, ya, za));
|
particle = std::make_shared<SpellParticle>(lev, x, y, z, xa, ya, za);
|
||||||
dynamic_pointer_cast<SpellParticle>(particle)->setBaseTex(9 * 16);
|
dynamic_pointer_cast<SpellParticle>(particle)->setBaseTex(9 * 16);
|
||||||
float randBrightness = lev->random->nextFloat() * 0.5f + 0.35f;
|
float randBrightness = lev->random->nextFloat() * 0.5f + 0.35f;
|
||||||
particle->setColor(1 * randBrightness, 0 * randBrightness, 1 * randBrightness);
|
particle->setColor(1 * randBrightness, 0 * randBrightness, 1 * randBrightness);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eParticleType_instantSpell:
|
case eParticleType_instantSpell:
|
||||||
particle = shared_ptr<Particle>(new SpellParticle(lev, x, y, z, xa, ya, za));
|
particle = std::make_shared<SpellParticle>(lev, x, y, z, xa, ya, za);
|
||||||
dynamic_pointer_cast<SpellParticle>(particle)->setBaseTex(9 * 16);
|
dynamic_pointer_cast<SpellParticle>(particle)->setBaseTex(9 * 16);
|
||||||
break;
|
break;
|
||||||
case eParticleType_note:
|
case eParticleType_note:
|
||||||
particle = shared_ptr<Particle>( new NoteParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<NoteParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_netherportal:
|
case eParticleType_netherportal:
|
||||||
particle = shared_ptr<Particle>( new NetherPortalParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<NetherPortalParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_ender:
|
case eParticleType_ender:
|
||||||
particle = shared_ptr<Particle>( new EnderParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<EnderParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_enchantmenttable:
|
case eParticleType_enchantmenttable:
|
||||||
particle = shared_ptr<Particle>(new EchantmentTableParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<EchantmentTableParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_explode:
|
case eParticleType_explode:
|
||||||
particle = shared_ptr<Particle>( new ExplodeParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<ExplodeParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_flame:
|
case eParticleType_flame:
|
||||||
particle = shared_ptr<Particle>( new FlameParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<FlameParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_lava:
|
case eParticleType_lava:
|
||||||
particle = shared_ptr<Particle>( new LavaParticle(lev, x, y, z) );
|
particle = std::make_shared<LavaParticle>(lev, x, y, z);
|
||||||
break;
|
break;
|
||||||
case eParticleType_footstep:
|
case eParticleType_footstep:
|
||||||
particle = shared_ptr<Particle>( new FootstepParticle(textures, lev, x, y, z) );
|
particle = std::make_shared<FootstepParticle>(textures, lev, x, y, z);
|
||||||
break;
|
break;
|
||||||
case eParticleType_splash:
|
case eParticleType_splash:
|
||||||
particle = shared_ptr<Particle>( new SplashParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<SplashParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_largesmoke:
|
case eParticleType_largesmoke:
|
||||||
particle = shared_ptr<Particle>( new SmokeParticle(lev, x, y, z, xa, ya, za, 2.5f) );
|
particle = std::make_shared<SmokeParticle>(lev, x, y, z, xa, ya, za, 2.5f);
|
||||||
break;
|
break;
|
||||||
case eParticleType_reddust:
|
case eParticleType_reddust:
|
||||||
particle = shared_ptr<Particle>( new RedDustParticle(lev, x, y, z, static_cast<float>(xa), static_cast<float>(ya), static_cast<float>(za)) );
|
particle = std::make_shared<RedDustParticle>(lev, x, y, z, static_cast<float>(xa), static_cast<float>(ya), static_cast<float>(za));
|
||||||
break;
|
break;
|
||||||
case eParticleType_snowballpoof:
|
case eParticleType_snowballpoof:
|
||||||
particle = shared_ptr<Particle>( new BreakingItemParticle(lev, x, y, z, Item::snowBall, textures) );
|
particle = std::make_shared<BreakingItemParticle>(lev, x, y, z, Item::snowBall, textures);
|
||||||
break;
|
break;
|
||||||
case eParticleType_dripWater:
|
case eParticleType_dripWater:
|
||||||
particle = shared_ptr<Particle>( new DripParticle(lev, x, y, z, Material::water) );
|
particle = std::make_shared<DripParticle>(lev, x, y, z, Material::water);
|
||||||
break;
|
break;
|
||||||
case eParticleType_dripLava:
|
case eParticleType_dripLava:
|
||||||
particle = shared_ptr<Particle>( new DripParticle(lev, x, y, z, Material::lava) );
|
particle = std::make_shared<DripParticle>(lev, x, y, z, Material::lava);
|
||||||
break;
|
break;
|
||||||
case eParticleType_snowshovel:
|
case eParticleType_snowshovel:
|
||||||
particle = shared_ptr<Particle>( new SnowShovelParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<SnowShovelParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_slime:
|
case eParticleType_slime:
|
||||||
particle = shared_ptr<Particle>( new BreakingItemParticle(lev, x, y, z, Item::slimeBall, textures));
|
particle = std::make_shared<BreakingItemParticle>(lev, x, y, z, Item::slimeBall, textures);
|
||||||
break;
|
break;
|
||||||
case eParticleType_heart:
|
case eParticleType_heart:
|
||||||
particle = shared_ptr<Particle>( new HeartParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<HeartParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
case eParticleType_angryVillager:
|
case eParticleType_angryVillager:
|
||||||
particle = shared_ptr<Particle>( new HeartParticle(lev, x, y + 0.5f, z, xa, ya, za) );
|
particle = std::make_shared<HeartParticle>(lev, x, y + 0.5f, z, xa, ya, za);
|
||||||
particle->setMiscTex(1 + 16 * 5);
|
particle->setMiscTex(1 + 16 * 5);
|
||||||
particle->setColor(1, 1, 1);
|
particle->setColor(1, 1, 1);
|
||||||
break;
|
break;
|
||||||
case eParticleType_happyVillager:
|
case eParticleType_happyVillager:
|
||||||
particle = shared_ptr<Particle>( new SuspendedTownParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<SuspendedTownParticle>(lev, x, y, z, xa, ya, za);
|
||||||
particle->setMiscTex(2 + 16 * 5);
|
particle->setMiscTex(2 + 16 * 5);
|
||||||
particle->setColor(1, 1, 1);
|
particle->setColor(1, 1, 1);
|
||||||
break;
|
break;
|
||||||
case eParticleType_dragonbreath:
|
case eParticleType_dragonbreath:
|
||||||
particle = shared_ptr<Particle>( new DragonBreathParticle(lev, x, y, z, xa, ya, za) );
|
particle = std::make_shared<DragonBreathParticle>(lev, x, y, z, xa, ya, za);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if( ( eParticleType >= eParticleType_iconcrack_base ) && ( eParticleType <= eParticleType_iconcrack_last ) )
|
if( ( eParticleType >= eParticleType_iconcrack_base ) && ( eParticleType <= eParticleType_iconcrack_last ) )
|
||||||
{
|
{
|
||||||
int id = PARTICLE_CRACK_ID(eParticleType), data = PARTICLE_CRACK_DATA(eParticleType);
|
int id = PARTICLE_CRACK_ID(eParticleType), data = PARTICLE_CRACK_DATA(eParticleType);
|
||||||
particle = shared_ptr<Particle>(new BreakingItemParticle(lev, x, y, z, xa, ya, za, Item::items[id], textures, data));
|
particle = std::make_shared<BreakingItemParticle>(lev, x, y, z, xa, ya, za, Item::items[id], textures, data);
|
||||||
}
|
}
|
||||||
else if( ( eParticleType >= eParticleType_tilecrack_base ) && ( eParticleType <= eParticleType_tilecrack_last ) )
|
else if( ( eParticleType >= eParticleType_tilecrack_base ) && ( eParticleType <= eParticleType_tilecrack_last ) )
|
||||||
{
|
{
|
||||||
int id = PARTICLE_CRACK_ID(eParticleType), data = PARTICLE_CRACK_DATA(eParticleType);
|
int id = PARTICLE_CRACK_ID(eParticleType), data = PARTICLE_CRACK_DATA(eParticleType);
|
||||||
particle = dynamic_pointer_cast<Particle>( shared_ptr<TerrainParticle>(new TerrainParticle(lev, x, y, z, xa, ya, za, Tile::tiles[id], 0, data, textures))->init(data) );
|
particle = dynamic_pointer_cast<Particle>(std::make_shared<TerrainParticle>(lev, x, y, z, xa, ya, za, Tile::tiles[id], 0, data, textures)->init(data) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ void LivingEntityRenderer::renderArrows(shared_ptr<LivingEntity> mob, float a)
|
||||||
int arrowCount = mob->getArrowCount();
|
int arrowCount = mob->getArrowCount();
|
||||||
if (arrowCount > 0)
|
if (arrowCount > 0)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> arrow = shared_ptr<Entity>(new Arrow(mob->level, mob->x, mob->y, mob->z));
|
shared_ptr<Entity> arrow = std::make_shared<Arrow>(mob->level, mob->x, mob->y, mob->z);
|
||||||
Random random = Random(mob->entityId);
|
Random random = Random(mob->entityId);
|
||||||
Lighting::turnOff();
|
Lighting::turnOff();
|
||||||
for (int i = 0; i < arrowCount; i++)
|
for (int i = 0; i < arrowCount; i++)
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
#ifndef _DURANGO
|
#ifndef _DURANGO
|
||||||
#include "..\Minecraft.World\CommonStats.h"
|
#include "..\Minecraft.World\CommonStats.h"
|
||||||
#endif
|
#endif
|
||||||
|
extern ConsoleUIController ui;
|
||||||
|
|
||||||
|
|
||||||
LocalPlayer::LocalPlayer(Minecraft *minecraft, Level *level, User *user, int dimension) : Player(level, user->name)
|
LocalPlayer::LocalPlayer(Minecraft *minecraft, Level *level, User *user, int dimension) : Player(level, user->name)
|
||||||
|
|
@ -705,21 +705,21 @@ bool LocalPlayer::openTrading(shared_ptr<Merchant> traderTarget, const wstring &
|
||||||
|
|
||||||
void LocalPlayer::crit(shared_ptr<Entity> e)
|
void LocalPlayer::crit(shared_ptr<Entity> e)
|
||||||
{
|
{
|
||||||
shared_ptr<CritParticle> critParticle = shared_ptr<CritParticle>( new CritParticle((Level *)minecraft->level, e) );
|
shared_ptr<CritParticle> critParticle = std::make_shared<CritParticle>(reinterpret_cast<Level*>(minecraft->level), e);
|
||||||
critParticle->CritParticlePostConstructor();
|
critParticle->CritParticlePostConstructor();
|
||||||
minecraft->particleEngine->add(critParticle);
|
minecraft->particleEngine->add(critParticle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::magicCrit(shared_ptr<Entity> e)
|
void LocalPlayer::magicCrit(shared_ptr<Entity> e)
|
||||||
{
|
{
|
||||||
shared_ptr<CritParticle> critParticle = shared_ptr<CritParticle>( new CritParticle((Level *)minecraft->level, e, eParticleType_magicCrit) );
|
shared_ptr<CritParticle> critParticle = std::make_shared<CritParticle>(reinterpret_cast<Level*>(minecraft->level), e, eParticleType_magicCrit);
|
||||||
critParticle->CritParticlePostConstructor();
|
critParticle->CritParticlePostConstructor();
|
||||||
minecraft->particleEngine->add(critParticle);
|
minecraft->particleEngine->add(critParticle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::take(shared_ptr<Entity> e, int orgCount)
|
void LocalPlayer::take(shared_ptr<Entity> e, int orgCount)
|
||||||
{
|
{
|
||||||
minecraft->particleEngine->add( shared_ptr<TakeAnimationParticle>( new TakeAnimationParticle((Level *)minecraft->level, e, shared_from_this(), -0.5f) ) );
|
minecraft->particleEngine->add(std::make_shared<TakeAnimationParticle>(reinterpret_cast<Level*>(minecraft->level), e, shared_from_this(), -0.5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::chat(const wstring& message)
|
void LocalPlayer::chat(const wstring& message)
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,8 @@ int Minecraft::frameTimePos = 0;
|
||||||
__int64 Minecraft::warezTime = 0;
|
__int64 Minecraft::warezTime = 0;
|
||||||
File Minecraft::workDir = File(L"");
|
File Minecraft::workDir = File(L"");
|
||||||
|
|
||||||
|
extern ConsoleUIController ui;
|
||||||
|
|
||||||
#ifdef __PSVITA__
|
#ifdef __PSVITA__
|
||||||
|
|
||||||
TOUCHSCREENRECT QuickSelectRect[3]=
|
TOUCHSCREENRECT QuickSelectRect[3]=
|
||||||
|
|
@ -932,7 +934,7 @@ bool Minecraft::addLocalPlayer(int idx)
|
||||||
if(success)
|
if(success)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Adding temp local player on pad %d\n", idx);
|
app.DebugPrintf("Adding temp local player on pad %d\n", idx);
|
||||||
localplayers[idx] = shared_ptr<MultiplayerLocalPlayer>( new MultiplayerLocalPlayer(this, level, user, nullptr ) );
|
localplayers[idx] = shared_ptr<MultiplayerLocalPlayer>(new MultiplayerLocalPlayer(this, level, user, nullptr));
|
||||||
localgameModes[idx] = nullptr;
|
localgameModes[idx] = nullptr;
|
||||||
|
|
||||||
updatePlayerViewportAssignments();
|
updatePlayerViewportAssignments();
|
||||||
|
|
@ -1131,7 +1133,7 @@ void Minecraft::removeLocalPlayerIdx(int idx)
|
||||||
}
|
}
|
||||||
else if( m_pendingLocalConnections[idx] != nullptr )
|
else if( m_pendingLocalConnections[idx] != nullptr )
|
||||||
{
|
{
|
||||||
m_pendingLocalConnections[idx]->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );;
|
m_pendingLocalConnections[idx]->sendAndDisconnect(std::make_shared<DisconnectPacket>(DisconnectPacket::eDisconnect_Quitting));;
|
||||||
delete m_pendingLocalConnections[idx];
|
delete m_pendingLocalConnections[idx];
|
||||||
m_pendingLocalConnections[idx] = nullptr;
|
m_pendingLocalConnections[idx] = nullptr;
|
||||||
g_NetworkManager.RemoveLocalPlayerByUserIndex(idx);
|
g_NetworkManager.RemoveLocalPlayerByUserIndex(idx);
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
|
||||||
wstring message = L"[Server] " + JoinConsoleCommandTokens(tokens, 1);
|
wstring message = L"[Server] " + JoinConsoleCommandTokens(tokens, 1);
|
||||||
if (playerList != nullptr)
|
if (playerList != nullptr)
|
||||||
{
|
{
|
||||||
playerList->broadcastAll(shared_ptr<ChatPacket>(new ChatPacket(message)));
|
playerList->broadcastAll(std::make_shared<ChatPacket>(message));
|
||||||
}
|
}
|
||||||
server->info(message);
|
server->info(message);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -904,7 +904,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||||
levelChunksNeedConverted = true;
|
levelChunksNeedConverted = true;
|
||||||
pSave->ConvertToLocalPlatform(); // check if we need to convert this file from PS3->PS4
|
pSave->ConvertToLocalPlatform(); // check if we need to convert this file from PS3->PS4
|
||||||
|
|
||||||
storage = shared_ptr<McRegionLevelStorage>(new McRegionLevelStorage(pSave, File(L"."), name, true));
|
storage = std::make_shared<McRegionLevelStorage>(pSave, File(L"."), name, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -931,7 +931,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
|
||||||
|
|
||||||
storage = shared_ptr<McRegionLevelStorage>(new McRegionLevelStorage(newFormatSave, File(L"."), name, true));
|
storage = shared_ptr<McRegionLevelStorage>(new McRegionLevelStorage(newFormatSave, File(L"."), name, true));
|
||||||
#else
|
#else
|
||||||
storage = shared_ptr<McRegionLevelStorage>(new McRegionLevelStorage(new ConsoleSaveFileOriginal( L"" ), File(L"."), name, true));
|
storage = std::make_shared<McRegionLevelStorage>(new ConsoleSaveFileOriginal(L""), File(L"."), name, true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1885,7 +1885,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
||||||
players->saveAll(Minecraft::GetInstance()->progressRenderer);
|
players->saveAll(Minecraft::GetInstance()->progressRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
players->broadcastAll( shared_ptr<UpdateProgressPacket>( new UpdateProgressPacket(20) ) );
|
players->broadcastAll(std::make_shared<UpdateProgressPacket>(20));
|
||||||
|
|
||||||
for (unsigned int j = 0; j < levels.length; j++)
|
for (unsigned int j = 0; j < levels.length; j++)
|
||||||
{
|
{
|
||||||
|
|
@ -1896,7 +1896,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
||||||
ServerLevel *level = levels[levels.length - 1 - j];
|
ServerLevel *level = levels[levels.length - 1 - j];
|
||||||
level->save(true, Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame));
|
level->save(true, Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame));
|
||||||
|
|
||||||
players->broadcastAll( shared_ptr<UpdateProgressPacket>( new UpdateProgressPacket(33 + (j*33) ) ) );
|
players->broadcastAll(std::make_shared<UpdateProgressPacket>(33 + (j * 33)));
|
||||||
}
|
}
|
||||||
if( !s_bServerHalted )
|
if( !s_bServerHalted )
|
||||||
{
|
{
|
||||||
|
|
@ -1911,7 +1911,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
||||||
{
|
{
|
||||||
shared_ptr<ServerPlayer> player = players->players.at(0);
|
shared_ptr<ServerPlayer> player = players->players.at(0);
|
||||||
size_t id = (size_t) param;
|
size_t id = (size_t) param;
|
||||||
player->drop( shared_ptr<ItemInstance>( new ItemInstance(id, 1, 0 ) ) );
|
player->drop(std::make_shared<ItemInstance>(id, 1, 0));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_SpawnMob:
|
case eXuiServerAction_SpawnMob:
|
||||||
|
|
@ -1946,14 +1946,14 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_ServerSettingChanged_Gamertags:
|
case eXuiServerAction_ServerSettingChanged_Gamertags:
|
||||||
players->broadcastAll( shared_ptr<ServerSettingsChangedPacket>( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_OPTIONS, app.GetGameHostOption(eGameHostOption_Gamertags)) ) );
|
players->broadcastAll(std::make_shared<ServerSettingsChangedPacket>(ServerSettingsChangedPacket::HOST_OPTIONS, app.GetGameHostOption(eGameHostOption_Gamertags)));
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_ServerSettingChanged_BedrockFog:
|
case eXuiServerAction_ServerSettingChanged_BedrockFog:
|
||||||
players->broadcastAll( shared_ptr<ServerSettingsChangedPacket>( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, app.GetGameHostOption(eGameHostOption_All)) ) );
|
players->broadcastAll(std::make_shared<ServerSettingsChangedPacket>(ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, app.GetGameHostOption(eGameHostOption_All)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eXuiServerAction_ServerSettingChanged_Difficulty:
|
case eXuiServerAction_ServerSettingChanged_Difficulty:
|
||||||
players->broadcastAll( shared_ptr<ServerSettingsChangedPacket>( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_DIFFICULTY, Minecraft::GetInstance()->options->difficulty) ) );
|
players->broadcastAll(std::make_shared<ServerSettingsChangedPacket>(ServerSettingsChangedPacket::HOST_DIFFICULTY, Minecraft::GetInstance()->options->difficulty));
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_ExportSchematic:
|
case eXuiServerAction_ExportSchematic:
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
|
|
@ -2054,14 +2054,14 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
|
||||||
|
|
||||||
void MinecraftServer::broadcastStartSavingPacket()
|
void MinecraftServer::broadcastStartSavingPacket()
|
||||||
{
|
{
|
||||||
players->broadcastAll( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::START_SAVING, 0) ) );;
|
players->broadcastAll(std::make_shared<GameEventPacket>(GameEventPacket::START_SAVING, 0));;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinecraftServer::broadcastStopSavingPacket()
|
void MinecraftServer::broadcastStopSavingPacket()
|
||||||
{
|
{
|
||||||
if( !s_bServerHalted )
|
if( !s_bServerHalted )
|
||||||
{
|
{
|
||||||
players->broadcastAll( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::STOP_SAVING, 0) ) );;
|
players->broadcastAll(std::make_shared<GameEventPacket>(GameEventPacket::STOP_SAVING, 0));;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2116,7 +2116,7 @@ void MinecraftServer::tick()
|
||||||
|
|
||||||
if (tickCount % 20 == 0)
|
if (tickCount % 20 == 0)
|
||||||
{
|
{
|
||||||
players->broadcastAll( shared_ptr<SetTimePacket>( new SetTimePacket(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT) ) ), level->dimension->id);
|
players->broadcastAll(std::make_shared<SetTimePacket>(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)), level->dimension->id);
|
||||||
}
|
}
|
||||||
// #ifndef __PS3__
|
// #ifndef __PS3__
|
||||||
static __int64 stc = 0;
|
static __int64 stc = 0;
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face)
|
||||||
// Skip if we just broke a block — prevents double-break on single clicks
|
// Skip if we just broke a block — prevents double-break on single clicks
|
||||||
if (destroyDelay > 0) return;
|
if (destroyDelay > 0) return;
|
||||||
|
|
||||||
connection->send(shared_ptr<PlayerActionPacket>( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) ));
|
connection->send(std::make_shared<PlayerActionPacket>(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face));
|
||||||
creativeDestroyBlock(minecraft, this, x, y, z, face);
|
creativeDestroyBlock(minecraft, this, x, y, z, face);
|
||||||
destroyDelay = 5;
|
destroyDelay = 5;
|
||||||
}
|
}
|
||||||
|
|
@ -137,9 +137,9 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face)
|
||||||
{
|
{
|
||||||
if (isDestroying)
|
if (isDestroying)
|
||||||
{
|
{
|
||||||
connection->send(shared_ptr<PlayerActionPacket>(new PlayerActionPacket(PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, yDestroyBlock, zDestroyBlock, face)));
|
connection->send(std::make_shared<PlayerActionPacket>(PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, yDestroyBlock, zDestroyBlock, face));
|
||||||
}
|
}
|
||||||
connection->send( shared_ptr<PlayerActionPacket>( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) ) );
|
connection->send(std::make_shared<PlayerActionPacket>(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face));
|
||||||
int t = minecraft->level->getTile(x, y, z);
|
int t = minecraft->level->getTile(x, y, z);
|
||||||
if (t > 0 && destroyProgress == 0) Tile::tiles[t]->attack(minecraft->level, x, y, z, minecraft->player);
|
if (t > 0 && destroyProgress == 0) Tile::tiles[t]->attack(minecraft->level, x, y, z, minecraft->player);
|
||||||
if (t > 0 &&
|
if (t > 0 &&
|
||||||
|
|
@ -169,7 +169,7 @@ void MultiPlayerGameMode::stopDestroyBlock()
|
||||||
{
|
{
|
||||||
if (isDestroying)
|
if (isDestroying)
|
||||||
{
|
{
|
||||||
connection->send(shared_ptr<PlayerActionPacket>(new PlayerActionPacket(PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, yDestroyBlock, zDestroyBlock, -1)));
|
connection->send(std::make_shared<PlayerActionPacket>(PlayerActionPacket::ABORT_DESTROY_BLOCK, xDestroyBlock, yDestroyBlock, zDestroyBlock, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
isDestroying = false;
|
isDestroying = false;
|
||||||
|
|
@ -193,7 +193,7 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face)
|
||||||
if (localPlayerMode->isCreative())
|
if (localPlayerMode->isCreative())
|
||||||
{
|
{
|
||||||
destroyDelay = 5;
|
destroyDelay = 5;
|
||||||
connection->send(shared_ptr<PlayerActionPacket>( new PlayerActionPacket(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face) ) );
|
connection->send(std::make_shared<PlayerActionPacket>(PlayerActionPacket::START_DESTROY_BLOCK, x, y, z, face));
|
||||||
creativeDestroyBlock(minecraft, this, x, y, z, face);
|
creativeDestroyBlock(minecraft, this, x, y, z, face);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -225,7 +225,7 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face)
|
||||||
if (destroyProgress >= 1)
|
if (destroyProgress >= 1)
|
||||||
{
|
{
|
||||||
isDestroying = false;
|
isDestroying = false;
|
||||||
connection->send( shared_ptr<PlayerActionPacket>( new PlayerActionPacket(PlayerActionPacket::STOP_DESTROY_BLOCK, x, y, z, face) ) );
|
connection->send(std::make_shared<PlayerActionPacket>(PlayerActionPacket::STOP_DESTROY_BLOCK, x, y, z, face));
|
||||||
destroyBlock(x, y, z, face);
|
destroyBlock(x, y, z, face);
|
||||||
destroyProgress = 0;
|
destroyProgress = 0;
|
||||||
destroyTicks = 0;
|
destroyTicks = 0;
|
||||||
|
|
@ -276,7 +276,7 @@ void MultiPlayerGameMode::ensureHasSentCarriedItem()
|
||||||
if (newItem != carriedItem)
|
if (newItem != carriedItem)
|
||||||
{
|
{
|
||||||
carriedItem = newItem;
|
carriedItem = newItem;
|
||||||
connection->send( shared_ptr<SetCarriedItemPacket>( new SetCarriedItemPacket(carriedItem) ) );
|
connection->send(std::make_shared<SetCarriedItemPacket>(carriedItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -379,7 +379,7 @@ bool MultiPlayerGameMode::useItemOn(shared_ptr<Player> player, Level *level, sha
|
||||||
// Fix for #7904 - Gameplay: Players can dupe torches by throwing them repeatedly into water.
|
// Fix for #7904 - Gameplay: Players can dupe torches by throwing them repeatedly into water.
|
||||||
if(!bTestUseOnly)
|
if(!bTestUseOnly)
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<UseItemPacket>( new UseItemPacket(x, y, z, face, player->inventory->getSelected(), clickX, clickY, clickZ) ) );
|
connection->send(std::make_shared<UseItemPacket>(x, y, z, face, player->inventory->getSelected(), clickX, clickY, clickZ));
|
||||||
}
|
}
|
||||||
return didSomething;
|
return didSomething;
|
||||||
}
|
}
|
||||||
|
|
@ -421,27 +421,27 @@ bool MultiPlayerGameMode::useItem(shared_ptr<Player> player, Level *level, share
|
||||||
|
|
||||||
if(!bTestUseOnly)
|
if(!bTestUseOnly)
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<UseItemPacket>( new UseItemPacket(-1, -1, -1, 255, player->inventory->getSelected(), 0, 0, 0) ) );
|
connection->send(std::make_shared<UseItemPacket>(-1, -1, -1, 255, player->inventory->getSelected(), 0, 0, 0));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<MultiplayerLocalPlayer> MultiPlayerGameMode::createPlayer(Level *level)
|
shared_ptr<MultiplayerLocalPlayer> MultiPlayerGameMode::createPlayer(Level *level)
|
||||||
{
|
{
|
||||||
return shared_ptr<MultiplayerLocalPlayer>( new MultiplayerLocalPlayer(minecraft, level, minecraft->user, connection) );
|
return std::make_shared<MultiplayerLocalPlayer>(minecraft, level, minecraft->user, connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiPlayerGameMode::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
|
void MultiPlayerGameMode::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
|
||||||
{
|
{
|
||||||
ensureHasSentCarriedItem();
|
ensureHasSentCarriedItem();
|
||||||
connection->send( shared_ptr<InteractPacket>( new InteractPacket(player->entityId, entity->entityId, InteractPacket::ATTACK) ) );
|
connection->send(std::make_shared<InteractPacket>(player->entityId, entity->entityId, InteractPacket::ATTACK));
|
||||||
player->attack(entity);
|
player->attack(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MultiPlayerGameMode::interact(shared_ptr<Player> player, shared_ptr<Entity> entity)
|
bool MultiPlayerGameMode::interact(shared_ptr<Player> player, shared_ptr<Entity> entity)
|
||||||
{
|
{
|
||||||
ensureHasSentCarriedItem();
|
ensureHasSentCarriedItem();
|
||||||
connection->send(shared_ptr<InteractPacket>( new InteractPacket(player->entityId, entity->entityId, InteractPacket::INTERACT) ) );
|
connection->send(std::make_shared<InteractPacket>(player->entityId, entity->entityId, InteractPacket::INTERACT));
|
||||||
return player->interact(entity);
|
return player->interact(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -450,21 +450,21 @@ shared_ptr<ItemInstance> MultiPlayerGameMode::handleInventoryMouseClick(int cont
|
||||||
short changeUid = player->containerMenu->backup(player->inventory);
|
short changeUid = player->containerMenu->backup(player->inventory);
|
||||||
|
|
||||||
shared_ptr<ItemInstance> clicked = player->containerMenu->clicked(slotNum, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, player);
|
shared_ptr<ItemInstance> clicked = player->containerMenu->clicked(slotNum, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, player);
|
||||||
connection->send( shared_ptr<ContainerClickPacket>( new ContainerClickPacket(containerId, slotNum, buttonNum, quickKeyHeld, clicked, changeUid) ) );
|
connection->send(std::make_shared<ContainerClickPacket>(containerId, slotNum, buttonNum, quickKeyHeld, clicked, changeUid));
|
||||||
|
|
||||||
return clicked;
|
return clicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiPlayerGameMode::handleInventoryButtonClick(int containerId, int buttonId)
|
void MultiPlayerGameMode::handleInventoryButtonClick(int containerId, int buttonId)
|
||||||
{
|
{
|
||||||
connection->send(shared_ptr<ContainerButtonClickPacket>( new ContainerButtonClickPacket(containerId, buttonId) ));
|
connection->send(std::make_shared<ContainerButtonClickPacket>(containerId, buttonId));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiPlayerGameMode::handleCreativeModeItemAdd(shared_ptr<ItemInstance> clicked, int slot)
|
void MultiPlayerGameMode::handleCreativeModeItemAdd(shared_ptr<ItemInstance> clicked, int slot)
|
||||||
{
|
{
|
||||||
if (localPlayerMode->isCreative())
|
if (localPlayerMode->isCreative())
|
||||||
{
|
{
|
||||||
connection->send(shared_ptr<SetCreativeModeSlotPacket>( new SetCreativeModeSlotPacket(slot, clicked) ) );
|
connection->send(std::make_shared<SetCreativeModeSlotPacket>(slot, clicked));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -472,14 +472,14 @@ void MultiPlayerGameMode::handleCreativeModeItemDrop(shared_ptr<ItemInstance> cl
|
||||||
{
|
{
|
||||||
if (localPlayerMode->isCreative() && clicked != nullptr)
|
if (localPlayerMode->isCreative() && clicked != nullptr)
|
||||||
{
|
{
|
||||||
connection->send(shared_ptr<SetCreativeModeSlotPacket>( new SetCreativeModeSlotPacket(-1, clicked) ) );
|
connection->send(std::make_shared<SetCreativeModeSlotPacket>(-1, clicked));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiPlayerGameMode::releaseUsingItem(shared_ptr<Player> player)
|
void MultiPlayerGameMode::releaseUsingItem(shared_ptr<Player> player)
|
||||||
{
|
{
|
||||||
ensureHasSentCarriedItem();
|
ensureHasSentCarriedItem();
|
||||||
connection->send(shared_ptr<PlayerActionPacket>( new PlayerActionPacket(PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 255) ) );
|
connection->send(std::make_shared<PlayerActionPacket>(PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 255));
|
||||||
player->releaseUsingItem();
|
player->releaseUsingItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -514,7 +514,7 @@ bool MultiPlayerGameMode::handleCraftItem(int recipe, shared_ptr<Player> player)
|
||||||
{
|
{
|
||||||
short changeUid = player->containerMenu->backup(player->inventory);
|
short changeUid = player->containerMenu->backup(player->inventory);
|
||||||
|
|
||||||
connection->send( shared_ptr<CraftItemPacket>( new CraftItemPacket(recipe, changeUid) ) );
|
connection->send(std::make_shared<CraftItemPacket>(recipe, changeUid));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -522,5 +522,5 @@ bool MultiPlayerGameMode::handleCraftItem(int recipe, shared_ptr<Player> player)
|
||||||
void MultiPlayerGameMode::handleDebugOptions(unsigned int uiVal, shared_ptr<Player> player)
|
void MultiPlayerGameMode::handleDebugOptions(unsigned int uiVal, shared_ptr<Player> player)
|
||||||
{
|
{
|
||||||
player->SetDebugOptions(uiVal);
|
player->SetDebugOptions(uiVal);
|
||||||
connection->send( shared_ptr<DebugOptionsPacket>( new DebugOptionsPacket(uiVal) ) );
|
connection->send(std::make_shared<DebugOptionsPacket>(uiVal));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ MultiPlayerLevel::ResetInfo::ResetInfo(int x, int y, int z, int tile, int data)
|
||||||
}
|
}
|
||||||
|
|
||||||
MultiPlayerLevel::MultiPlayerLevel(ClientConnection *connection, LevelSettings *levelSettings, int dimension, int difficulty)
|
MultiPlayerLevel::MultiPlayerLevel(ClientConnection *connection, LevelSettings *levelSettings, int dimension, int difficulty)
|
||||||
: Level(shared_ptr<MockedLevelStorage >(new MockedLevelStorage()), L"MpServer", Dimension::getNew(dimension), levelSettings, false)
|
: Level(std::make_shared<MockedLevelStorage>(), L"MpServer", Dimension::getNew(dimension), levelSettings, false)
|
||||||
{
|
{
|
||||||
minecraft = Minecraft::GetInstance();
|
minecraft = Minecraft::GetInstance();
|
||||||
|
|
||||||
|
|
@ -618,7 +618,7 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/)
|
||||||
for (auto& it : connections )
|
for (auto& it : connections )
|
||||||
{
|
{
|
||||||
if ( it )
|
if ( it )
|
||||||
it->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );
|
it->sendAndDisconnect(std::make_shared<DisconnectPacket>(DisconnectPacket::eDisconnect_Quitting));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -781,7 +781,7 @@ void MultiPlayerLevel::playLocalSound(double x, double y, double z, int iSound,
|
||||||
|
|
||||||
void MultiPlayerLevel::createFireworks(double x, double y, double z, double xd, double yd, double zd, CompoundTag *infoTag)
|
void MultiPlayerLevel::createFireworks(double x, double y, double z, double xd, double yd, double zd, CompoundTag *infoTag)
|
||||||
{
|
{
|
||||||
minecraft->particleEngine->add(shared_ptr<FireworksParticles::FireworksStarter>(new FireworksParticles::FireworksStarter(this, x, y, z, xd, yd, zd, minecraft->particleEngine, infoTag)));
|
minecraft->particleEngine->add(std::make_shared<FireworksParticles::FireworksStarter>(this, x, y, z, xd, yd, zd, minecraft->particleEngine, infoTag));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiPlayerLevel::setScoreboard(Scoreboard *scoreboard)
|
void MultiPlayerLevel::setScoreboard(Scoreboard *scoreboard)
|
||||||
|
|
@ -899,7 +899,7 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection *c, bool sendDisc
|
||||||
{
|
{
|
||||||
if( sendDisconnect )
|
if( sendDisconnect )
|
||||||
{
|
{
|
||||||
c->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );
|
c->sendAndDisconnect(std::make_shared<DisconnectPacket>(DisconnectPacket::eDisconnect_Quitting));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto it = find(connections.begin(), connections.end(), c);
|
auto it = find(connections.begin(), connections.end(), c);
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,8 @@ void MultiplayerLocalPlayer::tick()
|
||||||
{
|
{
|
||||||
if (isRiding())
|
if (isRiding())
|
||||||
{
|
{
|
||||||
connection->send(shared_ptr<MovePlayerPacket>(new MovePlayerPacket::Rot(yRot, xRot, onGround, abilities.flying)));
|
connection->send(std::make_shared<MovePlayerPacket::Rot>(yRot, xRot, onGround, abilities.flying));
|
||||||
connection->send(shared_ptr<PlayerInputPacket>(new PlayerInputPacket(xxa, yya, input->jumping, input->sneaking)));
|
connection->send(std::make_shared<PlayerInputPacket>(xxa, yya, input->jumping, input->sneaking));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -96,8 +96,8 @@ void MultiplayerLocalPlayer::sendPosition()
|
||||||
bool sprinting = isSprinting();
|
bool sprinting = isSprinting();
|
||||||
if (sprinting != lastSprinting)
|
if (sprinting != lastSprinting)
|
||||||
{
|
{
|
||||||
if (sprinting) connection->send(shared_ptr<PlayerCommandPacket>( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SPRINTING)));
|
if (sprinting) connection->send(std::make_shared<PlayerCommandPacket>(shared_from_this(), PlayerCommandPacket::START_SPRINTING));
|
||||||
else connection->send(shared_ptr<PlayerCommandPacket>( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SPRINTING)));
|
else connection->send(std::make_shared<PlayerCommandPacket>(shared_from_this(), PlayerCommandPacket::STOP_SPRINTING));
|
||||||
|
|
||||||
lastSprinting = sprinting;
|
lastSprinting = sprinting;
|
||||||
}
|
}
|
||||||
|
|
@ -105,8 +105,8 @@ void MultiplayerLocalPlayer::sendPosition()
|
||||||
bool sneaking = isSneaking();
|
bool sneaking = isSneaking();
|
||||||
if (sneaking != lastSneaked)
|
if (sneaking != lastSneaked)
|
||||||
{
|
{
|
||||||
if (sneaking) connection->send( shared_ptr<PlayerCommandPacket>( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SNEAKING) ) );
|
if (sneaking) connection->send(std::make_shared<PlayerCommandPacket>(shared_from_this(), PlayerCommandPacket::START_SNEAKING));
|
||||||
else connection->send( shared_ptr<PlayerCommandPacket>( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SNEAKING) ) );
|
else connection->send(std::make_shared<PlayerCommandPacket>(shared_from_this(), PlayerCommandPacket::STOP_SNEAKING));
|
||||||
|
|
||||||
lastSneaked = sneaking;
|
lastSneaked = sneaking;
|
||||||
}
|
}
|
||||||
|
|
@ -114,8 +114,8 @@ void MultiplayerLocalPlayer::sendPosition()
|
||||||
bool idle = isIdle();
|
bool idle = isIdle();
|
||||||
if (idle != lastIdle)
|
if (idle != lastIdle)
|
||||||
{
|
{
|
||||||
if (idle) connection->send( shared_ptr<PlayerCommandPacket>( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_IDLEANIM) ) );
|
if (idle) connection->send(std::make_shared<PlayerCommandPacket>(shared_from_this(), PlayerCommandPacket::START_IDLEANIM));
|
||||||
else connection->send( shared_ptr<PlayerCommandPacket>( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_IDLEANIM) ) );
|
else connection->send(std::make_shared<PlayerCommandPacket>(shared_from_this(), PlayerCommandPacket::STOP_IDLEANIM));
|
||||||
|
|
||||||
lastIdle = idle;
|
lastIdle = idle;
|
||||||
}
|
}
|
||||||
|
|
@ -131,26 +131,26 @@ void MultiplayerLocalPlayer::sendPosition()
|
||||||
bool rot = rydd != 0 || rxdd != 0;
|
bool rot = rydd != 0 || rxdd != 0;
|
||||||
if (riding != nullptr)
|
if (riding != nullptr)
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<MovePlayerPacket>( new MovePlayerPacket::PosRot(xd, -999, -999, zd, yRot, xRot, onGround, abilities.flying) ) );
|
connection->send(std::make_shared<MovePlayerPacket::PosRot>(xd, -999, -999, zd, yRot, xRot, onGround, abilities.flying));
|
||||||
move = false;
|
move = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (move && rot)
|
if (move && rot)
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<MovePlayerPacket>( new MovePlayerPacket::PosRot(x, bb->y0, y, z, yRot, xRot, onGround, abilities.flying) ) );
|
connection->send(std::make_shared<MovePlayerPacket::PosRot>(x, bb->y0, y, z, yRot, xRot, onGround, abilities.flying));
|
||||||
}
|
}
|
||||||
else if (move)
|
else if (move)
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<MovePlayerPacket>( new MovePlayerPacket::Pos(x, bb->y0, y, z, onGround, abilities.flying) ) );
|
connection->send(std::make_shared<MovePlayerPacket::Pos>(x, bb->y0, y, z, onGround, abilities.flying));
|
||||||
}
|
}
|
||||||
else if (rot)
|
else if (rot)
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<MovePlayerPacket>( new MovePlayerPacket::Rot(yRot, xRot, onGround, abilities.flying) ) );
|
connection->send(std::make_shared<MovePlayerPacket::Rot>(yRot, xRot, onGround, abilities.flying));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<MovePlayerPacket>( new MovePlayerPacket(onGround, abilities.flying) ) );
|
connection->send(std::make_shared<MovePlayerPacket>(onGround, abilities.flying));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -175,7 +175,7 @@ void MultiplayerLocalPlayer::sendPosition()
|
||||||
|
|
||||||
shared_ptr<ItemEntity> MultiplayerLocalPlayer::drop()
|
shared_ptr<ItemEntity> MultiplayerLocalPlayer::drop()
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<PlayerActionPacket>( new PlayerActionPacket(PlayerActionPacket::DROP_ITEM, 0, 0, 0, 0) ) );
|
connection->send(std::make_shared<PlayerActionPacket>(PlayerActionPacket::DROP_ITEM, 0, 0, 0, 0));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -185,19 +185,19 @@ void MultiplayerLocalPlayer::reallyDrop(shared_ptr<ItemEntity> itemEntity)
|
||||||
|
|
||||||
void MultiplayerLocalPlayer::chat(const wstring& message)
|
void MultiplayerLocalPlayer::chat(const wstring& message)
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<ChatPacket>( new ChatPacket(message) ) );
|
connection->send(std::make_shared<ChatPacket>(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiplayerLocalPlayer::swing()
|
void MultiplayerLocalPlayer::swing()
|
||||||
{
|
{
|
||||||
LocalPlayer::swing();
|
LocalPlayer::swing();
|
||||||
connection->send( shared_ptr<AnimatePacket>( new AnimatePacket(shared_from_this(), AnimatePacket::SWING) ) );
|
connection->send(std::make_shared<AnimatePacket>(shared_from_this(), AnimatePacket::SWING));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiplayerLocalPlayer::respawn()
|
void MultiplayerLocalPlayer::respawn()
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<ClientCommandPacket>( new ClientCommandPacket(ClientCommandPacket::PERFORM_RESPAWN)));
|
connection->send(std::make_shared<ClientCommandPacket>(ClientCommandPacket::PERFORM_RESPAWN));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -260,7 +260,7 @@ void MultiplayerLocalPlayer::onEffectRemoved(MobEffectInstance *effect)
|
||||||
|
|
||||||
void MultiplayerLocalPlayer::closeContainer()
|
void MultiplayerLocalPlayer::closeContainer()
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<ContainerClosePacket>( new ContainerClosePacket(containerMenu->containerId) ) );
|
connection->send(std::make_shared<ContainerClosePacket>(containerMenu->containerId));
|
||||||
clientSideCloseContainer();
|
clientSideCloseContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -314,7 +314,7 @@ void MultiplayerLocalPlayer::awardStatFromServer(Stat *stat, byteArray param)
|
||||||
|
|
||||||
void MultiplayerLocalPlayer::onUpdateAbilities()
|
void MultiplayerLocalPlayer::onUpdateAbilities()
|
||||||
{
|
{
|
||||||
connection->send(shared_ptr<PlayerAbilitiesPacket>(new PlayerAbilitiesPacket(&abilities)));
|
connection->send(std::make_shared<PlayerAbilitiesPacket>(&abilities));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MultiplayerLocalPlayer::isLocalPlayer()
|
bool MultiplayerLocalPlayer::isLocalPlayer()
|
||||||
|
|
@ -324,12 +324,12 @@ bool MultiplayerLocalPlayer::isLocalPlayer()
|
||||||
|
|
||||||
void MultiplayerLocalPlayer::sendRidingJump()
|
void MultiplayerLocalPlayer::sendRidingJump()
|
||||||
{
|
{
|
||||||
connection->send(shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::RIDING_JUMP, static_cast<int>(getJumpRidingScale() * 100.0f))));
|
connection->send(std::make_shared<PlayerCommandPacket>(shared_from_this(), PlayerCommandPacket::RIDING_JUMP, static_cast<int>(getJumpRidingScale() * 100.0f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiplayerLocalPlayer::sendOpenInventory()
|
void MultiplayerLocalPlayer::sendOpenInventory()
|
||||||
{
|
{
|
||||||
connection->send(shared_ptr<PlayerCommandPacket>(new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::OPEN_INVENTORY)));
|
connection->send(std::make_shared<PlayerCommandPacket>(shared_from_this(), PlayerCommandPacket::OPEN_INVENTORY));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiplayerLocalPlayer::ride(shared_ptr<Entity> e)
|
void MultiplayerLocalPlayer::ride(shared_ptr<Entity> e)
|
||||||
|
|
@ -386,7 +386,7 @@ void MultiplayerLocalPlayer::ride(shared_ptr<Entity> e)
|
||||||
|
|
||||||
void MultiplayerLocalPlayer::StopSleeping()
|
void MultiplayerLocalPlayer::StopSleeping()
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<PlayerCommandPacket>( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SLEEPING) ) );
|
connection->send(std::make_shared<PlayerCommandPacket>(shared_from_this(), PlayerCommandPacket::STOP_SLEEPING));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Added
|
// 4J Added
|
||||||
|
|
@ -397,7 +397,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(DWORD skinId)
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"Skin for local player %ls has changed to %ls (%d)\n", name.c_str(), customTextureUrl.c_str(), getPlayerDefaultSkin() );
|
wprintf(L"Skin for local player %ls has changed to %ls (%d)\n", name.c_str(), customTextureUrl.c_str(), getPlayerDefaultSkin() );
|
||||||
#endif
|
#endif
|
||||||
if(getCustomSkin() != oldSkinIndex) connection->send( shared_ptr<TextureAndGeometryChangePacket>( new TextureAndGeometryChangePacket( shared_from_this(), app.GetPlayerSkinName(GetXboxPad()) ) ) );
|
if(getCustomSkin() != oldSkinIndex) connection->send(std::make_shared<TextureAndGeometryChangePacket>(shared_from_this(), app.GetPlayerSkinName(GetXboxPad())));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiplayerLocalPlayer::setAndBroadcastCustomCape(DWORD capeId)
|
void MultiplayerLocalPlayer::setAndBroadcastCustomCape(DWORD capeId)
|
||||||
|
|
@ -407,7 +407,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomCape(DWORD capeId)
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"Cape for local player %ls has changed to %ls\n", name.c_str(), customTextureUrl2.c_str());
|
wprintf(L"Cape for local player %ls has changed to %ls\n", name.c_str(), customTextureUrl2.c_str());
|
||||||
#endif
|
#endif
|
||||||
if(getCustomCape() != oldCapeIndex) connection->send( shared_ptr<TextureChangePacket>( new TextureChangePacket( shared_from_this(), TextureChangePacket::e_TextureChange_Cape, app.GetPlayerCapeName(GetXboxPad()) ) ) );
|
if(getCustomCape() != oldCapeIndex) connection->send(std::make_shared<TextureChangePacket>(shared_from_this(), TextureChangePacket::e_TextureChange_Cape, app.GetPlayerCapeName(GetXboxPad())));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J added for testing. This moves the player in a repeated sequence of 2 modes:
|
// 4J added for testing. This moves the player in a repeated sequence of 2 modes:
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ void ParticleEngine::destroy(int x, int y, int z, int tid, int data)
|
||||||
double yp = y + (yy + 0.5) / SD;
|
double yp = y + (yy + 0.5) / SD;
|
||||||
double zp = z + (zz + 0.5) / SD;
|
double zp = z + (zz + 0.5) / SD;
|
||||||
int face = random->nextInt(6);
|
int face = random->nextInt(6);
|
||||||
add(( shared_ptr<TerrainParticle>(new TerrainParticle(level, xp, yp, zp, xp - x - 0.5f, yp - y - 0.5f, zp - z - 0.5f, tile, face, data, textures) ) )->init(x, y, z, data));
|
add((std::make_shared<TerrainParticle>(level, xp, yp, zp, xp - x - 0.5f, yp - y - 0.5f, zp - z - 0.5f, tile, face, data, textures))->init(x, y, z, data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -237,7 +237,7 @@ void ParticleEngine::crack(int x, int y, int z, int face)
|
||||||
if (face == 3) zp = z + tile->getShapeZ1() + r;
|
if (face == 3) zp = z + tile->getShapeZ1() + r;
|
||||||
if (face == 4) xp = x + tile->getShapeX0() - r;
|
if (face == 4) xp = x + tile->getShapeX0() - r;
|
||||||
if (face == 5) xp = x + tile->getShapeX1() + r;
|
if (face == 5) xp = x + tile->getShapeX1() + r;
|
||||||
add(( shared_ptr<TerrainParticle>(new TerrainParticle(level, xp, yp, zp, 0, 0, 0, tile, face, level->getData(x, y, z), textures) ) )->init(x, y, z, level->getData(x, y, z))->setPower(0.2f)->scale(0.6f));
|
add((std::make_shared<TerrainParticle>(level, xp, yp, zp, 0, 0, 0, tile, face, level->getData(x, y, z), textures))->init(x, y, z, level->getData(x, y, z))->setPower(0.2f)->scale(0.6f));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason)
|
||||||
// try { // 4J - removed try/catch
|
// try { // 4J - removed try/catch
|
||||||
// logger.info("Disconnecting " + getName() + ": " + reason);
|
// logger.info("Disconnecting " + getName() + ": " + reason);
|
||||||
app.DebugPrintf("Pending connection disconnect: %d\n", reason );
|
app.DebugPrintf("Pending connection disconnect: %d\n", reason );
|
||||||
connection->send( shared_ptr<DisconnectPacket>( new DisconnectPacket(reason) ) );
|
connection->send(std::make_shared<DisconnectPacket>(reason));
|
||||||
connection->sendAndQuit();
|
connection->sendAndQuit();
|
||||||
done = true;
|
done = true;
|
||||||
// } catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
|
|
@ -136,7 +136,7 @@ void PendingConnection::sendPreLoginResponse()
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(L"-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion,szUniqueMapName,app.GetGameHostOption(eGameHostOption_All),hostIndex, server->m_texturePackId) ) );
|
connection->send(std::make_shared<PreLoginPacket>(L"-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion, szUniqueMapName, app.GetGameHostOption(eGameHostOption_All), hostIndex, server->m_texturePackId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,7 +282,7 @@ void PendingConnection::handleGetInfo(shared_ptr<GetInfoPacket> packet)
|
||||||
//try {
|
//try {
|
||||||
//String message = server->motd + "<22>" + server->players->getPlayerCount() + "<22>" + server->players->getMaxPlayers();
|
//String message = server->motd + "<22>" + server->players->getPlayerCount() + "<22>" + server->players->getMaxPlayers();
|
||||||
//connection->send(new DisconnectPacket(message));
|
//connection->send(new DisconnectPacket(message));
|
||||||
connection->send(shared_ptr<DisconnectPacket>(new DisconnectPacket(DisconnectPacket::eDisconnect_ServerFull) ) );
|
connection->send(std::make_shared<DisconnectPacket>(DisconnectPacket::eDisconnect_ServerFull));
|
||||||
connection->sendAndQuit();
|
connection->sendAndQuit();
|
||||||
server->connection->removeSpamProtection(connection->getSocket());
|
server->connection->removeSpamProtection(connection->getSocket());
|
||||||
done = true;
|
done = true;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ void PlayerChunkMap::PlayerChunk::add(shared_ptr<ServerPlayer> player, bool send
|
||||||
player->seenChunks.insert(pos);
|
player->seenChunks.insert(pos);
|
||||||
|
|
||||||
// 4J Added the sendPacket check. See PlayerChunkMap::add for the usage
|
// 4J Added the sendPacket check. See PlayerChunkMap::add for the usage
|
||||||
if( sendPacket ) player->connection->send( shared_ptr<ChunkVisibilityPacket>( new ChunkVisibilityPacket(pos.x, pos.z, true) ) );
|
if( sendPacket ) player->connection->send(std::make_shared<ChunkVisibilityPacket>(pos.x, pos.z, true));
|
||||||
|
|
||||||
if (players.empty())
|
if (players.empty())
|
||||||
{
|
{
|
||||||
|
|
@ -143,7 +143,7 @@ void PlayerChunkMap::PlayerChunk::remove(shared_ptr<ServerPlayer> player)
|
||||||
if(noOtherPlayersFound)
|
if(noOtherPlayersFound)
|
||||||
{
|
{
|
||||||
//wprintf(L"Sending ChunkVisiblity packet false for chunk (%d,%d) to player %ls\n", x, z, player->name.c_str() );
|
//wprintf(L"Sending ChunkVisiblity packet false for chunk (%d,%d) to player %ls\n", x, z, player->name.c_str() );
|
||||||
player->connection->send( shared_ptr<ChunkVisibilityPacket>( new ChunkVisibilityPacket(pos.x, pos.z, false) ) );
|
player->connection->send(std::make_shared<ChunkVisibilityPacket>(pos.x, pos.z, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -322,7 +322,7 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate)
|
||||||
int x = pos.x * 16 + xChangeMin;
|
int x = pos.x * 16 + xChangeMin;
|
||||||
int y = yChangeMin;
|
int y = yChangeMin;
|
||||||
int z = pos.z * 16 + zChangeMin;
|
int z = pos.z * 16 + zChangeMin;
|
||||||
broadcast( shared_ptr<TileUpdatePacket>( new TileUpdatePacket(x, y, z, level) ) );
|
broadcast(std::make_shared<TileUpdatePacket>(x, y, z, level));
|
||||||
if (level->isEntityTile(x, y, z))
|
if (level->isEntityTile(x, y, z))
|
||||||
{
|
{
|
||||||
broadcast(level->getTileEntity(x, y, z));
|
broadcast(level->getTileEntity(x, y, z));
|
||||||
|
|
@ -352,7 +352,7 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate)
|
||||||
// Block region update packets can only encode ys in a range of 1 - 256
|
// Block region update packets can only encode ys in a range of 1 - 256
|
||||||
if( ys > 256 ) ys = 256;
|
if( ys > 256 ) ys = 256;
|
||||||
|
|
||||||
broadcast( shared_ptr<BlockRegionUpdatePacket>( new BlockRegionUpdatePacket(xp, yp, zp, xs, ys, zs, level) ) );
|
broadcast(std::make_shared<BlockRegionUpdatePacket>(xp, yp, zp, xs, ys, zs, level));
|
||||||
vector<shared_ptr<TileEntity> > *tes = level->getTileEntitiesInRegion(xp, yp, zp, xp + xs, yp + ys, zp + zs);
|
vector<shared_ptr<TileEntity> > *tes = level->getTileEntitiesInRegion(xp, yp, zp, xp + xs, yp + ys, zp + zs);
|
||||||
for (unsigned int i = 0; i < tes->size(); i++)
|
for (unsigned int i = 0; i < tes->size(); i++)
|
||||||
{
|
{
|
||||||
|
|
@ -365,7 +365,7 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 4J As we only get here if changes is less than MAX_CHANGES_BEFORE_RESEND (10) we only need to send a byte value in the packet
|
// 4J As we only get here if changes is less than MAX_CHANGES_BEFORE_RESEND (10) we only need to send a byte value in the packet
|
||||||
broadcast( shared_ptr<ChunkTilesUpdatePacket>( new ChunkTilesUpdatePacket(pos.x, pos.z, changedTiles, static_cast<byte>(changes), level) ) );
|
broadcast(std::make_shared<ChunkTilesUpdatePacket>(pos.x, pos.z, changedTiles, static_cast<byte>(changes), level));
|
||||||
for (int i = 0; i < changes; i++)
|
for (int i = 0; i < changes; i++)
|
||||||
{
|
{
|
||||||
int x = pos.x * 16 + ((changedTiles[i] >> 12) & 15);
|
int x = pos.x * 16 + ((changedTiles[i] >> 12) & 15);
|
||||||
|
|
@ -712,7 +712,7 @@ void PlayerChunkMap::add(shared_ptr<ServerPlayer> player)
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
player->connection->send( shared_ptr<ChunkVisibilityAreaPacket>( new ChunkVisibilityAreaPacket(minX, maxX, minZ, maxZ) ) );
|
player->connection->send(std::make_shared<ChunkVisibilityAreaPacket>(minX, maxX, minZ, maxZ));
|
||||||
|
|
||||||
#ifdef _LARGE_WORLDS
|
#ifdef _LARGE_WORLDS
|
||||||
getLevel()->cache->dontDrop(xc,zc);
|
getLevel()->cache->dontDrop(xc,zc);
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ void PlayerConnection::tick()
|
||||||
lastKeepAliveTick = tickCount;
|
lastKeepAliveTick = tickCount;
|
||||||
lastKeepAliveTime = System::nanoTime() / 1000000;
|
lastKeepAliveTime = System::nanoTime() / 1000000;
|
||||||
lastKeepAliveId = random.nextInt();
|
lastKeepAliveId = random.nextInt();
|
||||||
send( shared_ptr<KeepAlivePacket>( new KeepAlivePacket(lastKeepAliveId) ) );
|
send(std::make_shared<KeepAlivePacket>(lastKeepAliveId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatSpamTickCount > 0)
|
if (chatSpamTickCount > 0)
|
||||||
|
|
@ -121,17 +121,17 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason)
|
||||||
|
|
||||||
// 4J Stu - Need to remove the player from the receiving list before their socket is NULLed so that we can find another player on their system
|
// 4J Stu - Need to remove the player from the receiving list before their socket is NULLed so that we can find another player on their system
|
||||||
server->getPlayers()->removePlayerFromReceiving( player );
|
server->getPlayers()->removePlayerFromReceiving( player );
|
||||||
send( shared_ptr<DisconnectPacket>( new DisconnectPacket(reason) ));
|
send(std::make_shared<DisconnectPacket>(reason));
|
||||||
connection->sendAndQuit();
|
connection->sendAndQuit();
|
||||||
// 4J-PB - removed, since it needs to be localised in the language the client is in
|
// 4J-PB - removed, since it needs to be localised in the language the client is in
|
||||||
//server->players->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(L"<22>e" + player->name + L" left the game.") ) );
|
//server->players->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(L"<22>e" + player->name + L" left the game.") ) );
|
||||||
if(getWasKicked())
|
if(getWasKicked())
|
||||||
{
|
{
|
||||||
server->getPlayers()->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) );
|
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(player->name, ChatPacket::e_ChatPlayerKickedFromGame));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
server->getPlayers()->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame) ) );
|
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(player->name, ChatPacket::e_ChatPlayerLeftGame));
|
||||||
}
|
}
|
||||||
|
|
||||||
server->getPlayers()->remove(player);
|
server->getPlayers()->remove(player);
|
||||||
|
|
@ -376,7 +376,7 @@ void PlayerConnection::teleport(double x, double y, double z, float yRot, float
|
||||||
player->absMoveTo(x, y, z, yRot, xRot);
|
player->absMoveTo(x, y, z, yRot, xRot);
|
||||||
// 4J - note that 1.62 is added to the height here as the client connection that receives this will presume it represents y + heightOffset at that end
|
// 4J - note that 1.62 is added to the height here as the client connection that receives this will presume it represents y + heightOffset at that end
|
||||||
// This is different to the way that height is sent back to the server, where it represents the bottom of the player bounding volume
|
// This is different to the way that height is sent back to the server, where it represents the bottom of the player bounding volume
|
||||||
if(sendPacket) player->connection->send( shared_ptr<MovePlayerPacket>( new MovePlayerPacket::PosRot(x, y + 1.62f, y, z, yRot, xRot, false, false) ) );
|
if(sendPacket) player->connection->send(std::make_shared<MovePlayerPacket::PosRot>(x, y + 1.62f, y, z, yRot, xRot, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerConnection::handlePlayerAction(shared_ptr<PlayerActionPacket> packet)
|
void PlayerConnection::handlePlayerAction(shared_ptr<PlayerActionPacket> packet)
|
||||||
|
|
@ -429,19 +429,19 @@ void PlayerConnection::handlePlayerAction(shared_ptr<PlayerActionPacket> packet)
|
||||||
if (packet->action == PlayerActionPacket::START_DESTROY_BLOCK)
|
if (packet->action == PlayerActionPacket::START_DESTROY_BLOCK)
|
||||||
{
|
{
|
||||||
if (true) player->gameMode->startDestroyBlock(x, y, z, packet->face); // 4J - condition was !server->isUnderSpawnProtection(level, x, y, z, player) (from Java 1.6.4) but putting back to old behaviour
|
if (true) player->gameMode->startDestroyBlock(x, y, z, packet->face); // 4J - condition was !server->isUnderSpawnProtection(level, x, y, z, player) (from Java 1.6.4) but putting back to old behaviour
|
||||||
else player->connection->send( shared_ptr<TileUpdatePacket>( new TileUpdatePacket(x, y, z, level) ) );
|
else player->connection->send(std::make_shared<TileUpdatePacket>(x, y, z, level));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (packet->action == PlayerActionPacket::STOP_DESTROY_BLOCK)
|
else if (packet->action == PlayerActionPacket::STOP_DESTROY_BLOCK)
|
||||||
{
|
{
|
||||||
player->gameMode->stopDestroyBlock(x, y, z);
|
player->gameMode->stopDestroyBlock(x, y, z);
|
||||||
server->getPlayers()->prioritiseTileChanges(x, y, z, level->dimension->id); // 4J added - make sure that the update packets for this get prioritised over other general world updates
|
server->getPlayers()->prioritiseTileChanges(x, y, z, level->dimension->id); // 4J added - make sure that the update packets for this get prioritised over other general world updates
|
||||||
if (level->getTile(x, y, z) != 0) player->connection->send( shared_ptr<TileUpdatePacket>( new TileUpdatePacket(x, y, z, level) ) );
|
if (level->getTile(x, y, z) != 0) player->connection->send(std::make_shared<TileUpdatePacket>(x, y, z, level));
|
||||||
}
|
}
|
||||||
else if (packet->action == PlayerActionPacket::ABORT_DESTROY_BLOCK)
|
else if (packet->action == PlayerActionPacket::ABORT_DESTROY_BLOCK)
|
||||||
{
|
{
|
||||||
player->gameMode->abortDestroyBlock(x, y, z);
|
player->gameMode->abortDestroyBlock(x, y, z);
|
||||||
if (level->getTile(x, y, z) != 0) player->connection->send(shared_ptr<TileUpdatePacket>( new TileUpdatePacket(x, y, z, level)));
|
if (level->getTile(x, y, z) != 0) player->connection->send(std::make_shared<TileUpdatePacket>(x, y, z, level));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -484,7 +484,7 @@ void PlayerConnection::handleUseItem(shared_ptr<UseItemPacket> packet)
|
||||||
if (informClient)
|
if (informClient)
|
||||||
{
|
{
|
||||||
|
|
||||||
player->connection->send( shared_ptr<TileUpdatePacket>( new TileUpdatePacket(x, y, z, level) ) );
|
player->connection->send(std::make_shared<TileUpdatePacket>(x, y, z, level));
|
||||||
|
|
||||||
if (face == 0) y--;
|
if (face == 0) y--;
|
||||||
if (face == 1) y++;
|
if (face == 1) y++;
|
||||||
|
|
@ -500,7 +500,7 @@ void PlayerConnection::handleUseItem(shared_ptr<UseItemPacket> packet)
|
||||||
// isn't what it is expecting.
|
// isn't what it is expecting.
|
||||||
if( level->getTile(x,y,z) != Tile::pistonMovingPiece_Id )
|
if( level->getTile(x,y,z) != Tile::pistonMovingPiece_Id )
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<TileUpdatePacket>( new TileUpdatePacket(x, y, z, level) ) );
|
player->connection->send(std::make_shared<TileUpdatePacket>(x, y, z, level));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -528,7 +528,7 @@ void PlayerConnection::handleUseItem(shared_ptr<UseItemPacket> packet)
|
||||||
|
|
||||||
if (forceClientUpdate || !ItemInstance::matches(player->inventory->getSelected(), packet->getItem()))
|
if (forceClientUpdate || !ItemInstance::matches(player->inventory->getSelected(), packet->getItem()))
|
||||||
{
|
{
|
||||||
send( shared_ptr<ContainerSetSlotPacket>( new ContainerSetSlotPacket(player->containerMenu->containerId, s->index, player->inventory->getSelected()) ) );
|
send(std::make_shared<ContainerSetSlotPacket>(player->containerMenu->containerId, s->index, player->inventory->getSelected()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -542,11 +542,11 @@ void PlayerConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason,
|
||||||
//server->players->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(L"<22>e" + player->name + L" left the game.") ) );
|
//server->players->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(L"<22>e" + player->name + L" left the game.") ) );
|
||||||
if(getWasKicked())
|
if(getWasKicked())
|
||||||
{
|
{
|
||||||
server->getPlayers()->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) );
|
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(player->name, ChatPacket::e_ChatPlayerKickedFromGame));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
server->getPlayers()->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame) ) );
|
server->getPlayers()->broadcastAll(std::make_shared<ChatPacket>(player->name, ChatPacket::e_ChatPlayerLeftGame));
|
||||||
}
|
}
|
||||||
server->getPlayers()->remove(player);
|
server->getPlayers()->remove(player);
|
||||||
done = true;
|
done = true;
|
||||||
|
|
@ -803,7 +803,7 @@ void PlayerConnection::handleTexture(shared_ptr<TexturePacket> packet)
|
||||||
|
|
||||||
if(dwBytes!=0)
|
if(dwBytes!=0)
|
||||||
{
|
{
|
||||||
send( shared_ptr<TexturePacket>( new TexturePacket(packet->textureName,pbData,dwBytes) ) );
|
send(std::make_shared<TexturePacket>(packet->textureName, pbData, dwBytes));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -843,11 +843,11 @@ void PlayerConnection::handleTextureAndGeometry(shared_ptr<TextureAndGeometryPac
|
||||||
{
|
{
|
||||||
if(pDLCSkinFile->getAdditionalBoxesCount()!=0)
|
if(pDLCSkinFile->getAdditionalBoxesCount()!=0)
|
||||||
{
|
{
|
||||||
send( shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes,pDLCSkinFile) ) );
|
send(std::make_shared<TextureAndGeometryPacket>(packet->textureName, pbData, dwTextureBytes, pDLCSkinFile));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
send( shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes) ) );
|
send(std::make_shared<TextureAndGeometryPacket>(packet->textureName, pbData, dwTextureBytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -856,7 +856,7 @@ void PlayerConnection::handleTextureAndGeometry(shared_ptr<TextureAndGeometryPac
|
||||||
vector<SKIN_BOX *> *pvSkinBoxes = app.GetAdditionalSkinBoxes(packet->dwSkinID);
|
vector<SKIN_BOX *> *pvSkinBoxes = app.GetAdditionalSkinBoxes(packet->dwSkinID);
|
||||||
unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(packet->dwSkinID);
|
unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(packet->dwSkinID);
|
||||||
|
|
||||||
send( shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(packet->textureName,pbData,dwTextureBytes,pvSkinBoxes,uiAnimOverrideBitmask) ) );
|
send(std::make_shared<TextureAndGeometryPacket>(packet->textureName, pbData, dwTextureBytes, pvSkinBoxes, uiAnimOverrideBitmask));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -901,7 +901,7 @@ void PlayerConnection::handleTextureReceived(const wstring &textureName)
|
||||||
|
|
||||||
if(dwBytes!=0)
|
if(dwBytes!=0)
|
||||||
{
|
{
|
||||||
send( shared_ptr<TexturePacket>( new TexturePacket(textureName,pbData,dwBytes) ) );
|
send(std::make_shared<TexturePacket>(textureName, pbData, dwBytes));
|
||||||
m_texturesRequested.erase(it);
|
m_texturesRequested.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -922,7 +922,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(const wstring &textureNa
|
||||||
{
|
{
|
||||||
if(pDLCSkinFile && (pDLCSkinFile->getAdditionalBoxesCount()!=0))
|
if(pDLCSkinFile && (pDLCSkinFile->getAdditionalBoxesCount()!=0))
|
||||||
{
|
{
|
||||||
send( shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(textureName,pbData,dwTextureBytes,pDLCSkinFile) ) );
|
send(std::make_shared<TextureAndGeometryPacket>(textureName, pbData, dwTextureBytes, pDLCSkinFile));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -931,7 +931,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(const wstring &textureNa
|
||||||
vector<SKIN_BOX *> *pvSkinBoxes = app.GetAdditionalSkinBoxes(dwSkinID);
|
vector<SKIN_BOX *> *pvSkinBoxes = app.GetAdditionalSkinBoxes(dwSkinID);
|
||||||
unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(dwSkinID);
|
unsigned int uiAnimOverrideBitmask= app.GetAnimOverrideBitmask(dwSkinID);
|
||||||
|
|
||||||
send( shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(textureName,pbData,dwTextureBytes, pvSkinBoxes, uiAnimOverrideBitmask) ) );
|
send(std::make_shared<TextureAndGeometryPacket>(textureName, pbData, dwTextureBytes, pvSkinBoxes, uiAnimOverrideBitmask));
|
||||||
}
|
}
|
||||||
m_texturesRequested.erase(it);
|
m_texturesRequested.erase(it);
|
||||||
}
|
}
|
||||||
|
|
@ -958,20 +958,25 @@ void PlayerConnection::handleTextureChange(shared_ptr<TextureChangePacket> packe
|
||||||
}
|
}
|
||||||
if(!packet->path.empty() && packet->path.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(packet->path))
|
if(!packet->path.empty() && packet->path.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(packet->path))
|
||||||
{
|
{
|
||||||
if( server->connection->addPendingTextureRequest(packet->path))
|
if (server->connection->addPendingTextureRequest(packet->path))
|
||||||
{
|
{
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",packet->path.c_str(), player->name.c_str());
|
wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n", packet->path.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
send(shared_ptr<TexturePacket>( new TexturePacket(packet->path,nullptr,0) ) );
|
send(std::make_shared<TexturePacket>(
|
||||||
}
|
packet->path,
|
||||||
}
|
nullptr,
|
||||||
|
static_cast<DWORD>(0)
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path))
|
else if(!packet->path.empty() && 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,nullptr,0);
|
app.AddMemoryTextureFile(packet->path,nullptr,0);
|
||||||
}
|
}
|
||||||
server->getPlayers()->broadcastAll( shared_ptr<TextureChangePacket>( new TextureChangePacket(player,packet->action,packet->path) ), player->dimension );
|
server->getPlayers()->broadcastAll(std::make_shared<TextureChangePacket>(player, packet->action, packet->path), player->dimension );
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerConnection::handleTextureAndGeometryChange(shared_ptr<TextureAndGeometryChangePacket> packet)
|
void PlayerConnection::handleTextureAndGeometryChange(shared_ptr<TextureAndGeometryChangePacket> packet)
|
||||||
|
|
@ -990,7 +995,10 @@ void PlayerConnection::handleTextureAndGeometryChange(shared_ptr<TextureAndGeome
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",packet->path.c_str(), player->name.c_str());
|
wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",packet->path.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
send(shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(packet->path,nullptr,0) ) );
|
send(std::make_shared<TextureAndGeometryPacket>(
|
||||||
|
packet->path,
|
||||||
|
nullptr,
|
||||||
|
static_cast<DWORD>(0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path))
|
else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path))
|
||||||
|
|
@ -1004,7 +1012,7 @@ void PlayerConnection::handleTextureAndGeometryChange(shared_ptr<TextureAndGeome
|
||||||
//app.SetAdditionalSkinBoxes(packet->dwSkinID,)
|
//app.SetAdditionalSkinBoxes(packet->dwSkinID,)
|
||||||
//DebugBreak();
|
//DebugBreak();
|
||||||
}
|
}
|
||||||
server->getPlayers()->broadcastAll( shared_ptr<TextureAndGeometryChangePacket>( new TextureAndGeometryChangePacket(player,packet->path) ), player->dimension );
|
server->getPlayers()->broadcastAll(std::make_shared<TextureAndGeometryChangePacket>(player, packet->path), player->dimension );
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerConnection::handleServerSettingsChanged(shared_ptr<ServerSettingsChangedPacket> packet)
|
void PlayerConnection::handleServerSettingsChanged(shared_ptr<ServerSettingsChangedPacket> packet)
|
||||||
|
|
@ -1026,7 +1034,7 @@ void PlayerConnection::handleServerSettingsChanged(shared_ptr<ServerSettingsChan
|
||||||
app.SetGameHostOption(eGameHostOption_DoDaylightCycle, app.GetGameHostOption(packet->data, eGameHostOption_DoDaylightCycle));
|
app.SetGameHostOption(eGameHostOption_DoDaylightCycle, app.GetGameHostOption(packet->data, eGameHostOption_DoDaylightCycle));
|
||||||
app.SetGameHostOption(eGameHostOption_NaturalRegeneration, app.GetGameHostOption(packet->data, eGameHostOption_NaturalRegeneration));
|
app.SetGameHostOption(eGameHostOption_NaturalRegeneration, app.GetGameHostOption(packet->data, eGameHostOption_NaturalRegeneration));
|
||||||
|
|
||||||
server->getPlayers()->broadcastAll( shared_ptr<ServerSettingsChangedPacket>( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS,app.GetGameHostOption(eGameHostOption_All) ) ) );
|
server->getPlayers()->broadcastAll(std::make_shared<ServerSettingsChangedPacket>(ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, app.GetGameHostOption(eGameHostOption_All)));
|
||||||
|
|
||||||
// Update the QoS data
|
// Update the QoS data
|
||||||
g_NetworkManager.UpdateAndSetGameSessionData();
|
g_NetworkManager.UpdateAndSetGameSessionData();
|
||||||
|
|
@ -1141,7 +1149,7 @@ void PlayerConnection::handleContainerClick(shared_ptr<ContainerClickPacket> pac
|
||||||
if (ItemInstance::matches(packet->item, clicked))
|
if (ItemInstance::matches(packet->item, clicked))
|
||||||
{
|
{
|
||||||
// Yep, you sure did click what you claimed to click!
|
// Yep, you sure did click what you claimed to click!
|
||||||
player->connection->send( shared_ptr<ContainerAckPacket>( new ContainerAckPacket(packet->containerId, packet->uid, true) ) );
|
player->connection->send(std::make_shared<ContainerAckPacket>(packet->containerId, packet->uid, true));
|
||||||
player->ignoreSlotUpdateHack = true;
|
player->ignoreSlotUpdateHack = true;
|
||||||
player->containerMenu->broadcastChanges();
|
player->containerMenu->broadcastChanges();
|
||||||
player->broadcastCarriedItem();
|
player->broadcastCarriedItem();
|
||||||
|
|
@ -1151,7 +1159,7 @@ void PlayerConnection::handleContainerClick(shared_ptr<ContainerClickPacket> pac
|
||||||
{
|
{
|
||||||
// No, you clicked the wrong thing!
|
// No, you clicked the wrong thing!
|
||||||
expectedAcks[player->containerMenu->containerId] = packet->uid;
|
expectedAcks[player->containerMenu->containerId] = packet->uid;
|
||||||
player->connection->send( shared_ptr<ContainerAckPacket>( new ContainerAckPacket(packet->containerId, packet->uid, false) ) );
|
player->connection->send(std::make_shared<ContainerAckPacket>(packet->containerId, packet->uid, false));
|
||||||
player->containerMenu->setSynched(player, false);
|
player->containerMenu->setSynched(player, false);
|
||||||
|
|
||||||
vector<shared_ptr<ItemInstance> > items;
|
vector<shared_ptr<ItemInstance> > items;
|
||||||
|
|
@ -1206,7 +1214,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptr<SetCreativeModeSlotP
|
||||||
std::wstring id = wstring(buf);
|
std::wstring id = wstring(buf);
|
||||||
if( data == nullptr )
|
if( data == nullptr )
|
||||||
{
|
{
|
||||||
data = shared_ptr<MapItemSavedData>( new MapItemSavedData(id) );
|
data = std::make_shared<MapItemSavedData>(id);
|
||||||
}
|
}
|
||||||
player->level->setSavedData(id, (shared_ptr<SavedData> ) data);
|
player->level->setSavedData(id, (shared_ptr<SavedData> ) data);
|
||||||
|
|
||||||
|
|
@ -1357,7 +1365,7 @@ void PlayerConnection::handlePlayerInfo(shared_ptr<PlayerInfoPacket> packet)
|
||||||
#endif
|
#endif
|
||||||
serverPlayer->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_CreativeMode,Player::getPlayerGamePrivilege(packet->m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode) );
|
serverPlayer->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_CreativeMode,Player::getPlayerGamePrivilege(packet->m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode) );
|
||||||
serverPlayer->gameMode->setGameModeForPlayer(gameType);
|
serverPlayer->gameMode->setGameModeForPlayer(gameType);
|
||||||
serverPlayer->connection->send( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, gameType->getId()) ));
|
serverPlayer->connection->send(std::make_shared<GameEventPacket>(GameEventPacket::CHANGE_GAME_MODE, gameType->getId()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1409,7 +1417,7 @@ void PlayerConnection::handlePlayerInfo(shared_ptr<PlayerInfoPacket> packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server->getPlayers()->broadcastAll( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( serverPlayer ) ) );
|
server->getPlayers()->broadcastAll(std::make_shared<PlayerInfoPacket>(serverPlayer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1656,7 +1664,7 @@ void PlayerConnection::handleCraftItem(shared_ptr<CraftItemPacket> packet)
|
||||||
if (ingItemInst->getItem()->hasCraftingRemainingItem())
|
if (ingItemInst->getItem()->hasCraftingRemainingItem())
|
||||||
{
|
{
|
||||||
// replace item with remaining result
|
// replace item with remaining result
|
||||||
player->inventory->add( shared_ptr<ItemInstance>( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) );
|
player->inventory->add(std::make_shared<ItemInstance>(ingItemInst->getItem()->getCraftingRemainingItem()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
|
||||||
player->setCustomCape( packet->m_playerCapeId );
|
player->setCustomCape( packet->m_playerCapeId );
|
||||||
|
|
||||||
// 4J-JEV: Moved this here so we can send player-model texture and geometry data.
|
// 4J-JEV: Moved this here so we can send player-model texture and geometry data.
|
||||||
shared_ptr<PlayerConnection> playerConnection = shared_ptr<PlayerConnection>(new PlayerConnection(server, connection, player));
|
shared_ptr<PlayerConnection> playerConnection = std::make_shared<PlayerConnection>(server, connection, player);
|
||||||
//player->connection = playerConnection; // Used to be assigned in PlayerConnection ctor but moved out so we can use shared_ptr
|
//player->connection = playerConnection; // Used to be assigned in PlayerConnection ctor but moved out so we can use shared_ptr
|
||||||
|
|
||||||
if(newPlayer)
|
if(newPlayer)
|
||||||
|
|
@ -167,7 +167,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
|
||||||
int centreZC = 0;
|
int centreZC = 0;
|
||||||
#endif
|
#endif
|
||||||
// 4J Added - Give every player a map the first time they join a server
|
// 4J Added - Give every player a map the first time they join a server
|
||||||
player->inventory->setItem( 9, shared_ptr<ItemInstance>( new ItemInstance(Item::map_Id, 1, level->getAuxValueForMap(player->getXuid(),0,centreXC, centreZC, mapScale ) ) ) );
|
player->inventory->setItem( 9, std::make_shared<ItemInstance>(Item::map_Id, 1, level->getAuxValueForMap(player->getXuid(), 0, centreXC, centreZC, mapScale)));
|
||||||
if(app.getGameRuleDefinitions() != nullptr)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
app.getGameRuleDefinitions()->postProcessPlayer(player);
|
app.getGameRuleDefinitions()->postProcessPlayer(player);
|
||||||
|
|
@ -175,13 +175,17 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!player->customTextureUrl.empty() && player->customTextureUrl.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl))
|
if(!player->customTextureUrl.empty() && player->customTextureUrl.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl))
|
||||||
{
|
{
|
||||||
if( server->getConnection()->addPendingTextureRequest(player->customTextureUrl))
|
if (server->getConnection()->addPendingTextureRequest(player->customTextureUrl))
|
||||||
{
|
{
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",player->customTextureUrl.c_str(), player->name.c_str());
|
wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n", player->customTextureUrl.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
playerConnection->send(shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(player->customTextureUrl,nullptr,0) ) );
|
playerConnection->send(std::make_shared<TextureAndGeometryPacket>(
|
||||||
|
player->customTextureUrl,
|
||||||
|
nullptr,
|
||||||
|
static_cast<DWORD>(0)));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl))
|
else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl))
|
||||||
|
|
@ -197,7 +201,11 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",player->customTextureUrl2.c_str(), player->name.c_str());
|
wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",player->customTextureUrl2.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
playerConnection->send(shared_ptr<TexturePacket>( new TexturePacket(player->customTextureUrl2,nullptr,0) ) );
|
playerConnection->send(std::make_shared<TexturePacket>(
|
||||||
|
player->customTextureUrl,
|
||||||
|
nullptr,
|
||||||
|
static_cast<DWORD>(0)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2))
|
else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2))
|
||||||
|
|
@ -233,13 +241,13 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
|
||||||
|
|
||||||
addPlayerToReceiving( player );
|
addPlayerToReceiving( player );
|
||||||
|
|
||||||
playerConnection->send( shared_ptr<LoginPacket>( new LoginPacket(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(),
|
playerConnection->send(std::make_shared<LoginPacket>(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(),
|
||||||
static_cast<byte>(level->dimension->id), static_cast<byte>(level->getMaxBuildHeight()), static_cast<byte>(getMaxPlayers()),
|
static_cast<byte>(level->dimension->id), static_cast<byte>(level->getMaxBuildHeight()), static_cast<byte>(getMaxPlayers()),
|
||||||
level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), static_cast<BYTE>(playerIndex), level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(),
|
level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), static_cast<BYTE>(playerIndex), level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(),
|
||||||
level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale() ) ) );
|
level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale()));
|
||||||
playerConnection->send( shared_ptr<SetSpawnPositionPacket>( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z) ) );
|
playerConnection->send(std::make_shared<SetSpawnPositionPacket>(spawnPos->x, spawnPos->y, spawnPos->z));
|
||||||
playerConnection->send( shared_ptr<PlayerAbilitiesPacket>( new PlayerAbilitiesPacket(&player->abilities)) );
|
playerConnection->send(std::make_shared<PlayerAbilitiesPacket>(&player->abilities));
|
||||||
playerConnection->send( shared_ptr<SetCarriedItemPacket>( new SetCarriedItemPacket(player->inventory->selected)));
|
playerConnection->send(std::make_shared<SetCarriedItemPacket>(player->inventory->selected));
|
||||||
delete spawnPos;
|
delete spawnPos;
|
||||||
|
|
||||||
updateEntireScoreboard((ServerScoreboard *) level->getScoreboard(), player);
|
updateEntireScoreboard((ServerScoreboard *) level->getScoreboard(), player);
|
||||||
|
|
@ -248,7 +256,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
|
||||||
|
|
||||||
// 4J-PB - removed, since it needs to be localised in the language the client is in
|
// 4J-PB - removed, since it needs to be localised in the language the client is in
|
||||||
//server->players->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(L"<22>e" + playerEntity->name + L" joined the game.") ) );
|
//server->players->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(L"<22>e" + playerEntity->name + L" joined the game.") ) );
|
||||||
broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(player->name, ChatPacket::e_ChatPlayerJoinedGame) ) );
|
broadcastAll(std::make_shared<ChatPacket>(player->name, ChatPacket::e_ChatPlayerJoinedGame));
|
||||||
|
|
||||||
MemSect(14);
|
MemSect(14);
|
||||||
add(player);
|
add(player);
|
||||||
|
|
@ -258,12 +266,12 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
|
||||||
playerConnection->teleport(player->x, player->y, player->z, player->yRot, player->xRot);
|
playerConnection->teleport(player->x, player->y, player->z, player->yRot, player->xRot);
|
||||||
|
|
||||||
server->getConnection()->addPlayerConnection(playerConnection);
|
server->getConnection()->addPlayerConnection(playerConnection);
|
||||||
playerConnection->send( shared_ptr<SetTimePacket>( new SetTimePacket(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)) ) );
|
playerConnection->send(std::make_shared<SetTimePacket>(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)));
|
||||||
|
|
||||||
auto activeEffects = player->getActiveEffects();
|
auto activeEffects = player->getActiveEffects();
|
||||||
for(MobEffectInstance *effect : *player->getActiveEffects())
|
for(MobEffectInstance *effect : *player->getActiveEffects())
|
||||||
{
|
{
|
||||||
playerConnection->send(shared_ptr<UpdateMobEffectPacket>( new UpdateMobEffectPacket(player->entityId, effect) ) );
|
playerConnection->send(std::make_shared<UpdateMobEffectPacket>(player->entityId, effect));
|
||||||
}
|
}
|
||||||
|
|
||||||
player->initMenu();
|
player->initMenu();
|
||||||
|
|
@ -430,7 +438,7 @@ void PlayerList::add(shared_ptr<ServerPlayer> player)
|
||||||
//broadcastAll(shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket(player->name, true, 1000) ) );
|
//broadcastAll(shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket(player->name, true, 1000) ) );
|
||||||
if( player->connection->getNetworkPlayer() )
|
if( player->connection->getNetworkPlayer() )
|
||||||
{
|
{
|
||||||
broadcastAll(shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player ) ) );
|
broadcastAll(std::make_shared<PlayerInfoPacket>(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
players.push_back(player);
|
players.push_back(player);
|
||||||
|
|
@ -456,7 +464,7 @@ void PlayerList::add(shared_ptr<ServerPlayer> player)
|
||||||
//player->connection->send(shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket(op->name, true, op->latency) ) );
|
//player->connection->send(shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket(op->name, true, op->latency) ) );
|
||||||
if( op->connection->getNetworkPlayer() )
|
if( op->connection->getNetworkPlayer() )
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( op ) ) );
|
player->connection->send(std::make_shared<PlayerInfoPacket>(op));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -469,10 +477,10 @@ void PlayerList::add(shared_ptr<ServerPlayer> player)
|
||||||
if(thisPlayer->isSleeping())
|
if(thisPlayer->isSleeping())
|
||||||
{
|
{
|
||||||
if(firstSleepingPlayer == nullptr) firstSleepingPlayer = thisPlayer;
|
if(firstSleepingPlayer == nullptr) firstSleepingPlayer = thisPlayer;
|
||||||
thisPlayer->connection->send(shared_ptr<ChatPacket>( new ChatPacket(thisPlayer->name, ChatPacket::e_ChatBedMeSleep)));
|
thisPlayer->connection->send(std::make_shared<ChatPacket>(thisPlayer->name, ChatPacket::e_ChatBedMeSleep));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(firstSleepingPlayer->name, ChatPacket::e_ChatBedPlayerSleep)));
|
player->connection->send(std::make_shared<ChatPacket>(firstSleepingPlayer->name, ChatPacket::e_ChatBedPlayerSleep));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -522,7 +530,7 @@ shared_ptr<ServerPlayer> PlayerList::getPlayerForLogin(PendingConnection *pendin
|
||||||
pendingConnection->disconnect(DisconnectPacket::eDisconnect_ServerFull);
|
pendingConnection->disconnect(DisconnectPacket::eDisconnect_ServerFull);
|
||||||
return shared_ptr<ServerPlayer>();
|
return shared_ptr<ServerPlayer>();
|
||||||
}
|
}
|
||||||
shared_ptr<ServerPlayer> player = shared_ptr<ServerPlayer>(new ServerPlayer(server, server->getLevel(0), userName, new ServerPlayerGameMode(server->getLevel(0)) ));
|
shared_ptr<ServerPlayer> player = std::make_shared<ServerPlayer>(server, server->getLevel(0), userName, new ServerPlayerGameMode(server->getLevel(0)));
|
||||||
player->gameMode->player = player; // 4J added as had to remove this assignment from ServerPlayer ctor
|
player->gameMode->player = player; // 4J added as had to remove this assignment from ServerPlayer ctor
|
||||||
player->setXuid( xuid ); // 4J Added
|
player->setXuid( xuid ); // 4J Added
|
||||||
player->setOnlineXuid( onlineXuid ); // 4J Added
|
player->setOnlineXuid( onlineXuid ); // 4J Added
|
||||||
|
|
@ -634,7 +642,7 @@ shared_ptr<ServerPlayer> PlayerList::respawn(shared_ptr<ServerPlayer> serverPlay
|
||||||
PlayerUID playerXuid = serverPlayer->getXuid();
|
PlayerUID playerXuid = serverPlayer->getXuid();
|
||||||
PlayerUID playerOnlineXuid = serverPlayer->getOnlineXuid();
|
PlayerUID playerOnlineXuid = serverPlayer->getOnlineXuid();
|
||||||
|
|
||||||
shared_ptr<ServerPlayer> player = shared_ptr<ServerPlayer>(new ServerPlayer(server, server->getLevel(serverPlayer->dimension), serverPlayer->getName(), new ServerPlayerGameMode(server->getLevel(serverPlayer->dimension))));
|
shared_ptr<ServerPlayer> player = std::make_shared<ServerPlayer>(server, server->getLevel(serverPlayer->dimension), serverPlayer->getName(), new ServerPlayerGameMode(server->getLevel(serverPlayer->dimension)));
|
||||||
player->connection = serverPlayer->connection;
|
player->connection = serverPlayer->connection;
|
||||||
player->restoreFrom(serverPlayer, keepAllPlayerData);
|
player->restoreFrom(serverPlayer, keepAllPlayerData);
|
||||||
if (keepAllPlayerData)
|
if (keepAllPlayerData)
|
||||||
|
|
@ -692,7 +700,7 @@ shared_ptr<ServerPlayer> PlayerList::respawn(shared_ptr<ServerPlayer> serverPlay
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::NO_RESPAWN_BED_AVAILABLE, 0) ) );
|
player->connection->send(std::make_shared<GameEventPacket>(GameEventPacket::NO_RESPAWN_BED_AVAILABLE, 0));
|
||||||
}
|
}
|
||||||
delete bedPosition;
|
delete bedPosition;
|
||||||
}
|
}
|
||||||
|
|
@ -822,9 +830,9 @@ void PlayerList::toggleDimension(shared_ptr<ServerPlayer> player, int targetDime
|
||||||
// 4J Stu Added so that we remove entities from the correct level, after the respawn packet we will be in the wrong level
|
// 4J Stu Added so that we remove entities from the correct level, after the respawn packet we will be in the wrong level
|
||||||
player->flushEntitiesToRemove();
|
player->flushEntitiesToRemove();
|
||||||
|
|
||||||
player->connection->send( shared_ptr<RespawnPacket>( new RespawnPacket(static_cast<char>(player->dimension), newLevel->getSeed(), newLevel->getMaxBuildHeight(),
|
player->connection->send(std::make_shared<RespawnPacket>(static_cast<char>(player->dimension), newLevel->getSeed(), newLevel->getMaxBuildHeight(),
|
||||||
player->gameMode->getGameModeForPlayer(), newLevel->difficulty, newLevel->getLevelData()->getGenerator(),
|
player->gameMode->getGameModeForPlayer(), newLevel->difficulty, newLevel->getLevelData()->getGenerator(),
|
||||||
newLevel->useNewSeaLevel(), player->entityId, newLevel->getLevelData()->getXZSize(), newLevel->getLevelData()->getHellScale()) ) );
|
newLevel->useNewSeaLevel(), player->entityId, newLevel->getLevelData()->getXZSize(), newLevel->getLevelData()->getHellScale()));
|
||||||
|
|
||||||
oldLevel->removeEntityImmediately(player);
|
oldLevel->removeEntityImmediately(player);
|
||||||
player->removed = false;
|
player->removed = false;
|
||||||
|
|
@ -951,7 +959,7 @@ void PlayerList::tick()
|
||||||
//broadcastAll(shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket(op->name, true, op->latency) ) );
|
//broadcastAll(shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket(op->name, true, op->latency) ) );
|
||||||
if( op->connection->getNetworkPlayer() )
|
if( op->connection->getNetworkPlayer() )
|
||||||
{
|
{
|
||||||
broadcastAll(shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( op ) ) );
|
broadcastAll(std::make_shared<PlayerInfoPacket>(op));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1013,7 +1021,7 @@ void PlayerList::tick()
|
||||||
// 4J Stu - If we have kicked a player, make sure that they have no privileges if they later try to join the world when trust players is off
|
// 4J Stu - If we have kicked a player, make sure that they have no privileges if they later try to join the world when trust players is off
|
||||||
player->enableAllPlayerPrivileges( false );
|
player->enableAllPlayerPrivileges( false );
|
||||||
player->connection->setWasKicked();
|
player->connection->setWasKicked();
|
||||||
player->connection->send( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Kicked) ));
|
player->connection->send(std::make_shared<DisconnectPacket>(DisconnectPacket::eDisconnect_Kicked));
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
@ -1240,7 +1248,7 @@ void PlayerList::sendMessage(const wstring& name, const wstring& message)
|
||||||
shared_ptr<ServerPlayer> player = getPlayer(name);
|
shared_ptr<ServerPlayer> player = getPlayer(name);
|
||||||
if (player != nullptr)
|
if (player != nullptr)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<ChatPacket>( new ChatPacket(message) ) );
|
player->connection->send(std::make_shared<ChatPacket>(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1351,22 +1359,22 @@ void PlayerList::reloadWhitelist()
|
||||||
|
|
||||||
void PlayerList::sendLevelInfo(shared_ptr<ServerPlayer> player, ServerLevel *level)
|
void PlayerList::sendLevelInfo(shared_ptr<ServerPlayer> player, ServerLevel *level)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<SetTimePacket>( new SetTimePacket(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)) ) );
|
player->connection->send(std::make_shared<SetTimePacket>(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)));
|
||||||
if (level->isRaining())
|
if (level->isRaining())
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::START_RAINING, 0) ) );
|
player->connection->send(std::make_shared<GameEventPacket>(GameEventPacket::START_RAINING, 0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 4J Stu - Fix for #44836 - Customer Encountered: Out of Sync Weather [A-10]
|
// 4J Stu - Fix for #44836 - Customer Encountered: Out of Sync Weather [A-10]
|
||||||
// If it was raining when the player left the level, and is now not raining we need to make sure that state is updated
|
// If it was raining when the player left the level, and is now not raining we need to make sure that state is updated
|
||||||
player->connection->send( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::STOP_RAINING, 0) ) );
|
player->connection->send(std::make_shared<GameEventPacket>(GameEventPacket::STOP_RAINING, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// send the stronghold position if there is one
|
// send the stronghold position if there is one
|
||||||
if((level->dimension->id==0) && level->getLevelData()->getHasStronghold())
|
if((level->dimension->id==0) && level->getLevelData()->getHasStronghold())
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<XZPacket>( new XZPacket(XZPacket::STRONGHOLD,level->getLevelData()->getXStronghold(),level->getLevelData()->getZStronghold()) ) );
|
player->connection->send(std::make_shared<XZPacket>(XZPacket::STRONGHOLD, level->getLevelData()->getXStronghold(), level->getLevelData()->getZStronghold()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1374,7 +1382,7 @@ void PlayerList::sendAllPlayerInfo(shared_ptr<ServerPlayer> player)
|
||||||
{
|
{
|
||||||
player->refreshContainer(player->inventoryMenu);
|
player->refreshContainer(player->inventoryMenu);
|
||||||
player->resetSentInfo();
|
player->resetSentInfo();
|
||||||
player->connection->send( shared_ptr<SetCarriedItemPacket>( new SetCarriedItemPacket(player->inventory->selected)) );
|
player->connection->send(std::make_shared<SetCarriedItemPacket>(player->inventory->selected));
|
||||||
}
|
}
|
||||||
|
|
||||||
int PlayerList::getPlayerCount()
|
int PlayerList::getPlayerCount()
|
||||||
|
|
|
||||||
|
|
@ -353,7 +353,7 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
|
||||||
|
|
||||||
if (mob->fishing != nullptr)
|
if (mob->fishing != nullptr)
|
||||||
{
|
{
|
||||||
item = shared_ptr<ItemInstance>( new ItemInstance(Item::stick) );
|
item = std::make_shared<ItemInstance>(Item::stick);
|
||||||
}
|
}
|
||||||
|
|
||||||
UseAnim anim = UseAnim_none;//null;
|
UseAnim anim = UseAnim_none;//null;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ void ReceivingLevelScreen::tick()
|
||||||
tickCount++;
|
tickCount++;
|
||||||
if (tickCount % 20 == 0)
|
if (tickCount % 20 == 0)
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<KeepAlivePacket>( new KeepAlivePacket() ) );
|
connection->send(std::make_shared<KeepAlivePacket>());
|
||||||
}
|
}
|
||||||
if (connection != nullptr)
|
if (connection != nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -497,7 +497,7 @@ void ServerLevel::tickTiles()
|
||||||
|
|
||||||
if (isRainingAt(x, y, z))
|
if (isRainingAt(x, y, z))
|
||||||
{
|
{
|
||||||
addGlobalEntity( shared_ptr<LightningBolt>( new LightningBolt(this, x, y, z) ) );
|
addGlobalEntity(std::make_shared<LightningBolt>(this, x, y, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1085,7 +1085,7 @@ bool ServerLevel::addGlobalEntity(shared_ptr<Entity> e)
|
||||||
{
|
{
|
||||||
if (Level::addGlobalEntity(e))
|
if (Level::addGlobalEntity(e))
|
||||||
{
|
{
|
||||||
server->getPlayers()->broadcast(e->x, e->y, e->z, 512, dimension->id, shared_ptr<AddGlobalEntityPacket>( new AddGlobalEntityPacket(e) ) );
|
server->getPlayers()->broadcast(e->x, e->y, e->z, 512, dimension->id, std::make_shared<AddGlobalEntityPacket>(e));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1093,7 +1093,7 @@ bool ServerLevel::addGlobalEntity(shared_ptr<Entity> e)
|
||||||
|
|
||||||
void ServerLevel::broadcastEntityEvent(shared_ptr<Entity> e, byte event)
|
void ServerLevel::broadcastEntityEvent(shared_ptr<Entity> e, byte event)
|
||||||
{
|
{
|
||||||
shared_ptr<Packet> p = shared_ptr<EntityEventPacket>( new EntityEventPacket(e->entityId, event) );
|
shared_ptr<Packet> p = std::make_shared<EntityEventPacket>(e->entityId, event);
|
||||||
server->getLevel(dimension->id)->getTracker()->broadcastAndSend(e, p);
|
server->getLevel(dimension->id)->getTracker()->broadcastAndSend(e, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1101,7 +1101,7 @@ shared_ptr<Explosion> ServerLevel::explode(shared_ptr<Entity> source, double x,
|
||||||
{
|
{
|
||||||
// instead of calling super, we run the same explosion code here except
|
// instead of calling super, we run the same explosion code here except
|
||||||
// we don't generate any particles
|
// we don't generate any particles
|
||||||
shared_ptr<Explosion> explosion = shared_ptr<Explosion>( new Explosion(this, source, x, y, z, r) );
|
shared_ptr<Explosion> explosion = std::make_shared<Explosion>(this, source, x, y, z, r);
|
||||||
explosion->fire = fire;
|
explosion->fire = fire;
|
||||||
explosion->destroyBlocks = destroyBlocks;
|
explosion->destroyBlocks = destroyBlocks;
|
||||||
explosion->explode();
|
explosion->explode();
|
||||||
|
|
@ -1144,7 +1144,7 @@ shared_ptr<Explosion> ServerLevel::explode(shared_ptr<Entity> source, double x,
|
||||||
Vec3 *knockbackVec = explosion->getHitPlayerKnockback(player);
|
Vec3 *knockbackVec = explosion->getHitPlayerKnockback(player);
|
||||||
//app.DebugPrintf("Sending %s with knockback (%f,%f,%f)\n", knockbackOnly?"knockbackOnly":"allExplosion",knockbackVec->x,knockbackVec->y,knockbackVec->z);
|
//app.DebugPrintf("Sending %s with knockback (%f,%f,%f)\n", knockbackOnly?"knockbackOnly":"allExplosion",knockbackVec->x,knockbackVec->y,knockbackVec->z);
|
||||||
// If the player is not the primary on the system, then we only want to send info for the knockback
|
// If the player is not the primary on the system, then we only want to send info for the knockback
|
||||||
player->connection->send( shared_ptr<ExplodePacket>( new ExplodePacket(x, y, z, r, &explosion->toBlow, knockbackVec, knockbackOnly)));
|
player->connection->send(std::make_shared<ExplodePacket>(x, y, z, r, &explosion->toBlow, knockbackVec, knockbackOnly));
|
||||||
sentTo.push_back( player );
|
sentTo.push_back( player );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1182,7 +1182,7 @@ void ServerLevel::runTileEvents()
|
||||||
if (doTileEvent(&it))
|
if (doTileEvent(&it))
|
||||||
{
|
{
|
||||||
TileEventData te = it;
|
TileEventData te = it;
|
||||||
server->getPlayers()->broadcast(te.getX(), te.getY(), te.getZ(), 64, dimension->id, shared_ptr<TileEventPacket>( new TileEventPacket(te.getX(), te.getY(), te.getZ(), te.getTile(), te.getParamA(), te.getParamB())));
|
server->getPlayers()->broadcast(te.getX(), te.getY(), te.getZ(), 64, dimension->id, std::make_shared<TileEventPacket>(te.getX(), te.getY(), te.getZ(), te.getTile(), te.getParamA(), te.getParamB()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tileEvents[runList].clear();
|
tileEvents[runList].clear();
|
||||||
|
|
@ -1212,11 +1212,11 @@ void ServerLevel::tickWeather()
|
||||||
{
|
{
|
||||||
if (wasRaining)
|
if (wasRaining)
|
||||||
{
|
{
|
||||||
server->getPlayers()->broadcastAll( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::STOP_RAINING, 0) ) );
|
server->getPlayers()->broadcastAll(std::make_shared<GameEventPacket>(GameEventPacket::STOP_RAINING, 0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
server->getPlayers()->broadcastAll( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::START_RAINING, 0) ) );
|
server->getPlayers()->broadcastAll(std::make_shared<GameEventPacket>(GameEventPacket::START_RAINING, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ void ServerPlayer::flushEntitiesToRemove()
|
||||||
it = entitiesToRemove.erase(it);
|
it = entitiesToRemove.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
connection->send(shared_ptr<RemoveEntitiesPacket>(new RemoveEntitiesPacket(ids)));
|
connection->send(std::make_shared<RemoveEntitiesPacket>(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -429,7 +429,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks)
|
||||||
// app.DebugPrintf("Creating BRUP for %d %d\n",nearest.x, nearest.z);
|
// app.DebugPrintf("Creating BRUP for %d %d\n",nearest.x, nearest.z);
|
||||||
PIXBeginNamedEvent(0,"Creation BRUP for sending\n");
|
PIXBeginNamedEvent(0,"Creation BRUP for sending\n");
|
||||||
__int64 before = System::currentTimeMillis();
|
__int64 before = System::currentTimeMillis();
|
||||||
shared_ptr<BlockRegionUpdatePacket> packet = shared_ptr<BlockRegionUpdatePacket>( new BlockRegionUpdatePacket(nearest.x * 16, 0, nearest.z * 16, 16, Level::maxBuildHeight, 16, level) );
|
shared_ptr<BlockRegionUpdatePacket> packet = std::make_shared<BlockRegionUpdatePacket>(nearest.x * 16, 0, nearest.z * 16, 16, Level::maxBuildHeight, 16, level);
|
||||||
__int64 after = System::currentTimeMillis();
|
__int64 after = System::currentTimeMillis();
|
||||||
// app.DebugPrintf(">>><<< %d ms\n",after-before);
|
// app.DebugPrintf(">>><<< %d ms\n",after-before);
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
@ -523,7 +523,7 @@ void ServerPlayer::doTickB()
|
||||||
if (getHealth() != lastSentHealth || lastSentFood != foodData.getFoodLevel() || ((foodData.getSaturationLevel() == 0) != lastFoodSaturationZero))
|
if (getHealth() != lastSentHealth || lastSentFood != foodData.getFoodLevel() || ((foodData.getSaturationLevel() == 0) != lastFoodSaturationZero))
|
||||||
{
|
{
|
||||||
// 4J Stu - Added m_lastDamageSource for telemetry
|
// 4J Stu - Added m_lastDamageSource for telemetry
|
||||||
connection->send( shared_ptr<SetHealthPacket>( new SetHealthPacket(getHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel(), m_lastDamageSource) ) );
|
connection->send(std::make_shared<SetHealthPacket>(getHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel(), m_lastDamageSource));
|
||||||
lastSentHealth = getHealth();
|
lastSentHealth = getHealth();
|
||||||
lastSentFood = foodData.getFoodLevel();
|
lastSentFood = foodData.getFoodLevel();
|
||||||
lastFoodSaturationZero = foodData.getSaturationLevel() == 0;
|
lastFoodSaturationZero = foodData.getSaturationLevel() == 0;
|
||||||
|
|
@ -550,7 +550,7 @@ void ServerPlayer::doTickB()
|
||||||
if (totalExperience != lastSentExp)
|
if (totalExperience != lastSentExp)
|
||||||
{
|
{
|
||||||
lastSentExp = totalExperience;
|
lastSentExp = totalExperience;
|
||||||
connection->send( shared_ptr<SetExperiencePacket>( new SetExperiencePacket(experienceProgress, totalExperience, experienceLevel) ) );
|
connection->send(std::make_shared<SetExperiencePacket>(experienceProgress, totalExperience, experienceLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -741,7 +741,7 @@ void ServerPlayer::changeDimension(int i)
|
||||||
level->removeEntity(shared_from_this());
|
level->removeEntity(shared_from_this());
|
||||||
wonGame = true;
|
wonGame = true;
|
||||||
m_enteredEndExitPortal = true; // We only flag this for the player in the portal
|
m_enteredEndExitPortal = true; // We only flag this for the player in the portal
|
||||||
connection->send( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()) ) );
|
connection->send(std::make_shared<GameEventPacket>(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()));
|
||||||
app.DebugPrintf("Sending packet to %d\n", thisPlayer->GetUserIndex());
|
app.DebugPrintf("Sending packet to %d\n", thisPlayer->GetUserIndex());
|
||||||
}
|
}
|
||||||
if(thisPlayer)
|
if(thisPlayer)
|
||||||
|
|
@ -752,7 +752,7 @@ void ServerPlayer::changeDimension(int i)
|
||||||
if(thisPlayer != checkPlayer && checkPlayer != nullptr && thisPlayer->IsSameSystem( checkPlayer ) && !servPlayer->wonGame )
|
if(thisPlayer != checkPlayer && checkPlayer != nullptr && thisPlayer->IsSameSystem( checkPlayer ) && !servPlayer->wonGame )
|
||||||
{
|
{
|
||||||
servPlayer->wonGame = true;
|
servPlayer->wonGame = true;
|
||||||
servPlayer->connection->send( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex() ) ) );
|
servPlayer->connection->send(std::make_shared<GameEventPacket>(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()));
|
||||||
app.DebugPrintf("Sending packet to %d\n", thisPlayer->GetUserIndex());
|
app.DebugPrintf("Sending packet to %d\n", thisPlayer->GetUserIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -812,7 +812,7 @@ Player::BedSleepingResult ServerPlayer::startSleepInBed(int x, int y, int z, boo
|
||||||
BedSleepingResult result = Player::startSleepInBed(x, y, z, bTestUse);
|
BedSleepingResult result = Player::startSleepInBed(x, y, z, bTestUse);
|
||||||
if (result == OK)
|
if (result == OK)
|
||||||
{
|
{
|
||||||
shared_ptr<Packet> p = shared_ptr<EntityActionAtPositionPacket>( new EntityActionAtPositionPacket(shared_from_this(), EntityActionAtPositionPacket::START_SLEEP, x, y, z) );
|
shared_ptr<Packet> p = std::make_shared<EntityActionAtPositionPacket>(shared_from_this(), EntityActionAtPositionPacket::START_SLEEP, x, y, z);
|
||||||
getLevel()->getTracker()->broadcast(shared_from_this(), p);
|
getLevel()->getTracker()->broadcast(shared_from_this(), p);
|
||||||
connection->teleport(this->x, this->y, this->z, yRot, xRot);
|
connection->teleport(this->x, this->y, this->z, yRot, xRot);
|
||||||
connection->send(p);
|
connection->send(p);
|
||||||
|
|
@ -824,7 +824,7 @@ void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, boo
|
||||||
{
|
{
|
||||||
if (isSleeping())
|
if (isSleeping())
|
||||||
{
|
{
|
||||||
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr<AnimatePacket>( new AnimatePacket(shared_from_this(), AnimatePacket::WAKE_UP) ) );
|
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::make_shared<AnimatePacket>(shared_from_this(), AnimatePacket::WAKE_UP));
|
||||||
}
|
}
|
||||||
Player::stopSleepInBed(forcefulWakeUp, updateLevelList, saveRespawnPoint);
|
Player::stopSleepInBed(forcefulWakeUp, updateLevelList, saveRespawnPoint);
|
||||||
if (connection != nullptr) connection->teleport(x, y, z, yRot, xRot);
|
if (connection != nullptr) connection->teleport(x, y, z, yRot, xRot);
|
||||||
|
|
@ -833,7 +833,7 @@ void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, boo
|
||||||
void ServerPlayer::ride(shared_ptr<Entity> e)
|
void ServerPlayer::ride(shared_ptr<Entity> e)
|
||||||
{
|
{
|
||||||
Player::ride(e);
|
Player::ride(e);
|
||||||
connection->send( shared_ptr<SetEntityLinkPacket>( new SetEntityLinkPacket(SetEntityLinkPacket::RIDING, shared_from_this(), riding) ) );
|
connection->send(std::make_shared<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
|
// 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
|
// of the player. If we also teleport it then we can end up with a repeating movements, e.g. bouncing
|
||||||
|
|
@ -856,7 +856,7 @@ void ServerPlayer::openTextEdit(shared_ptr<TileEntity> sign)
|
||||||
if (signTE != nullptr)
|
if (signTE != nullptr)
|
||||||
{
|
{
|
||||||
signTE->setAllowedPlayerEditor(dynamic_pointer_cast<Player>(shared_from_this()));
|
signTE->setAllowedPlayerEditor(dynamic_pointer_cast<Player>(shared_from_this()));
|
||||||
connection->send( shared_ptr<TileEditorOpenPacket>( new TileEditorOpenPacket(TileEditorOpenPacket::SIGN, sign->x, sign->y, sign->z)) );
|
connection->send(std::make_shared<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)
|
if(containerMenu == inventoryMenu)
|
||||||
{
|
{
|
||||||
nextContainerCounter();
|
nextContainerCounter();
|
||||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::WORKBENCH, L"", 9, false) ) );
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::WORKBENCH, L"", 9, false));
|
||||||
containerMenu = new CraftingMenu(inventory, level, x, y, z);
|
containerMenu = new CraftingMenu(inventory, level, x, y, z);
|
||||||
containerMenu->containerId = containerCounter;
|
containerMenu->containerId = containerCounter;
|
||||||
containerMenu->addSlotListener(this);
|
containerMenu->addSlotListener(this);
|
||||||
|
|
@ -888,7 +888,7 @@ bool ServerPlayer::openFireworks(int x, int y, int z)
|
||||||
if(containerMenu == inventoryMenu)
|
if(containerMenu == inventoryMenu)
|
||||||
{
|
{
|
||||||
nextContainerCounter();
|
nextContainerCounter();
|
||||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false) ) );
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false));
|
||||||
containerMenu = new FireworksMenu(inventory, level, x, y, z);
|
containerMenu = new FireworksMenu(inventory, level, x, y, z);
|
||||||
containerMenu->containerId = containerCounter;
|
containerMenu->containerId = containerCounter;
|
||||||
containerMenu->addSlotListener(this);
|
containerMenu->addSlotListener(this);
|
||||||
|
|
@ -898,7 +898,7 @@ bool ServerPlayer::openFireworks(int x, int y, int z)
|
||||||
closeContainer();
|
closeContainer();
|
||||||
|
|
||||||
nextContainerCounter();
|
nextContainerCounter();
|
||||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false) ) );
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::FIREWORKS, L"", 9, false));
|
||||||
containerMenu = new FireworksMenu(inventory, level, x, y, z);
|
containerMenu = new FireworksMenu(inventory, level, x, y, z);
|
||||||
containerMenu->containerId = containerCounter;
|
containerMenu->containerId = containerCounter;
|
||||||
containerMenu->addSlotListener(this);
|
containerMenu->addSlotListener(this);
|
||||||
|
|
@ -916,7 +916,7 @@ bool ServerPlayer::startEnchanting(int x, int y, int z, const wstring &name)
|
||||||
if(containerMenu == inventoryMenu)
|
if(containerMenu == inventoryMenu)
|
||||||
{
|
{
|
||||||
nextContainerCounter();
|
nextContainerCounter();
|
||||||
connection->send(shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::ENCHANTMENT, name.empty()? L"" : name, 9, !name.empty() ) ));
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::ENCHANTMENT, name.empty() ? L"" : name, 9, !name.empty()));
|
||||||
containerMenu = new EnchantmentMenu(inventory, level, x, y, z);
|
containerMenu = new EnchantmentMenu(inventory, level, x, y, z);
|
||||||
containerMenu->containerId = containerCounter;
|
containerMenu->containerId = containerCounter;
|
||||||
containerMenu->addSlotListener(this);
|
containerMenu->addSlotListener(this);
|
||||||
|
|
@ -934,7 +934,7 @@ bool ServerPlayer::startRepairing(int x, int y, int z)
|
||||||
if(containerMenu == inventoryMenu)
|
if(containerMenu == inventoryMenu)
|
||||||
{
|
{
|
||||||
nextContainerCounter();
|
nextContainerCounter();
|
||||||
connection->send(shared_ptr<ContainerOpenPacket> ( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::REPAIR_TABLE, L"", 9, false)) );
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::REPAIR_TABLE, L"", 9, false));
|
||||||
containerMenu = new AnvilMenu(inventory, level, x, y, z, dynamic_pointer_cast<Player>(shared_from_this()));
|
containerMenu = new AnvilMenu(inventory, level, x, y, z, dynamic_pointer_cast<Player>(shared_from_this()));
|
||||||
containerMenu->containerId = containerCounter;
|
containerMenu->containerId = containerCounter;
|
||||||
containerMenu->addSlotListener(this);
|
containerMenu->addSlotListener(this);
|
||||||
|
|
@ -957,7 +957,7 @@ bool ServerPlayer::openContainer(shared_ptr<Container> container)
|
||||||
int containerType = container->getContainerType();
|
int containerType = container->getContainerType();
|
||||||
assert(containerType >= 0);
|
assert(containerType >= 0);
|
||||||
|
|
||||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, containerType, container->getCustomName(), container->getContainerSize(), container->hasCustomName()) ) );
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, containerType, container->getCustomName(), container->getContainerSize(), container->hasCustomName()));
|
||||||
|
|
||||||
containerMenu = new ContainerMenu(inventory, container);
|
containerMenu = new ContainerMenu(inventory, container);
|
||||||
containerMenu->containerId = containerCounter;
|
containerMenu->containerId = containerCounter;
|
||||||
|
|
@ -976,7 +976,7 @@ bool ServerPlayer::openHopper(shared_ptr<HopperTileEntity> container)
|
||||||
if(containerMenu == inventoryMenu)
|
if(containerMenu == inventoryMenu)
|
||||||
{
|
{
|
||||||
nextContainerCounter();
|
nextContainerCounter();
|
||||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName())) );
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName()));
|
||||||
containerMenu = new HopperMenu(inventory, container);
|
containerMenu = new HopperMenu(inventory, container);
|
||||||
containerMenu->containerId = containerCounter;
|
containerMenu->containerId = containerCounter;
|
||||||
containerMenu->addSlotListener(this);
|
containerMenu->addSlotListener(this);
|
||||||
|
|
@ -994,7 +994,7 @@ bool ServerPlayer::openHopper(shared_ptr<MinecartHopper> container)
|
||||||
if(containerMenu == inventoryMenu)
|
if(containerMenu == inventoryMenu)
|
||||||
{
|
{
|
||||||
nextContainerCounter();
|
nextContainerCounter();
|
||||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName())) );
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize(), container->hasCustomName()));
|
||||||
containerMenu = new HopperMenu(inventory, container);
|
containerMenu = new HopperMenu(inventory, container);
|
||||||
containerMenu->containerId = containerCounter;
|
containerMenu->containerId = containerCounter;
|
||||||
containerMenu->addSlotListener(this);
|
containerMenu->addSlotListener(this);
|
||||||
|
|
@ -1012,7 +1012,7 @@ bool ServerPlayer::openFurnace(shared_ptr<FurnaceTileEntity> furnace)
|
||||||
if(containerMenu == inventoryMenu)
|
if(containerMenu == inventoryMenu)
|
||||||
{
|
{
|
||||||
nextContainerCounter();
|
nextContainerCounter();
|
||||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::FURNACE, furnace->getCustomName(), furnace->getContainerSize(), furnace->hasCustomName()) ) );
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::FURNACE, furnace->getCustomName(), furnace->getContainerSize(), furnace->hasCustomName()));
|
||||||
containerMenu = new FurnaceMenu(inventory, furnace);
|
containerMenu = new FurnaceMenu(inventory, furnace);
|
||||||
containerMenu->containerId = containerCounter;
|
containerMenu->containerId = containerCounter;
|
||||||
containerMenu->addSlotListener(this);
|
containerMenu->addSlotListener(this);
|
||||||
|
|
@ -1030,7 +1030,7 @@ bool ServerPlayer::openTrap(shared_ptr<DispenserTileEntity> trap)
|
||||||
if(containerMenu == inventoryMenu)
|
if(containerMenu == inventoryMenu)
|
||||||
{
|
{
|
||||||
nextContainerCounter();
|
nextContainerCounter();
|
||||||
connection->send( shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, trap->GetType() == eTYPE_DROPPERTILEENTITY ? ContainerOpenPacket::DROPPER : ContainerOpenPacket::TRAP, trap->getCustomName(), trap->getContainerSize(), trap->hasCustomName() ) ) );
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, trap->GetType() == eTYPE_DROPPERTILEENTITY ? ContainerOpenPacket::DROPPER : ContainerOpenPacket::TRAP, trap->getCustomName(), trap->getContainerSize(), trap->hasCustomName()));
|
||||||
containerMenu = new TrapMenu(inventory, trap);
|
containerMenu = new TrapMenu(inventory, trap);
|
||||||
containerMenu->containerId = containerCounter;
|
containerMenu->containerId = containerCounter;
|
||||||
containerMenu->addSlotListener(this);
|
containerMenu->addSlotListener(this);
|
||||||
|
|
@ -1048,7 +1048,7 @@ bool ServerPlayer::openBrewingStand(shared_ptr<BrewingStandTileEntity> brewingSt
|
||||||
if(containerMenu == inventoryMenu)
|
if(containerMenu == inventoryMenu)
|
||||||
{
|
{
|
||||||
nextContainerCounter();
|
nextContainerCounter();
|
||||||
connection->send(shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::BREWING_STAND, brewingStand->getCustomName(), brewingStand->getContainerSize(), brewingStand->hasCustomName() )));
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::BREWING_STAND, brewingStand->getCustomName(), brewingStand->getContainerSize(), brewingStand->hasCustomName()));
|
||||||
containerMenu = new BrewingStandMenu(inventory, brewingStand);
|
containerMenu = new BrewingStandMenu(inventory, brewingStand);
|
||||||
containerMenu->containerId = containerCounter;
|
containerMenu->containerId = containerCounter;
|
||||||
containerMenu->addSlotListener(this);
|
containerMenu->addSlotListener(this);
|
||||||
|
|
@ -1066,7 +1066,7 @@ bool ServerPlayer::openBeacon(shared_ptr<BeaconTileEntity> beacon)
|
||||||
if(containerMenu == inventoryMenu)
|
if(containerMenu == inventoryMenu)
|
||||||
{
|
{
|
||||||
nextContainerCounter();
|
nextContainerCounter();
|
||||||
connection->send(shared_ptr<ContainerOpenPacket>( new ContainerOpenPacket(containerCounter, ContainerOpenPacket::BEACON, beacon->getCustomName(), beacon->getContainerSize(), beacon->hasCustomName() )));
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::BEACON, beacon->getCustomName(), beacon->getContainerSize(), beacon->hasCustomName()));
|
||||||
containerMenu = new BeaconMenu(inventory, beacon);
|
containerMenu = new BeaconMenu(inventory, beacon);
|
||||||
containerMenu->containerId = containerCounter;
|
containerMenu->containerId = containerCounter;
|
||||||
containerMenu->addSlotListener(this);
|
containerMenu->addSlotListener(this);
|
||||||
|
|
@ -1089,7 +1089,7 @@ bool ServerPlayer::openTrading(shared_ptr<Merchant> traderTarget, const wstring
|
||||||
containerMenu->addSlotListener(this);
|
containerMenu->addSlotListener(this);
|
||||||
shared_ptr<Container> container = static_cast<MerchantMenu *>(containerMenu)->getTradeContainer();
|
shared_ptr<Container> container = static_cast<MerchantMenu *>(containerMenu)->getTradeContainer();
|
||||||
|
|
||||||
connection->send(shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(containerCounter, ContainerOpenPacket::TRADER_NPC, name.empty()?L"":name, container->getContainerSize(), !name.empty())));
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::TRADER_NPC, name.empty() ? L"" : name, container->getContainerSize(), !name.empty()));
|
||||||
|
|
||||||
MerchantRecipeList *offers = traderTarget->getOffers(dynamic_pointer_cast<Player>(shared_from_this()));
|
MerchantRecipeList *offers = traderTarget->getOffers(dynamic_pointer_cast<Player>(shared_from_this()));
|
||||||
if (offers != nullptr)
|
if (offers != nullptr)
|
||||||
|
|
@ -1101,7 +1101,7 @@ bool ServerPlayer::openTrading(shared_ptr<Merchant> traderTarget, const wstring
|
||||||
output.writeInt(containerCounter);
|
output.writeInt(containerCounter);
|
||||||
offers->writeToStream(&output);
|
offers->writeToStream(&output);
|
||||||
|
|
||||||
connection->send(shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_LIST_PACKET, rawOutput.toByteArray())));
|
connection->send(std::make_shared<CustomPayloadPacket>(CustomPayloadPacket::TRADER_LIST_PACKET, rawOutput.toByteArray()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1119,7 +1119,7 @@ bool ServerPlayer::openHorseInventory(shared_ptr<EntityHorse> horse, shared_ptr<
|
||||||
closeContainer();
|
closeContainer();
|
||||||
}
|
}
|
||||||
nextContainerCounter();
|
nextContainerCounter();
|
||||||
connection->send(shared_ptr<ContainerOpenPacket>(new ContainerOpenPacket(containerCounter, ContainerOpenPacket::HORSE, horse->getCustomName(), container->getContainerSize(), container->hasCustomName(), horse->entityId )));
|
connection->send(std::make_shared<ContainerOpenPacket>(containerCounter, ContainerOpenPacket::HORSE, horse->getCustomName(), container->getContainerSize(), container->hasCustomName(), horse->entityId));
|
||||||
containerMenu = new HorseInventoryMenu(inventory, container, horse);
|
containerMenu = new HorseInventoryMenu(inventory, container, horse);
|
||||||
containerMenu->containerId = containerCounter;
|
containerMenu->containerId = containerCounter;
|
||||||
containerMenu->addSlotListener(this);
|
containerMenu->addSlotListener(this);
|
||||||
|
|
@ -1144,7 +1144,7 @@ void ServerPlayer::slotChanged(AbstractContainerMenu *container, int slotIndex,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
connection->send( shared_ptr<ContainerSetSlotPacket>( new ContainerSetSlotPacket(container->containerId, slotIndex, item) ) );
|
connection->send(std::make_shared<ContainerSetSlotPacket>(container->containerId, slotIndex, item));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1157,8 +1157,8 @@ void ServerPlayer::refreshContainer(AbstractContainerMenu *menu)
|
||||||
|
|
||||||
void ServerPlayer::refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items)
|
void ServerPlayer::refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items)
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<ContainerSetContentPacket>( new ContainerSetContentPacket(container->containerId, items) ) );
|
connection->send(std::make_shared<ContainerSetContentPacket>(container->containerId, items));
|
||||||
connection->send( shared_ptr<ContainerSetSlotPacket>( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) );
|
connection->send(std::make_shared<ContainerSetSlotPacket>(-1, -1, inventory->getCarried()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerPlayer::setContainerData(AbstractContainerMenu *container, int id, int value)
|
void ServerPlayer::setContainerData(AbstractContainerMenu *container, int id, int value)
|
||||||
|
|
@ -1173,12 +1173,12 @@ void ServerPlayer::setContainerData(AbstractContainerMenu *container, int id, in
|
||||||
// client again.
|
// client again.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connection->send( shared_ptr<ContainerSetDataPacket>( new ContainerSetDataPacket(container->containerId, id, value) ) );
|
connection->send(std::make_shared<ContainerSetDataPacket>(container->containerId, id, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerPlayer::closeContainer()
|
void ServerPlayer::closeContainer()
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<ContainerClosePacket>( new ContainerClosePacket(containerMenu->containerId) ) );
|
connection->send(std::make_shared<ContainerClosePacket>(containerMenu->containerId));
|
||||||
doCloseContainer();
|
doCloseContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1192,7 +1192,7 @@ void ServerPlayer::broadcastCarriedItem()
|
||||||
// client again.
|
// client again.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connection->send( shared_ptr<ContainerSetSlotPacket>( new ContainerSetSlotPacket(-1, -1, inventory->getCarried()) ) );
|
connection->send(std::make_shared<ContainerSetSlotPacket>(-1, -1, inventory->getCarried()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerPlayer::doCloseContainer()
|
void ServerPlayer::doCloseContainer()
|
||||||
|
|
@ -1226,7 +1226,7 @@ void ServerPlayer::awardStat(Stat *stat, byteArray param)
|
||||||
int count = *((int*)param.data);
|
int count = *((int*)param.data);
|
||||||
delete [] param.data;
|
delete [] param.data;
|
||||||
|
|
||||||
connection->send( shared_ptr<AwardStatPacket>( new AwardStatPacket(stat->id, count) ) );
|
connection->send(std::make_shared<AwardStatPacket>(stat->id, count));
|
||||||
#else
|
#else
|
||||||
connection->send( shared_ptr<AwardStatPacket>( new AwardStatPacket(stat->id, param) ) );
|
connection->send( shared_ptr<AwardStatPacket>( new AwardStatPacket(stat->id, param) ) );
|
||||||
// byteArray deleted in AwardStatPacket destructor.
|
// byteArray deleted in AwardStatPacket destructor.
|
||||||
|
|
@ -1257,19 +1257,19 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
{
|
{
|
||||||
case IDS_TILE_BED_OCCUPIED:
|
case IDS_TILE_BED_OCCUPIED:
|
||||||
messageType = ChatPacket::e_ChatBedOccupied;
|
messageType = ChatPacket::e_ChatBedOccupied;
|
||||||
connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"", messageType) ) );
|
connection->send(std::make_shared<ChatPacket>(L"", messageType));
|
||||||
break;
|
break;
|
||||||
case IDS_TILE_BED_NO_SLEEP:
|
case IDS_TILE_BED_NO_SLEEP:
|
||||||
messageType = ChatPacket::e_ChatBedNoSleep;
|
messageType = ChatPacket::e_ChatBedNoSleep;
|
||||||
connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"", messageType) ) );
|
connection->send(std::make_shared<ChatPacket>(L"", messageType));
|
||||||
break;
|
break;
|
||||||
case IDS_TILE_BED_NOT_VALID:
|
case IDS_TILE_BED_NOT_VALID:
|
||||||
messageType = ChatPacket::e_ChatBedNotValid;
|
messageType = ChatPacket::e_ChatBedNotValid;
|
||||||
connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"", messageType) ) );
|
connection->send(std::make_shared<ChatPacket>(L"", messageType));
|
||||||
break;
|
break;
|
||||||
case IDS_TILE_BED_NOTSAFE:
|
case IDS_TILE_BED_NOTSAFE:
|
||||||
messageType = ChatPacket::e_ChatBedNotSafe;
|
messageType = ChatPacket::e_ChatBedNotSafe;
|
||||||
connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"", messageType) ) );
|
connection->send(std::make_shared<ChatPacket>(L"", messageType));
|
||||||
break;
|
break;
|
||||||
case IDS_TILE_BED_PLAYERSLEEP:
|
case IDS_TILE_BED_PLAYERSLEEP:
|
||||||
messageType = ChatPacket::e_ChatBedPlayerSleep;
|
messageType = ChatPacket::e_ChatBedPlayerSleep;
|
||||||
|
|
@ -1279,11 +1279,11 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()!=player)
|
if(shared_from_this()!=player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatBedPlayerSleep)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatBedPlayerSleep));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatBedMeSleep)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatBedMeSleep));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
@ -1294,7 +1294,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()!=player)
|
if(shared_from_this()!=player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerEnteredEnd)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerEnteredEnd));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1304,13 +1304,13 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()!=player)
|
if(shared_from_this()!=player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerLeftEnd)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerLeftEnd));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IDS_TILE_BED_MESLEEP:
|
case IDS_TILE_BED_MESLEEP:
|
||||||
messageType = ChatPacket::e_ChatBedMeSleep;
|
messageType = ChatPacket::e_ChatBedMeSleep;
|
||||||
connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"", messageType) ) );
|
connection->send(std::make_shared<ChatPacket>(L"", messageType));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED:
|
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];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxPigsSheepCows)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxPigsSheepCows));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1329,7 +1329,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxChickens)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxChickens));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1339,7 +1339,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxSquid)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxSquid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1349,7 +1349,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBats)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxBats));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1359,7 +1359,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxWolves)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxWolves));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1369,7 +1369,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxMooshrooms)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxMooshrooms));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1379,7 +1379,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxEnemies)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxEnemies));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1390,7 +1390,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxVillagers)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxVillagers));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1400,7 +1400,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredPigsSheepCows)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxBredPigsSheepCows));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1410,7 +1410,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredChickens)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxBredChickens));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1420,7 +1420,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredMooshrooms)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxBredMooshrooms));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1431,7 +1431,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBredWolves)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxBredWolves));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1442,7 +1442,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerCantShearMooshroom)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerCantShearMooshroom));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1454,7 +1454,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxHangingEntities)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxHangingEntities));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1464,7 +1464,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerCantSpawnInPeaceful)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerCantSpawnInPeaceful));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1475,7 +1475,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
shared_ptr<ServerPlayer> player = server->getPlayers()->players[i];
|
||||||
if(shared_from_this()==player)
|
if(shared_from_this()==player)
|
||||||
{
|
{
|
||||||
player->connection->send(shared_ptr<ChatPacket>( new ChatPacket(name, ChatPacket::e_ChatPlayerMaxBoats)));
|
player->connection->send(std::make_shared<ChatPacket>(name, ChatPacket::e_ChatPlayerMaxBoats));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1493,7 +1493,7 @@ void ServerPlayer::displayClientMessage(int messageId)
|
||||||
|
|
||||||
void ServerPlayer::completeUsingItem()
|
void ServerPlayer::completeUsingItem()
|
||||||
{
|
{
|
||||||
connection->send(shared_ptr<EntityEventPacket>( new EntityEventPacket(entityId, EntityEvent::USE_ITEM_COMPLETE) ) );
|
connection->send(std::make_shared<EntityEventPacket>(entityId, EntityEvent::USE_ITEM_COMPLETE));
|
||||||
Player::completeUsingItem();
|
Player::completeUsingItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1503,7 +1503,7 @@ void ServerPlayer::startUsingItem(shared_ptr<ItemInstance> instance, int duratio
|
||||||
|
|
||||||
if (instance != nullptr && instance->getItem() != nullptr && instance->getItem()->getUseAnimation(instance) == UseAnim_eat)
|
if (instance != nullptr && instance->getItem() != nullptr && instance->getItem()->getUseAnimation(instance) == UseAnim_eat)
|
||||||
{
|
{
|
||||||
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr<AnimatePacket>( new AnimatePacket(shared_from_this(), AnimatePacket::EAT) ) );
|
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::make_shared<AnimatePacket>(shared_from_this(), AnimatePacket::EAT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1519,21 +1519,21 @@ void ServerPlayer::restoreFrom(shared_ptr<Player> oldPlayer, bool restoreAll)
|
||||||
void ServerPlayer::onEffectAdded(MobEffectInstance *effect)
|
void ServerPlayer::onEffectAdded(MobEffectInstance *effect)
|
||||||
{
|
{
|
||||||
Player::onEffectAdded(effect);
|
Player::onEffectAdded(effect);
|
||||||
connection->send(shared_ptr<UpdateMobEffectPacket>( new UpdateMobEffectPacket(entityId, effect) ) );
|
connection->send(std::make_shared<UpdateMobEffectPacket>(entityId, effect));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ServerPlayer::onEffectUpdated(MobEffectInstance *effect, bool doRefreshAttributes)
|
void ServerPlayer::onEffectUpdated(MobEffectInstance *effect, bool doRefreshAttributes)
|
||||||
{
|
{
|
||||||
Player::onEffectUpdated(effect, doRefreshAttributes);
|
Player::onEffectUpdated(effect, doRefreshAttributes);
|
||||||
connection->send(shared_ptr<UpdateMobEffectPacket>( new UpdateMobEffectPacket(entityId, effect) ) );
|
connection->send(std::make_shared<UpdateMobEffectPacket>(entityId, effect));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ServerPlayer::onEffectRemoved(MobEffectInstance *effect)
|
void ServerPlayer::onEffectRemoved(MobEffectInstance *effect)
|
||||||
{
|
{
|
||||||
Player::onEffectRemoved(effect);
|
Player::onEffectRemoved(effect);
|
||||||
connection->send(shared_ptr<RemoveMobEffectPacket>( new RemoveMobEffectPacket(entityId, effect) ) );
|
connection->send(std::make_shared<RemoveMobEffectPacket>(entityId, effect));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerPlayer::teleportTo(double x, double y, double z)
|
void ServerPlayer::teleportTo(double x, double y, double z)
|
||||||
|
|
@ -1543,18 +1543,18 @@ void ServerPlayer::teleportTo(double x, double y, double z)
|
||||||
|
|
||||||
void ServerPlayer::crit(shared_ptr<Entity> entity)
|
void ServerPlayer::crit(shared_ptr<Entity> entity)
|
||||||
{
|
{
|
||||||
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr<AnimatePacket>( new AnimatePacket(entity, AnimatePacket::CRITICAL_HIT) ));
|
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::make_shared<AnimatePacket>(entity, AnimatePacket::CRITICAL_HIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerPlayer::magicCrit(shared_ptr<Entity> entity)
|
void ServerPlayer::magicCrit(shared_ptr<Entity> entity)
|
||||||
{
|
{
|
||||||
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr<AnimatePacket>( new AnimatePacket(entity, AnimatePacket::MAGIC_CRITICAL_HIT) ));
|
getLevel()->getTracker()->broadcastAndSend(shared_from_this(), std::make_shared<AnimatePacket>(entity, AnimatePacket::MAGIC_CRITICAL_HIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerPlayer::onUpdateAbilities()
|
void ServerPlayer::onUpdateAbilities()
|
||||||
{
|
{
|
||||||
if (connection == nullptr) return;
|
if (connection == nullptr) return;
|
||||||
connection->send(shared_ptr<PlayerAbilitiesPacket>(new PlayerAbilitiesPacket(&abilities)));
|
connection->send(std::make_shared<PlayerAbilitiesPacket>(&abilities));
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerLevel *ServerPlayer::getLevel()
|
ServerLevel *ServerPlayer::getLevel()
|
||||||
|
|
@ -1565,12 +1565,12 @@ ServerLevel *ServerPlayer::getLevel()
|
||||||
void ServerPlayer::setGameMode(GameType *mode)
|
void ServerPlayer::setGameMode(GameType *mode)
|
||||||
{
|
{
|
||||||
gameMode->setGameModeForPlayer(mode);
|
gameMode->setGameModeForPlayer(mode);
|
||||||
connection->send(shared_ptr<GameEventPacket>(new GameEventPacket(GameEventPacket::CHANGE_GAME_MODE, mode->getId())));
|
connection->send(std::make_shared<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""*/)
|
void ServerPlayer::sendMessage(const wstring& message, ChatPacket::EChatPacketMessage type /*= e_ChatCustom*/, int customData /*= -1*/, const wstring& additionalMessage /*= L""*/)
|
||||||
{
|
{
|
||||||
connection->send(shared_ptr<ChatPacket>(new ChatPacket(message,type,customData,additionalMessage)));
|
connection->send(std::make_shared<ChatPacket>(message, type, customData, additionalMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ServerPlayer::hasPermission(EGameCommand command)
|
bool ServerPlayer::hasPermission(EGameCommand command)
|
||||||
|
|
|
||||||
|
|
@ -286,7 +286,7 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z)
|
||||||
|
|
||||||
if (isCreative())
|
if (isCreative())
|
||||||
{
|
{
|
||||||
shared_ptr<TileUpdatePacket> tup = shared_ptr<TileUpdatePacket>( new TileUpdatePacket(x, y, z, level) );
|
shared_ptr<TileUpdatePacket> tup = std::make_shared<TileUpdatePacket>(x, y, z, level);
|
||||||
// 4J - a bit of a hack here, but if we want to tell the client that it needs to inform the renderer of a block being destroyed, then send a block 255 instead of a 0. This is handled in ClientConnection::handleTileUpdate
|
// 4J - a bit of a hack here, but if we want to tell the client that it needs to inform the renderer of a block being destroyed, then send a block 255 instead of a 0. This is handled in ClientConnection::handleTileUpdate
|
||||||
if( tup->block == 0 )
|
if( tup->block == 0 )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ void SnowManRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a
|
||||||
shared_ptr<SnowMan> mob = dynamic_pointer_cast<SnowMan>(_mob);
|
shared_ptr<SnowMan> mob = dynamic_pointer_cast<SnowMan>(_mob);
|
||||||
|
|
||||||
MobRenderer::additionalRendering(mob, a);
|
MobRenderer::additionalRendering(mob, a);
|
||||||
shared_ptr<ItemInstance> headGear = shared_ptr<ItemInstance>( new ItemInstance(Tile::pumpkin, 1) );
|
shared_ptr<ItemInstance> headGear = std::make_shared<ItemInstance>(Tile::pumpkin, 1);
|
||||||
if (headGear != nullptr && headGear->getItem()->id < 256)
|
if (headGear != nullptr && headGear->getItem()->id < 256)
|
||||||
{
|
{
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
|
||||||
|
|
@ -86,5 +86,5 @@ shared_ptr<GameCommandPacket> TeleportCommand::preparePacket(PlayerUID subject,
|
||||||
dos.writePlayerUID(subject);
|
dos.writePlayerUID(subject);
|
||||||
dos.writePlayerUID(destination);
|
dos.writePlayerUID(destination);
|
||||||
|
|
||||||
return shared_ptr<GameCommandPacket>( new GameCommandPacket(eGameCommand_Teleport, baos.toByteArray() ));
|
return std::make_shared<GameCommandPacket>(eGameCommand_Teleport, baos.toByteArray());
|
||||||
}
|
}
|
||||||
|
|
@ -35,7 +35,7 @@ void TextEditScreen::removed()
|
||||||
Keyboard::enableRepeatEvents(false);
|
Keyboard::enableRepeatEvents(false);
|
||||||
if (minecraft->level->isClientSide)
|
if (minecraft->level->isClientSide)
|
||||||
{
|
{
|
||||||
minecraft->getConnection(0)->send( shared_ptr<SignUpdatePacket>( new SignUpdatePacket(sign->x, sign->y, sign->z, sign->IsVerified(), sign->IsCensored(), sign->GetMessages()) ) );
|
minecraft->getConnection(0)->send(std::make_shared<SignUpdatePacket>(sign->x, sign->y, sign->z, sign->IsVerified(), sign->IsCensored(), sign->GetMessages()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
#include "..\Minecraft.World\File.h"
|
#include "..\Minecraft.World\File.h"
|
||||||
#include "..\Minecraft.World\StringHelpers.h"
|
#include "..\Minecraft.World\StringHelpers.h"
|
||||||
#include "Minimap.h"
|
#include "Minimap.h"
|
||||||
|
#include "Common/UI/UI.h"
|
||||||
|
|
||||||
TexturePack *TexturePackRepository::DEFAULT_TEXTURE_PACK = nullptr;
|
TexturePack *TexturePackRepository::DEFAULT_TEXTURE_PACK = nullptr;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
|
||||||
if (lastRidingEntity != e->riding || (e->riding != nullptr && tickCount % (SharedConstants::TICKS_PER_SECOND * 3) == 0))
|
if (lastRidingEntity != e->riding || (e->riding != nullptr && tickCount % (SharedConstants::TICKS_PER_SECOND * 3) == 0))
|
||||||
{
|
{
|
||||||
lastRidingEntity = e->riding;
|
lastRidingEntity = e->riding;
|
||||||
broadcast(shared_ptr<SetEntityLinkPacket>(new SetEntityLinkPacket(SetEntityLinkPacket::RIDING, e, e->riding)));
|
broadcast(std::make_shared<SetEntityLinkPacket>(SetEntityLinkPacket::RIDING, e, e->riding));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Moving forward special case for item frames
|
// Moving forward special case for item frames
|
||||||
|
|
@ -94,7 +94,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
|
||||||
shared_ptr<SynchedEntityData> entityData = e->getEntityData();
|
shared_ptr<SynchedEntityData> entityData = e->getEntityData();
|
||||||
if (entityData->isDirty())
|
if (entityData->isDirty())
|
||||||
{
|
{
|
||||||
broadcastAndSend( shared_ptr<SetEntityDataPacket>( new SetEntityDataPacket(e->entityId, entityData, false) ) );
|
broadcastAndSend(std::make_shared<SetEntityDataPacket>(e->entityId, entityData, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (tickCount % updateInterval == 0 || e->hasImpulse || e->getEntityData()->isDirty())
|
else if (tickCount % updateInterval == 0 || e->hasImpulse || e->getEntityData()->isDirty())
|
||||||
|
|
@ -152,7 +152,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
teleportDelay = 0;
|
teleportDelay = 0;
|
||||||
packet = shared_ptr<TeleportEntityPacket>( new TeleportEntityPacket(e->entityId, xn, yn, zn, static_cast<byte>(yRotn), static_cast<byte>(xRotn)) );
|
packet = std::make_shared<TeleportEntityPacket>(e->entityId, xn, yn, zn, static_cast<byte>(yRotn), static_cast<byte>(xRotn));
|
||||||
// printf("%d: New teleport rot %d\n",e->entityId,yRotn);
|
// printf("%d: New teleport rot %d\n",e->entityId,yRotn);
|
||||||
yRotp = yRotn;
|
yRotp = yRotn;
|
||||||
xRotp = xRotn;
|
xRotp = xRotn;
|
||||||
|
|
@ -179,12 +179,12 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
|
||||||
yRotn = yRotp + yRota;
|
yRotn = yRotp + yRota;
|
||||||
}
|
}
|
||||||
// 5 bits each for x & z, and 6 for y
|
// 5 bits each for x & z, and 6 for y
|
||||||
packet = shared_ptr<MoveEntityPacketSmall>( new MoveEntityPacketSmall::PosRot(e->entityId, static_cast<char>(xa), static_cast<char>(ya), static_cast<char>(za), static_cast<char>(yRota), 0 ) );
|
packet = std::make_shared<MoveEntityPacketSmall::PosRot>(e->entityId, static_cast<char>(xa), static_cast<char>(ya), static_cast<char>(za), static_cast<char>(yRota), 0);
|
||||||
c0a++;
|
c0a++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
packet = shared_ptr<MoveEntityPacket>( new MoveEntityPacket::PosRot(e->entityId, static_cast<char>(xa), static_cast<char>(ya), static_cast<char>(za), static_cast<char>(yRota), static_cast<char>(xRota)) );
|
packet = std::make_shared<MoveEntityPacket::PosRot>(e->entityId, static_cast<char>(xa), static_cast<char>(ya), static_cast<char>(za), static_cast<char>(yRota), static_cast<char>(xRota));
|
||||||
// printf("%d: New posrot %d + %d = %d\n",e->entityId,yRotp,yRota,yRotn);
|
// printf("%d: New posrot %d + %d = %d\n",e->entityId,yRotp,yRota,yRotn);
|
||||||
c0b++;
|
c0b++;
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +197,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
|
||||||
( ya >= -16 ) && ( ya <= 15 ) )
|
( ya >= -16 ) && ( ya <= 15 ) )
|
||||||
{
|
{
|
||||||
// 4 bits each for x & z, and 5 for y
|
// 4 bits each for x & z, and 5 for y
|
||||||
packet = shared_ptr<MoveEntityPacketSmall>( new MoveEntityPacketSmall::Pos(e->entityId, static_cast<char>(xa), static_cast<char>(ya), static_cast<char>(za)) );
|
packet = std::make_shared<MoveEntityPacketSmall::Pos>(e->entityId, static_cast<char>(xa), static_cast<char>(ya), static_cast<char>(za));
|
||||||
c1a++;
|
c1a++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -206,12 +206,12 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
|
||||||
( ya >= -32 ) && ( ya <= 31 ) )
|
( ya >= -32 ) && ( ya <= 31 ) )
|
||||||
{
|
{
|
||||||
// use the packet with small packet with rotation if we can - 5 bits each for x & z, and 6 for y - still a byte less than the alternative
|
// use the packet with small packet with rotation if we can - 5 bits each for x & z, and 6 for y - still a byte less than the alternative
|
||||||
packet = shared_ptr<MoveEntityPacketSmall>( new MoveEntityPacketSmall::PosRot(e->entityId, static_cast<char>(xa), static_cast<char>(ya), static_cast<char>(za), 0, 0 ));
|
packet = std::make_shared<MoveEntityPacketSmall::PosRot>(e->entityId, static_cast<char>(xa), static_cast<char>(ya), static_cast<char>(za), 0, 0);
|
||||||
c1b++;
|
c1b++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
packet = shared_ptr<MoveEntityPacket>( new MoveEntityPacket::Pos(e->entityId, static_cast<char>(xa), static_cast<char>(ya), static_cast<char>(za)) );
|
packet = std::make_shared<MoveEntityPacket::Pos>(e->entityId, static_cast<char>(xa), static_cast<char>(ya), static_cast<char>(za));
|
||||||
c1c++;
|
c1c++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -231,13 +231,13 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
|
||||||
yRota = 15;
|
yRota = 15;
|
||||||
yRotn = yRotp + yRota;
|
yRotn = yRotp + yRota;
|
||||||
}
|
}
|
||||||
packet = shared_ptr<MoveEntityPacketSmall>( new MoveEntityPacketSmall::Rot(e->entityId, static_cast<char>(yRota), 0) );
|
packet = std::make_shared<MoveEntityPacketSmall::Rot>(e->entityId, static_cast<char>(yRota), 0);
|
||||||
c2a++;
|
c2a++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// printf("%d: New rot %d + %d = %d\n",e->entityId,yRotp,yRota,yRotn);
|
// printf("%d: New rot %d + %d = %d\n",e->entityId,yRotp,yRota,yRotn);
|
||||||
packet = shared_ptr<MoveEntityPacket>( new MoveEntityPacket::Rot(e->entityId, static_cast<char>(yRota), static_cast<char>(xRota)) );
|
packet = std::make_shared<MoveEntityPacket::Rot>(e->entityId, static_cast<char>(yRota), static_cast<char>(xRota));
|
||||||
c2b++;
|
c2b++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -259,7 +259,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
|
||||||
xap = e->xd;
|
xap = e->xd;
|
||||||
yap = e->yd;
|
yap = e->yd;
|
||||||
zap = e->zd;
|
zap = e->zd;
|
||||||
broadcast( shared_ptr<SetEntityMotionPacket>( new SetEntityMotionPacket(e->entityId, xap, yap, zap) ) );
|
broadcast(std::make_shared<SetEntityMotionPacket>(e->entityId, xap, yap, zap));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -291,7 +291,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
|
||||||
if (rot)
|
if (rot)
|
||||||
{
|
{
|
||||||
// 4J: Changed this to use deltas
|
// 4J: Changed this to use deltas
|
||||||
broadcast( shared_ptr<MoveEntityPacket>( new MoveEntityPacket::Rot(e->entityId, static_cast<byte>(yRota), static_cast<byte>(xRota))) );
|
broadcast(std::make_shared<MoveEntityPacket::Rot>(e->entityId, static_cast<byte>(yRota), static_cast<byte>(xRota)));
|
||||||
yRotp = yRotn;
|
yRotp = yRotn;
|
||||||
xRotp = xRotn;
|
xRotp = xRotn;
|
||||||
}
|
}
|
||||||
|
|
@ -308,7 +308,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
|
||||||
int yHeadRot = Mth::floor(e->getYHeadRot() * 256 / 360);
|
int yHeadRot = Mth::floor(e->getYHeadRot() * 256 / 360);
|
||||||
if (abs(yHeadRot - yHeadRotp) >= TOLERANCE_LEVEL)
|
if (abs(yHeadRot - yHeadRotp) >= TOLERANCE_LEVEL)
|
||||||
{
|
{
|
||||||
broadcast(shared_ptr<RotateHeadPacket>( new RotateHeadPacket(e->entityId, static_cast<byte>(yHeadRot))));
|
broadcast(std::make_shared<RotateHeadPacket>(e->entityId, static_cast<byte>(yHeadRot)));
|
||||||
yHeadRotp = yHeadRot;
|
yHeadRotp = yHeadRot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -320,7 +320,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
|
||||||
if (e->hurtMarked)
|
if (e->hurtMarked)
|
||||||
{
|
{
|
||||||
// broadcast(new AnimatePacket(e, AnimatePacket.HURT));
|
// broadcast(new AnimatePacket(e, AnimatePacket.HURT));
|
||||||
broadcastAndSend( shared_ptr<SetEntityMotionPacket>( new SetEntityMotionPacket(e) ) );
|
broadcastAndSend(std::make_shared<SetEntityMotionPacket>(e));
|
||||||
e->hurtMarked = false;
|
e->hurtMarked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -331,7 +331,7 @@ void TrackedEntity::sendDirtyEntityData()
|
||||||
shared_ptr<SynchedEntityData> entityData = e->getEntityData();
|
shared_ptr<SynchedEntityData> entityData = e->getEntityData();
|
||||||
if (entityData->isDirty())
|
if (entityData->isDirty())
|
||||||
{
|
{
|
||||||
broadcastAndSend( shared_ptr<SetEntityDataPacket>( new SetEntityDataPacket(e->entityId, entityData, false)) );
|
broadcastAndSend(std::make_shared<SetEntityDataPacket>(e->entityId, entityData, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( e->instanceof(eTYPE_LIVINGENTITY) )
|
if ( e->instanceof(eTYPE_LIVINGENTITY) )
|
||||||
|
|
@ -342,7 +342,7 @@ void TrackedEntity::sendDirtyEntityData()
|
||||||
|
|
||||||
if (!attributes->empty())
|
if (!attributes->empty())
|
||||||
{
|
{
|
||||||
broadcastAndSend(shared_ptr<UpdateAttributesPacket>( new UpdateAttributesPacket(e->entityId, attributes)) );
|
broadcastAndSend(std::make_shared<UpdateAttributesPacket>(e->entityId, attributes));
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes->clear();
|
attributes->clear();
|
||||||
|
|
@ -539,7 +539,7 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr<ServerPlayer
|
||||||
// 4J Stu brought forward to fix when Item Frames
|
// 4J Stu brought forward to fix when Item Frames
|
||||||
if (!e->getEntityData()->isEmpty() && !isAddMobPacket)
|
if (!e->getEntityData()->isEmpty() && !isAddMobPacket)
|
||||||
{
|
{
|
||||||
sp->connection->send(shared_ptr<SetEntityDataPacket>( new SetEntityDataPacket(e->entityId, e->getEntityData(), true)));
|
sp->connection->send(std::make_shared<SetEntityDataPacket>(e->entityId, e->getEntityData(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( e->instanceof(eTYPE_LIVINGENTITY) )
|
if ( e->instanceof(eTYPE_LIVINGENTITY) )
|
||||||
|
|
@ -550,23 +550,23 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr<ServerPlayer
|
||||||
|
|
||||||
if (!attributes->empty())
|
if (!attributes->empty())
|
||||||
{
|
{
|
||||||
sp->connection->send(shared_ptr<UpdateAttributesPacket>( new UpdateAttributesPacket(e->entityId, attributes)) );
|
sp->connection->send(std::make_shared<UpdateAttributesPacket>(e->entityId, attributes));
|
||||||
}
|
}
|
||||||
delete attributes;
|
delete attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trackDelta && !isAddMobPacket)
|
if (trackDelta && !isAddMobPacket)
|
||||||
{
|
{
|
||||||
sp->connection->send( shared_ptr<SetEntityMotionPacket>( new SetEntityMotionPacket(e->entityId, e->xd, e->yd, e->zd) ) );
|
sp->connection->send(std::make_shared<SetEntityMotionPacket>(e->entityId, e->xd, e->yd, e->zd));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e->riding != nullptr)
|
if (e->riding != nullptr)
|
||||||
{
|
{
|
||||||
sp->connection->send(shared_ptr<SetEntityLinkPacket>(new SetEntityLinkPacket(SetEntityLinkPacket::RIDING, e, e->riding)));
|
sp->connection->send(std::make_shared<SetEntityLinkPacket>(SetEntityLinkPacket::RIDING, e, e->riding));
|
||||||
}
|
}
|
||||||
if ( e->instanceof(eTYPE_MOB) && dynamic_pointer_cast<Mob>(e)->getLeashHolder() != nullptr)
|
if ( e->instanceof(eTYPE_MOB) && dynamic_pointer_cast<Mob>(e)->getLeashHolder() != nullptr)
|
||||||
{
|
{
|
||||||
sp->connection->send( shared_ptr<SetEntityLinkPacket>( new SetEntityLinkPacket(SetEntityLinkPacket::LEASH, e, dynamic_pointer_cast<Mob>(e)->getLeashHolder())) );
|
sp->connection->send(std::make_shared<SetEntityLinkPacket>(SetEntityLinkPacket::LEASH, e, dynamic_pointer_cast<Mob>(e)->getLeashHolder()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( e->instanceof(eTYPE_LIVINGENTITY) )
|
if ( e->instanceof(eTYPE_LIVINGENTITY) )
|
||||||
|
|
@ -574,7 +574,7 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr<ServerPlayer
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> item = dynamic_pointer_cast<LivingEntity>(e)->getCarried(i);
|
shared_ptr<ItemInstance> item = dynamic_pointer_cast<LivingEntity>(e)->getCarried(i);
|
||||||
if(item != nullptr) sp->connection->send( shared_ptr<SetEquippedItemPacket>( new SetEquippedItemPacket(e->entityId, i, item) ) );
|
if(item != nullptr) sp->connection->send(std::make_shared<SetEquippedItemPacket>(e->entityId, i, item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -583,7 +583,7 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr<ServerPlayer
|
||||||
shared_ptr<Player> spe = dynamic_pointer_cast<Player>(e);
|
shared_ptr<Player> spe = dynamic_pointer_cast<Player>(e);
|
||||||
if (spe->isSleeping())
|
if (spe->isSleeping())
|
||||||
{
|
{
|
||||||
sp->connection->send( shared_ptr<EntityActionAtPositionPacket>( new EntityActionAtPositionPacket(e, EntityActionAtPositionPacket::START_SLEEP, Mth::floor(e->x), Mth::floor(e->y), Mth::floor(e->z)) ) );
|
sp->connection->send(std::make_shared<EntityActionAtPositionPacket>(e, EntityActionAtPositionPacket::START_SLEEP, Mth::floor(e->x), Mth::floor(e->y), Mth::floor(e->z)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -639,12 +639,12 @@ shared_ptr<Packet> TrackedEntity::getAddEntityPacket()
|
||||||
if (dynamic_pointer_cast<Creature>(e) != nullptr)
|
if (dynamic_pointer_cast<Creature>(e) != nullptr)
|
||||||
{
|
{
|
||||||
yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360);
|
yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360);
|
||||||
return shared_ptr<AddMobPacket>( new AddMobPacket(dynamic_pointer_cast<Mob>(e), yRotp, xRotp, xp, yp, zp, yHeadRotp) );
|
return std::make_shared<AddMobPacket>(dynamic_pointer_cast<Mob>(e), yRotp, xRotp, xp, yp, zp, yHeadRotp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e->instanceof(eTYPE_ITEMENTITY))
|
if (e->instanceof(eTYPE_ITEMENTITY))
|
||||||
{
|
{
|
||||||
shared_ptr<AddEntityPacket> packet = shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp) );
|
shared_ptr<AddEntityPacket> packet = std::make_shared<AddEntityPacket>(e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp);
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_SERVERPLAYER))
|
else if (e->instanceof(eTYPE_SERVERPLAYER))
|
||||||
|
|
@ -659,55 +659,55 @@ shared_ptr<Packet> TrackedEntity::getAddEntityPacket()
|
||||||
OnlineXuid = player->getOnlineXuid();
|
OnlineXuid = player->getOnlineXuid();
|
||||||
}
|
}
|
||||||
// 4J Added yHeadRotp param to fix #102563 - TU12: Content: Gameplay: When one of the Players is idle for a few minutes his head turns 180 degrees.
|
// 4J Added yHeadRotp param to fix #102563 - TU12: Content: Gameplay: When one of the Players is idle for a few minutes his head turns 180 degrees.
|
||||||
return shared_ptr<AddPlayerPacket>( new AddPlayerPacket( player, xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp ) );
|
return std::make_shared<AddPlayerPacket>(player, xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_MINECART))
|
else if (e->instanceof(eTYPE_MINECART))
|
||||||
{
|
{
|
||||||
shared_ptr<Minecart> minecart = dynamic_pointer_cast<Minecart>(e);
|
shared_ptr<Minecart> minecart = dynamic_pointer_cast<Minecart>(e);
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::MINECART, minecart->getType(), yRotp, xRotp, xp, yp, zp) );
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::MINECART, minecart->getType(), yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_BOAT))
|
else if (e->instanceof(eTYPE_BOAT))
|
||||||
{
|
{
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp) );
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_ENDERDRAGON))
|
else if (e->instanceof(eTYPE_ENDERDRAGON))
|
||||||
{
|
{
|
||||||
yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360);
|
yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360);
|
||||||
return shared_ptr<AddMobPacket>( new AddMobPacket(dynamic_pointer_cast<LivingEntity>(e), yRotp, xRotp, xp, yp, zp, yHeadRotp ) );
|
return std::make_shared<AddMobPacket>(dynamic_pointer_cast<LivingEntity>(e), yRotp, xRotp, xp, yp, zp, yHeadRotp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_FISHINGHOOK))
|
else if (e->instanceof(eTYPE_FISHINGHOOK))
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> owner = dynamic_pointer_cast<FishingHook>(e)->owner;
|
shared_ptr<Entity> owner = dynamic_pointer_cast<FishingHook>(e)->owner;
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::FISH_HOOK, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) );
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::FISH_HOOK, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_ARROW))
|
else if (e->instanceof(eTYPE_ARROW))
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> owner = (dynamic_pointer_cast<Arrow>(e))->owner;
|
shared_ptr<Entity> owner = (dynamic_pointer_cast<Arrow>(e))->owner;
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::ARROW, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) );
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::ARROW, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_SNOWBALL))
|
else if (e->instanceof(eTYPE_SNOWBALL))
|
||||||
{
|
{
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp) );
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_THROWNPOTION))
|
else if (e->instanceof(eTYPE_THROWNPOTION))
|
||||||
{
|
{
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::THROWN_POTION, ((dynamic_pointer_cast<ThrownPotion>(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp));
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::THROWN_POTION, ((dynamic_pointer_cast<ThrownPotion>(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_THROWNEXPBOTTLE))
|
else if (e->instanceof(eTYPE_THROWNEXPBOTTLE))
|
||||||
{
|
{
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp) );
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_THROWNENDERPEARL))
|
else if (e->instanceof(eTYPE_THROWNENDERPEARL))
|
||||||
{
|
{
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp) );
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_EYEOFENDERSIGNAL))
|
else if (e->instanceof(eTYPE_EYEOFENDERSIGNAL))
|
||||||
{
|
{
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp) );
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_FIREWORKS_ROCKET))
|
else if (e->instanceof(eTYPE_FIREWORKS_ROCKET))
|
||||||
{
|
{
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::FIREWORKS, yRotp, xRotp, xp, yp, zp) );
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::FIREWORKS, yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_FIREBALL))
|
else if (e->instanceof(eTYPE_FIREBALL))
|
||||||
{
|
{
|
||||||
|
|
@ -730,11 +730,11 @@ shared_ptr<Packet> TrackedEntity::getAddEntityPacket()
|
||||||
shared_ptr<AddEntityPacket> aep = nullptr;
|
shared_ptr<AddEntityPacket> aep = nullptr;
|
||||||
if (fb->owner != nullptr)
|
if (fb->owner != nullptr)
|
||||||
{
|
{
|
||||||
aep = shared_ptr<AddEntityPacket>( new AddEntityPacket(e, type, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) );
|
aep = std::make_shared<AddEntityPacket>(e, type, fb->owner->entityId, yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aep = shared_ptr<AddEntityPacket>( new AddEntityPacket(e, type, 0, yRotp, xRotp, xp, yp, zp) );
|
aep = std::make_shared<AddEntityPacket>(e, type, 0, yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
aep->xa = static_cast<int>(fb->xPower * 8000);
|
aep->xa = static_cast<int>(fb->xPower * 8000);
|
||||||
aep->ya = static_cast<int>(fb->yPower * 8000);
|
aep->ya = static_cast<int>(fb->yPower * 8000);
|
||||||
|
|
@ -743,24 +743,24 @@ shared_ptr<Packet> TrackedEntity::getAddEntityPacket()
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_THROWNEGG))
|
else if (e->instanceof(eTYPE_THROWNEGG))
|
||||||
{
|
{
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp) );
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_PRIMEDTNT))
|
else if (e->instanceof(eTYPE_PRIMEDTNT))
|
||||||
{
|
{
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp) );
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_ENDER_CRYSTAL))
|
else if (e->instanceof(eTYPE_ENDER_CRYSTAL))
|
||||||
{
|
{
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp) );
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_FALLINGTILE))
|
else if (e->instanceof(eTYPE_FALLINGTILE))
|
||||||
{
|
{
|
||||||
shared_ptr<FallingTile> ft = dynamic_pointer_cast<FallingTile>(e);
|
shared_ptr<FallingTile> ft = dynamic_pointer_cast<FallingTile>(e);
|
||||||
return shared_ptr<AddEntityPacket>( new AddEntityPacket(e, AddEntityPacket::FALLING, ft->tile | (ft->data << 16), yRotp, xRotp, xp, yp, zp) );
|
return std::make_shared<AddEntityPacket>(e, AddEntityPacket::FALLING, ft->tile | (ft->data << 16), yRotp, xRotp, xp, yp, zp);
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_PAINTING))
|
else if (e->instanceof(eTYPE_PAINTING))
|
||||||
{
|
{
|
||||||
return shared_ptr<AddPaintingPacket>( new AddPaintingPacket(dynamic_pointer_cast<Painting>(e)) );
|
return std::make_shared<AddPaintingPacket>(dynamic_pointer_cast<Painting>(e));
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_ITEM_FRAME))
|
else if (e->instanceof(eTYPE_ITEM_FRAME))
|
||||||
{
|
{
|
||||||
|
|
@ -774,7 +774,7 @@ shared_ptr<Packet> TrackedEntity::getAddEntityPacket()
|
||||||
app.DebugPrintf("eTYPE_ITEM_FRAME xyz %d,%d,%d\n",ix,iy,iz);
|
app.DebugPrintf("eTYPE_ITEM_FRAME xyz %d,%d,%d\n",ix,iy,iz);
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<AddEntityPacket> packet = shared_ptr<AddEntityPacket>(new AddEntityPacket(e, AddEntityPacket::ITEM_FRAME, frame->dir, yRotp, xRotp, xp, yp, zp));
|
shared_ptr<AddEntityPacket> packet = std::make_shared<AddEntityPacket>(e, AddEntityPacket::ITEM_FRAME, frame->dir, yRotp, xRotp, xp, yp, zp);
|
||||||
packet->x = Mth::floor(frame->xTile * 32.0f);
|
packet->x = Mth::floor(frame->xTile * 32.0f);
|
||||||
packet->y = Mth::floor(frame->yTile * 32.0f);
|
packet->y = Mth::floor(frame->yTile * 32.0f);
|
||||||
packet->z = Mth::floor(frame->zTile * 32.0f);
|
packet->z = Mth::floor(frame->zTile * 32.0f);
|
||||||
|
|
@ -783,7 +783,7 @@ shared_ptr<Packet> TrackedEntity::getAddEntityPacket()
|
||||||
else if (e->instanceof(eTYPE_LEASHFENCEKNOT))
|
else if (e->instanceof(eTYPE_LEASHFENCEKNOT))
|
||||||
{
|
{
|
||||||
shared_ptr<LeashFenceKnotEntity> knot = dynamic_pointer_cast<LeashFenceKnotEntity>(e);
|
shared_ptr<LeashFenceKnotEntity> knot = dynamic_pointer_cast<LeashFenceKnotEntity>(e);
|
||||||
shared_ptr<AddEntityPacket> packet = shared_ptr<AddEntityPacket>(new AddEntityPacket(e, AddEntityPacket::LEASH_KNOT, yRotp, xRotp, xp, yp, zp) );
|
shared_ptr<AddEntityPacket> packet = std::make_shared<AddEntityPacket>(e, AddEntityPacket::LEASH_KNOT, yRotp, xRotp, xp, yp, zp);
|
||||||
packet->x = Mth::floor(static_cast<float>(knot->xTile) * 32);
|
packet->x = Mth::floor(static_cast<float>(knot->xTile) * 32);
|
||||||
packet->y = Mth::floor(static_cast<float>(knot->yTile) * 32);
|
packet->y = Mth::floor(static_cast<float>(knot->yTile) * 32);
|
||||||
packet->z = Mth::floor(static_cast<float>(knot->zTile) * 32);
|
packet->z = Mth::floor(static_cast<float>(knot->zTile) * 32);
|
||||||
|
|
@ -791,7 +791,7 @@ shared_ptr<Packet> TrackedEntity::getAddEntityPacket()
|
||||||
}
|
}
|
||||||
else if (e->instanceof(eTYPE_EXPERIENCEORB))
|
else if (e->instanceof(eTYPE_EXPERIENCEORB))
|
||||||
{
|
{
|
||||||
return shared_ptr<AddExperienceOrbPacket>( new AddExperienceOrbPacket(dynamic_pointer_cast<ExperienceOrb>(e)) );
|
return std::make_shared<AddExperienceOrbPacket>(dynamic_pointer_cast<ExperienceOrb>(e));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
#include "Common/PostProcesser.h"
|
#include "Common/PostProcesser.h"
|
||||||
#include "Network\WinsockNetLayer.h"
|
#include "Network\WinsockNetLayer.h"
|
||||||
#include "Windows64_Xuid.h"
|
#include "Windows64_Xuid.h"
|
||||||
|
#include "Common/UI/UI.h"
|
||||||
|
|
||||||
#include "Xbox/resource.h"
|
#include "Xbox/resource.h"
|
||||||
|
|
||||||
|
|
@ -78,7 +79,6 @@ DWORD dwProfileSettingsA[NUM_PROFILE_VALUES]=
|
||||||
0,0,0,0,0
|
0,0,0,0,0
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
// Time Since fAppTime is a float, we need to keep the quadword app time
|
// Time Since fAppTime is a float, we need to keep the quadword app time
|
||||||
// as a LARGE_INTEGER so that we don't lose precision after running
|
// as a LARGE_INTEGER so that we don't lose precision after running
|
||||||
|
|
|
||||||
|
|
@ -26,5 +26,3 @@ public:
|
||||||
public:
|
public:
|
||||||
void shutdown();
|
void shutdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ConsoleUIController ui;
|
|
||||||
|
|
@ -276,7 +276,7 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
|
||||||
if(looped)
|
if(looped)
|
||||||
{
|
{
|
||||||
// Return a non-null value to indicate that we want to loop more
|
// Return a non-null value to indicate that we want to loop more
|
||||||
clickedEntity = shared_ptr<ItemInstance>(new ItemInstance(0,1,0));
|
clickedEntity = std::make_shared<ItemInstance>(0, 1, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -467,20 +467,20 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
|
||||||
player->drop(item);
|
player->drop(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (clickType == CLICK_PICKUP_ALL && slotIndex >= 0)
|
else if (clickType == CLICK_PICKUP_ALL && slotIndex >= 0)
|
||||||
{
|
{
|
||||||
Slot *slot = slots.at(slotIndex);
|
Slot *slot = slots.at(slotIndex);
|
||||||
shared_ptr<ItemInstance> carried = inventory->getCarried();
|
shared_ptr<ItemInstance> carried = inventory->getCarried();
|
||||||
|
|
||||||
if (carried != nullptr && (slot == nullptr || !slot->hasItem() || !slot->mayPickup(player)))
|
if (carried != nullptr && (slot == nullptr || !slot->hasItem() || !slot->mayPickup(player)))
|
||||||
{
|
{
|
||||||
int start = buttonNum == 0 ? 0 : slots.size() - 1;
|
int start = buttonNum == 0 ? 0 : static_cast<int>(slots.size()) - 1;
|
||||||
int step = buttonNum == 0 ? 1 : -1;
|
int step = buttonNum == 0 ? 1 : -1;
|
||||||
|
|
||||||
for (int pass = 0; pass < 2; pass++ )
|
for (int pass = 0; pass < 2; pass++ )
|
||||||
{
|
{
|
||||||
// In the first pass, we only get partial stacks.
|
// In the first pass, we only get partial stacks.
|
||||||
for (int i = start; i >= 0 && i < slots.size() && carried->count < carried->getMaxStackSize(); i += step)
|
for (int i = start; i >= 0 && i < static_cast<int>(slots.size()) && carried->count < carried->getMaxStackSize(); i += step)
|
||||||
{
|
{
|
||||||
Slot *target = slots.at(i);
|
Slot *target = slots.at(i);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public:
|
||||||
static const int CONTAINER_ID_INVENTORY = 0;
|
static const int CONTAINER_ID_INVENTORY = 0;
|
||||||
static const int CONTAINER_ID_CREATIVE = -2;
|
static const int CONTAINER_ID_CREATIVE = -2;
|
||||||
|
|
||||||
vector<shared_ptr<ItemInstance> > lastSlots;
|
vector<shared_ptr<ItemInstance>> lastSlots;
|
||||||
vector<Slot *> slots;
|
vector<Slot *> slots;
|
||||||
int containerId;
|
int containerId;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,6 @@ public:
|
||||||
virtual int getEstimatedSize();
|
virtual int getEstimatedSize();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddEntityPacket()); }
|
static shared_ptr<Packet> create() { return std::make_shared<AddEntityPacket>(); }
|
||||||
virtual int getId() { return 23; }
|
virtual int getId() { return 23; }
|
||||||
};
|
};
|
||||||
|
|
@ -19,6 +19,6 @@ public:
|
||||||
virtual void handle(PacketListener *listener);
|
virtual void handle(PacketListener *listener);
|
||||||
virtual int getEstimatedSize();
|
virtual int getEstimatedSize();
|
||||||
|
|
||||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddExperienceOrbPacket()); }
|
static shared_ptr<Packet> create() { return std::make_shared<AddExperienceOrbPacket>(); }
|
||||||
virtual int getId() { return 26; }
|
virtual int getId() { return 26; }
|
||||||
};
|
};
|
||||||
|
|
@ -20,6 +20,6 @@ public:
|
||||||
virtual int getEstimatedSize();
|
virtual int getEstimatedSize();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddGlobalEntityPacket()); }
|
static shared_ptr<Packet> create() { return std::make_shared<AddGlobalEntityPacket>(); }
|
||||||
virtual int getId() { return 71; }
|
virtual int getId() { return 71; }
|
||||||
};
|
};
|
||||||
|
|
@ -32,6 +32,6 @@ public:
|
||||||
vector<shared_ptr<SynchedEntityData::DataItem> > *getUnpackedData();
|
vector<shared_ptr<SynchedEntityData::DataItem> > *getUnpackedData();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddMobPacket()); }
|
static shared_ptr<Packet> create() { return std::make_shared<AddMobPacket>(); }
|
||||||
virtual int getId() { return 24; }
|
virtual int getId() { return 24; }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,6 @@ public:
|
||||||
virtual void handle(PacketListener *listener);
|
virtual void handle(PacketListener *listener);
|
||||||
virtual int getEstimatedSize();
|
virtual int getEstimatedSize();
|
||||||
public:
|
public:
|
||||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddPaintingPacket()); }
|
static shared_ptr<Packet> create() { return std::make_shared<AddPaintingPacket>(); }
|
||||||
virtual int getId() { return 25; }
|
virtual int getId() { return 25; }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,6 @@ public:
|
||||||
|
|
||||||
vector<shared_ptr<SynchedEntityData::DataItem> > *getUnpackedData();
|
vector<shared_ptr<SynchedEntityData::DataItem> > *getUnpackedData();
|
||||||
public:
|
public:
|
||||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddPlayerPacket()); }
|
static shared_ptr<Packet> create() { return std::make_shared<AddPlayerPacket>(); }
|
||||||
virtual int getId() { return 20; }
|
virtual int getId() { return 20; }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ void Animal::breedWith(shared_ptr<Animal> target)
|
||||||
}
|
}
|
||||||
level->addEntity(offspring);
|
level->addEntity(offspring);
|
||||||
|
|
||||||
level->addEntity( shared_ptr<ExperienceOrb>( new ExperienceOrb(level, x, y, z, random->nextInt(4) + 1) ) );
|
level->addEntity(std::make_shared<ExperienceOrb>(level, x, y, z, random->nextInt(4) + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
setDespawnProtected();
|
setDespawnProtected();
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,6 @@ public:
|
||||||
virtual int getEstimatedSize();
|
virtual int getEstimatedSize();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AnimatePacket()); }
|
static shared_ptr<Packet> create() { return std::make_shared<AnimatePacket>(); }
|
||||||
virtual int getId() { return 18; }
|
virtual int getId() { return 18; }
|
||||||
};
|
};
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
AnvilMenu::AnvilMenu(shared_ptr<Inventory> inventory, Level *level, int xt, int yt, int zt, shared_ptr<Player> player)
|
AnvilMenu::AnvilMenu(shared_ptr<Inventory> inventory, Level *level, int xt, int yt, int zt, shared_ptr<Player> player)
|
||||||
{
|
{
|
||||||
resultSlots = shared_ptr<ResultContainer>( new ResultContainer() );
|
resultSlots = std::make_shared<ResultContainer>();
|
||||||
repairSlots = shared_ptr<RepairContainer>( new RepairContainer(this,IDS_REPAIR_AND_NAME, true, 2) );
|
repairSlots = std::make_shared<RepairContainer>(this,IDS_REPAIR_AND_NAME, true, 2);
|
||||||
cost = 0;
|
cost = 0;
|
||||||
repairItemCountCost = 0;
|
repairItemCountCost = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ void Arrow::tick()
|
||||||
|
|
||||||
if (owner != nullptr && res->entity != owner && owner->GetType() == eTYPE_SERVERPLAYER)
|
if (owner != nullptr && res->entity != owner && owner->GetType() == eTYPE_SERVERPLAYER)
|
||||||
{
|
{
|
||||||
dynamic_pointer_cast<ServerPlayer>(owner)->connection->send( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::SUCCESSFUL_BOW_HIT, 0)) );
|
dynamic_pointer_cast<ServerPlayer>(owner)->connection->send(std::make_shared<GameEventPacket>(GameEventPacket::SUCCESSFUL_BOW_HIT, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -499,7 +499,7 @@ void Arrow::playerTouch(shared_ptr<Player> player)
|
||||||
|
|
||||||
if (pickup == PICKUP_ALLOWED)
|
if (pickup == PICKUP_ALLOWED)
|
||||||
{
|
{
|
||||||
if (!player->inventory->add( shared_ptr<ItemInstance>( new ItemInstance(Item::arrow, 1) ) ))
|
if (!player->inventory->add(std::make_shared<ItemInstance>(Item::arrow, 1)))
|
||||||
{
|
{
|
||||||
bRemove = false;
|
bRemove = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public:
|
||||||
virtual int getEstimatedSize();
|
virtual int getEstimatedSize();
|
||||||
virtual bool isAync();
|
virtual bool isAync();
|
||||||
|
|
||||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AwardStatPacket()); }
|
static shared_ptr<Packet> create() { return std::make_shared<AwardStatPacket>(); }
|
||||||
virtual int getId() { return 200; }
|
virtual int getId() { return 200; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ BeaconTile::BeaconTile(int id) : BaseEntityTile(id, Material::glass, isSolidRend
|
||||||
|
|
||||||
shared_ptr<TileEntity> BeaconTile::newTileEntity(Level *level)
|
shared_ptr<TileEntity> BeaconTile::newTileEntity(Level *level)
|
||||||
{
|
{
|
||||||
return shared_ptr<BeaconTileEntity>( new BeaconTileEntity() );
|
return std::make_shared<BeaconTileEntity>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BeaconTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly)
|
bool BeaconTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
shared_ptr<TileEntity> BeaconTileEntity::clone()
|
shared_ptr<TileEntity> BeaconTileEntity::clone()
|
||||||
{
|
{
|
||||||
shared_ptr<BeaconTileEntity> result = shared_ptr<BeaconTileEntity>( new BeaconTileEntity() );
|
shared_ptr<BeaconTileEntity> result = std::make_shared<BeaconTileEntity>();
|
||||||
TileEntity::clone(result);
|
TileEntity::clone(result);
|
||||||
|
|
||||||
result->primaryPower = primaryPower;
|
result->primaryPower = primaryPower;
|
||||||
|
|
@ -252,7 +252,7 @@ shared_ptr<Packet> BeaconTileEntity::getUpdatePacket()
|
||||||
{
|
{
|
||||||
CompoundTag *tag = new CompoundTag();
|
CompoundTag *tag = new CompoundTag();
|
||||||
save(tag);
|
save(tag);
|
||||||
return shared_ptr<TileEntityDataPacket>( new TileEntityDataPacket(x, y, z, TileEntityDataPacket::TYPE_BEACON, tag) );
|
return std::make_shared<TileEntityDataPacket>(x, y, z, TileEntityDataPacket::TYPE_BEACON, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
double BeaconTileEntity::getViewDistance()
|
double BeaconTileEntity::getViewDistance()
|
||||||
|
|
@ -306,7 +306,7 @@ shared_ptr<ItemInstance> BeaconTileEntity::removeItem(unsigned int slot, int cou
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
paymentItem->count -= count;
|
paymentItem->count -= count;
|
||||||
return shared_ptr<ItemInstance>( new ItemInstance(paymentItem->id, count, paymentItem->getAuxValue()) );
|
return std::make_shared<ItemInstance>(paymentItem->id, count, paymentItem->getAuxValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ void Blaze::checkHurtTarget(shared_ptr<Entity> target, float d)
|
||||||
level->levelEvent(nullptr, LevelEvent::SOUND_BLAZE_FIREBALL, static_cast<int>(x), static_cast<int>(y), static_cast<int>(z), 0);
|
level->levelEvent(nullptr, LevelEvent::SOUND_BLAZE_FIREBALL, static_cast<int>(x), static_cast<int>(y), static_cast<int>(z), 0);
|
||||||
// level.playSound(this, "mob.ghast.fireball", getSoundVolume(), (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f);
|
// level.playSound(this, "mob.ghast.fireball", getSoundVolume(), (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f);
|
||||||
for (int i = 0; i < 1; i++) {
|
for (int i = 0; i < 1; i++) {
|
||||||
shared_ptr<SmallFireball> ie = shared_ptr<SmallFireball>( new SmallFireball(level, dynamic_pointer_cast<Mob>( shared_from_this() ), xd + random->nextGaussian() * sqd, yd, zd + random->nextGaussian() * sqd) );
|
shared_ptr<SmallFireball> ie = std::make_shared<SmallFireball>(level, dynamic_pointer_cast<Mob>(shared_from_this()), xd + random->nextGaussian() * sqd, yd, zd + random->nextGaussian() * sqd);
|
||||||
// Vec3 v = getViewVector(1);
|
// Vec3 v = getViewVector(1);
|
||||||
// ie.x = x + v.x * 1.5;
|
// ie.x = x + v.x * 1.5;
|
||||||
ie->y = y + bbHeight / 2 + 0.5f;
|
ie->y = y + bbHeight / 2 + 0.5f;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,6 @@ public:
|
||||||
virtual int getEstimatedSize();
|
virtual int getEstimatedSize();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new BlockRegionUpdatePacket()); }
|
static shared_ptr<Packet> create() { return std::make_shared<BlockRegionUpdatePacket>(); }
|
||||||
virtual int getId() { return 51; }
|
virtual int getId() { return 51; }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ shared_ptr<ItemInstance> BoatItem::use(shared_ptr<ItemInstance> itemInstance, Le
|
||||||
if (level->getTile(xt, yt, zt) == Tile::topSnow_Id) yt--;
|
if (level->getTile(xt, yt, zt) == Tile::topSnow_Id) yt--;
|
||||||
if( level->countInstanceOf(eTYPE_BOAT, true) < Level::MAX_XBOX_BOATS ) // 4J - added limit
|
if( level->countInstanceOf(eTYPE_BOAT, true) < Level::MAX_XBOX_BOATS ) // 4J - added limit
|
||||||
{
|
{
|
||||||
shared_ptr<Boat> boat = shared_ptr<Boat>( new Boat(level, xt + 0.5f, yt + 1.0f, zt + 0.5f) );
|
shared_ptr<Boat> boat = std::make_shared<Boat>(level, xt + 0.5f, yt + 1.0f, zt + 0.5f);
|
||||||
boat->yRot = ((Mth::floor(player->yRot * 4.0F / 360.0F + 0.5) & 0x3) - 1) * 90;
|
boat->yRot = ((Mth::floor(player->yRot * 4.0F / 360.0F + 0.5) & 0x3) - 1) * 90;
|
||||||
if (!level->getCubes(boat, boat->bb->grow(-.1, -.1, -.1))->empty())
|
if (!level->getCubes(boat, boat->bb->grow(-.1, -.1, -.1))->empty())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -40,13 +40,13 @@ shared_ptr<ItemInstance> BottleItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||||
itemInstance->count--;
|
itemInstance->count--;
|
||||||
if (itemInstance->count <= 0)
|
if (itemInstance->count <= 0)
|
||||||
{
|
{
|
||||||
return shared_ptr<ItemInstance>( new ItemInstance( static_cast<Item *>(Item::potion)) );
|
return std::make_shared<ItemInstance>(static_cast<Item *>(Item::potion));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!player->inventory->add(shared_ptr<ItemInstance>( new ItemInstance( static_cast<Item *>(Item::potion)) )))
|
if (!player->inventory->add(std::make_shared<ItemInstance>(static_cast<Item *>(Item::potion))))
|
||||||
{
|
{
|
||||||
player->drop( shared_ptr<ItemInstance>( new ItemInstance(Item::potion_Id, 1, 0) ));
|
player->drop(std::make_shared<ItemInstance>(Item::potion_Id, 1, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ void BowItem::releaseUsing(shared_ptr<ItemInstance> itemInstance, Level *level,
|
||||||
if (pow < 0.1) return;
|
if (pow < 0.1) return;
|
||||||
if (pow > 1) pow = 1;
|
if (pow > 1) pow = 1;
|
||||||
|
|
||||||
shared_ptr<Arrow> arrow = shared_ptr<Arrow>( new Arrow(level, player, pow * 2.0f) );
|
shared_ptr<Arrow> arrow = std::make_shared<Arrow>(level, player, pow * 2.0f);
|
||||||
if (pow == 1) arrow->setCritArrow(true);
|
if (pow == 1) arrow->setCritArrow(true);
|
||||||
int damageBonus = EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowBonus->id, itemInstance);
|
int damageBonus = EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowBonus->id, itemInstance);
|
||||||
if (damageBonus > 0)
|
if (damageBonus > 0)
|
||||||
|
|
|
||||||
|
|
@ -12,5 +12,5 @@ shared_ptr<ItemInstance> BowlFoodItem::useTimeDepleted(shared_ptr<ItemInstance>
|
||||||
{
|
{
|
||||||
FoodItem::useTimeDepleted(instance, level, player);
|
FoodItem::useTimeDepleted(instance, level, player);
|
||||||
|
|
||||||
return shared_ptr<ItemInstance>(new ItemInstance(Item::bowl));
|
return std::make_shared<ItemInstance>(Item::bowl);
|
||||||
}
|
}
|
||||||
|
|
@ -118,5 +118,5 @@ void BreedGoal::breed()
|
||||||
* animal->bbWidth * 2 - animal->bbWidth, xa, ya, za);
|
* animal->bbWidth * 2 - animal->bbWidth, xa, ya, za);
|
||||||
}
|
}
|
||||||
// 4J-PB - Fix for 106869- Customer Encountered: TU12: Content: Gameplay: Breeding animals does not give any Experience Orbs.
|
// 4J-PB - Fix for 106869- Customer Encountered: TU12: Content: Gameplay: Breeding animals does not give any Experience Orbs.
|
||||||
level->addEntity( shared_ptr<ExperienceOrb>( new ExperienceOrb(level, animal->x, animal->y, animal->z, random->nextInt(7) + 1) ) );
|
level->addEntity(std::make_shared<ExperienceOrb>(level, animal->x, animal->y, animal->z, random->nextInt(7) + 1));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ int BrewingStandTile::getRenderShape()
|
||||||
|
|
||||||
shared_ptr<TileEntity> BrewingStandTile::newTileEntity(Level *level)
|
shared_ptr<TileEntity> BrewingStandTile::newTileEntity(Level *level)
|
||||||
{
|
{
|
||||||
return shared_ptr<TileEntity>(new BrewingStandTileEntity());
|
return std::make_shared<BrewingStandTileEntity>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BrewingStandTile::isCubeShaped()
|
bool BrewingStandTile::isCubeShaped()
|
||||||
|
|
@ -104,7 +104,7 @@ void BrewingStandTile::onRemove(Level *level, int x, int y, int z, int id, int d
|
||||||
if (count > item->count) count = item->count;
|
if (count > item->count) count = item->count;
|
||||||
item->count -= count;
|
item->count -= count;
|
||||||
|
|
||||||
shared_ptr<ItemEntity> itemEntity = shared_ptr<ItemEntity>(new ItemEntity(level, x + xo, y + yo, z + zo, shared_ptr<ItemInstance>( new ItemInstance(item->id, count, item->getAuxValue()))));
|
shared_ptr<ItemEntity> itemEntity = std::make_shared<ItemEntity>(level, x + xo, y + yo, z + zo, shared_ptr<ItemInstance>(new ItemInstance(item->id, count, item->getAuxValue())));
|
||||||
float pow = 0.05f;
|
float pow = 0.05f;
|
||||||
itemEntity->xd = static_cast<float>(random->nextGaussian()) * pow;
|
itemEntity->xd = static_cast<float>(random->nextGaussian()) * pow;
|
||||||
itemEntity->yd = static_cast<float>(random->nextGaussian()) * pow + 0.2f;
|
itemEntity->yd = static_cast<float>(random->nextGaussian()) * pow + 0.2f;
|
||||||
|
|
|
||||||
|
|
@ -254,14 +254,14 @@ void BrewingStandTileEntity::doBrew()
|
||||||
}
|
}
|
||||||
else if (isWater && items[dest] != nullptr && items[dest]->id == Item::glassBottle_Id)
|
else if (isWater && items[dest] != nullptr && items[dest]->id == Item::glassBottle_Id)
|
||||||
{
|
{
|
||||||
items[dest] = shared_ptr<ItemInstance>(new ItemInstance(Item::potion));
|
items[dest] = std::make_shared<ItemInstance>(Item::potion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Item::items[ingredient->id]->hasCraftingRemainingItem())
|
if (Item::items[ingredient->id]->hasCraftingRemainingItem())
|
||||||
{
|
{
|
||||||
items[INGREDIENT_SLOT] = shared_ptr<ItemInstance>(new ItemInstance(Item::items[ingredient->id]->getCraftingRemainingItem()));
|
items[INGREDIENT_SLOT] = std::make_shared<ItemInstance>(Item::items[ingredient->id]->getCraftingRemainingItem());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -476,7 +476,7 @@ bool BrewingStandTileEntity::canTakeItemThroughFace(int slot, shared_ptr<ItemIns
|
||||||
// 4J Added
|
// 4J Added
|
||||||
shared_ptr<TileEntity> BrewingStandTileEntity::clone()
|
shared_ptr<TileEntity> BrewingStandTileEntity::clone()
|
||||||
{
|
{
|
||||||
shared_ptr<BrewingStandTileEntity> result = shared_ptr<BrewingStandTileEntity>( new BrewingStandTileEntity() );
|
shared_ptr<BrewingStandTileEntity> result = std::make_shared<BrewingStandTileEntity>();
|
||||||
TileEntity::clone(result);
|
TileEntity::clone(result);
|
||||||
|
|
||||||
result->brewTime = brewTime;
|
result->brewTime = brewTime;
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ shared_ptr<ItemInstance> BucketItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||||
if( servPlayer != nullptr )
|
if( servPlayer != nullptr )
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Sending ChatPacket::e_ChatCannotPlaceLava to player\n");
|
app.DebugPrintf("Sending ChatPacket::e_ChatCannotPlaceLava to player\n");
|
||||||
servPlayer->connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"", ChatPacket::e_ChatCannotPlaceLava ) ) );
|
servPlayer->connection->send(std::make_shared<ChatPacket>(L"", ChatPacket::e_ChatCannotPlaceLava));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete hr;
|
delete hr;
|
||||||
|
|
@ -141,13 +141,13 @@ shared_ptr<ItemInstance> BucketItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||||
|
|
||||||
if (--itemInstance->count <= 0)
|
if (--itemInstance->count <= 0)
|
||||||
{
|
{
|
||||||
return shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_water) );
|
return std::make_shared<ItemInstance>(Item::bucket_water);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!player->inventory->add(shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_water))))
|
if (!player->inventory->add(std::make_shared<ItemInstance>(Item::bucket_water)))
|
||||||
{
|
{
|
||||||
player->drop(shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_water_Id, 1, 0)));
|
player->drop(std::make_shared<ItemInstance>(Item::bucket_water_Id, 1, 0));
|
||||||
}
|
}
|
||||||
return itemInstance;
|
return itemInstance;
|
||||||
}
|
}
|
||||||
|
|
@ -168,13 +168,13 @@ shared_ptr<ItemInstance> BucketItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||||
}
|
}
|
||||||
if (--itemInstance->count <= 0)
|
if (--itemInstance->count <= 0)
|
||||||
{
|
{
|
||||||
return shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_lava) );
|
return std::make_shared<ItemInstance>(Item::bucket_lava);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!player->inventory->add(shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_lava))))
|
if (!player->inventory->add(std::make_shared<ItemInstance>(Item::bucket_lava)))
|
||||||
{
|
{
|
||||||
player->drop(shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_lava_Id, 1, 0)));
|
player->drop(std::make_shared<ItemInstance>(Item::bucket_lava_Id, 1, 0));
|
||||||
}
|
}
|
||||||
return itemInstance;
|
return itemInstance;
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +183,7 @@ shared_ptr<ItemInstance> BucketItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||||
else if (content < 0)
|
else if (content < 0)
|
||||||
{
|
{
|
||||||
delete hr;
|
delete hr;
|
||||||
return shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_empty) );
|
return std::make_shared<ItemInstance>(Item::bucket_empty);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -199,7 +199,7 @@ shared_ptr<ItemInstance> BucketItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||||
|
|
||||||
if (emptyBucket(level, xt, yt, zt) && !player->abilities.instabuild)
|
if (emptyBucket(level, xt, yt, zt) && !player->abilities.instabuild)
|
||||||
{
|
{
|
||||||
return shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_empty) );
|
return std::make_shared<ItemInstance>(Item::bucket_empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ shared_ptr<ItemInstance> CarrotOnAStickItem::use(shared_ptr<ItemInstance> itemIn
|
||||||
|
|
||||||
if (itemInstance->count == 0)
|
if (itemInstance->count == 0)
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> replacement = shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod));
|
shared_ptr<ItemInstance> replacement = std::make_shared<ItemInstance>(Item::fishingRod);
|
||||||
replacement->setTag(itemInstance->tag);
|
replacement->setTag(itemInstance->tag);
|
||||||
return replacement;
|
return replacement;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue