Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.
This reverts commit a9be52c41a.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#include "HitResult.h"
|
||||
|
||||
DWORD AABB::tlsIdx = 0;
|
||||
AABB::ThreadStorage *AABB::tlsDefault = nullptr;
|
||||
AABB::ThreadStorage *AABB::tlsDefault = NULL;
|
||||
|
||||
AABB::ThreadStorage::ThreadStorage()
|
||||
{
|
||||
@@ -25,7 +25,7 @@ AABB::ThreadStorage::~ThreadStorage()
|
||||
void AABB::CreateNewThreadStorage()
|
||||
{
|
||||
ThreadStorage *tls = new ThreadStorage();
|
||||
if(tlsDefault == nullptr )
|
||||
if(tlsDefault == NULL )
|
||||
{
|
||||
tlsIdx = TlsAlloc();
|
||||
tlsDefault = tls;
|
||||
@@ -41,7 +41,7 @@ void AABB::UseDefaultThreadStorage()
|
||||
|
||||
void AABB::ReleaseThreadStorage()
|
||||
{
|
||||
ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(tlsIdx));
|
||||
ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx);
|
||||
if( tls == tlsDefault ) return;
|
||||
|
||||
delete tls;
|
||||
@@ -62,7 +62,7 @@ void AABB::resetPool()
|
||||
|
||||
AABB *AABB::newTemp(double x0, double y0, double z0, double x1, double y1, double z1)
|
||||
{
|
||||
ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(tlsIdx));
|
||||
ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx);
|
||||
AABB *thisAABB = &tls->pool[tls->poolPointer];
|
||||
thisAABB->set(x0, y0, z0, x1, y1, z1);
|
||||
tls->poolPointer = ( tls->poolPointer + 1 ) % ThreadStorage::POOL_SIZE;
|
||||
@@ -286,23 +286,23 @@ HitResult *AABB::clip(Vec3 *a, Vec3 *b)
|
||||
Vec3 *zh0 = a->clipZ(b, z0);
|
||||
Vec3 *zh1 = a->clipZ(b, z1);
|
||||
|
||||
if (!containsX(xh0)) xh0 = nullptr;
|
||||
if (!containsX(xh1)) xh1 = nullptr;
|
||||
if (!containsY(yh0)) yh0 = nullptr;
|
||||
if (!containsY(yh1)) yh1 = nullptr;
|
||||
if (!containsZ(zh0)) zh0 = nullptr;
|
||||
if (!containsZ(zh1)) zh1 = nullptr;
|
||||
if (!containsX(xh0)) xh0 = NULL;
|
||||
if (!containsX(xh1)) xh1 = NULL;
|
||||
if (!containsY(yh0)) yh0 = NULL;
|
||||
if (!containsY(yh1)) yh1 = NULL;
|
||||
if (!containsZ(zh0)) zh0 = NULL;
|
||||
if (!containsZ(zh1)) zh1 = NULL;
|
||||
|
||||
Vec3 *closest = nullptr;
|
||||
Vec3 *closest = NULL;
|
||||
|
||||
if (xh0 != nullptr && (closest == nullptr || a->distanceToSqr(xh0) < a->distanceToSqr(closest))) closest = xh0;
|
||||
if (xh1 != nullptr && (closest == nullptr || a->distanceToSqr(xh1) < a->distanceToSqr(closest))) closest = xh1;
|
||||
if (yh0 != nullptr && (closest == nullptr || a->distanceToSqr(yh0) < a->distanceToSqr(closest))) closest = yh0;
|
||||
if (yh1 != nullptr && (closest == nullptr || a->distanceToSqr(yh1) < a->distanceToSqr(closest))) closest = yh1;
|
||||
if (zh0 != nullptr && (closest == nullptr || a->distanceToSqr(zh0) < a->distanceToSqr(closest))) closest = zh0;
|
||||
if (zh1 != nullptr && (closest == nullptr || a->distanceToSqr(zh1) < a->distanceToSqr(closest))) closest = zh1;
|
||||
if (xh0 != NULL && (closest == NULL || a->distanceToSqr(xh0) < a->distanceToSqr(closest))) closest = xh0;
|
||||
if (xh1 != NULL && (closest == NULL || a->distanceToSqr(xh1) < a->distanceToSqr(closest))) closest = xh1;
|
||||
if (yh0 != NULL && (closest == NULL || a->distanceToSqr(yh0) < a->distanceToSqr(closest))) closest = yh0;
|
||||
if (yh1 != NULL && (closest == NULL || a->distanceToSqr(yh1) < a->distanceToSqr(closest))) closest = yh1;
|
||||
if (zh0 != NULL && (closest == NULL || a->distanceToSqr(zh0) < a->distanceToSqr(closest))) closest = zh0;
|
||||
if (zh1 != NULL && (closest == NULL || a->distanceToSqr(zh1) < a->distanceToSqr(closest))) closest = zh1;
|
||||
|
||||
if (closest == nullptr) return nullptr;
|
||||
if (closest == NULL) return NULL;
|
||||
|
||||
int face = -1;
|
||||
|
||||
@@ -319,19 +319,19 @@ HitResult *AABB::clip(Vec3 *a, Vec3 *b)
|
||||
|
||||
bool AABB::containsX(Vec3 *v)
|
||||
{
|
||||
if (v == nullptr) return false;
|
||||
if (v == NULL) return false;
|
||||
return v->y >= y0 && v->y <= y1 && v->z >= z0 && v->z <= z1;
|
||||
}
|
||||
|
||||
bool AABB::containsY(Vec3 *v)
|
||||
{
|
||||
if (v == nullptr) return false;
|
||||
if (v == NULL) return false;
|
||||
return v->x >= x0 && v->x <= x1 && v->z >= z0 && v->z <= z1;
|
||||
}
|
||||
|
||||
bool AABB::containsZ(Vec3 *v)
|
||||
{
|
||||
if (v == nullptr) return false;
|
||||
if (v == NULL) return false;
|
||||
return v->x >= x0 && v->x <= x1 && v->y >= y0 && v->y <= y1;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ AbstractContainerMenu::~AbstractContainerMenu()
|
||||
|
||||
Slot *AbstractContainerMenu::addSlot(Slot *slot)
|
||||
{
|
||||
slot->index = static_cast<int>(slots.size());
|
||||
slot->index = (int)slots.size();
|
||||
slots.push_back(slot);
|
||||
lastSlots.push_back(nullptr);
|
||||
return slot;
|
||||
@@ -80,7 +80,7 @@ void AbstractContainerMenu::broadcastChanges()
|
||||
{
|
||||
// 4J Stu - Added 0 count check. There is a bug in the Java with anvils that means this broadcast
|
||||
// happens while we are in the middle of quickmoving, and before the slot properly gets set to null
|
||||
expected = (current == nullptr || current->count == 0) ? nullptr : current->copy();
|
||||
expected = (current == NULL || current->count == 0) ? nullptr : current->copy();
|
||||
lastSlots[i] = expected;
|
||||
m_bNeedsRendered = true;
|
||||
|
||||
@@ -103,7 +103,7 @@ bool AbstractContainerMenu::needsRendered()
|
||||
shared_ptr<ItemInstance> expected = lastSlots.at(i);
|
||||
if (!ItemInstance::matches(expected, current))
|
||||
{
|
||||
expected = current == nullptr ? nullptr : current->copy();
|
||||
expected = current == NULL ? nullptr : current->copy();
|
||||
lastSlots[i] = expected;
|
||||
needsRendered = true;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ Slot *AbstractContainerMenu::getSlotFor(shared_ptr<Container> c, int index)
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Slot *AbstractContainerMenu::getSlot(int index)
|
||||
@@ -137,7 +137,7 @@ Slot *AbstractContainerMenu::getSlot(int index)
|
||||
shared_ptr<ItemInstance> AbstractContainerMenu::quickMoveStack(shared_ptr<Player> player, int slotIndex)
|
||||
{
|
||||
Slot *slot = slots.at(slotIndex);
|
||||
if (slot != nullptr)
|
||||
if (slot != NULL)
|
||||
{
|
||||
return slot->getItem();
|
||||
}
|
||||
@@ -158,7 +158,7 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
|
||||
{
|
||||
resetQuickCraft();
|
||||
}
|
||||
else if (inventory->getCarried() == nullptr)
|
||||
else if (inventory->getCarried() == NULL)
|
||||
{
|
||||
resetQuickCraft();
|
||||
}
|
||||
@@ -180,7 +180,7 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
|
||||
{
|
||||
Slot *slot = slots.at(slotIndex);
|
||||
|
||||
if (slot != nullptr && canItemQuickReplace(slot, inventory->getCarried(), true) && slot->mayPlace(inventory->getCarried()) && inventory->getCarried()->count > quickcraftSlots.size() && canDragTo(slot))
|
||||
if (slot != NULL && canItemQuickReplace(slot, inventory->getCarried(), true) && slot->mayPlace(inventory->getCarried()) && inventory->getCarried()->count > quickcraftSlots.size() && canDragTo(slot))
|
||||
{
|
||||
quickcraftSlots.insert(slot);
|
||||
}
|
||||
@@ -231,7 +231,7 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
|
||||
{
|
||||
if (slotIndex == SLOT_CLICKED_OUTSIDE)
|
||||
{
|
||||
if (inventory->getCarried() != nullptr)
|
||||
if (inventory->getCarried() != NULL)
|
||||
{
|
||||
if (slotIndex == SLOT_CLICKED_OUTSIDE)
|
||||
{
|
||||
@@ -253,10 +253,10 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
|
||||
{
|
||||
if (slotIndex < 0) return nullptr;
|
||||
Slot *slot = slots.at(slotIndex);
|
||||
if(slot != nullptr && slot->mayPickup(player))
|
||||
if(slot != NULL && slot->mayPickup(player))
|
||||
{
|
||||
shared_ptr<ItemInstance> piiClicked = quickMoveStack(player, slotIndex);
|
||||
if (piiClicked != nullptr)
|
||||
if (piiClicked != NULL)
|
||||
{
|
||||
int oldType = piiClicked->id;
|
||||
|
||||
@@ -269,14 +269,14 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
|
||||
// 4J Stu - Remove the reference to this before we start a recursive loop
|
||||
piiClicked = nullptr;
|
||||
|
||||
if (slot != nullptr)
|
||||
if (slot != NULL)
|
||||
{
|
||||
if (slot->getItem() != nullptr && slot->getItem()->id == oldType)
|
||||
if (slot->getItem() != NULL && slot->getItem()->id == oldType)
|
||||
{
|
||||
if(looped)
|
||||
{
|
||||
// Return a non-null value to indicate that we want to loop more
|
||||
clickedEntity = std::make_shared<ItemInstance>(0, 1, 0);
|
||||
clickedEntity = shared_ptr<ItemInstance>(new ItemInstance(0,1,0));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -293,19 +293,19 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
|
||||
if (slotIndex < 0) return nullptr;
|
||||
|
||||
Slot *slot = slots.at(slotIndex);
|
||||
if (slot != nullptr)
|
||||
if (slot != NULL)
|
||||
{
|
||||
shared_ptr<ItemInstance> clicked = slot->getItem();
|
||||
shared_ptr<ItemInstance> carried = inventory->getCarried();
|
||||
|
||||
if (clicked != nullptr)
|
||||
if (clicked != NULL)
|
||||
{
|
||||
clickedEntity = clicked->copy();
|
||||
}
|
||||
|
||||
if (clicked == nullptr)
|
||||
if (clicked == NULL)
|
||||
{
|
||||
if (carried != nullptr && slot->mayPlace(carried))
|
||||
if (carried != NULL && slot->mayPlace(carried))
|
||||
{
|
||||
int c = buttonNum == 0 ? carried->count : 1;
|
||||
if (c > slot->getMaxStackSize())
|
||||
@@ -326,7 +326,7 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
|
||||
else if (buttonNum == 1 && mayCombine(slot, carried))
|
||||
{
|
||||
shared_ptr<ItemInstance> combined = slot->combine(carried);
|
||||
if(combined != nullptr)
|
||||
if(combined != NULL)
|
||||
{
|
||||
slot->set(combined);
|
||||
if(!player->abilities.instabuild) carried->remove(1);
|
||||
@@ -338,7 +338,7 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
|
||||
}
|
||||
else if (slot->mayPickup(player))
|
||||
{
|
||||
if (carried == nullptr)
|
||||
if (carried == NULL)
|
||||
{
|
||||
// pick up to empty hand
|
||||
int c = buttonNum == 0 ? clicked->count : (clicked->count + 1) / 2;
|
||||
@@ -412,7 +412,7 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
|
||||
if (slot->mayPickup(player))
|
||||
{
|
||||
shared_ptr<ItemInstance> current = inventory->getItem(buttonNum);
|
||||
bool canMove = current == nullptr || (slot->container == inventory && slot->mayPlace(current));
|
||||
bool canMove = current == NULL || (slot->container == inventory && slot->mayPlace(current));
|
||||
int freeSlot = -1;
|
||||
|
||||
if (!canMove)
|
||||
@@ -426,7 +426,7 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
|
||||
shared_ptr<ItemInstance> taking = slot->getItem();
|
||||
inventory->setItem(buttonNum, taking);
|
||||
|
||||
if ((slot->container == inventory && slot->mayPlace(current)) || current == nullptr)
|
||||
if ((slot->container == inventory && slot->mayPlace(current)) || current == NULL)
|
||||
{
|
||||
slot->remove(taking->count);
|
||||
slot->set(current);
|
||||
@@ -440,47 +440,47 @@ shared_ptr<ItemInstance> AbstractContainerMenu::clicked(int slotIndex, int butto
|
||||
slot->onTake(player, taking);
|
||||
}
|
||||
}
|
||||
else if (!slot->hasItem() && current != nullptr && slot->mayPlace(current))
|
||||
else if (!slot->hasItem() && current != NULL && slot->mayPlace(current))
|
||||
{
|
||||
inventory->setItem(buttonNum, nullptr);
|
||||
slot->set(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (clickType == CLICK_CLONE && player->abilities.instabuild && inventory->getCarried() == nullptr && slotIndex >= 0)
|
||||
else if (clickType == CLICK_CLONE && player->abilities.instabuild && inventory->getCarried() == NULL && slotIndex >= 0)
|
||||
{
|
||||
Slot *slot = slots.at(slotIndex);
|
||||
if (slot != nullptr && slot->hasItem())
|
||||
if (slot != NULL && slot->hasItem())
|
||||
{
|
||||
shared_ptr<ItemInstance> copy = slot->getItem()->copy();
|
||||
copy->count = copy->getMaxStackSize();
|
||||
inventory->setCarried(copy);
|
||||
}
|
||||
}
|
||||
else if (clickType == CLICK_THROW && inventory->getCarried() == nullptr && slotIndex >= 0)
|
||||
else if (clickType == CLICK_THROW && inventory->getCarried() == NULL && slotIndex >= 0)
|
||||
{
|
||||
Slot *slot = slots.at(slotIndex);
|
||||
if (slot != nullptr && slot->hasItem() && slot->mayPickup(player))
|
||||
if (slot != NULL && slot->hasItem() && slot->mayPickup(player))
|
||||
{
|
||||
shared_ptr<ItemInstance> item = slot->remove(buttonNum == 0 ? 1 : slot->getItem()->count);
|
||||
slot->onTake(player, 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);
|
||||
shared_ptr<ItemInstance> carried = inventory->getCarried();
|
||||
|
||||
if (carried != nullptr && (slot == nullptr || !slot->hasItem() || !slot->mayPickup(player)))
|
||||
if (carried != NULL && (slot == NULL || !slot->hasItem() || !slot->mayPickup(player)))
|
||||
{
|
||||
int start = buttonNum == 0 ? 0 : static_cast<int>(slots.size()) - 1;
|
||||
int start = buttonNum == 0 ? 0 : slots.size() - 1;
|
||||
int step = buttonNum == 0 ? 1 : -1;
|
||||
|
||||
for (int pass = 0; pass < 2; pass++ )
|
||||
{
|
||||
// In the first pass, we only get partial stacks.
|
||||
for (size_t i = start; i >= 0 && i < static_cast<int>(slots.size()) && carried->count < carried->getMaxStackSize(); i += step)
|
||||
for (int i = start; i >= 0 && i < slots.size() && carried->count < carried->getMaxStackSize(); i += step)
|
||||
{
|
||||
Slot *target = slots.at(i);
|
||||
|
||||
@@ -514,7 +514,7 @@ bool AbstractContainerMenu::canTakeItemForPickAll(shared_ptr<ItemInstance> carri
|
||||
// 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in creative
|
||||
void AbstractContainerMenu::loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, shared_ptr<Player> player)
|
||||
{
|
||||
while( clicked(slotIndex, buttonNum, CLICK_QUICK_MOVE, player, true) != nullptr)
|
||||
while( clicked(slotIndex, buttonNum, CLICK_QUICK_MOVE, player, true) != NULL)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -527,7 +527,7 @@ bool AbstractContainerMenu::mayCombine(Slot *slot, shared_ptr<ItemInstance> item
|
||||
void AbstractContainerMenu::removed(shared_ptr<Player> player)
|
||||
{
|
||||
shared_ptr<Inventory> inventory = player->inventory;
|
||||
if (inventory->getCarried() != nullptr)
|
||||
if (inventory->getCarried() != NULL)
|
||||
{
|
||||
player->drop(inventory->getCarried());
|
||||
inventory->setCarried(nullptr);
|
||||
@@ -605,7 +605,7 @@ bool AbstractContainerMenu::moveItemStackTo(shared_ptr<ItemInstance> itemStack,
|
||||
|
||||
Slot *slot = slots.at(destSlot);
|
||||
shared_ptr<ItemInstance> target = slot->getItem();
|
||||
if (target != nullptr && target->id == itemStack->id && (!itemStack->isStackedByData() || itemStack->getAuxValue() == target->getAuxValue())
|
||||
if (target != NULL && target->id == itemStack->id && (!itemStack->isStackedByData() || itemStack->getAuxValue() == target->getAuxValue())
|
||||
&& ItemInstance::tagMatches(itemStack, target) )
|
||||
{
|
||||
int totalStack = target->count + itemStack->count;
|
||||
@@ -652,7 +652,7 @@ bool AbstractContainerMenu::moveItemStackTo(shared_ptr<ItemInstance> itemStack,
|
||||
Slot *slot = slots.at(destSlot);
|
||||
shared_ptr<ItemInstance> target = slot->getItem();
|
||||
|
||||
if (target == nullptr)
|
||||
if (target == NULL)
|
||||
{
|
||||
slot->set(itemStack->copy());
|
||||
slot->setChanged();
|
||||
@@ -707,9 +707,9 @@ void AbstractContainerMenu::resetQuickCraft()
|
||||
|
||||
bool AbstractContainerMenu::canItemQuickReplace(Slot *slot, shared_ptr<ItemInstance> item, bool ignoreSize)
|
||||
{
|
||||
bool canReplace = slot == nullptr || !slot->hasItem();
|
||||
bool canReplace = slot == NULL || !slot->hasItem();
|
||||
|
||||
if (slot != nullptr && slot->hasItem() && item != nullptr && item->sameItem(slot->getItem()) && ItemInstance::tagMatches(slot->getItem(), item))
|
||||
if (slot != NULL && slot->hasItem() && item != NULL && item->sameItem(slot->getItem()) && ItemInstance::tagMatches(slot->getItem(), item))
|
||||
{
|
||||
canReplace |= slot->getItem()->count + (ignoreSize ? 0 : item->count) <= item->getMaxStackSize();
|
||||
}
|
||||
@@ -722,7 +722,7 @@ void AbstractContainerMenu::getQuickCraftSlotCount(unordered_set<Slot *> *quickC
|
||||
switch (quickCraftingType)
|
||||
{
|
||||
case QUICKCRAFT_TYPE_CHARITABLE:
|
||||
item->count = Mth::floor(item->count / static_cast<float>(quickCraftSlots->size()));
|
||||
item->count = Mth::floor(item->count / (float) quickCraftSlots->size());
|
||||
break;
|
||||
case QUICKCRAFT_TYPE_GREEDY:
|
||||
item->count = 1;
|
||||
@@ -739,7 +739,7 @@ bool AbstractContainerMenu::canDragTo(Slot *slot)
|
||||
|
||||
int AbstractContainerMenu::getRedstoneSignalFromContainer(shared_ptr<Container> container)
|
||||
{
|
||||
if (container == nullptr) return 0;
|
||||
if (container == NULL) return 0;
|
||||
int count = 0;
|
||||
float totalPct = 0;
|
||||
|
||||
@@ -747,9 +747,9 @@ int AbstractContainerMenu::getRedstoneSignalFromContainer(shared_ptr<Container>
|
||||
{
|
||||
shared_ptr<ItemInstance> item = container->getItem(i);
|
||||
|
||||
if (item != nullptr)
|
||||
if (item != NULL)
|
||||
{
|
||||
totalPct += item->count / static_cast<float>(min(container->getMaxStackSize(), item->getMaxStackSize()));
|
||||
totalPct += item->count / (float) min(container->getMaxStackSize(), item->getMaxStackSize());
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
static const int CONTAINER_ID_INVENTORY = 0;
|
||||
static const int CONTAINER_ID_CREATIVE = -2;
|
||||
|
||||
vector<shared_ptr<ItemInstance>> lastSlots;
|
||||
vector<shared_ptr<ItemInstance> > lastSlots;
|
||||
vector<Slot *> slots;
|
||||
int containerId;
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
virtual bool stillValid(shared_ptr<Player> player) = 0;
|
||||
|
||||
// 4J Stu Added for UI
|
||||
unsigned int getSize() { return static_cast<unsigned int>(slots.size()); }
|
||||
unsigned int getSize() { return (unsigned int)slots.size(); }
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@@ -58,7 +58,7 @@ bool Achievement::isAchievement()
|
||||
|
||||
wstring Achievement::getDescription()
|
||||
{
|
||||
if (descFormatter != nullptr)
|
||||
if (descFormatter != NULL)
|
||||
{
|
||||
return descFormatter->format(desc);
|
||||
}
|
||||
|
||||
@@ -17,79 +17,79 @@ int Achievements::yMax = 0;
|
||||
|
||||
vector<Achievement *> *Achievements::achievements = new vector<Achievement *>;
|
||||
|
||||
Achievement *Achievements::openInventory = nullptr;
|
||||
Achievement *Achievements::mineWood = nullptr;
|
||||
Achievement *Achievements::buildWorkbench = nullptr;
|
||||
Achievement *Achievements::buildPickaxe = nullptr;
|
||||
Achievement *Achievements::buildFurnace = nullptr;
|
||||
Achievement *Achievements::acquireIron = nullptr;
|
||||
Achievement *Achievements::buildHoe = nullptr;
|
||||
Achievement *Achievements::makeBread = nullptr;
|
||||
Achievement *Achievements::bakeCake = nullptr;
|
||||
Achievement *Achievements::buildBetterPickaxe = nullptr;
|
||||
Achievement *Achievements::cookFish = nullptr;
|
||||
Achievement *Achievements::onARail = nullptr;
|
||||
Achievement *Achievements::buildSword = nullptr;
|
||||
Achievement *Achievements::killEnemy = nullptr;
|
||||
Achievement *Achievements::killCow = nullptr;
|
||||
Achievement *Achievements::flyPig = nullptr;
|
||||
Achievement *Achievements::openInventory = NULL;
|
||||
Achievement *Achievements::mineWood = NULL;
|
||||
Achievement *Achievements::buildWorkbench = NULL;
|
||||
Achievement *Achievements::buildPickaxe = NULL;
|
||||
Achievement *Achievements::buildFurnace = NULL;
|
||||
Achievement *Achievements::acquireIron = NULL;
|
||||
Achievement *Achievements::buildHoe = NULL;
|
||||
Achievement *Achievements::makeBread = NULL;
|
||||
Achievement *Achievements::bakeCake = NULL;
|
||||
Achievement *Achievements::buildBetterPickaxe = NULL;
|
||||
Achievement *Achievements::cookFish = NULL;
|
||||
Achievement *Achievements::onARail = NULL;
|
||||
Achievement *Achievements::buildSword = NULL;
|
||||
Achievement *Achievements::killEnemy = NULL;
|
||||
Achievement *Achievements::killCow = NULL;
|
||||
Achievement *Achievements::flyPig = NULL;
|
||||
|
||||
Achievement *Achievements::snipeSkeleton = nullptr;
|
||||
Achievement *Achievements::diamonds = nullptr;
|
||||
//Achievement *Achievements::portal = nullptr;
|
||||
Achievement *Achievements::ghast = nullptr;
|
||||
Achievement *Achievements::blazeRod = nullptr;
|
||||
Achievement *Achievements::potion = nullptr;
|
||||
Achievement *Achievements::theEnd = nullptr;
|
||||
Achievement *Achievements::winGame = nullptr;
|
||||
Achievement *Achievements::enchantments = nullptr;
|
||||
//Achievement *Achievements::overkill = nullptr;
|
||||
//Achievement *Achievements::bookcase = nullptr;
|
||||
Achievement *Achievements::snipeSkeleton = NULL;
|
||||
Achievement *Achievements::diamonds = NULL;
|
||||
//Achievement *Achievements::portal = NULL;
|
||||
Achievement *Achievements::ghast = NULL;
|
||||
Achievement *Achievements::blazeRod = NULL;
|
||||
Achievement *Achievements::potion = NULL;
|
||||
Achievement *Achievements::theEnd = NULL;
|
||||
Achievement *Achievements::winGame = NULL;
|
||||
Achievement *Achievements::enchantments = NULL;
|
||||
//Achievement *Achievements::overkill = NULL;
|
||||
//Achievement *Achievements::bookcase = NULL;
|
||||
|
||||
// 4J : WESTY : Added new acheivements.
|
||||
Achievement *Achievements::leaderOfThePack = nullptr;
|
||||
Achievement *Achievements::MOARTools = nullptr;
|
||||
Achievement *Achievements::dispenseWithThis = nullptr;
|
||||
Achievement *Achievements::InToTheNether = nullptr;
|
||||
Achievement *Achievements::leaderOfThePack = NULL;
|
||||
Achievement *Achievements::MOARTools = NULL;
|
||||
Achievement *Achievements::dispenseWithThis = NULL;
|
||||
Achievement *Achievements::InToTheNether = NULL;
|
||||
|
||||
// 4J : WESTY : Added other awards.
|
||||
Achievement *Achievements::socialPost = nullptr;
|
||||
Achievement *Achievements::eatPorkChop = nullptr;
|
||||
Achievement *Achievements::play100Days = nullptr;
|
||||
Achievement *Achievements::arrowKillCreeper = nullptr;
|
||||
Achievement *Achievements::mine100Blocks = nullptr;
|
||||
Achievement *Achievements::kill10Creepers = nullptr;
|
||||
Achievement *Achievements::socialPost = NULL;
|
||||
Achievement *Achievements::eatPorkChop = NULL;
|
||||
Achievement *Achievements::play100Days = NULL;
|
||||
Achievement *Achievements::arrowKillCreeper = NULL;
|
||||
Achievement *Achievements::mine100Blocks = NULL;
|
||||
Achievement *Achievements::kill10Creepers = NULL;
|
||||
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
Achievement *Achievements::overkill = nullptr; // Restored old achivements.
|
||||
Achievement *Achievements::bookcase = nullptr; // Restored old achivements.
|
||||
Achievement *Achievements::overkill = NULL; // Restored old achivements.
|
||||
Achievement *Achievements::bookcase = NULL; // Restored old achivements.
|
||||
|
||||
// 4J-JEV: New Achievements for Orbis.
|
||||
Achievement *Achievements::adventuringTime = nullptr;
|
||||
Achievement *Achievements::repopulation = nullptr;
|
||||
//Achievement *Achievements::porkChop = nullptr;
|
||||
Achievement *Achievements::diamondsToYou = nullptr;
|
||||
//Achievement *Achievements::passingTheTime = nullptr;
|
||||
//Achievement *Achievements::archer = nullptr;
|
||||
Achievement *Achievements::theHaggler = nullptr;
|
||||
Achievement *Achievements::potPlanter = nullptr;
|
||||
Achievement *Achievements::itsASign = nullptr;
|
||||
Achievement *Achievements::ironBelly = nullptr;
|
||||
Achievement *Achievements::haveAShearfulDay = nullptr;
|
||||
Achievement *Achievements::rainbowCollection = nullptr;
|
||||
Achievement *Achievements::stayinFrosty = nullptr;
|
||||
Achievement *Achievements::chestfulOfCobblestone = nullptr;
|
||||
Achievement *Achievements::renewableEnergy = nullptr;
|
||||
Achievement *Achievements::musicToMyEars = nullptr;
|
||||
Achievement *Achievements::bodyGuard = nullptr;
|
||||
Achievement *Achievements::ironMan = nullptr;
|
||||
Achievement *Achievements::zombieDoctor = nullptr;
|
||||
Achievement *Achievements::lionTamer = nullptr;
|
||||
Achievement *Achievements::adventuringTime = NULL;
|
||||
Achievement *Achievements::repopulation = NULL;
|
||||
//Achievement *Achievements::porkChop = NULL;
|
||||
Achievement *Achievements::diamondsToYou = NULL;
|
||||
//Achievement *Achievements::passingTheTime = NULL;
|
||||
//Achievement *Achievements::archer = NULL;
|
||||
Achievement *Achievements::theHaggler = NULL;
|
||||
Achievement *Achievements::potPlanter = NULL;
|
||||
Achievement *Achievements::itsASign = NULL;
|
||||
Achievement *Achievements::ironBelly = NULL;
|
||||
Achievement *Achievements::haveAShearfulDay = NULL;
|
||||
Achievement *Achievements::rainbowCollection = NULL;
|
||||
Achievement *Achievements::stayinFrosty = NULL;
|
||||
Achievement *Achievements::chestfulOfCobblestone = NULL;
|
||||
Achievement *Achievements::renewableEnergy = NULL;
|
||||
Achievement *Achievements::musicToMyEars = NULL;
|
||||
Achievement *Achievements::bodyGuard = NULL;
|
||||
Achievement *Achievements::ironMan = NULL;
|
||||
Achievement *Achievements::zombieDoctor = NULL;
|
||||
Achievement *Achievements::lionTamer = NULL;
|
||||
#endif
|
||||
|
||||
void Achievements::staticCtor()
|
||||
{
|
||||
Achievements::openInventory = (new Achievement(eAward_TakingInventory, L"openInventory", 0, 0, Item::book, nullptr))->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::openInventory = (new Achievement(eAward_TakingInventory, L"openInventory", 0, 0, Item::book, NULL))->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::mineWood = (new Achievement(eAward_GettingWood, L"mineWood", 2, 1, Tile::treeTrunk, (Achievement *) openInventory))->postConstruct();
|
||||
Achievements::buildWorkbench = (new Achievement(eAward_Benchmarking, L"buildWorkBench", 4, -1, Tile::workBench, (Achievement *) mineWood))->postConstruct();
|
||||
Achievements::buildPickaxe = (new Achievement(eAward_TimeToMine, L"buildPickaxe", 4, 2, Item::pickAxe_wood, (Achievement *) buildWorkbench))->postConstruct();
|
||||
@@ -152,26 +152,26 @@ void Achievements::staticCtor()
|
||||
Achievements::overkill = (new Achievement(eAward_overkill, L"overkill", -4,1, Item::sword_diamond, (Achievement *)enchantments) )->setGolden()->postConstruct();
|
||||
Achievements::bookcase = (new Achievement(eAward_bookcase, L"bookcase", -3,6, Tile::bookshelf, (Achievement *)enchantments) )->postConstruct();
|
||||
|
||||
Achievements::adventuringTime = (new Achievement(eAward_adventuringTime, L"adventuringTime", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::repopulation = (new Achievement(eAward_repopulation, L"repopulation", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct();
|
||||
Achievements::adventuringTime = (new Achievement(eAward_adventuringTime, L"adventuringTime", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::repopulation = (new Achievement(eAward_repopulation, L"repopulation", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct();
|
||||
//Achievements::porkChoop // // // // // //
|
||||
Achievements::diamondsToYou = (new Achievement(eAward_diamondsToYou, L"diamondsToYou", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct();
|
||||
//Achievements::passingTheTime = (new Achievement(eAward_play100Days, L"passingTheTime", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct();
|
||||
//Achievements::archer = (new Achievement(eAward_arrowKillCreeper, L"archer", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct();
|
||||
Achievements::theHaggler = (new Achievement(eAward_theHaggler, L"theHaggler", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::potPlanter = (new Achievement(eAward_potPlanter, L"potPlanter", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::itsASign = (new Achievement(eAward_itsASign, L"itsASign", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::ironBelly = (new Achievement(eAward_ironBelly, L"ironBelly", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct();
|
||||
Achievements::haveAShearfulDay = (new Achievement(eAward_haveAShearfulDay, L"haveAShearfulDay", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct();
|
||||
Achievements::rainbowCollection = (new Achievement(eAward_rainbowCollection, L"rainbowCollection", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::stayinFrosty = (new Achievement(eAward_stayinFrosty, L"stayingFrosty", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct();
|
||||
Achievements::chestfulOfCobblestone = (new Achievement(eAward_chestfulOfCobblestone, L"chestfulOfCobblestone", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::renewableEnergy = (new Achievement(eAward_renewableEnergy, L"renewableEnergy", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct();
|
||||
Achievements::musicToMyEars = (new Achievement(eAward_musicToMyEars, L"musicToMyEars", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct();
|
||||
Achievements::bodyGuard = (new Achievement(eAward_bodyGuard, L"bodyGuard", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct();
|
||||
Achievements::ironMan = (new Achievement(eAward_ironMan, L"ironMan", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct();
|
||||
Achievements::zombieDoctor = (new Achievement(eAward_zombieDoctor, L"zombieDoctor", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct();
|
||||
Achievements::lionTamer = (new Achievement(eAward_lionTamer, L"lionTamer", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct();
|
||||
Achievements::diamondsToYou = (new Achievement(eAward_diamondsToYou, L"diamondsToYou", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct();
|
||||
//Achievements::passingTheTime = (new Achievement(eAward_play100Days, L"passingTheTime", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct();
|
||||
//Achievements::archer = (new Achievement(eAward_arrowKillCreeper, L"archer", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct();
|
||||
Achievements::theHaggler = (new Achievement(eAward_theHaggler, L"theHaggler", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::potPlanter = (new Achievement(eAward_potPlanter, L"potPlanter", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::itsASign = (new Achievement(eAward_itsASign, L"itsASign", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::ironBelly = (new Achievement(eAward_ironBelly, L"ironBelly", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct();
|
||||
Achievements::haveAShearfulDay = (new Achievement(eAward_haveAShearfulDay, L"haveAShearfulDay", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct();
|
||||
Achievements::rainbowCollection = (new Achievement(eAward_rainbowCollection, L"rainbowCollection", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::stayinFrosty = (new Achievement(eAward_stayinFrosty, L"stayingFrosty", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct();
|
||||
Achievements::chestfulOfCobblestone = (new Achievement(eAward_chestfulOfCobblestone, L"chestfulOfCobblestone", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct();
|
||||
Achievements::renewableEnergy = (new Achievement(eAward_renewableEnergy, L"renewableEnergy", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct();
|
||||
Achievements::musicToMyEars = (new Achievement(eAward_musicToMyEars, L"musicToMyEars", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct();
|
||||
Achievements::bodyGuard = (new Achievement(eAward_bodyGuard, L"bodyGuard", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct();
|
||||
Achievements::ironMan = (new Achievement(eAward_ironMan, L"ironMan", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct();
|
||||
Achievements::zombieDoctor = (new Achievement(eAward_zombieDoctor, L"zombieDoctor", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct();
|
||||
Achievements::lionTamer = (new Achievement(eAward_lionTamer, L"lionTamer", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ void AddEntityPacket::_init(shared_ptr<Entity> e, int type, int data, int xp, in
|
||||
if (xd > m) xd = m;
|
||||
if (yd > m) yd = m;
|
||||
if (zd > m) zd = m;
|
||||
xa = static_cast<int>(xd * 8000.0);
|
||||
ya = static_cast<int>(yd * 8000.0);
|
||||
za = static_cast<int>(zd * 8000.0);
|
||||
xa = (int) (xd * 8000.0);
|
||||
ya = (int) (yd * 8000.0);
|
||||
za = (int) (zd * 8000.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,6 @@ public:
|
||||
virtual int getEstimatedSize();
|
||||
|
||||
public:
|
||||
static shared_ptr<Packet> create() { return std::make_shared<AddEntityPacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddEntityPacket()); }
|
||||
virtual int getId() { return 23; }
|
||||
};
|
||||
@@ -19,6 +19,6 @@ public:
|
||||
virtual void handle(PacketListener *listener);
|
||||
virtual int getEstimatedSize();
|
||||
|
||||
static shared_ptr<Packet> create() { return std::make_shared<AddExperienceOrbPacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddExperienceOrbPacket()); }
|
||||
virtual int getId() { return 26; }
|
||||
};
|
||||
@@ -20,6 +20,6 @@ public:
|
||||
virtual int getEstimatedSize();
|
||||
|
||||
public:
|
||||
static shared_ptr<Packet> create() { return std::make_shared<AddGlobalEntityPacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddGlobalEntityPacket()); }
|
||||
virtual int getId() { return 71; }
|
||||
};
|
||||
@@ -17,7 +17,7 @@ AddMobPacket::AddMobPacket()
|
||||
yRot = 0;
|
||||
xRot = 0;
|
||||
entityData = nullptr;
|
||||
unpack = nullptr;
|
||||
unpack = NULL;
|
||||
}
|
||||
|
||||
AddMobPacket::~AddMobPacket()
|
||||
@@ -29,7 +29,7 @@ AddMobPacket::AddMobPacket(shared_ptr<LivingEntity> mob, int yRotp, int xRotp, i
|
||||
{
|
||||
id = mob->entityId;
|
||||
|
||||
type = static_cast<byte>(EntityIO::getId(mob));
|
||||
type = (byte) EntityIO::getId(mob);
|
||||
// 4J Stu - We should add entities at their "last sent" position so that the relative update packets
|
||||
// put them in the correct place
|
||||
x = xp;//Mth::floor(mob->x * 32);
|
||||
@@ -54,14 +54,14 @@ AddMobPacket::AddMobPacket(shared_ptr<LivingEntity> mob, int yRotp, int xRotp, i
|
||||
if (xd > m) xd = m;
|
||||
if (yd > m) yd = m;
|
||||
if (zd > m) zd = m;
|
||||
this->xd = static_cast<int>(xd * 8000.0);
|
||||
this->yd = static_cast<int>(yd * 8000.0);
|
||||
this->zd = static_cast<int>(zd * 8000.0);
|
||||
this->xd = (int) (xd * 8000.0);
|
||||
this->yd = (int) (yd * 8000.0);
|
||||
this->zd = (int) (zd * 8000.0);
|
||||
|
||||
// printf("%d: New add mob rot %d\n",id,yRot);
|
||||
|
||||
entityData = mob->getEntityData();
|
||||
unpack = nullptr;
|
||||
unpack = NULL;
|
||||
}
|
||||
|
||||
void AddMobPacket::read(DataInputStream *dis) //throws IOException
|
||||
@@ -118,11 +118,11 @@ void AddMobPacket::handle(PacketListener *listener)
|
||||
int AddMobPacket::getEstimatedSize()
|
||||
{
|
||||
int size = 11;
|
||||
if( entityData != nullptr )
|
||||
if( entityData != NULL )
|
||||
{
|
||||
size += entityData->getSizeInBytes();
|
||||
}
|
||||
else if( unpack != nullptr )
|
||||
else if( unpack != NULL )
|
||||
{
|
||||
// 4J Stu - This is an incoming value which we aren't currently analysing
|
||||
//size += unpack->get
|
||||
@@ -132,7 +132,7 @@ int AddMobPacket::getEstimatedSize()
|
||||
|
||||
vector<shared_ptr<SynchedEntityData::DataItem> > *AddMobPacket::getUnpackedData()
|
||||
{
|
||||
if (unpack == nullptr)
|
||||
if (unpack == NULL)
|
||||
{
|
||||
unpack = entityData->getAll();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,6 @@ public:
|
||||
vector<shared_ptr<SynchedEntityData::DataItem> > *getUnpackedData();
|
||||
|
||||
public:
|
||||
static shared_ptr<Packet> create() { return std::make_shared<AddMobPacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddMobPacket()); }
|
||||
virtual int getId() { return 24; }
|
||||
};
|
||||
|
||||
@@ -22,6 +22,6 @@ public:
|
||||
virtual void handle(PacketListener *listener);
|
||||
virtual int getEstimatedSize();
|
||||
public:
|
||||
static shared_ptr<Packet> create() { return std::make_shared<AddPaintingPacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddPaintingPacket()); }
|
||||
virtual int getId() { return 25; }
|
||||
};
|
||||
|
||||
@@ -24,12 +24,12 @@ AddPlayerPacket::AddPlayerPacket()
|
||||
m_capeId = 0;
|
||||
m_uiGamePrivileges = 0;
|
||||
entityData = nullptr;
|
||||
unpack = nullptr;
|
||||
unpack = NULL;
|
||||
}
|
||||
|
||||
AddPlayerPacket::~AddPlayerPacket()
|
||||
{
|
||||
if(unpack != nullptr) delete unpack;
|
||||
if(unpack != NULL) delete unpack;
|
||||
}
|
||||
|
||||
AddPlayerPacket::AddPlayerPacket(shared_ptr<Player> player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp)
|
||||
@@ -51,17 +51,17 @@ AddPlayerPacket::AddPlayerPacket(shared_ptr<Player> player, PlayerUID xuid, Play
|
||||
//printf("%d: New add player (%f,%f,%f) : (%d,%d,%d) : xRot %d, yRot %d\n",id,player->x,player->y,player->z,x,y,z,xRot,yRot);
|
||||
|
||||
shared_ptr<ItemInstance> itemInstance = player->inventory->getSelected();
|
||||
carriedItem = itemInstance == nullptr ? 0 : itemInstance->id;
|
||||
carriedItem = itemInstance == NULL ? 0 : itemInstance->id;
|
||||
|
||||
this->xuid = xuid;
|
||||
this->OnlineXuid = OnlineXuid;
|
||||
m_playerIndex = static_cast<BYTE>(player->getPlayerIndex());
|
||||
m_playerIndex = (BYTE)player->getPlayerIndex();
|
||||
m_skinId = player->getCustomSkin();
|
||||
m_capeId = player->getCustomCape();
|
||||
m_uiGamePrivileges = player->getAllPlayerGamePrivileges();
|
||||
|
||||
entityData = player->getEntityData();
|
||||
unpack = nullptr;
|
||||
unpack = NULL;
|
||||
}
|
||||
|
||||
void AddPlayerPacket::read(DataInputStream *dis) //throws IOException
|
||||
@@ -119,11 +119,11 @@ int AddPlayerPacket::getEstimatedSize()
|
||||
{
|
||||
int iSize= sizeof(int) + Player::MAX_NAME_LENGTH + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(BYTE) + sizeof(BYTE) +sizeof(short) + sizeof(PlayerUID) + sizeof(PlayerUID) + sizeof(int) + sizeof(BYTE) + sizeof(unsigned int) + sizeof(byte);
|
||||
|
||||
if( entityData != nullptr )
|
||||
if( entityData != NULL )
|
||||
{
|
||||
iSize += entityData->getSizeInBytes();
|
||||
}
|
||||
else if( unpack != nullptr )
|
||||
else if( unpack != NULL )
|
||||
{
|
||||
// 4J Stu - This is an incoming value which we aren't currently analysing
|
||||
//iSize += unpack->get
|
||||
@@ -134,7 +134,7 @@ int AddPlayerPacket::getEstimatedSize()
|
||||
|
||||
vector<shared_ptr<SynchedEntityData::DataItem> > *AddPlayerPacket::getUnpackedData()
|
||||
{
|
||||
if (unpack == nullptr)
|
||||
if (unpack == NULL)
|
||||
{
|
||||
unpack = entityData->getAll();
|
||||
}
|
||||
|
||||
@@ -38,6 +38,6 @@ public:
|
||||
|
||||
vector<shared_ptr<SynchedEntityData::DataItem> > *getUnpackedData();
|
||||
public:
|
||||
static shared_ptr<Packet> create() { return std::make_shared<AddPlayerPacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AddPlayerPacket()); }
|
||||
virtual int getId() { return 20; }
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ bool AgableMob::mobInteract(shared_ptr<Player> player)
|
||||
{
|
||||
shared_ptr<ItemInstance> item = player->inventory->getSelected();
|
||||
|
||||
if (item != nullptr && item->id == Item::spawnEgg_Id)
|
||||
if (item != NULL && item->id == Item::spawnEgg_Id)
|
||||
{
|
||||
if (!level->isClientSide)
|
||||
{
|
||||
@@ -27,10 +27,10 @@ bool AgableMob::mobInteract(shared_ptr<Player> player)
|
||||
int error;
|
||||
shared_ptr<Entity> result = SpawnEggItem::canSpawn(item->getAuxValue(), level, &error);
|
||||
|
||||
if (result != nullptr)
|
||||
if (result != NULL)
|
||||
{
|
||||
shared_ptr<AgableMob> offspring = getBreedOffspring(dynamic_pointer_cast<AgableMob>(shared_from_this()));
|
||||
if (offspring != nullptr)
|
||||
if (offspring != NULL)
|
||||
{
|
||||
offspring->setAge(BABY_START_AGE);
|
||||
offspring->moveTo(x, y, z, 0, 0);
|
||||
|
||||
@@ -72,13 +72,13 @@ void Animal::checkHurtTarget(shared_ptr<Entity> target, float d)
|
||||
{
|
||||
double xd = target->x - x;
|
||||
double zd = target->z - z;
|
||||
yRot = static_cast<float>(atan2(zd, xd) * 180 / PI) - 90;
|
||||
yRot = (float) (atan2(zd, xd) * 180 / PI) - 90;
|
||||
|
||||
holdGround = true;
|
||||
}
|
||||
|
||||
shared_ptr<Player> p = dynamic_pointer_cast<Player>(target);
|
||||
if (p->getSelectedItem() == nullptr || !isFood(p->getSelectedItem()))
|
||||
if (p->getSelectedItem() == NULL || !isFood(p->getSelectedItem()))
|
||||
{
|
||||
attackTarget = nullptr;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ void Animal::checkHurtTarget(shared_ptr<Entity> target, float d)
|
||||
}
|
||||
else if (getInLoveValue() > 0 && a->getInLoveValue() > 0)
|
||||
{
|
||||
if (a->attackTarget == nullptr) a->attackTarget = shared_from_this();
|
||||
if (a->attackTarget == NULL) a->attackTarget = shared_from_this();
|
||||
|
||||
if (a->attackTarget == shared_from_this() && d < 3.5)
|
||||
{
|
||||
@@ -134,9 +134,9 @@ void Animal::breedWith(shared_ptr<Animal> target)
|
||||
target->loveTime = 0;
|
||||
target->setInLoveValue(0);
|
||||
|
||||
// 4J - we have offspring of nullptr returned when we have hit our limits of spawning any particular type of animal. In these cases try and do everything we can apart from actually
|
||||
// 4J - we have offspring of NULL returned when we have hit our limits of spawning any particular type of animal. In these cases try and do everything we can apart from actually
|
||||
// spawning the entity.
|
||||
if (offspring != nullptr)
|
||||
if (offspring != NULL)
|
||||
{
|
||||
// Only want to set the age to this +ve value if something is actually spawned, as during this period the animal will attempt to follow offspring and ignore players.
|
||||
setAge(5 * 60 * 20);
|
||||
@@ -154,7 +154,7 @@ void Animal::breedWith(shared_ptr<Animal> target)
|
||||
}
|
||||
level->addEntity(offspring);
|
||||
|
||||
level->addEntity(std::make_shared<ExperienceOrb>(level, x, y, z, random->nextInt(4) + 1));
|
||||
level->addEntity( shared_ptr<ExperienceOrb>( new ExperienceOrb(level, x, y, z, random->nextInt(4) + 1) ) );
|
||||
}
|
||||
|
||||
setDespawnProtected();
|
||||
@@ -169,7 +169,7 @@ float Animal::getWalkTargetValue(int x, int y, int z)
|
||||
bool Animal::hurt(DamageSource *dmgSource, float dmg)
|
||||
{
|
||||
if (isInvulnerable()) return false;
|
||||
if (dynamic_cast<EntityDamageSource *>(dmgSource) != nullptr)
|
||||
if (dynamic_cast<EntityDamageSource *>(dmgSource) != NULL)
|
||||
{
|
||||
shared_ptr<Entity> source = dmgSource->getDirectEntity();
|
||||
|
||||
@@ -179,12 +179,12 @@ bool Animal::hurt(DamageSource *dmgSource, float dmg)
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( (source != nullptr) && source->instanceof(eTYPE_ARROW) )
|
||||
if ( (source != NULL) && source->instanceof(eTYPE_ARROW) )
|
||||
{
|
||||
shared_ptr<Arrow> arrow = dynamic_pointer_cast<Arrow>(source);
|
||||
|
||||
// 4J: Check that the arrow's owner can attack animals (dispenser arrows are not owned)
|
||||
if (arrow->owner != nullptr && arrow->owner->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast<Player>(arrow->owner)->isAllowedToAttackAnimals() )
|
||||
if (arrow->owner != NULL && arrow->owner->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast<Player>(arrow->owner)->isAllowedToAttackAnimals() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -196,7 +196,7 @@ bool Animal::hurt(DamageSource *dmgSource, float dmg)
|
||||
if (!useNewAi())
|
||||
{
|
||||
AttributeInstance *speed = getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED);
|
||||
if (speed->getModifier(eModifierId_MOB_FLEEING) == nullptr)
|
||||
if (speed->getModifier(eModifierId_MOB_FLEEING) == NULL)
|
||||
{
|
||||
speed->addModifier(new AttributeModifier(*Animal::SPEED_MODIFIER_FLEEING));
|
||||
}
|
||||
@@ -255,7 +255,7 @@ shared_ptr<Entity> Animal::findAttackTarget()
|
||||
setDespawnProtected();
|
||||
|
||||
shared_ptr<Player> p = dynamic_pointer_cast<Player>(it);
|
||||
if (p->getSelectedItem() != nullptr && this->isFood(p->getSelectedItem()))
|
||||
if (p->getSelectedItem() != NULL && this->isFood(p->getSelectedItem()))
|
||||
{
|
||||
delete players;
|
||||
return p;
|
||||
@@ -317,7 +317,7 @@ bool Animal::isFood(shared_ptr<ItemInstance> itemInstance)
|
||||
bool Animal::mobInteract(shared_ptr<Player> player)
|
||||
{
|
||||
shared_ptr<ItemInstance> item = player->inventory->getSelected();
|
||||
if (item != nullptr && isFood(item) && getAge() == 0 && getInLoveValue() <= 0)
|
||||
if (item != NULL && isFood(item) && getAge() == 0 && getInLoveValue() <= 0)
|
||||
{
|
||||
if (!player->abilities.instabuild)
|
||||
{
|
||||
|
||||
@@ -26,6 +26,6 @@ public:
|
||||
virtual int getEstimatedSize();
|
||||
|
||||
public:
|
||||
static shared_ptr<Packet> create() { return std::make_shared<AnimatePacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AnimatePacket()); }
|
||||
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)
|
||||
{
|
||||
resultSlots = std::make_shared<ResultContainer>();
|
||||
repairSlots = std::make_shared<RepairContainer>(this,IDS_REPAIR_AND_NAME, true, 2);
|
||||
resultSlots = shared_ptr<ResultContainer>( new ResultContainer() );
|
||||
repairSlots = shared_ptr<RepairContainer>( new RepairContainer(this,IDS_REPAIR_AND_NAME, true, 2) );
|
||||
cost = 0;
|
||||
repairItemCountCost = 0;
|
||||
|
||||
@@ -55,7 +55,7 @@ void AnvilMenu::createResult()
|
||||
|
||||
if (DEBUG_COST) app.DebugPrintf("----");
|
||||
|
||||
if (input == nullptr)
|
||||
if (input == NULL)
|
||||
{
|
||||
resultSlots->setItem(0, nullptr);
|
||||
cost = 0;
|
||||
@@ -68,15 +68,15 @@ void AnvilMenu::createResult()
|
||||
unordered_map<int,int> *enchantments = EnchantmentHelper::getEnchantments(result);
|
||||
bool usingBook = false;
|
||||
|
||||
tax += input->getBaseRepairCost() + (addition == nullptr ? 0 : addition->getBaseRepairCost());
|
||||
tax += input->getBaseRepairCost() + (addition == NULL ? 0 : addition->getBaseRepairCost());
|
||||
if (DEBUG_COST)
|
||||
{
|
||||
app.DebugPrintf("Starting with base repair tax of %d (%d + %d)\n", tax, input->getBaseRepairCost(), (addition == nullptr ? 0 : addition->getBaseRepairCost()));
|
||||
app.DebugPrintf("Starting with base repair tax of %d (%d + %d)\n", tax, input->getBaseRepairCost(), (addition == NULL ? 0 : addition->getBaseRepairCost()));
|
||||
}
|
||||
|
||||
repairItemCountCost = 0;
|
||||
|
||||
if (addition != nullptr)
|
||||
if (addition != NULL)
|
||||
{
|
||||
usingBook = addition->id == Item::enchantedBook_Id && Item::enchantedBook->getEnchantments(addition)->size() > 0;
|
||||
|
||||
@@ -290,10 +290,10 @@ void AnvilMenu::createResult()
|
||||
result = nullptr;
|
||||
}
|
||||
|
||||
if (result != nullptr)
|
||||
if (result != NULL)
|
||||
{
|
||||
int baseCost = result->getBaseRepairCost();
|
||||
if (addition != nullptr && baseCost < addition->getBaseRepairCost()) baseCost = addition->getBaseRepairCost();
|
||||
if (addition != NULL && baseCost < addition->getBaseRepairCost()) baseCost = addition->getBaseRepairCost();
|
||||
if (result->hasCustomHoverName()) baseCost -= 9;
|
||||
if (baseCost < 0) baseCost = 0;
|
||||
baseCost += 2;
|
||||
@@ -344,7 +344,7 @@ void AnvilMenu::removed(shared_ptr<Player> player)
|
||||
for (int i = 0; i < repairSlots->getContainerSize(); i++)
|
||||
{
|
||||
shared_ptr<ItemInstance> item = repairSlots->removeItemNoUpdate(i);
|
||||
if (item != nullptr)
|
||||
if (item != NULL)
|
||||
{
|
||||
player->drop(item);
|
||||
}
|
||||
@@ -362,7 +362,7 @@ shared_ptr<ItemInstance> AnvilMenu::quickMoveStack(shared_ptr<Player> player, in
|
||||
{
|
||||
shared_ptr<ItemInstance> clicked = nullptr;
|
||||
Slot *slot = slots.at(slotIndex);
|
||||
if (slot != nullptr && slot->hasItem())
|
||||
if (slot != NULL && slot->hasItem())
|
||||
{
|
||||
shared_ptr<ItemInstance> stack = slot->getItem();
|
||||
clicked = stack->copy();
|
||||
|
||||
@@ -21,7 +21,7 @@ AnvilTile::AnvilTile(int id) : HeavyTile(id, Material::heavyMetal, isSolidRender
|
||||
{
|
||||
part = PART_BASE;
|
||||
setLightBlock(0);
|
||||
icons = nullptr;
|
||||
icons = NULL;
|
||||
}
|
||||
|
||||
bool AnvilTile::isCubeShaped()
|
||||
|
||||
@@ -13,12 +13,12 @@ bool ArmorDyeRecipe::matches(shared_ptr<CraftingContainer> craftSlots, Level *le
|
||||
for (int slot = 0; slot < craftSlots->getContainerSize(); slot++)
|
||||
{
|
||||
shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
|
||||
if (item == nullptr) continue;
|
||||
if (item == NULL) continue;
|
||||
|
||||
ArmorItem *armor = dynamic_cast<ArmorItem *>(item->getItem());
|
||||
if (armor)
|
||||
{
|
||||
if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == nullptr)
|
||||
if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == NULL)
|
||||
{
|
||||
target = item;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ bool ArmorDyeRecipe::matches(shared_ptr<CraftingContainer> craftSlots, Level *le
|
||||
}
|
||||
}
|
||||
|
||||
return target != nullptr && !dyes.empty();
|
||||
return target != NULL && !dyes.empty();
|
||||
}
|
||||
|
||||
shared_ptr<ItemInstance> ArmorDyeRecipe::assembleDyedArmor(shared_ptr<CraftingContainer> craftSlots)
|
||||
@@ -46,19 +46,19 @@ shared_ptr<ItemInstance> ArmorDyeRecipe::assembleDyedArmor(shared_ptr<CraftingCo
|
||||
int colorTotals[3] = {0,0,0};
|
||||
int intensityTotal = 0;
|
||||
int colourCounts = 0;
|
||||
ArmorItem *armor = nullptr;
|
||||
ArmorItem *armor = NULL;
|
||||
|
||||
if(craftSlots != nullptr)
|
||||
if(craftSlots != NULL)
|
||||
{
|
||||
for (int slot = 0; slot < craftSlots->getContainerSize(); slot++)
|
||||
{
|
||||
shared_ptr<ItemInstance> item = craftSlots->getItem(slot);
|
||||
if (item == nullptr) continue;
|
||||
if (item == NULL) continue;
|
||||
|
||||
armor = dynamic_cast<ArmorItem *>(item->getItem());
|
||||
if (armor)
|
||||
{
|
||||
if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == nullptr)
|
||||
if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == NULL)
|
||||
{
|
||||
target = item->copy();
|
||||
target->count = 1;
|
||||
@@ -66,9 +66,9 @@ shared_ptr<ItemInstance> ArmorDyeRecipe::assembleDyedArmor(shared_ptr<CraftingCo
|
||||
if (armor->hasCustomColor(item))
|
||||
{
|
||||
int color = armor->getColor(target);
|
||||
float red = static_cast<float>((color >> 16) & 0xFF) / 0xFF;
|
||||
float green = static_cast<float>((color >> 8) & 0xFF) / 0xFF;
|
||||
float blue = static_cast<float>(color & 0xFF) / 0xFF;
|
||||
float red = (float) ((color >> 16) & 0xFF) / 0xFF;
|
||||
float green = (float) ((color >> 8) & 0xFF) / 0xFF;
|
||||
float blue = (float) (color & 0xFF) / 0xFF;
|
||||
|
||||
intensityTotal += max(red, max(green, blue)) * 0xFF;
|
||||
|
||||
@@ -86,9 +86,9 @@ shared_ptr<ItemInstance> ArmorDyeRecipe::assembleDyedArmor(shared_ptr<CraftingCo
|
||||
else if (item->id == Item::dye_powder_Id)
|
||||
{
|
||||
int tileData = ColoredTile::getTileDataForItemAuxValue(item->getAuxValue());
|
||||
int red = static_cast<int>(Sheep::COLOR[tileData][0] * 0xFF);
|
||||
int green = static_cast<int>(Sheep::COLOR[tileData][1] * 0xFF);
|
||||
int blue = static_cast<int>(Sheep::COLOR[tileData][2] * 0xFF);
|
||||
int red = (int) (Sheep::COLOR[tileData][0] * 0xFF);
|
||||
int green = (int) (Sheep::COLOR[tileData][1] * 0xFF);
|
||||
int blue = (int) (Sheep::COLOR[tileData][2] * 0xFF);
|
||||
|
||||
intensityTotal += max(red, max(green, blue));
|
||||
|
||||
@@ -104,19 +104,19 @@ shared_ptr<ItemInstance> ArmorDyeRecipe::assembleDyedArmor(shared_ptr<CraftingCo
|
||||
}
|
||||
}
|
||||
|
||||
if (armor == nullptr) return nullptr;
|
||||
if (armor == NULL) return nullptr;
|
||||
|
||||
int red = (colorTotals[0] / colourCounts);
|
||||
int green = (colorTotals[1] / colourCounts);
|
||||
int blue = (colorTotals[2] / colourCounts);
|
||||
|
||||
float averageIntensity = static_cast<float>(intensityTotal) / colourCounts;
|
||||
float resultIntensity = static_cast<float>(max(red, max(green, blue)));
|
||||
float averageIntensity = (float) intensityTotal / colourCounts;
|
||||
float resultIntensity = (float) max(red, max(green, blue));
|
||||
// System.out.println(averageIntensity + ", " + resultIntensity);
|
||||
|
||||
red = static_cast<int>((float)red * averageIntensity / resultIntensity);
|
||||
green = static_cast<int>((float)green * averageIntensity / resultIntensity);
|
||||
blue = static_cast<int>((float)blue * averageIntensity / resultIntensity);
|
||||
red = (int) ((float) red * averageIntensity / resultIntensity);
|
||||
green = (int) ((float) green * averageIntensity / resultIntensity);
|
||||
blue = (int) ((float) blue * averageIntensity / resultIntensity);
|
||||
|
||||
int rgb = red;
|
||||
rgb = (rgb << 8) + green;
|
||||
@@ -138,7 +138,7 @@ int ArmorDyeRecipe::size()
|
||||
|
||||
const ItemInstance *ArmorDyeRecipe::getResultItem()
|
||||
{
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const int ArmorDyeRecipe::getGroup()
|
||||
@@ -175,7 +175,7 @@ void ArmorDyeRecipe::reqs(INGREDIENTS_REQUIRED *pIngReq)
|
||||
#if 0
|
||||
for ( ItemInstance *expected : *ingredients )
|
||||
{
|
||||
if (expected!=nullptr)
|
||||
if (expected!=NULL)
|
||||
{
|
||||
int iAuxVal = expected->getAuxValue();
|
||||
TempIngReq.uiGridA[iCount++]=expected->id | iAuxVal<<24;
|
||||
|
||||
@@ -170,9 +170,9 @@ int ArmorItem::getColor(shared_ptr<ItemInstance> item)
|
||||
if (armorType != ArmorMaterial::CLOTH) return -1;
|
||||
|
||||
CompoundTag *tag = item->getTag();
|
||||
if (tag == nullptr) return Minecraft::GetInstance()->getColourTable()->getColor( DEFAULT_LEATHER_COLOR );
|
||||
if (tag == NULL) return Minecraft::GetInstance()->getColourTable()->getColor( DEFAULT_LEATHER_COLOR );
|
||||
CompoundTag *display = tag->getCompound(L"display");
|
||||
if (display == nullptr) return Minecraft::GetInstance()->getColourTable()->getColor( DEFAULT_LEATHER_COLOR );
|
||||
if (display == NULL) return Minecraft::GetInstance()->getColourTable()->getColor( DEFAULT_LEATHER_COLOR );
|
||||
|
||||
if (display->contains(L"color"))
|
||||
{
|
||||
@@ -197,7 +197,7 @@ void ArmorItem::clearColor(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
if (armorType != ArmorMaterial::CLOTH) return;
|
||||
CompoundTag *tag = item->getTag();
|
||||
if (tag == nullptr) return;
|
||||
if (tag == NULL) return;
|
||||
CompoundTag *display = tag->getCompound(L"display");
|
||||
if (display->contains(L"color")) display->remove(L"color");
|
||||
}
|
||||
@@ -215,7 +215,7 @@ void ArmorItem::setColor(shared_ptr<ItemInstance> item, int color)
|
||||
|
||||
CompoundTag *tag = item->getTag();
|
||||
|
||||
if (tag == nullptr)
|
||||
if (tag == NULL)
|
||||
{
|
||||
tag = new CompoundTag();
|
||||
item->setTag(tag);
|
||||
@@ -262,5 +262,5 @@ Icon *ArmorItem::getEmptyIcon(int slot)
|
||||
return Item::boots_diamond->iconEmpty;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
@@ -19,11 +19,11 @@ int ArmorSlot::getMaxStackSize() const
|
||||
|
||||
bool ArmorSlot::mayPlace(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
if (item == nullptr)
|
||||
if (item == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ( dynamic_cast<ArmorItem *>( item->getItem() ) != nullptr)
|
||||
if ( dynamic_cast<ArmorItem *>( item->getItem() ) != NULL)
|
||||
{
|
||||
return dynamic_cast<ArmorItem *>( item->getItem() )->slot == slotNum;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ Icon *ArmorSlot::getNoItemIcon()
|
||||
//bool ArmorSlot::mayCombine(shared_ptr<ItemInstance> item)
|
||||
//{
|
||||
// shared_ptr<ItemInstance> thisItemI = getItem();
|
||||
// if(thisItemI == nullptr || item == nullptr) return false;
|
||||
// if(thisItemI == NULL || item == NULL) return false;
|
||||
//
|
||||
// ArmorItem *thisItem = (ArmorItem *)thisItemI->getItem();
|
||||
// bool thisIsDyableArmor = thisItem->getMaterial() == ArmorItem::ArmorMaterial::CLOTH;
|
||||
@@ -53,7 +53,7 @@ Icon *ArmorSlot::getNoItemIcon()
|
||||
//
|
||||
//shared_ptr<ItemInstance> ArmorSlot::combine(shared_ptr<ItemInstance> item)
|
||||
//{
|
||||
// shared_ptr<CraftingContainer> craftSlots = shared_ptr<CraftingContainer>( new CraftingContainer(nullptr, 2, 2) );
|
||||
// shared_ptr<CraftingContainer> craftSlots = shared_ptr<CraftingContainer>( new CraftingContainer(NULL, 2, 2) );
|
||||
// craftSlots->setItem(0, item);
|
||||
// craftSlots->setItem(1, getItem()); // Armour item needs to go second
|
||||
// shared_ptr<ItemInstance> result = ArmorDyeRecipe::assembleDyedArmor(craftSlots);
|
||||
|
||||
@@ -10,7 +10,7 @@ template <class T> class arrayWithLength
|
||||
public:
|
||||
T *data;
|
||||
unsigned int length;
|
||||
arrayWithLength() { data = nullptr; length = 0; }
|
||||
arrayWithLength() { data = NULL; length = 0; }
|
||||
arrayWithLength(unsigned int elements, bool bClearArray=true) { assert(elements!=0); data = new T[elements]; if(bClearArray){ memset( data,0,sizeof(T)*elements); } this->length = elements; }
|
||||
|
||||
// 4J Stu Added this ctor so I static init arrays in the Item derivation tree
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
T *temp = new T[elements];
|
||||
memset( temp,0,sizeof(T)*elements);
|
||||
|
||||
if( data != nullptr )
|
||||
if( data != NULL )
|
||||
{
|
||||
std::copy( data, data+length, temp );
|
||||
|
||||
@@ -45,7 +45,7 @@ template <class T> class array2DWithLength
|
||||
public:
|
||||
_parrayWithLength *data;
|
||||
unsigned int length;
|
||||
array2DWithLength() { data = nullptr; length = 0; }
|
||||
array2DWithLength() { data = NULL; length = 0; }
|
||||
array2DWithLength(unsigned int dimA, unsigned int dimB)
|
||||
{
|
||||
data = new _parrayWithLength[dimA];
|
||||
|
||||
@@ -72,15 +72,15 @@ Arrow::Arrow(Level *level, shared_ptr<LivingEntity> mob, shared_ptr<LivingEntity
|
||||
double sd = sqrt(xd * xd + zd * zd);
|
||||
if (sd < 0.0000001) return;
|
||||
|
||||
float yRot = static_cast<float>(atan2(zd, xd) * 180 / PI) - 90;
|
||||
float xRot = static_cast<float>(-(atan2(yd, sd) * 180 / PI));
|
||||
float yRot = (float) (atan2(zd, xd) * 180 / PI) - 90;
|
||||
float xRot = (float) -(atan2(yd, sd) * 180 / PI);
|
||||
|
||||
double xdn = xd / sd;
|
||||
double zdn = zd / sd;
|
||||
moveTo(mob->x + xdn, y, mob->z + zdn, yRot, xRot);
|
||||
heightOffset = 0;
|
||||
|
||||
float yo = static_cast<float>(sd) * 0.2f;
|
||||
float yo = (float) sd * 0.2f;
|
||||
shoot(xd, yd + yo, zd, power, uncertainty);
|
||||
}
|
||||
|
||||
@@ -123,13 +123,13 @@ Arrow::Arrow(Level *level, shared_ptr<LivingEntity> mob, float power) : Entity(
|
||||
|
||||
void Arrow::defineSynchedData()
|
||||
{
|
||||
entityData->define(ID_FLAGS, static_cast<byte>(0));
|
||||
entityData->define(ID_FLAGS, (byte) 0);
|
||||
}
|
||||
|
||||
|
||||
void Arrow::shoot(double xd, double yd, double zd, float pow, float uncertainty)
|
||||
{
|
||||
float dist = static_cast<float>(sqrt(xd * xd + yd * yd + zd * zd));
|
||||
float dist = (float) sqrt(xd * xd + yd * yd + zd * zd);
|
||||
|
||||
xd /= dist;
|
||||
yd /= dist;
|
||||
@@ -149,8 +149,8 @@ void Arrow::shoot(double xd, double yd, double zd, float pow, float uncertainty)
|
||||
|
||||
double sd = sqrt(xd * xd + zd * zd);
|
||||
|
||||
yRotO = yRot = static_cast<float>(atan2(xd, zd) * 180 / PI);
|
||||
xRotO = xRot = static_cast<float>(atan2(yd, sd) * 180 / PI);
|
||||
yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI);
|
||||
xRotO = xRot = (float) (atan2(yd, sd) * 180 / PI);
|
||||
life = 0;
|
||||
}
|
||||
|
||||
@@ -168,8 +168,8 @@ void Arrow::lerpMotion(double xd, double yd, double zd)
|
||||
if (xRotO == 0 && yRotO == 0)
|
||||
{
|
||||
double sd = sqrt(xd * xd + zd * zd);
|
||||
yRotO = yRot = static_cast<float>(atan2(xd, zd) * 180 / PI);
|
||||
xRotO = xRot = static_cast<float>(atan2(yd, sd) * 180 / PI);
|
||||
yRotO = yRot = (float) (atan2( xd, zd) * 180 / PI);
|
||||
xRotO = xRot = (float) (atan2( yd, sd) * 180 / PI);
|
||||
xRotO = xRot;
|
||||
yRotO = yRot;
|
||||
app.DebugPrintf("%f %f : 0x%x\n",xRot,yRot,&yRot);
|
||||
@@ -186,8 +186,8 @@ void Arrow::tick()
|
||||
if (xRotO == 0 && yRotO == 0)
|
||||
{
|
||||
double sd = sqrt(xd * xd + zd * zd);
|
||||
yRotO = yRot = static_cast<float>(atan2(xd, zd) * 180 / PI);
|
||||
xRotO = xRot = static_cast<float>(atan2(yd, sd) * 180 / PI);
|
||||
yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI);
|
||||
xRotO = xRot = (float) (atan2(yd, sd) * 180 / PI);
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ void Arrow::tick()
|
||||
{
|
||||
Tile::tiles[t]->updateShape(level, xTile, yTile, zTile);
|
||||
AABB *aabb = Tile::tiles[t]->getAABB(level, xTile, yTile, zTile);
|
||||
if (aabb != nullptr && aabb->contains(Vec3::newTemp(x, y, z)))
|
||||
if (aabb != NULL && aabb->contains(Vec3::newTemp(x, y, z)))
|
||||
{
|
||||
inGround = true;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ void Arrow::tick()
|
||||
|
||||
from = Vec3::newTemp(x, y, z);
|
||||
to = Vec3::newTemp(x + xd, y + yd, z + zd);
|
||||
if (res != nullptr)
|
||||
if (res != NULL)
|
||||
{
|
||||
to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z);
|
||||
}
|
||||
@@ -256,7 +256,7 @@ void Arrow::tick()
|
||||
float rr = 0.3f;
|
||||
AABB *bb = e->bb->grow(rr, rr, rr);
|
||||
HitResult *p = bb->clip(from, to);
|
||||
if (p != nullptr)
|
||||
if (p != NULL)
|
||||
{
|
||||
double dd = from->distanceTo(p->pos);
|
||||
if (dd < nearest || nearest == 0)
|
||||
@@ -268,33 +268,33 @@ void Arrow::tick()
|
||||
}
|
||||
}
|
||||
|
||||
if (hitEntity != nullptr)
|
||||
if (hitEntity != NULL)
|
||||
{
|
||||
delete res;
|
||||
res = new HitResult(hitEntity);
|
||||
}
|
||||
|
||||
if ( (res != nullptr) && (res->entity != nullptr) && res->entity->instanceof(eTYPE_PLAYER))
|
||||
if ( (res != NULL) && (res->entity != NULL) && res->entity->instanceof(eTYPE_PLAYER))
|
||||
{
|
||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(res->entity);
|
||||
// 4J: Check for owner being null
|
||||
if ( player->abilities.invulnerable || ((owner != nullptr) && (owner->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast<Player>(owner)->canHarmPlayer(player))))
|
||||
if ( player->abilities.invulnerable || ((owner != NULL) && (owner->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast<Player>(owner)->canHarmPlayer(player))))
|
||||
{
|
||||
res = nullptr;
|
||||
res = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (res != nullptr)
|
||||
if (res != NULL)
|
||||
{
|
||||
if (res->entity != nullptr)
|
||||
if (res->entity != NULL)
|
||||
{
|
||||
float pow = Mth::sqrt(xd * xd + yd * yd + zd * zd);
|
||||
int dmg = (int) Mth::ceil(static_cast<float>(pow * baseDamage));
|
||||
int dmg = (int) Mth::ceil((float)(pow * baseDamage));
|
||||
|
||||
if(isCritArrow()) dmg += random->nextInt(dmg / 2 + 2);
|
||||
|
||||
DamageSource *damageSource = nullptr;
|
||||
if (owner == nullptr)
|
||||
DamageSource *damageSource = NULL;
|
||||
if (owner == NULL)
|
||||
{
|
||||
damageSource = DamageSource::arrow(dynamic_pointer_cast<Arrow>(shared_from_this()), shared_from_this());
|
||||
}
|
||||
@@ -331,19 +331,19 @@ void Arrow::tick()
|
||||
}
|
||||
}
|
||||
|
||||
if (owner != nullptr)
|
||||
if (owner != NULL)
|
||||
{
|
||||
ThornsEnchantment::doThornsAfterAttack(owner, mob, random);
|
||||
}
|
||||
|
||||
if (owner != nullptr && res->entity != owner && owner->GetType() == eTYPE_SERVERPLAYER)
|
||||
if (owner != NULL && res->entity != owner && owner->GetType() == eTYPE_SERVERPLAYER)
|
||||
{
|
||||
dynamic_pointer_cast<ServerPlayer>(owner)->connection->send(std::make_shared<GameEventPacket>(GameEventPacket::SUCCESSFUL_BOW_HIT, 0));
|
||||
dynamic_pointer_cast<ServerPlayer>(owner)->connection->send( shared_ptr<GameEventPacket>( new GameEventPacket(GameEventPacket::SUCCESSFUL_BOW_HIT, 0)) );
|
||||
}
|
||||
}
|
||||
|
||||
// 4J : WESTY : For award, need to track if creeper was killed by arrow from the player.
|
||||
if (owner != nullptr && owner->instanceof(eTYPE_PLAYER) // arrow owner is a player
|
||||
if (owner != NULL && owner->instanceof(eTYPE_PLAYER) // arrow owner is a player
|
||||
&& !res->entity->isAlive() // target is now dead
|
||||
&& (res->entity->GetType() == eTYPE_CREEPER)) // target is a creeper
|
||||
|
||||
@@ -376,10 +376,10 @@ void Arrow::tick()
|
||||
zTile = res->z;
|
||||
lastTile = level->getTile(xTile, yTile, zTile);
|
||||
lastData = level->getData(xTile, yTile, zTile);
|
||||
xd = static_cast<float>(res->pos->x - x);
|
||||
yd = static_cast<float>(res->pos->y - y);
|
||||
zd = static_cast<float>(res->pos->z - z);
|
||||
float dd = static_cast<float>(sqrt(xd * xd + yd * yd + zd * zd));
|
||||
xd = (float) (res->pos->x - x);
|
||||
yd = (float) (res->pos->y - y);
|
||||
zd = (float) (res->pos->z - z);
|
||||
float dd = (float) sqrt(xd * xd + yd * yd + zd * zd);
|
||||
// 4J added check - zero dd here was creating NaNs
|
||||
if( dd > 0.0001f )
|
||||
{
|
||||
@@ -414,8 +414,8 @@ void Arrow::tick()
|
||||
z += zd;
|
||||
|
||||
double sd = sqrt(xd * xd + zd * zd);
|
||||
yRot = static_cast<float>(atan2(xd, zd) * 180 / PI);
|
||||
xRot = static_cast<float>(atan2(yd, sd) * 180 / PI);
|
||||
yRot = (float) (atan2(xd, zd) * 180 / PI);
|
||||
xRot = (float) (atan2(yd, sd) * 180 / PI);
|
||||
|
||||
while (xRot - xRotO < -180)
|
||||
xRotO -= 360;
|
||||
@@ -456,14 +456,14 @@ void Arrow::tick()
|
||||
|
||||
void Arrow::addAdditonalSaveData(CompoundTag *tag)
|
||||
{
|
||||
tag->putShort(L"xTile", static_cast<short>(xTile));
|
||||
tag->putShort(L"yTile", static_cast<short>(yTile));
|
||||
tag->putShort(L"zTile", static_cast<short>(zTile));
|
||||
tag->putByte(L"inTile", static_cast<byte>(lastTile));
|
||||
tag->putByte(L"inData", static_cast<byte>(lastData));
|
||||
tag->putByte(L"shake", static_cast<byte>(shakeTime));
|
||||
tag->putByte(L"inGround", static_cast<byte>(inGround ? 1 : 0));
|
||||
tag->putByte(L"pickup", static_cast<byte>(pickup));
|
||||
tag->putShort(L"xTile", (short) xTile);
|
||||
tag->putShort(L"yTile", (short) yTile);
|
||||
tag->putShort(L"zTile", (short) zTile);
|
||||
tag->putByte(L"inTile", (byte) lastTile);
|
||||
tag->putByte(L"inData", (byte) lastData);
|
||||
tag->putByte(L"shake", (byte) shakeTime);
|
||||
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0));
|
||||
tag->putByte(L"pickup", (byte) pickup);
|
||||
tag->putDouble(L"damage", baseDamage);
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ void Arrow::playerTouch(shared_ptr<Player> player)
|
||||
|
||||
if (pickup == PICKUP_ALLOWED)
|
||||
{
|
||||
if (!player->inventory->add(std::make_shared<ItemInstance>(Item::arrow, 1)))
|
||||
if (!player->inventory->add( shared_ptr<ItemInstance>( new ItemInstance(Item::arrow, 1) ) ))
|
||||
{
|
||||
bRemove = false;
|
||||
}
|
||||
@@ -548,11 +548,11 @@ void Arrow::setCritArrow(bool critArrow)
|
||||
byte flags = entityData->getByte(ID_FLAGS);
|
||||
if (critArrow)
|
||||
{
|
||||
entityData->set(ID_FLAGS, static_cast<byte>(flags | FLAG_CRIT));
|
||||
entityData->set(ID_FLAGS, (byte) (flags | FLAG_CRIT));
|
||||
}
|
||||
else
|
||||
{
|
||||
entityData->set(ID_FLAGS, static_cast<byte>(flags & ~FLAG_CRIT));
|
||||
entityData->set(ID_FLAGS, (byte) (flags & ~FLAG_CRIT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ AttributeModifier *AttributeModifier::setSerialize(bool serialize)
|
||||
bool AttributeModifier::equals(AttributeModifier *modifier)
|
||||
{
|
||||
if (this == modifier) return true;
|
||||
if (modifier == nullptr) return false; //|| getClass() != o.getClass()) return false;
|
||||
if (modifier == NULL) return false; //|| getClass() != o.getClass()) return false;
|
||||
|
||||
if (id != modifier->id) return false;
|
||||
|
||||
@@ -123,7 +123,7 @@ HtmlString AttributeModifier::getHoverText(eATTRIBUTE_ID attribute)
|
||||
}
|
||||
|
||||
wchar_t formatted[256];
|
||||
swprintf(formatted, 256, L"%ls%d%ls %ls", (amount > 0 ? L"+" : L"-"), static_cast<int>(displayAmount), (percentage ? L"%" : L""), app.GetString(Attribute::getName(attribute)));
|
||||
swprintf(formatted, 256, L"%ls%d%ls %ls", (amount > 0 ? L"+" : L"-"), (int) displayAmount, (percentage ? L"%" : L""), app.GetString(Attribute::getName(attribute)));
|
||||
|
||||
return HtmlString(formatted, color);
|
||||
}
|
||||
@@ -33,12 +33,12 @@ AvoidPlayerGoal::AvoidPlayerGoal(PathfinderMob *mob, const type_info& avoidType,
|
||||
entitySelector = new AvoidPlayerGoalEntitySelector(this);
|
||||
|
||||
toAvoid = weak_ptr<Entity>();
|
||||
path = nullptr;
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
AvoidPlayerGoal::~AvoidPlayerGoal()
|
||||
{
|
||||
if(path != nullptr) delete path;
|
||||
if(path != NULL) delete path;
|
||||
delete entitySelector;
|
||||
}
|
||||
|
||||
@@ -47,9 +47,9 @@ bool AvoidPlayerGoal::canUse()
|
||||
if (avoidType == typeid(Player))
|
||||
{
|
||||
shared_ptr<TamableAnimal> tamableAnimal = dynamic_pointer_cast<TamableAnimal>(mob->shared_from_this());
|
||||
if (tamableAnimal != nullptr && tamableAnimal->isTame()) return false;
|
||||
if (tamableAnimal != NULL && tamableAnimal->isTame()) return false;
|
||||
toAvoid = weak_ptr<Entity>(mob->level->getNearestPlayer(mob->shared_from_this(), maxDist));
|
||||
if (toAvoid.lock() == nullptr) return false;
|
||||
if (toAvoid.lock() == NULL) return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -64,24 +64,24 @@ bool AvoidPlayerGoal::canUse()
|
||||
}
|
||||
|
||||
Vec3 *pos = RandomPos::getPosAvoid(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 16, 7, Vec3::newTemp(toAvoid.lock()->x, toAvoid.lock()->y, toAvoid.lock()->z));
|
||||
if (pos == nullptr) return false;
|
||||
if (pos == NULL) return false;
|
||||
if (toAvoid.lock()->distanceToSqr(pos->x, pos->y, pos->z) < toAvoid.lock()->distanceToSqr(mob->shared_from_this())) return false;
|
||||
delete path;
|
||||
path = pathNav->createPath(pos->x, pos->y, pos->z);
|
||||
if (path == nullptr) return false;
|
||||
if (path == NULL) return false;
|
||||
if (!path->endsInXZ(pos)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AvoidPlayerGoal::canContinueToUse()
|
||||
{
|
||||
return toAvoid.lock() != nullptr && !pathNav->isDone();
|
||||
return toAvoid.lock() != NULL && !pathNav->isDone();
|
||||
}
|
||||
|
||||
void AvoidPlayerGoal::start()
|
||||
{
|
||||
pathNav->moveTo(path, walkSpeedModifier);
|
||||
path = nullptr;
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
void AvoidPlayerGoal::stop()
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
AwardStatPacket::AwardStatPacket()
|
||||
{
|
||||
this->m_paramData.data = nullptr;
|
||||
this->m_paramData.data = NULL;
|
||||
this->m_paramData.length = 0;
|
||||
}
|
||||
|
||||
@@ -28,17 +28,17 @@ AwardStatPacket::AwardStatPacket(int statId, byteArray paramData)
|
||||
|
||||
AwardStatPacket::~AwardStatPacket()
|
||||
{
|
||||
if (m_paramData.data != nullptr)
|
||||
if (m_paramData.data != NULL)
|
||||
{
|
||||
delete [] m_paramData.data;
|
||||
m_paramData.data = nullptr;
|
||||
m_paramData.data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void AwardStatPacket::handle(PacketListener *listener)
|
||||
{
|
||||
listener->handleAwardStat(shared_from_this());
|
||||
m_paramData.data = nullptr;
|
||||
m_paramData.data = NULL;
|
||||
}
|
||||
|
||||
void AwardStatPacket::read(DataInputStream *dis) //throws IOException
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
virtual int getEstimatedSize();
|
||||
virtual bool isAync();
|
||||
|
||||
static shared_ptr<Packet> create() { return std::make_shared<AwardStatPacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new AwardStatPacket()); }
|
||||
virtual int getId() { return 200; }
|
||||
|
||||
public:
|
||||
|
||||
@@ -24,7 +24,7 @@ AttributeInstance *BaseAttributeMap::getInstance(eATTRIBUTE_ID id)
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ void BaseAttributeMap::removeItemModifiers(shared_ptr<ItemInstance> item)
|
||||
AttributeInstance* attribute = getInstance(it.first);
|
||||
AttributeModifier* modifier = it.second;
|
||||
|
||||
if (attribute != nullptr)
|
||||
if (attribute != NULL)
|
||||
{
|
||||
attribute->removeModifier(modifier);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ void BaseAttributeMap::addItemModifiers(shared_ptr<ItemInstance> item)
|
||||
AttributeInstance* attribute = getInstance(it.first);
|
||||
AttributeModifier* modifier = it.second;
|
||||
|
||||
if (attribute != nullptr)
|
||||
if (attribute != NULL)
|
||||
{
|
||||
attribute->removeModifier(modifier);
|
||||
attribute->addModifier(new AttributeModifier(*modifier));
|
||||
|
||||
@@ -25,7 +25,7 @@ bool BaseEntityTile::triggerEvent(Level *level, int x, int y, int z, int b0, int
|
||||
{
|
||||
Tile::triggerEvent(level, x, y, z, b0, b1);
|
||||
shared_ptr<TileEntity> te = level->getTileEntity(x, y, z);
|
||||
if (te != nullptr)
|
||||
if (te != NULL)
|
||||
{
|
||||
return te->triggerEvent(b0, b1);
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
BaseMobSpawner::BaseMobSpawner()
|
||||
{
|
||||
spawnPotentials = nullptr;
|
||||
spawnPotentials = NULL;
|
||||
spawnDelay = 20;
|
||||
entityId = L"Pig";
|
||||
nextSpawnData = nullptr;
|
||||
nextSpawnData = NULL;
|
||||
spin = oSpin = 0.0;
|
||||
|
||||
minSpawnDelay = SharedConstants::TICKS_PER_SECOND * 10;
|
||||
@@ -37,7 +37,7 @@ BaseMobSpawner::~BaseMobSpawner()
|
||||
|
||||
wstring BaseMobSpawner::getEntityId()
|
||||
{
|
||||
if (getNextSpawnData() == nullptr)
|
||||
if (getNextSpawnData() == NULL)
|
||||
{
|
||||
if (entityId.compare(L"Minecart") == 0)
|
||||
{
|
||||
@@ -58,7 +58,7 @@ void BaseMobSpawner::setEntityId(const wstring &entityId)
|
||||
|
||||
bool BaseMobSpawner::isNearPlayer()
|
||||
{
|
||||
return getLevel()->getNearestPlayer(getX() + 0.5, getY() + 0.5, getZ() + 0.5, requiredPlayerRange) != nullptr;
|
||||
return getLevel()->getNearestPlayer(getX() + 0.5, getY() + 0.5, getZ() + 0.5, requiredPlayerRange) != NULL;
|
||||
}
|
||||
|
||||
void BaseMobSpawner::tick()
|
||||
@@ -78,7 +78,7 @@ void BaseMobSpawner::tick()
|
||||
|
||||
if (spawnDelay > 0) spawnDelay--;
|
||||
oSpin = spin;
|
||||
spin = static_cast<int>(spin + 1000 / (spawnDelay + 200.0f)) % 360;
|
||||
spin = (int)(spin + 1000 / (spawnDelay + 200.0f)) % 360;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -95,7 +95,7 @@ void BaseMobSpawner::tick()
|
||||
for (int c = 0; c < spawnCount; c++)
|
||||
{
|
||||
shared_ptr<Entity> entity = EntityIO::newEntity(getEntityId(), getLevel());
|
||||
if (entity == nullptr) return;
|
||||
if (entity == NULL) return;
|
||||
|
||||
int nearBy = getLevel()->getEntitiesOfClass( typeid(entity.get()), AABB::newTemp(getX(), getY(), getZ(), getX() + 1, getY() + 1, getZ() + 1)->grow(spawnRange * 2, 4, spawnRange * 2))->size();
|
||||
if (nearBy >= maxNearbyEntities)
|
||||
@@ -111,12 +111,12 @@ void BaseMobSpawner::tick()
|
||||
|
||||
entity->moveTo(xp, yp, zp, getLevel()->random->nextFloat() * 360, 0);
|
||||
|
||||
if (mob == nullptr || mob->canSpawn())
|
||||
if (mob == NULL || mob->canSpawn())
|
||||
{
|
||||
loadDataAndAddEntity(entity);
|
||||
getLevel()->levelEvent(LevelEvent::PARTICLES_MOBTILE_SPAWN, getX(), getY(), getZ(), 0);
|
||||
|
||||
if (mob != nullptr)
|
||||
if (mob != NULL)
|
||||
{
|
||||
mob->spawnAnim();
|
||||
}
|
||||
@@ -131,7 +131,7 @@ void BaseMobSpawner::tick()
|
||||
|
||||
shared_ptr<Entity> BaseMobSpawner::loadDataAndAddEntity(shared_ptr<Entity> entity)
|
||||
{
|
||||
if (getNextSpawnData() != nullptr)
|
||||
if (getNextSpawnData() != NULL)
|
||||
{
|
||||
CompoundTag *data = new CompoundTag();
|
||||
entity->save(data);
|
||||
@@ -147,7 +147,7 @@ shared_ptr<Entity> BaseMobSpawner::loadDataAndAddEntity(shared_ptr<Entity> entit
|
||||
}
|
||||
|
||||
entity->load(data);
|
||||
if (entity->level != nullptr) entity->level->addEntity(entity);
|
||||
if (entity->level != NULL) entity->level->addEntity(entity);
|
||||
|
||||
// add mounts
|
||||
shared_ptr<Entity> rider = entity;
|
||||
@@ -155,7 +155,7 @@ shared_ptr<Entity> BaseMobSpawner::loadDataAndAddEntity(shared_ptr<Entity> entit
|
||||
{
|
||||
CompoundTag *ridingTag = data->getCompound(Entity::RIDING_TAG);
|
||||
shared_ptr<Entity> mount = EntityIO::newEntity(ridingTag->getString(L"id"), entity->level);
|
||||
if (mount != nullptr)
|
||||
if (mount != NULL)
|
||||
{
|
||||
CompoundTag *mountData = new CompoundTag();
|
||||
mount->save(mountData);
|
||||
@@ -172,7 +172,7 @@ shared_ptr<Entity> BaseMobSpawner::loadDataAndAddEntity(shared_ptr<Entity> entit
|
||||
mount->load(mountData);
|
||||
mount->moveTo(rider->x, rider->y, rider->z, rider->yRot, rider->xRot);
|
||||
|
||||
if (entity->level != nullptr) entity->level->addEntity(mount);
|
||||
if (entity->level != NULL) entity->level->addEntity(mount);
|
||||
rider->ride(mount);
|
||||
}
|
||||
rider = mount;
|
||||
@@ -180,9 +180,9 @@ shared_ptr<Entity> BaseMobSpawner::loadDataAndAddEntity(shared_ptr<Entity> entit
|
||||
}
|
||||
|
||||
}
|
||||
else if (entity->instanceof(eTYPE_LIVINGENTITY) && entity->level != nullptr)
|
||||
else if (entity->instanceof(eTYPE_LIVINGENTITY) && entity->level != NULL)
|
||||
{
|
||||
dynamic_pointer_cast<Mob>( entity )->finalizeMobSpawn(nullptr);
|
||||
dynamic_pointer_cast<Mob>( entity )->finalizeMobSpawn(NULL);
|
||||
getLevel()->addEntity(entity);
|
||||
}
|
||||
|
||||
@@ -200,9 +200,9 @@ void BaseMobSpawner::delay()
|
||||
spawnDelay = minSpawnDelay + getLevel()->random->nextInt(maxSpawnDelay - minSpawnDelay);
|
||||
}
|
||||
|
||||
if ( (spawnPotentials != nullptr) && (spawnPotentials->size() > 0) )
|
||||
if ( (spawnPotentials != NULL) && (spawnPotentials->size() > 0) )
|
||||
{
|
||||
setNextSpawnData( static_cast<SpawnData *>(WeighedRandom::getRandomItem((Random *)getLevel()->random, (vector<WeighedRandomItem *> *)spawnPotentials)) );
|
||||
setNextSpawnData( (SpawnData*) WeighedRandom::getRandomItem((Random*)getLevel()->random, (vector<WeighedRandomItem*>*)spawnPotentials) );
|
||||
}
|
||||
|
||||
broadcastEvent(EVENT_SPAWN);
|
||||
@@ -225,7 +225,7 @@ void BaseMobSpawner::load(CompoundTag *tag)
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnPotentials = nullptr;
|
||||
spawnPotentials = NULL;
|
||||
}
|
||||
|
||||
if (tag->contains(L"SpawnData"))
|
||||
@@ -234,7 +234,7 @@ void BaseMobSpawner::load(CompoundTag *tag)
|
||||
}
|
||||
else
|
||||
{
|
||||
setNextSpawnData(nullptr);
|
||||
setNextSpawnData(NULL);
|
||||
}
|
||||
|
||||
if (tag->contains(L"MinSpawnDelay"))
|
||||
@@ -252,7 +252,7 @@ void BaseMobSpawner::load(CompoundTag *tag)
|
||||
|
||||
if (tag->contains(L"SpawnRange")) spawnRange = tag->getShort(L"SpawnRange");
|
||||
|
||||
if (getLevel() != nullptr && getLevel()->isClientSide)
|
||||
if (getLevel() != NULL && getLevel()->isClientSide)
|
||||
{
|
||||
displayEntity = nullptr;
|
||||
}
|
||||
@@ -261,20 +261,20 @@ void BaseMobSpawner::load(CompoundTag *tag)
|
||||
void BaseMobSpawner::save(CompoundTag *tag)
|
||||
{
|
||||
tag->putString(L"EntityId", getEntityId());
|
||||
tag->putShort(L"Delay", static_cast<short>(spawnDelay));
|
||||
tag->putShort(L"MinSpawnDelay", static_cast<short>(minSpawnDelay));
|
||||
tag->putShort(L"MaxSpawnDelay", static_cast<short>(maxSpawnDelay));
|
||||
tag->putShort(L"SpawnCount", static_cast<short>(spawnCount));
|
||||
tag->putShort(L"MaxNearbyEntities", static_cast<short>(maxNearbyEntities));
|
||||
tag->putShort(L"RequiredPlayerRange", static_cast<short>(requiredPlayerRange));
|
||||
tag->putShort(L"SpawnRange", static_cast<short>(spawnRange));
|
||||
tag->putShort(L"Delay", (short) spawnDelay);
|
||||
tag->putShort(L"MinSpawnDelay", (short) minSpawnDelay);
|
||||
tag->putShort(L"MaxSpawnDelay", (short) maxSpawnDelay);
|
||||
tag->putShort(L"SpawnCount", (short) spawnCount);
|
||||
tag->putShort(L"MaxNearbyEntities", (short) maxNearbyEntities);
|
||||
tag->putShort(L"RequiredPlayerRange", (short) requiredPlayerRange);
|
||||
tag->putShort(L"SpawnRange", (short) spawnRange);
|
||||
|
||||
if (getNextSpawnData() != nullptr)
|
||||
if (getNextSpawnData() != NULL)
|
||||
{
|
||||
tag->putCompound(L"SpawnData", static_cast<CompoundTag *>(getNextSpawnData()->tag->copy()));
|
||||
tag->putCompound(L"SpawnData", (CompoundTag *) getNextSpawnData()->tag->copy());
|
||||
}
|
||||
|
||||
if (getNextSpawnData() != nullptr || (spawnPotentials != nullptr && spawnPotentials->size() > 0))
|
||||
if (getNextSpawnData() != NULL || (spawnPotentials != NULL && spawnPotentials->size() > 0))
|
||||
{
|
||||
ListTag<CompoundTag> *list = new ListTag<CompoundTag>();
|
||||
|
||||
@@ -296,9 +296,9 @@ void BaseMobSpawner::save(CompoundTag *tag)
|
||||
|
||||
shared_ptr<Entity> BaseMobSpawner::getDisplayEntity()
|
||||
{
|
||||
if (displayEntity == nullptr)
|
||||
if (displayEntity == NULL)
|
||||
{
|
||||
shared_ptr<Entity> e = EntityIO::newEntity(getEntityId(), nullptr);
|
||||
shared_ptr<Entity> e = EntityIO::newEntity(getEntityId(), NULL);
|
||||
e = loadDataAndAddEntity(e);
|
||||
displayEntity = e;
|
||||
}
|
||||
@@ -333,7 +333,7 @@ BaseMobSpawner::SpawnData::SpawnData(CompoundTag *base) : WeighedRandomItem(base
|
||||
|
||||
if (_type.compare(L"Minecart") == 0)
|
||||
{
|
||||
if (tag != nullptr)
|
||||
if (tag != NULL)
|
||||
{
|
||||
switch (tag->getInt(L"Type"))
|
||||
{
|
||||
@@ -362,7 +362,7 @@ BaseMobSpawner::SpawnData::SpawnData(CompoundTag *tag, wstring _type) : WeighedR
|
||||
{
|
||||
if (_type.compare(L"Minecart") == 0)
|
||||
{
|
||||
if (tag != nullptr)
|
||||
if (tag != NULL)
|
||||
{
|
||||
switch (tag->getInt(L"Type"))
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ int BasePressurePlateTile::getTickDelay(Level *level)
|
||||
|
||||
AABB *BasePressurePlateTile::getAABB(Level *level, int x, int y, int z)
|
||||
{
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool BasePressurePlateTile::isSolidRender(bool isServerLevel)
|
||||
|
||||
@@ -19,7 +19,7 @@ BaseRailTile::Rail::Rail(Level *level, int x, int y, int z)
|
||||
if(m_bValidRail)
|
||||
{
|
||||
int direction = level->getData(x, y, z);
|
||||
if (static_cast<BaseRailTile *>(Tile::tiles[id])->usesDataBit)
|
||||
if (((BaseRailTile *) Tile::tiles[id])->usesDataBit)
|
||||
{
|
||||
usesDataBit = true;
|
||||
direction = direction & ~RAIL_DATA_BIT;
|
||||
@@ -34,7 +34,7 @@ BaseRailTile::Rail::Rail(Level *level, int x, int y, int z)
|
||||
|
||||
BaseRailTile::Rail::~Rail()
|
||||
{
|
||||
for( size_t i = 0; i < connections.size(); i++ )
|
||||
for( int i = 0; i < connections.size(); i++ )
|
||||
{
|
||||
delete connections[i];
|
||||
}
|
||||
@@ -44,7 +44,7 @@ void BaseRailTile::Rail::updateConnections(int direction)
|
||||
{
|
||||
if(m_bValidRail)
|
||||
{
|
||||
for( size_t i = 0; i < connections.size(); i++ )
|
||||
for( int i = 0; i < connections.size(); i++ )
|
||||
{
|
||||
delete connections[i];
|
||||
}
|
||||
@@ -102,7 +102,7 @@ void BaseRailTile::Rail::removeSoftConnections()
|
||||
for (unsigned int i = 0; i < connections.size(); i++)
|
||||
{
|
||||
Rail *rail = getRail(connections[i]);
|
||||
if (rail == nullptr || !rail->connectsTo(this))
|
||||
if (rail == NULL || !rail->connectsTo(this))
|
||||
{
|
||||
delete connections[i];
|
||||
connections.erase(connections.begin()+i);
|
||||
@@ -130,11 +130,11 @@ bool BaseRailTile::Rail::hasRail(int x, int y, int z)
|
||||
|
||||
BaseRailTile::Rail *BaseRailTile::Rail::getRail(TilePos *p)
|
||||
{
|
||||
if(!m_bValidRail) return nullptr;
|
||||
if(!m_bValidRail) return NULL;
|
||||
if (isRail(level, p->x, p->y, p->z)) return new Rail(level, p->x, p->y, p->z);
|
||||
if (isRail(level, p->x, p->y + 1, p->z)) return new Rail(level, p->x, p->y + 1, p->z);
|
||||
if (isRail(level, p->x, p->y - 1, p->z)) return new Rail(level, p->x, p->y - 1, p->z);
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ bool BaseRailTile::Rail::hasNeighborRail(int x, int y, int z)
|
||||
if(!m_bValidRail) return false;
|
||||
TilePos tp(x,y,z);
|
||||
Rail *neighbor = getRail( &tp );
|
||||
if (neighbor == nullptr) return false;
|
||||
if (neighbor == NULL) return false;
|
||||
neighbor->removeSoftConnections();
|
||||
bool retval = neighbor->canConnectTo(this);
|
||||
delete neighbor;
|
||||
@@ -331,7 +331,7 @@ void BaseRailTile::Rail::place(bool hasSignal, bool first)
|
||||
for ( auto& it : connections )
|
||||
{
|
||||
Rail *neighbor = getRail(it);
|
||||
if (neighbor == nullptr) continue;
|
||||
if (neighbor == NULL) continue;
|
||||
neighbor->removeSoftConnections();
|
||||
|
||||
if (neighbor->canConnectTo(this))
|
||||
@@ -359,7 +359,7 @@ BaseRailTile::BaseRailTile(int id, bool usesDataBit) : Tile(id, Material::decora
|
||||
this->usesDataBit = usesDataBit;
|
||||
setShape(0, 0, 0, 1, 2 / 16.0f, 1);
|
||||
|
||||
iconTurn = nullptr;
|
||||
iconTurn = NULL;
|
||||
}
|
||||
|
||||
bool BaseRailTile::isUsesDataBit()
|
||||
@@ -369,7 +369,7 @@ bool BaseRailTile::isUsesDataBit()
|
||||
|
||||
AABB *BaseRailTile::getAABB(Level *level, int x, int y, int z)
|
||||
{
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool BaseRailTile::blocksLight()
|
||||
|
||||
@@ -34,7 +34,7 @@ BasicTree::BasicTree(bool doUpdate) : Feature(doUpdate)
|
||||
trunkWidth = 1;
|
||||
heightVariance = 12;
|
||||
foliageHeight = 4;
|
||||
foliageCoords = nullptr;
|
||||
foliageCoords = NULL;
|
||||
foliageCoordsLength = 0;
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ void BasicTree::prepare()
|
||||
// Populate the list of foliage cluster locations.
|
||||
// Designed to be overridden in child classes to change basic
|
||||
// tree properties (trunk width, branch angle, foliage density, etc..).
|
||||
trunkHeight = static_cast<int>(height * trunkHeightScale);
|
||||
trunkHeight = (int) (height * trunkHeightScale);
|
||||
if (trunkHeight >= height) trunkHeight = height - 1;
|
||||
int clustersPerY = static_cast<int>(1.382 + pow(foliageDensity * height / 13.0, 2));
|
||||
int clustersPerY = (int) (1.382 + pow(foliageDensity * height / 13.0, 2));
|
||||
if (clustersPerY < 1) clustersPerY = 1;
|
||||
// The foliage coordinates are a list of [x,y,z,y of branch base] values for each cluster
|
||||
int **tempFoliageCoords = new int *[clustersPerY * height];
|
||||
@@ -100,7 +100,7 @@ void BasicTree::prepare()
|
||||
}
|
||||
else
|
||||
{
|
||||
checkBranchBase[1] = static_cast<int>(checkStart[1] - branchHeight);
|
||||
checkBranchBase[1] = (int) (checkStart[1] - branchHeight);
|
||||
}
|
||||
// Now check the branch path
|
||||
if (checkLine(checkBranchBase, checkStart) == -1)
|
||||
@@ -126,7 +126,7 @@ void BasicTree::prepare()
|
||||
for( int i = clusterCount; i < clustersPerY * height; i++ )
|
||||
{
|
||||
delete [] tempFoliageCoords[i];
|
||||
tempFoliageCoords[i] = nullptr;
|
||||
tempFoliageCoords[i] = NULL;
|
||||
}
|
||||
// 4J - original code for above is the following, it isn't obvious to me why it is doing a copy of the array, so let's not for now
|
||||
// foliageCoords = new int[clusterCount][4];
|
||||
@@ -147,7 +147,7 @@ void BasicTree::crossection(int x, int y, int z, float radius, byte direction, i
|
||||
// radius is the radius of the section from the center
|
||||
// direction is the direction the cross section is pointed, 0 for x, 1 for y, 2 for z
|
||||
// material is the index number for the material to use
|
||||
int rad = static_cast<int>(radius + 0.618);
|
||||
int rad = (int) (radius + 0.618);
|
||||
byte secidx1 = axisConversionArray[direction];
|
||||
byte secidx2 = axisConversionArray[direction + 3];
|
||||
int center[] = { x, y, z };
|
||||
@@ -197,15 +197,15 @@ float BasicTree::treeShape(int y)
|
||||
// This method is intended for overriding in child classes, allowing
|
||||
// different shaped trees.
|
||||
// This method should return a consistent value for each y (don't randomize).
|
||||
if (y < (static_cast<float>(height) * 0.3)) return (float) -1.618;
|
||||
float radius = static_cast<float>(height) / static_cast<float>(2.0);
|
||||
float adjacent = (static_cast<float>(height) / static_cast<float>(2.0)) - y;
|
||||
if (y < (((float) height) * 0.3)) return (float) -1.618;
|
||||
float radius = ((float) height) / ((float) 2.0);
|
||||
float adjacent = (((float) height) / ((float) 2.0)) - y;
|
||||
float distance;
|
||||
if (adjacent == 0) distance = radius;
|
||||
else if (abs(adjacent) >= radius) distance = static_cast<float>(0.0);
|
||||
else distance = static_cast<float>(sqrt(pow(abs(radius), 2) - pow(abs(adjacent), 2)));
|
||||
else if (abs(adjacent) >= radius) distance = (float) 0.0;
|
||||
else distance = (float) sqrt(pow(abs(radius), 2) - pow(abs(adjacent), 2));
|
||||
// Alter this factor to change the overall width of the tree.
|
||||
distance *= static_cast<float>(0.5);
|
||||
distance *= (float) 0.5;
|
||||
return distance;
|
||||
}
|
||||
|
||||
@@ -216,9 +216,9 @@ float BasicTree::foliageShape(int y)
|
||||
// Return a negative number if no foliage should be created at this level
|
||||
// this method is intended for overriding in child classes, allowing
|
||||
// foliage of different sizes and shapes.
|
||||
if ((y < 0) || (y >= foliageHeight)) return static_cast<float>(-1);
|
||||
else if ((y == 0) || (y == (foliageHeight - 1))) return static_cast<float>(2);
|
||||
else return static_cast<float>(3);
|
||||
if ((y < 0) || (y >= foliageHeight)) return (float) -1;
|
||||
else if ((y == 0) || (y == (foliageHeight - 1))) return (float) 2;
|
||||
else return (float) 3;
|
||||
}
|
||||
|
||||
void BasicTree::foliageCluster(int x, int y, int z)
|
||||
@@ -270,8 +270,8 @@ void BasicTree::limb(int *start, int *end, int material)
|
||||
if (delta[primidx] > 0) primsign = 1;
|
||||
else primsign = -1;
|
||||
// Initilize the per-step movement for the non-primary axies.
|
||||
double secfac1 = static_cast<double>(delta[secidx1]) / static_cast<double>(delta[primidx]);
|
||||
double secfac2 = static_cast<double>(delta[secidx2]) / static_cast<double>(delta[primidx]);
|
||||
double secfac1 = ((double) delta[secidx1]) / ((double) delta[primidx]);
|
||||
double secfac2 = ((double) delta[secidx2]) / ((double) delta[primidx]);
|
||||
// Initialize the coordinates.
|
||||
int coordinate[] = { 0, 0, 0 };
|
||||
// Loop through each crossection along the primary axis, from start to end
|
||||
@@ -411,8 +411,8 @@ int BasicTree::checkLine(int *start, int *end)
|
||||
if (delta[primidx] > 0) primsign = 1;
|
||||
else primsign = -1;
|
||||
// Initilize the per-step movement for the non-primary axies.
|
||||
double secfac1 = static_cast<double>(delta[secidx1]) / static_cast<double>(delta[primidx]);
|
||||
double secfac2 = static_cast<double>(delta[secidx2]) / static_cast<double>(delta[primidx]);
|
||||
double secfac1 = ((double) delta[secidx1]) / ((double) delta[primidx]);
|
||||
double secfac2 = ((double) delta[secidx2]) / ((double) delta[primidx]);
|
||||
// Initialize the coordinates.
|
||||
int coordinate[] = { 0, 0, 0 };
|
||||
// Loop through each crossection along the primary axis, from start to end
|
||||
@@ -460,7 +460,7 @@ bool BasicTree::checkLocation()
|
||||
int endPosition[] = { origin[0], origin[1] + height - 1, origin[2] };
|
||||
|
||||
// 4J Stu Added to stop tree features generating areas previously place by game rule generation
|
||||
if(app.getLevelGenerationOptions() != nullptr)
|
||||
if(app.getLevelGenerationOptions() != NULL)
|
||||
{
|
||||
LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions();
|
||||
bool intersects = levelGenOptions->checkIntersects(startPosition[0], startPosition[1], startPosition[2], endPosition[0], endPosition[1], endPosition[2]);
|
||||
@@ -507,7 +507,7 @@ void BasicTree::init(double heightInit, double widthInit, double foliageDensityI
|
||||
//
|
||||
// Note, you can call "place" without calling "init".
|
||||
// This is the same as calling init(1.0,1.0,1.0) and then calling place.
|
||||
heightVariance = static_cast<int>(heightInit * 12);
|
||||
heightVariance = (int) (heightInit * 12);
|
||||
if (heightInit > 0.5) foliageHeight = 5;
|
||||
widthScale = widthInit;
|
||||
foliageDensity = foliageDensityInit;
|
||||
|
||||
@@ -18,5 +18,5 @@ const double Double::MIN_NORMAL = DBL_MIN;
|
||||
|
||||
int Integer::parseInt(wstring &str, int radix /* = 10*/)
|
||||
{
|
||||
return wcstol( str.c_str(), nullptr, radix );
|
||||
return wcstol( str.c_str(), NULL, radix );
|
||||
}
|
||||
@@ -15,7 +15,7 @@ Bat::Bat(Level *level) : AmbientCreature(level)
|
||||
registerAttributes();
|
||||
setHealth(getMaxHealth());
|
||||
|
||||
targetPosition = nullptr;
|
||||
targetPosition = NULL;
|
||||
|
||||
setSize(.5f, .9f);
|
||||
setResting(true);
|
||||
@@ -90,11 +90,11 @@ void Bat::setResting(bool value)
|
||||
char current = entityData->getByte(DATA_ID_FLAGS);
|
||||
if (value)
|
||||
{
|
||||
entityData->set(DATA_ID_FLAGS, static_cast<char>(current | FLAG_RESTING));
|
||||
entityData->set(DATA_ID_FLAGS, (char) (current | FLAG_RESTING));
|
||||
}
|
||||
else
|
||||
{
|
||||
entityData->set(DATA_ID_FLAGS, static_cast<char>(current & ~FLAG_RESTING));
|
||||
entityData->set(DATA_ID_FLAGS, (char) (current & ~FLAG_RESTING));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,10 +128,10 @@ void Bat::newServerAiStep()
|
||||
|
||||
if (isResting())
|
||||
{
|
||||
if (!level->isSolidBlockingTile(Mth::floor(x), static_cast<int>(y) + 1, Mth::floor(z)))
|
||||
if (!level->isSolidBlockingTile(Mth::floor(x), (int) y + 1, Mth::floor(z)))
|
||||
{
|
||||
setResting(false);
|
||||
level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, static_cast<int>(x), static_cast<int>(y), static_cast<int>(z), 0);
|
||||
level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, (int) x, (int) y, (int) z, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -141,25 +141,25 @@ void Bat::newServerAiStep()
|
||||
yHeadRot = random->nextInt(360);
|
||||
}
|
||||
|
||||
if (level->getNearestPlayer(shared_from_this(), 4.0f) != nullptr)
|
||||
if (level->getNearestPlayer(shared_from_this(), 4.0f) != NULL)
|
||||
{
|
||||
setResting(false);
|
||||
level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, static_cast<int>(x), static_cast<int>(y), static_cast<int>(z), 0);
|
||||
level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, (int) x, (int) y, (int) z, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (targetPosition != nullptr && (!level->isEmptyTile(targetPosition->x, targetPosition->y, targetPosition->z) || targetPosition->y < 1))
|
||||
if (targetPosition != NULL && (!level->isEmptyTile(targetPosition->x, targetPosition->y, targetPosition->z) || targetPosition->y < 1))
|
||||
{
|
||||
delete targetPosition;
|
||||
targetPosition = nullptr;
|
||||
targetPosition = NULL;
|
||||
}
|
||||
if (targetPosition == nullptr || random->nextInt(30) == 0 || targetPosition->distSqr(static_cast<int>(x), static_cast<int>(y), static_cast<int>(z)) < 4)
|
||||
if (targetPosition == NULL || random->nextInt(30) == 0 || targetPosition->distSqr((int) x, (int) y, (int) z) < 4)
|
||||
{
|
||||
delete targetPosition;
|
||||
targetPosition = new Pos(static_cast<int>(x) + random->nextInt(7) - random->nextInt(7), static_cast<int>(y) + random->nextInt(6) - 2, static_cast<int>(z) + random->nextInt(7) - random->nextInt(7));
|
||||
targetPosition = new Pos((int) x + random->nextInt(7) - random->nextInt(7), (int) y + random->nextInt(6) - 2, (int) z + random->nextInt(7) - random->nextInt(7));
|
||||
}
|
||||
|
||||
double dx = (targetPosition->x + .5) - x;
|
||||
@@ -170,12 +170,12 @@ void Bat::newServerAiStep()
|
||||
yd = yd + (signum(dy) * .7f - yd) * .1f;
|
||||
zd = zd + (signum(dz) * .5f - zd) * .1f;
|
||||
|
||||
float yRotD = static_cast<float>(atan2(zd, xd) * 180 / PI) - 90;
|
||||
float yRotD = (float) (atan2(zd, xd) * 180 / PI) - 90;
|
||||
float rotDiff = Mth::wrapDegrees(yRotD - yRot);
|
||||
yya = .5f;
|
||||
yRot += rotDiff;
|
||||
|
||||
if (random->nextInt(100) == 0 && level->isSolidBlockingTile(Mth::floor(x), static_cast<int>(y) + 1, Mth::floor(z)))
|
||||
if (random->nextInt(100) == 0 && level->isSolidBlockingTile(Mth::floor(x), (int) y + 1, Mth::floor(z)))
|
||||
{
|
||||
setResting(true);
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ BeachBiome::BeachBiome(int id) : Biome(id)
|
||||
// remove default mob spawn settings
|
||||
friendlies.clear();
|
||||
friendlies_chicken.clear(); // 4J added
|
||||
topMaterial = static_cast<byte>(Tile::sand_Id);
|
||||
material = static_cast<byte>(Tile::sand_Id);
|
||||
topMaterial = (byte) Tile::sand_Id;
|
||||
material = (byte) Tile::sand_Id;
|
||||
|
||||
decorator->treeCount = -999;
|
||||
decorator->deadBushCount = 0;
|
||||
|
||||
@@ -60,7 +60,7 @@ shared_ptr<ItemInstance> BeaconMenu::quickMoveStack(shared_ptr<Player> player, i
|
||||
{
|
||||
shared_ptr<ItemInstance> clicked = nullptr;
|
||||
Slot *slot = slots.at(slotIndex);
|
||||
if (slot != nullptr && slot->hasItem())
|
||||
if (slot != NULL && slot->hasItem())
|
||||
{
|
||||
shared_ptr<ItemInstance> stack = slot->getItem();
|
||||
clicked = stack->copy();
|
||||
@@ -127,7 +127,7 @@ BeaconMenu::PaymentSlot::PaymentSlot(shared_ptr<Container> container, int slot,
|
||||
|
||||
bool BeaconMenu::PaymentSlot::mayPlace(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
if (item != nullptr)
|
||||
if (item != NULL)
|
||||
{
|
||||
return (item->id == Item::emerald_Id || item->id == Item::diamond_Id || item->id == Item::goldIngot_Id || item->id == Item::ironIngot_Id);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ BeaconTile::BeaconTile(int id) : BaseEntityTile(id, Material::glass, isSolidRend
|
||||
|
||||
shared_ptr<TileEntity> BeaconTile::newTileEntity(Level *level)
|
||||
{
|
||||
return std::make_shared<BeaconTileEntity>();
|
||||
return shared_ptr<BeaconTileEntity>( new 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)
|
||||
@@ -19,7 +19,7 @@ bool BeaconTile::use(Level *level, int x, int y, int z, shared_ptr<Player> playe
|
||||
if (level->isClientSide) return true;
|
||||
|
||||
shared_ptr<BeaconTileEntity> beacon = dynamic_pointer_cast<BeaconTileEntity>( level->getTileEntity(x, y, z) );
|
||||
if (beacon != nullptr) player->openBeacon(beacon);
|
||||
if (beacon != NULL) player->openBeacon(beacon);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
shared_ptr<TileEntity> BeaconTileEntity::clone()
|
||||
{
|
||||
shared_ptr<BeaconTileEntity> result = std::make_shared<BeaconTileEntity>();
|
||||
shared_ptr<BeaconTileEntity> result = shared_ptr<BeaconTileEntity>( new BeaconTileEntity() );
|
||||
TileEntity::clone(result);
|
||||
|
||||
result->primaryPower = primaryPower;
|
||||
@@ -28,7 +28,7 @@ void BeaconTileEntity::staticCtor()
|
||||
{
|
||||
for(unsigned int effect = 0; effect < BEACON_EFFECTS_EFFECTS; ++effect)
|
||||
{
|
||||
BEACON_EFFECTS[tier][effect] = nullptr;
|
||||
BEACON_EFFECTS[tier][effect] = NULL;
|
||||
}
|
||||
}
|
||||
BEACON_EFFECTS[0][0] = MobEffect::movementSpeed;
|
||||
@@ -163,18 +163,18 @@ float BeaconTileEntity::getAndUpdateClientSideScale()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int renderDelta = static_cast<int>(level->getGameTime() - clientSideRenderTick);
|
||||
int renderDelta = (int) (level->getGameTime() - clientSideRenderTick);
|
||||
clientSideRenderTick = level->getGameTime();
|
||||
if (renderDelta > 1)
|
||||
{
|
||||
clientSideRenderScale -= (static_cast<float>(renderDelta) / static_cast<float>(SCALE_TIME));
|
||||
clientSideRenderScale -= ((float) renderDelta / (float) SCALE_TIME);
|
||||
|
||||
if (clientSideRenderScale < 0)
|
||||
{
|
||||
clientSideRenderScale = 0;
|
||||
}
|
||||
}
|
||||
clientSideRenderScale += (1.0f / static_cast<float>(SCALE_TIME));
|
||||
clientSideRenderScale += (1.0f / (float) SCALE_TIME);
|
||||
if (clientSideRenderScale > 1)
|
||||
{
|
||||
clientSideRenderScale = 1;
|
||||
@@ -213,7 +213,7 @@ void BeaconTileEntity::setPrimaryPower(int primaryPower)
|
||||
for(unsigned int e = 0; e < BEACON_EFFECTS_EFFECTS; ++e)
|
||||
{
|
||||
MobEffect *effect = BEACON_EFFECTS[tier][e];
|
||||
if(effect == nullptr) break;
|
||||
if(effect == NULL) break;
|
||||
|
||||
if (effect->id == primaryPower)
|
||||
{
|
||||
@@ -236,7 +236,7 @@ void BeaconTileEntity::setSecondaryPower(int secondaryPower)
|
||||
for(unsigned int e = 0; e < BEACON_EFFECTS_EFFECTS; ++e)
|
||||
{
|
||||
MobEffect *effect = BEACON_EFFECTS[tier][e];
|
||||
if(effect == nullptr) break;
|
||||
if(effect == NULL) break;
|
||||
|
||||
if (effect->id == secondaryPower)
|
||||
{
|
||||
@@ -252,7 +252,7 @@ shared_ptr<Packet> BeaconTileEntity::getUpdatePacket()
|
||||
{
|
||||
CompoundTag *tag = new CompoundTag();
|
||||
save(tag);
|
||||
return std::make_shared<TileEntityDataPacket>(x, y, z, TileEntityDataPacket::TYPE_BEACON, tag);
|
||||
return shared_ptr<TileEntityDataPacket>( new TileEntityDataPacket(x, y, z, TileEntityDataPacket::TYPE_BEACON, tag) );
|
||||
}
|
||||
|
||||
double BeaconTileEntity::getViewDistance()
|
||||
@@ -295,7 +295,7 @@ shared_ptr<ItemInstance> BeaconTileEntity::getItem(unsigned int slot)
|
||||
|
||||
shared_ptr<ItemInstance> BeaconTileEntity::removeItem(unsigned int slot, int count)
|
||||
{
|
||||
if (slot == 0 && paymentItem != nullptr)
|
||||
if (slot == 0 && paymentItem != NULL)
|
||||
{
|
||||
if (count >= paymentItem->count)
|
||||
{
|
||||
@@ -306,7 +306,7 @@ shared_ptr<ItemInstance> BeaconTileEntity::removeItem(unsigned int slot, int cou
|
||||
else
|
||||
{
|
||||
paymentItem->count -= count;
|
||||
return std::make_shared<ItemInstance>(paymentItem->id, count, paymentItem->getAuxValue());
|
||||
return shared_ptr<ItemInstance>( new ItemInstance(paymentItem->id, count, paymentItem->getAuxValue()) );
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
@@ -314,7 +314,7 @@ shared_ptr<ItemInstance> BeaconTileEntity::removeItem(unsigned int slot, int cou
|
||||
|
||||
shared_ptr<ItemInstance> BeaconTileEntity::removeItemNoUpdate(int slot)
|
||||
{
|
||||
if (slot == 0 && paymentItem != nullptr)
|
||||
if (slot == 0 && paymentItem != NULL)
|
||||
{
|
||||
shared_ptr<ItemInstance> returnItem = paymentItem;
|
||||
paymentItem = nullptr;
|
||||
|
||||
@@ -24,7 +24,7 @@ bool BedItem::useOn(shared_ptr<ItemInstance> itemInstance, shared_ptr<Player> pl
|
||||
// place on top of tile
|
||||
y = y + 1;
|
||||
|
||||
BedTile *tile = static_cast<BedTile *>(Tile::bed);
|
||||
BedTile *tile = (BedTile *) Tile::bed;
|
||||
|
||||
int dir = ( Mth::floor(player->yRot * 4 / (360) + 0.5f) ) & 3;
|
||||
int xra = 0;
|
||||
|
||||
@@ -16,9 +16,9 @@ BedTile::BedTile(int id) : DirectionalTile(id, Material::cloth, isSolidRender())
|
||||
{
|
||||
setShape();
|
||||
|
||||
iconEnd = nullptr;
|
||||
iconSide = nullptr;
|
||||
iconTop = nullptr;
|
||||
iconEnd = NULL;
|
||||
iconSide = NULL;
|
||||
iconTop = NULL;
|
||||
}
|
||||
|
||||
// 4J Added override
|
||||
@@ -120,7 +120,7 @@ bool BedTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player,
|
||||
}
|
||||
}
|
||||
|
||||
if (sleepingPlayer == nullptr)
|
||||
if (sleepingPlayer == NULL)
|
||||
{
|
||||
setOccupied(level, x, y, z, false);
|
||||
}
|
||||
@@ -309,7 +309,7 @@ Pos *BedTile::findStandUpPosition(Level *level, int x, int y, int z, int skipCou
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void BedTile::spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonus)
|
||||
|
||||
@@ -20,14 +20,14 @@ BegGoal::BegGoal(Wolf *wolf, float lookDistance)
|
||||
bool BegGoal::canUse()
|
||||
{
|
||||
player = weak_ptr<Player>(level->getNearestPlayer(wolf->shared_from_this(), lookDistance));
|
||||
if (player.lock() == nullptr) return false;
|
||||
if (player.lock() == NULL) return false;
|
||||
wolf->setDespawnProtected();
|
||||
return playerHoldingInteresting(player.lock());
|
||||
}
|
||||
|
||||
bool BegGoal::canContinueToUse()
|
||||
{
|
||||
if (player.lock() == nullptr || !player.lock()->isAlive()) return false;
|
||||
if (player.lock() == NULL || !player.lock()->isAlive()) return false;
|
||||
if (wolf->distanceToSqr(player.lock()) > lookDistance * lookDistance) return false;
|
||||
wolf->setDespawnProtected();
|
||||
return lookTime > 0 && playerHoldingInteresting(player.lock());
|
||||
@@ -54,7 +54,7 @@ void BegGoal::tick()
|
||||
bool BegGoal::playerHoldingInteresting(shared_ptr<Player> player)
|
||||
{
|
||||
shared_ptr<ItemInstance> item = player->inventory->getSelected();
|
||||
if (item == nullptr) return false;
|
||||
if (item == NULL) return false;
|
||||
if (!wolf->isTame() && item->id == Item::bone_Id) return true;
|
||||
return wolf->isFood(item);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ Node *BinaryHeap::pop()
|
||||
{
|
||||
Node *popped = heap[0];
|
||||
heap[0] = heap[--sizeVar];
|
||||
heap[sizeVar] = nullptr;
|
||||
heap[sizeVar] = NULL;
|
||||
if (sizeVar > 0) downHeap(0);
|
||||
popped->heapIdx=-1;
|
||||
return popped;
|
||||
@@ -68,7 +68,7 @@ void BinaryHeap::remove(Node *node)
|
||||
{
|
||||
// This is what node.heapIdx is for.
|
||||
heap[node->heapIdx] = heap[--sizeVar];
|
||||
heap[sizeVar] = nullptr;
|
||||
heap[sizeVar] = NULL;
|
||||
if (sizeVar > node->heapIdx)
|
||||
{
|
||||
if (heap[node->heapIdx]->f < node->f)
|
||||
@@ -145,7 +145,7 @@ void BinaryHeap::downHeap(int idx)
|
||||
if (rightIdx >= sizeVar)
|
||||
{
|
||||
// Only need to compare with left.
|
||||
rightNode = nullptr;
|
||||
rightNode = NULL;
|
||||
rightCost = Float::POSITIVE_INFINITY;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -13,34 +13,34 @@
|
||||
//public static final Biome[] biomes = new Biome[256];
|
||||
Biome *Biome::biomes[256];
|
||||
|
||||
Biome *Biome::ocean = nullptr;
|
||||
Biome *Biome::plains = nullptr;
|
||||
Biome *Biome::desert = nullptr;
|
||||
Biome *Biome::ocean = NULL;
|
||||
Biome *Biome::plains = NULL;
|
||||
Biome *Biome::desert = NULL;
|
||||
|
||||
Biome *Biome::extremeHills = nullptr;
|
||||
Biome *Biome::forest = nullptr;
|
||||
Biome *Biome::taiga = nullptr;
|
||||
Biome *Biome::extremeHills = NULL;
|
||||
Biome *Biome::forest = NULL;
|
||||
Biome *Biome::taiga = NULL;
|
||||
|
||||
Biome *Biome::swampland = nullptr;
|
||||
Biome *Biome::river = nullptr;
|
||||
Biome *Biome::swampland = NULL;
|
||||
Biome *Biome::river = NULL;
|
||||
|
||||
Biome *Biome::hell = nullptr;
|
||||
Biome *Biome::sky = nullptr;
|
||||
Biome *Biome::hell = NULL;
|
||||
Biome *Biome::sky = NULL;
|
||||
|
||||
Biome *Biome::frozenOcean = nullptr;
|
||||
Biome *Biome::frozenRiver = nullptr;
|
||||
Biome *Biome::iceFlats = nullptr;
|
||||
Biome *Biome::iceMountains = nullptr;
|
||||
Biome *Biome::mushroomIsland = nullptr;
|
||||
Biome *Biome::mushroomIslandShore = nullptr;
|
||||
Biome *Biome::beaches = nullptr;
|
||||
Biome *Biome::desertHills = nullptr;
|
||||
Biome *Biome::forestHills = nullptr;
|
||||
Biome *Biome::taigaHills = nullptr;
|
||||
Biome *Biome::smallerExtremeHills = nullptr;
|
||||
Biome *Biome::frozenOcean = NULL;
|
||||
Biome *Biome::frozenRiver = NULL;
|
||||
Biome *Biome::iceFlats = NULL;
|
||||
Biome *Biome::iceMountains = NULL;
|
||||
Biome *Biome::mushroomIsland = NULL;
|
||||
Biome *Biome::mushroomIslandShore = NULL;
|
||||
Biome *Biome::beaches = NULL;
|
||||
Biome *Biome::desertHills = NULL;
|
||||
Biome *Biome::forestHills = NULL;
|
||||
Biome *Biome::taigaHills = NULL;
|
||||
Biome *Biome::smallerExtremeHills = NULL;
|
||||
|
||||
Biome *Biome::jungle = nullptr;
|
||||
Biome *Biome::jungleHills = nullptr;
|
||||
Biome *Biome::jungle = NULL;
|
||||
Biome *Biome::jungleHills = NULL;
|
||||
|
||||
|
||||
void Biome::staticCtor()
|
||||
@@ -86,8 +86,8 @@ Biome::Biome(int id) : id(id)
|
||||
color = 0;
|
||||
// snowCovered = false; // 4J - this isn't set by the java game any more so removing to save confusion
|
||||
|
||||
topMaterial = static_cast<byte>(Tile::grass_Id);
|
||||
material = static_cast<byte>(Tile::dirt_Id);
|
||||
topMaterial = (byte) Tile::grass_Id;
|
||||
material = (byte) Tile::dirt_Id;
|
||||
leafColor = 0x4EE031;
|
||||
_hasRain = true;
|
||||
depth = 0.1f;
|
||||
@@ -95,7 +95,7 @@ Biome::Biome(int id) : id(id)
|
||||
temperature = 0.5f;
|
||||
downfall = 0.5f;
|
||||
//waterColor = 0xffffff; // 4J Stu - Not used
|
||||
decorator = nullptr;
|
||||
decorator = NULL;
|
||||
|
||||
m_grassColor = eMinecraftColour_NOT_SET;
|
||||
m_foliageColor = eMinecraftColour_NOT_SET;
|
||||
@@ -132,7 +132,7 @@ Biome::Biome(int id) : id(id)
|
||||
|
||||
Biome::~Biome()
|
||||
{
|
||||
if(decorator != nullptr) delete decorator;
|
||||
if(decorator != NULL) delete decorator;
|
||||
}
|
||||
|
||||
BiomeDecorator *Biome::createDecorator()
|
||||
@@ -228,7 +228,7 @@ vector<Biome::MobSpawnerData *> *Biome::getMobs(MobCategory *category)
|
||||
if (category == MobCategory::creature_wolf) return &friendlies_wolf;
|
||||
if (category == MobCategory::creature_mushroomcow) return &friendlies_mushroomcow;
|
||||
if (category == MobCategory::ambient) return &ambientFriendlies;
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Biome::hasSnow()
|
||||
@@ -261,12 +261,12 @@ float Biome::getCreatureProbability()
|
||||
|
||||
int Biome::getDownfallInt()
|
||||
{
|
||||
return static_cast<int>(downfall * 65536);
|
||||
return (int) (downfall * 65536);
|
||||
}
|
||||
|
||||
int Biome::getTemperatureInt()
|
||||
{
|
||||
return static_cast<int>(temperature * 65536);
|
||||
return (int) (temperature * 65536);
|
||||
}
|
||||
|
||||
// 4J - brought forward from 1.2.3
|
||||
|
||||
@@ -10,7 +10,7 @@ BiomeCache::Block::Block(int x, int z, BiomeCache *parent)
|
||||
// temps = floatArray(ZONE_SIZE * ZONE_SIZE, false); // MGH - added "no clear" flag to arrayWithLength
|
||||
// downfall = floatArray(ZONE_SIZE * ZONE_SIZE, false);
|
||||
// biomes = BiomeArray(ZONE_SIZE * ZONE_SIZE, false);
|
||||
biomeIndices = byteArray(static_cast<unsigned int>(ZONE_SIZE * ZONE_SIZE), false);
|
||||
biomeIndices = byteArray(ZONE_SIZE * ZONE_SIZE, false);
|
||||
|
||||
lastUse = 0;
|
||||
this->x = x;
|
||||
@@ -34,7 +34,7 @@ Biome *BiomeCache::Block::getBiome(int x, int z)
|
||||
{
|
||||
// return biomes[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)];
|
||||
|
||||
const int biomeIndex = biomeIndices[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)];
|
||||
int biomeIndex = biomeIndices[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)];
|
||||
return Biome::biomes[biomeIndex];
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ float BiomeCache::Block::getTemperature(int x, int z)
|
||||
{
|
||||
// return temps[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)];
|
||||
|
||||
const int biomeIndex = biomeIndices[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)];
|
||||
int biomeIndex = biomeIndices[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)];
|
||||
return Biome::biomes[biomeIndex]->getTemperature();
|
||||
|
||||
}
|
||||
@@ -51,7 +51,7 @@ float BiomeCache::Block::getDownfall(int x, int z)
|
||||
{
|
||||
// return downfall[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)];
|
||||
|
||||
const int biomeIndex = biomeIndices[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)];
|
||||
int biomeIndex = biomeIndices[(x & ZONE_SIZE_MASK) | ((z & ZONE_SIZE_MASK) << ZONE_SIZE_BITS)];
|
||||
return Biome::biomes[biomeIndex]->getDownfall();
|
||||
|
||||
}
|
||||
@@ -72,7 +72,7 @@ BiomeCache::~BiomeCache()
|
||||
// 4J Stu - Delete source?
|
||||
// delete source;
|
||||
|
||||
for(const auto& it : all )
|
||||
for( auto& it : all )
|
||||
{
|
||||
delete it;
|
||||
}
|
||||
@@ -85,9 +85,9 @@ BiomeCache::Block *BiomeCache::getBlockAt(int x, int z)
|
||||
EnterCriticalSection(&m_CS);
|
||||
x >>= ZONE_SIZE_BITS;
|
||||
z >>= ZONE_SIZE_BITS;
|
||||
const int64_t slot = (static_cast<int64_t>(x) & 0xffffffffl) | ((static_cast<int64_t>(z) & 0xffffffffl) << 32l);
|
||||
const auto it = cached.find(slot);
|
||||
Block *block = nullptr;
|
||||
int64_t slot = (((int64_t) x) & 0xffffffffl) | ((((int64_t) z) & 0xffffffffl) << 32l);
|
||||
auto it = cached.find(slot);
|
||||
Block *block = NULL;
|
||||
if (it == cached.end())
|
||||
{
|
||||
MemSect(48);
|
||||
@@ -124,20 +124,20 @@ float BiomeCache::getDownfall(int x, int z)
|
||||
void BiomeCache::update()
|
||||
{
|
||||
EnterCriticalSection(&m_CS);
|
||||
const int64_t now = app.getAppTime();
|
||||
const int64_t utime = now - lastUpdateTime;
|
||||
int64_t now = app.getAppTime();
|
||||
int64_t utime = now - lastUpdateTime;
|
||||
if (utime > DECAY_TIME / 4 || utime < 0)
|
||||
{
|
||||
lastUpdateTime = now;
|
||||
|
||||
for (auto it = all.begin(); it != all.end();)
|
||||
{
|
||||
const Block *block = *it;
|
||||
const int64_t time = now - block->lastUse;
|
||||
Block *block = *it;
|
||||
int64_t time = now - block->lastUse;
|
||||
if (time > DECAY_TIME || time < 0)
|
||||
{
|
||||
it = all.erase(it);
|
||||
int64_t slot = (static_cast<int64_t>(block->x) & 0xffffffffl) | ((static_cast<int64_t>(block->z) & 0xffffffffl) << 32l);
|
||||
int64_t slot = (((int64_t) block->x) & 0xffffffffl) | ((((int64_t) block->z) & 0xffffffffl) << 32l);
|
||||
cached.erase(slot);
|
||||
delete block;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ BiomeDecorator::BiomeDecorator(Biome *biome)
|
||||
_init();
|
||||
|
||||
// 4J inits
|
||||
level = nullptr;
|
||||
random = nullptr;
|
||||
level = NULL;
|
||||
random = NULL;
|
||||
xo = 0;
|
||||
zo = 0;
|
||||
|
||||
@@ -19,7 +19,7 @@ BiomeDecorator::BiomeDecorator(Biome *biome)
|
||||
|
||||
void BiomeDecorator::decorate(Level *level, Random *random, int xo, int zo)
|
||||
{
|
||||
if (this->level != nullptr)
|
||||
if (this->level != NULL)
|
||||
{
|
||||
app.DebugPrintf("BiomeDecorator::decorate - Already decorating!!\n");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
@@ -34,8 +34,8 @@ void BiomeDecorator::decorate(Level *level, Random *random, int xo, int zo)
|
||||
|
||||
decorate();
|
||||
|
||||
this->level = nullptr;
|
||||
this->random = nullptr;
|
||||
this->level = NULL;
|
||||
this->random = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ void BiomeDecorator::decorate()
|
||||
|
||||
// 4J Stu - For some reason this was created each time round in the loop
|
||||
// I assume there is a case where deadBushCount could be 0
|
||||
DeadBushFeature *deadBushFeature = nullptr;
|
||||
DeadBushFeature *deadBushFeature = NULL;
|
||||
if(deadBushCount > 0) deadBushFeature = new DeadBushFeature(Tile::deadBush_Id);
|
||||
for (int i = 0; i < deadBushCount; i++)
|
||||
{
|
||||
@@ -174,7 +174,7 @@ void BiomeDecorator::decorate()
|
||||
//new DeadBushFeature(Tile::deadBush_Id)->place(level, random, x, y, z);
|
||||
deadBushFeature->place(level, random, x, y, z);
|
||||
}
|
||||
if(deadBushFeature != nullptr)delete deadBushFeature;
|
||||
if(deadBushFeature != NULL)delete deadBushFeature;
|
||||
|
||||
for (int i = 0; i < waterlilyCount; i++)
|
||||
{
|
||||
|
||||
@@ -11,14 +11,14 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup)
|
||||
|
||||
#ifdef _UNICODE
|
||||
wstring path = L"GAME:\\GameRules\\biomemap.bin";
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#else
|
||||
#ifdef _WINDOWS64
|
||||
string path = "GameRules\\biomemap.bin";
|
||||
#else
|
||||
string path = "GAME:\\GameRules\\biomemap.bin";
|
||||
#endif
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#endif
|
||||
if( file == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
@@ -35,14 +35,14 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup)
|
||||
__debugbreak(); // TODO
|
||||
DWORD bytesRead,dwFileSize = 0;
|
||||
#else
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr);
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,NULL);
|
||||
#endif
|
||||
if(dwFileSize > m_biomeOverride.length)
|
||||
{
|
||||
app.DebugPrintf("Biomemap binary is too large!!\n");
|
||||
__debugbreak();
|
||||
}
|
||||
BOOL bSuccess = ReadFile(file,m_biomeOverride.data,dwFileSize,&bytesRead,nullptr);
|
||||
BOOL bSuccess = ReadFile(file,m_biomeOverride.data,dwFileSize,&bytesRead,NULL);
|
||||
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
|
||||
@@ -87,17 +87,17 @@ floatArray BiomeSource::getDownfallBlock(int x, int z, int w, int h) const
|
||||
void BiomeSource::getDownfallBlock(floatArray &downfalls, int x, int z, int w, int h) const
|
||||
{
|
||||
IntCache::releaseAll();
|
||||
//if (downfalls == nullptr || downfalls->length < w * h)
|
||||
if (downfalls.data == nullptr || downfalls.length < w * h)
|
||||
//if (downfalls == NULL || downfalls->length < w * h)
|
||||
if (downfalls.data == NULL || downfalls.length < w * h)
|
||||
{
|
||||
if(downfalls.data != nullptr) delete [] downfalls.data;
|
||||
if(downfalls.data != NULL) delete [] downfalls.data;
|
||||
downfalls = floatArray(w * h);
|
||||
}
|
||||
|
||||
intArray result = zoomedLayer->getArea(x, z, w, h);
|
||||
for (int i = 0; i < w * h; i++)
|
||||
{
|
||||
float d = static_cast<float>(Biome::biomes[result[i]]->getDownfallInt()) / 65536.0f;
|
||||
float d = (float) Biome::biomes[result[i]]->getDownfallInt() / 65536.0f;
|
||||
if (d > 1) d = 1;
|
||||
downfalls[i] = d;
|
||||
}
|
||||
@@ -132,16 +132,16 @@ void BiomeSource::getTemperatureBlock(floatArray& temperatures, int x, int z, in
|
||||
{
|
||||
IntCache::releaseAll();
|
||||
//if (temperatures == null || temperatures.length < w * h) {
|
||||
if (temperatures.data == nullptr || temperatures.length < w * h)
|
||||
if (temperatures.data == NULL || temperatures.length < w * h)
|
||||
{
|
||||
if( temperatures.data != nullptr ) delete [] temperatures.data;
|
||||
if( temperatures.data != NULL ) delete [] temperatures.data;
|
||||
temperatures = floatArray(w * h);
|
||||
}
|
||||
|
||||
intArray result = zoomedLayer->getArea(x, z, w, h);
|
||||
for (int i = 0; i < w * h; i++)
|
||||
{
|
||||
float t = static_cast<float>(Biome::biomes[result[i]]->getTemperatureInt()) / 65536.0f;
|
||||
float t = (float) Biome::biomes[result[i]]->getTemperatureInt() / 65536.0f;
|
||||
if (t > 1) t = 1;
|
||||
temperatures[i] = t;
|
||||
}
|
||||
@@ -170,9 +170,9 @@ void BiomeSource::getRawBiomeBlock(BiomeArray &biomes, int x, int z, int w, int
|
||||
{
|
||||
IntCache::releaseAll();
|
||||
//if (biomes == null || biomes.length < w * h)
|
||||
if (biomes.data == nullptr || biomes.length < w * h)
|
||||
if (biomes.data == NULL || biomes.length < w * h)
|
||||
{
|
||||
if(biomes.data != nullptr) delete [] biomes.data;
|
||||
if(biomes.data != NULL) delete [] biomes.data;
|
||||
biomes = BiomeArray(w * h);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ void BiomeSource::getRawBiomeBlock(BiomeArray &biomes, int x, int z, int w, int
|
||||
{
|
||||
biomes[i] = Biome::biomes[result[i]];
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
if(biomes[i] == nullptr)
|
||||
if(biomes[i] == NULL)
|
||||
{
|
||||
app.DebugPrintf("Tried to assign null biome %d\n", result[i]);
|
||||
__debugbreak();
|
||||
@@ -208,9 +208,9 @@ void BiomeSource::getBiomeBlock(BiomeArray& biomes, int x, int z, int w, int h,
|
||||
{
|
||||
IntCache::releaseAll();
|
||||
//if (biomes == null || biomes.length < w * h)
|
||||
if (biomes.data == nullptr || biomes.length < w * h)
|
||||
if (biomes.data == NULL || biomes.length < w * h)
|
||||
{
|
||||
if(biomes.data != nullptr) delete [] biomes.data;
|
||||
if(biomes.data != NULL) delete [] biomes.data;
|
||||
biomes = BiomeArray(w * h);
|
||||
}
|
||||
|
||||
@@ -248,9 +248,9 @@ void BiomeSource::getBiomeIndexBlock(byteArray& biomeIndices, int x, int z, int
|
||||
{
|
||||
IntCache::releaseAll();
|
||||
//if (biomes == null || biomes.length < w * h)
|
||||
if (biomeIndices.data == nullptr || biomeIndices.length < w * h)
|
||||
if (biomeIndices.data == NULL || biomeIndices.length < w * h)
|
||||
{
|
||||
if(biomeIndices.data != nullptr) delete [] biomeIndices.data;
|
||||
if(biomeIndices.data != NULL) delete [] biomeIndices.data;
|
||||
biomeIndices = byteArray(w * h);
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ void BiomeSource::getBiomeIndexBlock(byteArray& biomeIndices, int x, int z, int
|
||||
intArray result = zoomedLayer->getArea(x, z, w, h);
|
||||
for (int i = 0; i < w * h; i++)
|
||||
{
|
||||
biomeIndices[i] = static_cast<byte>(result[i]);
|
||||
biomeIndices[i] = (byte)result[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, Biome *toFind, Random *rand
|
||||
int w = x1 - x0 + 1;
|
||||
int h = z1 - z0 + 1;
|
||||
intArray biomes = layer->getArea(x0, z0, w, h);
|
||||
TilePos *res = nullptr;
|
||||
TilePos *res = NULL;
|
||||
int found = 0;
|
||||
int biomesCount = w*h;
|
||||
for (unsigned int i = 0; i < biomesCount; i++)
|
||||
@@ -351,7 +351,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, Biome *toFind, Random *rand
|
||||
Biome *b = Biome::biomes[biomes[i]];
|
||||
if (b == toFind)
|
||||
{
|
||||
if (res == nullptr || random->nextInt(found + 1) == 0)
|
||||
if (res == NULL || random->nextInt(found + 1) == 0)
|
||||
{
|
||||
res = new TilePos(xx, 0, zz);
|
||||
found++;
|
||||
@@ -380,7 +380,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, vector<Biome *> allowed, Ra
|
||||
int h = z1 - z0 + 1;
|
||||
MemSect(50);
|
||||
intArray biomes = layer->getArea(x0, z0, w, h);
|
||||
TilePos *res = nullptr;
|
||||
TilePos *res = NULL;
|
||||
int found = 0;
|
||||
for (unsigned int i = 0; i < w * h; i++)
|
||||
{
|
||||
@@ -389,7 +389,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, vector<Biome *> allowed, Ra
|
||||
Biome *b = Biome::biomes[biomes[i]];
|
||||
if (find(allowed.begin(), allowed.end(), b) != allowed.end())
|
||||
{
|
||||
if (res == nullptr || random->nextInt(found + 1) == 0)
|
||||
if (res == NULL || random->nextInt(found + 1) == 0)
|
||||
{
|
||||
delete res;
|
||||
res = new TilePos(xx, 0, zz);
|
||||
@@ -553,7 +553,7 @@ void BiomeSource::getFracs(intArray indices, float *fracs)
|
||||
|
||||
for( int i = 0; i < Biome::BIOME_COUNT; i++ )
|
||||
{
|
||||
fracs[i] /= static_cast<float>(indices.length);
|
||||
fracs[i] /= (float)(indices.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ bool BirchFeature::place(Level *level, Random *random, int x, int y, int z)
|
||||
if ((belowTile != Tile::grass_Id && belowTile != Tile::dirt_Id) || y >= Level::maxBuildHeight - treeHeight - 1) return false;
|
||||
|
||||
// 4J Stu Added to stop tree features generating areas previously place by game rule generation
|
||||
if(app.getLevelGenerationOptions() != nullptr)
|
||||
if(app.getLevelGenerationOptions() != NULL)
|
||||
{
|
||||
LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions();
|
||||
int radius = 3;
|
||||
|
||||
@@ -42,7 +42,7 @@ void Blaze::defineSynchedData()
|
||||
{
|
||||
Monster::defineSynchedData();
|
||||
|
||||
entityData->define(DATA_FLAGS_ID, static_cast<byte>(0));
|
||||
entityData->define(DATA_FLAGS_ID, (byte) 0);
|
||||
}
|
||||
|
||||
int Blaze::getAmbientSound()
|
||||
@@ -84,10 +84,10 @@ void Blaze::aiStep()
|
||||
if (nextHeightOffsetChangeTick <= 0)
|
||||
{
|
||||
nextHeightOffsetChangeTick = SharedConstants::TICKS_PER_SECOND * 5;
|
||||
allowedHeightOffset = .5f + static_cast<float>(random->nextGaussian()) * 3;
|
||||
allowedHeightOffset = .5f + (float) random->nextGaussian() * 3;
|
||||
}
|
||||
|
||||
if (getAttackTarget() != nullptr && (getAttackTarget()->y + getAttackTarget()->getHeadHeight()) > (y + getHeadHeight() + allowedHeightOffset))
|
||||
if (getAttackTarget() != NULL && (getAttackTarget()->y + getAttackTarget()->getHeadHeight()) > (y + getHeadHeight() + allowedHeightOffset))
|
||||
{
|
||||
yd = yd + (.3f - yd) * .3f;
|
||||
}
|
||||
@@ -149,10 +149,10 @@ void Blaze::checkHurtTarget(shared_ptr<Entity> target, float d)
|
||||
{
|
||||
float sqd = sqrt(d) * .5f;
|
||||
|
||||
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, (int) x, (int) y, (int) z, 0);
|
||||
// level.playSound(this, "mob.ghast.fireball", getSoundVolume(), (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f);
|
||||
for (int i = 0; i < 1; i++) {
|
||||
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);
|
||||
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) );
|
||||
// Vec3 v = getViewVector(1);
|
||||
// ie.x = x + v.x * 1.5;
|
||||
ie->y = y + bbHeight / 2 + 0.5f;
|
||||
@@ -162,7 +162,7 @@ void Blaze::checkHurtTarget(shared_ptr<Entity> target, float d)
|
||||
}
|
||||
|
||||
}
|
||||
yRot = static_cast<float>(atan2(zd, xd) * 180 / PI) - 90;
|
||||
yRot = (float) (atan2(zd, xd) * 180 / PI) - 90;
|
||||
|
||||
holdGround = true;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ public:
|
||||
virtual int getEstimatedSize();
|
||||
|
||||
public:
|
||||
static shared_ptr<Packet> create() { return std::make_shared<BlockRegionUpdatePacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new BlockRegionUpdatePacket()); }
|
||||
virtual int getId() { return 51; }
|
||||
};
|
||||
|
||||
@@ -8,8 +8,8 @@ void BlockReplacements::staticCtor()
|
||||
{
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
byte b = static_cast<byte>(i);
|
||||
if (b != 0 && Tile::tiles[b & 0xff] == nullptr)
|
||||
byte b = (byte) i;
|
||||
if (b != 0 && Tile::tiles[b & 0xff] == NULL)
|
||||
{
|
||||
b = 0;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ bool Boat::isPushable()
|
||||
Boat::Boat(Level *level, double x, double y, double z) : Entity( level )
|
||||
{
|
||||
_init();
|
||||
setPos(x, y + heightOffset, z);
|
||||
setPos(x, y + heightOffset + 0.1, z);
|
||||
|
||||
xd = 0;
|
||||
yd = 0;
|
||||
@@ -97,7 +97,7 @@ bool Boat::hurt(DamageSource *source, float hurtDamage)
|
||||
|
||||
// 4J-JEV: Fix for #88212,
|
||||
// Untrusted players shouldn't be able to damage minecarts or boats.
|
||||
if (dynamic_cast<EntityDamageSource *>(source) != nullptr)
|
||||
if (dynamic_cast<EntityDamageSource *>(source) != NULL)
|
||||
{
|
||||
shared_ptr<Entity> attacker = source->getDirectEntity();
|
||||
|
||||
@@ -113,18 +113,18 @@ bool Boat::hurt(DamageSource *source, float hurtDamage)
|
||||
// 4J Stu - If someone is riding in this, then it can tick multiple times which causes the damage to
|
||||
// decrease too quickly. So just make the damage a bit higher to start with for similar behaviour
|
||||
// to an unridden one. Only do this change if the riding player is attacking it.
|
||||
if( rider.lock() != nullptr && rider.lock() == source->getEntity() ) hurtDamage += 1;
|
||||
if( rider.lock() != NULL && rider.lock() == source->getEntity() ) hurtDamage += 1;
|
||||
|
||||
setDamage(getDamage() + hurtDamage * 10);
|
||||
markHurt();
|
||||
|
||||
// 4J Stu - Brought froward from 12w36 to fix #46611 - TU5: Gameplay: Minecarts and boat requires more hits than one to be destroyed in creative mode
|
||||
// 4J-PB - Fix for XB1 #175735 - [CRASH] [Multi-Plat]: Code: Gameplay: Placing a boat on harmful surfaces causes the game to crash
|
||||
bool creativePlayer = (source->getEntity() != nullptr) && source->getEntity()->instanceof(eTYPE_PLAYER) && dynamic_pointer_cast<Player>(source->getEntity())->abilities.instabuild;
|
||||
bool creativePlayer = (source->getEntity() != NULL) && source->getEntity()->instanceof(eTYPE_PLAYER) && dynamic_pointer_cast<Player>(source->getEntity())->abilities.instabuild;
|
||||
|
||||
if (creativePlayer || getDamage() > 20 * 2)
|
||||
{
|
||||
if (rider.lock() != nullptr) rider.lock()->ride( shared_from_this() );
|
||||
if (rider.lock() != NULL) rider.lock()->ride( shared_from_this() );
|
||||
if (!creativePlayer) spawnAtLocation(Item::boat_Id, 1, 0);
|
||||
remove();
|
||||
}
|
||||
@@ -209,30 +209,9 @@ void Boat::tick()
|
||||
}
|
||||
|
||||
double lastSpeed = sqrt(xd * xd + zd * zd);
|
||||
if (lastSpeed > MAX_COLLISION_SPEED)
|
||||
if (lastSpeed > MAX_COLLISION_SPEED && waterPercentage > 1)
|
||||
{
|
||||
double xa = cos(yRot * PI / 180);
|
||||
double za = sin(yRot * PI / 180);
|
||||
|
||||
for (int i = 0; i < 1 + lastSpeed * 60; i++)
|
||||
{
|
||||
|
||||
double side = (random->nextFloat() * 2 - 1);
|
||||
|
||||
double side2 = (random->nextInt(2) * 2 - 1) * 0.7;
|
||||
if (random->nextBoolean())
|
||||
{
|
||||
double xx = x - xa * side * 0.8 + za * side2;
|
||||
double zz = z - za * side * 0.8 - xa * side2;
|
||||
level->addParticle(eParticleType_splash, xx, y - 2 / 16.0f, zz, +xd, yd, +zd);
|
||||
}
|
||||
else
|
||||
{
|
||||
double xx = x + xa + za * side * 0.7;
|
||||
double zz = z + za - xa * side * 0.7;
|
||||
level->addParticle(eParticleType_splash, xx, y - 2 / 16.0f, zz, +xd, yd, +zd);
|
||||
}
|
||||
}
|
||||
createSplash(lastSpeed);
|
||||
}
|
||||
|
||||
if (level->isClientSide && doLerp)
|
||||
@@ -254,7 +233,6 @@ void Boat::tick()
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 1
|
||||
// Original
|
||||
//double xt = x + xd;
|
||||
//double yt = y + yd;
|
||||
@@ -273,52 +251,24 @@ void Boat::tick()
|
||||
xd *= 0.99f;
|
||||
yd *= 0.95f;
|
||||
zd *= 0.99f;
|
||||
#else
|
||||
// 4J Stu - Fix for #8280 - Gameplay : Boats behave erratically when exited next to land.
|
||||
// The client shouldn't change the position of the boat
|
||||
double xt = x;// + xd;
|
||||
double yt = y + yd;
|
||||
double zt = z;// + zd;
|
||||
this->setPos(xt, yt, zt);
|
||||
|
||||
// 4J Stu - Fix for #9579 - GAMEPLAY: Boats with a player in them slowly sink under the water over time, and with no player in them they float into the sky.
|
||||
// Just make the boats bob up and down rather than any other client-side movement when not receiving packets from server
|
||||
if (waterPercentage > 0)
|
||||
{
|
||||
double bob = waterPercentage * 2 - 1;
|
||||
yd += 0.04f * bob;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yd < 0) yd /= 2;
|
||||
yd += 0.007f;
|
||||
}
|
||||
//if (onGround)
|
||||
//{
|
||||
xd *= 0.5f;
|
||||
yd *= 0.5f;
|
||||
zd *= 0.5f;
|
||||
//}
|
||||
//xd *= 0.99f;
|
||||
//yd *= 0.95f;
|
||||
//zd *= 0.99f;
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Bob on water
|
||||
if (waterPercentage > 0)
|
||||
{
|
||||
double bob = waterPercentage * 2 - 1;
|
||||
yd += 0.04f * bob;
|
||||
}
|
||||
else
|
||||
{
|
||||
yd = 0;
|
||||
|
||||
// Reimplement "gravity"
|
||||
if (level->getTile(x, Mth::floor(y - 0.15), z) == 0 && !onGround) {
|
||||
yd += 0.04f * -1.0; // -1.0 is what bob should return in this situation, just hardcoded.
|
||||
}
|
||||
|
||||
|
||||
if ( rider.lock() != nullptr && rider.lock()->instanceof(eTYPE_LIVINGENTITY) )
|
||||
// Rider Controls
|
||||
if ( rider.lock() != NULL && rider.lock()->instanceof(eTYPE_LIVINGENTITY) )
|
||||
{
|
||||
shared_ptr<LivingEntity> livingRider = dynamic_pointer_cast<LivingEntity>(rider.lock());
|
||||
double forward = livingRider->yya;
|
||||
@@ -334,6 +284,7 @@ void Boat::tick()
|
||||
|
||||
double curSpeed = sqrt(xd * xd + zd * zd);
|
||||
|
||||
// Speed Clamp
|
||||
if (curSpeed > MAX_SPEED)
|
||||
{
|
||||
double ratio = MAX_SPEED / curSpeed;
|
||||
@@ -354,14 +305,15 @@ void Boat::tick()
|
||||
if (acceleration < MIN_ACCELERATION) acceleration = MIN_ACCELERATION;
|
||||
}
|
||||
|
||||
// Slow speed on ground
|
||||
if (onGround)
|
||||
{
|
||||
xd *= 0.5f;
|
||||
yd *= 0.5f;
|
||||
zd *= 0.5f;
|
||||
}
|
||||
move(xd, yd, zd);
|
||||
|
||||
// Break boat
|
||||
if ((horizontalCollision && lastSpeed > 0.20))
|
||||
{
|
||||
if (!level->isClientSide && !removed)
|
||||
@@ -401,6 +353,7 @@ void Boat::tick()
|
||||
yRot += (float) rotDiff;
|
||||
setRot(yRot, xRot);
|
||||
|
||||
// Server only code below
|
||||
if(level->isClientSide) return;
|
||||
|
||||
vector<shared_ptr<Entity> > *entities = level->getEntities(shared_from_this(), bb->grow(0.2f, 0, 0.2f));
|
||||
@@ -438,19 +391,43 @@ void Boat::tick()
|
||||
|
||||
}
|
||||
|
||||
if (rider.lock() != nullptr)
|
||||
if (rider.lock() != NULL)
|
||||
{
|
||||
if (rider.lock()->removed) rider = weak_ptr<Entity>();
|
||||
}
|
||||
}
|
||||
|
||||
void Boat::createSplash(double particleStrengh) {
|
||||
double xa = cos(yRot * PI / 180);
|
||||
double za = sin(yRot * PI / 180);
|
||||
|
||||
for (int i = 0; i < 1 + particleStrengh * 60; i++)
|
||||
{
|
||||
double side = (random->nextFloat() * 2 - 1);
|
||||
|
||||
double side2 = (random->nextInt(2) * 2 - 1) * 0.7;
|
||||
if (random->nextBoolean())
|
||||
{
|
||||
double xx = x - xa * side * 0.8 + za * side2;
|
||||
double zz = z - za * side * 0.8 - xa * side2;
|
||||
level->addParticle(eParticleType_splash, xx, y - 2 / 16.0f, zz, +xd, yd, +zd);
|
||||
}
|
||||
else
|
||||
{
|
||||
double xx = x + xa + za * side * 0.7;
|
||||
double zz = z + za - xa * side * 0.7;
|
||||
level->addParticle(eParticleType_splash, xx, y - 2 / 16.0f, zz, +xd, yd, +zd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Boat::positionRider()
|
||||
{
|
||||
if (rider.lock() == nullptr) return;
|
||||
if (rider.lock() == NULL) return;
|
||||
|
||||
double xa = cos(yRot * PI / 180) * 0.4;
|
||||
double za = sin(yRot * PI / 180) * 0.4;
|
||||
rider.lock()->setPos(x + xa, y + getRideHeight() + rider.lock()->getRidingHeight(), z + za);
|
||||
rider.lock()->setPos(x + xa, y + getRideHeight() + rider.lock()->getRidingHeight()-0.5, z + za);
|
||||
}
|
||||
|
||||
|
||||
@@ -475,7 +452,7 @@ wstring Boat::getName()
|
||||
|
||||
bool Boat::interact(shared_ptr<Player> player)
|
||||
{
|
||||
if ( (rider.lock() != nullptr) && rider.lock()->instanceof(eTYPE_PLAYER) && (rider.lock() != player) ) return true;
|
||||
if ( (rider.lock() != NULL) && rider.lock()->instanceof(eTYPE_PLAYER) && (rider.lock() != player) ) return true;
|
||||
if (!level->isClientSide)
|
||||
{
|
||||
// 4J HEG - Fixed issue with player not being able to dismount boat (issue #4446)
|
||||
|
||||
@@ -39,7 +39,7 @@ bool BoatItem::TestUse(shared_ptr<ItemInstance> itemInstance, Level *level, shar
|
||||
double range = 5;
|
||||
Vec3 *to = from->add(xa * range, ya * range, za * range);
|
||||
HitResult *hr = level->clip(from, to, true);
|
||||
if (hr == nullptr) return false;
|
||||
if (hr == NULL) return false;
|
||||
|
||||
if (hr->type == HitResult::TILE)
|
||||
{
|
||||
@@ -74,7 +74,7 @@ shared_ptr<ItemInstance> BoatItem::use(shared_ptr<ItemInstance> itemInstance, Le
|
||||
double range = 5;
|
||||
Vec3 *to = from->add(xa * range, ya * range, za * range);
|
||||
HitResult *hr = level->clip(from, to, true);
|
||||
if (hr == nullptr) return itemInstance;
|
||||
if (hr == NULL) return itemInstance;
|
||||
|
||||
// check entity collision
|
||||
Vec3 *b = player->getViewVector(a);
|
||||
@@ -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->countInstanceOf(eTYPE_BOAT, true) < Level::MAX_XBOX_BOATS ) // 4J - added limit
|
||||
{
|
||||
shared_ptr<Boat> boat = std::make_shared<Boat>(level, xt + 0.5f, yt + 1.0f, zt + 0.5f);
|
||||
shared_ptr<Boat> boat = shared_ptr<Boat>( new 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;
|
||||
if (!level->getCubes(boat, boat->bb->grow(-.1, -.1, -.1))->empty())
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z,
|
||||
{
|
||||
level->setTileAndData(x2, y2, z2, Tile::chest_Id, 0, Tile::UPDATE_CLIENTS);
|
||||
shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x2, y2, z2));
|
||||
if (chest != nullptr)
|
||||
if (chest != NULL)
|
||||
{
|
||||
WeighedTreasure::addChestItems(random, treasureList, chest, numRolls);
|
||||
chest->isBonusChest = true; // 4J added
|
||||
|
||||
@@ -18,7 +18,7 @@ Icon *BottleItem::getIcon(int auxValue)
|
||||
shared_ptr<ItemInstance> BottleItem::use(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player)
|
||||
{
|
||||
HitResult *hr = getPlayerPOVHitResult(level, player, true);
|
||||
if (hr == nullptr) return itemInstance;
|
||||
if (hr == NULL) return itemInstance;
|
||||
|
||||
if (hr->type == HitResult::TILE)
|
||||
{
|
||||
@@ -40,13 +40,13 @@ shared_ptr<ItemInstance> BottleItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||
itemInstance->count--;
|
||||
if (itemInstance->count <= 0)
|
||||
{
|
||||
return std::make_shared<ItemInstance>(static_cast<Item *>(Item::potion));
|
||||
return shared_ptr<ItemInstance>( new ItemInstance( (Item *)Item::potion) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!player->inventory->add(std::make_shared<ItemInstance>(static_cast<Item *>(Item::potion))))
|
||||
if (!player->inventory->add(shared_ptr<ItemInstance>( new ItemInstance( (Item *)Item::potion) )))
|
||||
{
|
||||
player->drop(std::make_shared<ItemInstance>(Item::potion_Id, 1, 0));
|
||||
player->drop( shared_ptr<ItemInstance>( new ItemInstance(Item::potion_Id, 1, 0) ));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ shared_ptr<ItemInstance> BottleItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||
bool BottleItem::TestUse(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player)
|
||||
{
|
||||
HitResult *hr = getPlayerPOVHitResult(level, player, true);
|
||||
if (hr == nullptr) return false;
|
||||
if (hr == NULL) return false;
|
||||
|
||||
if (hr->type == HitResult::TILE)
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@ BoundingBox *BoundingBox::getIntersection(BoundingBox *other)
|
||||
{
|
||||
if (!intersects(other))
|
||||
{
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
BoundingBox *result = new BoundingBox();
|
||||
result->x0 = Math::_max(x0, other->x0);
|
||||
|
||||
@@ -15,7 +15,7 @@ BowItem::BowItem(int id) : Item( id )
|
||||
maxStackSize = 1;
|
||||
setMaxDamage(384);
|
||||
|
||||
icons = nullptr;
|
||||
icons = NULL;
|
||||
}
|
||||
|
||||
void BowItem::releaseUsing(shared_ptr<ItemInstance> itemInstance, Level *level, shared_ptr<Player> player, int durationLeft)
|
||||
@@ -25,17 +25,17 @@ void BowItem::releaseUsing(shared_ptr<ItemInstance> itemInstance, Level *level,
|
||||
if (infiniteArrows || player->inventory->hasResource(Item::arrow_Id))
|
||||
{
|
||||
int timeHeld = getUseDuration(itemInstance) - durationLeft;
|
||||
float pow = timeHeld / static_cast<float>(MAX_DRAW_DURATION);
|
||||
float pow = timeHeld / (float) MAX_DRAW_DURATION;
|
||||
pow = ((pow * pow) + pow * 2) / 3;
|
||||
if (pow < 0.1) return;
|
||||
if (pow > 1) pow = 1;
|
||||
|
||||
shared_ptr<Arrow> arrow = std::make_shared<Arrow>(level, player, pow * 2.0f);
|
||||
shared_ptr<Arrow> arrow = shared_ptr<Arrow>( new Arrow(level, player, pow * 2.0f) );
|
||||
if (pow == 1) arrow->setCritArrow(true);
|
||||
int damageBonus = EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowBonus->id, itemInstance);
|
||||
if (damageBonus > 0)
|
||||
{
|
||||
arrow->setBaseDamage(arrow->getBaseDamage() + static_cast<double>(damageBonus) * .5 + .5);
|
||||
arrow->setBaseDamage(arrow->getBaseDamage() + (double) damageBonus * .5 + .5);
|
||||
}
|
||||
int knockbackBonus = EnchantmentHelper::getEnchantmentLevel(Enchantment::arrowKnockback->id, itemInstance);
|
||||
if (knockbackBonus > 0)
|
||||
|
||||
@@ -12,5 +12,5 @@ shared_ptr<ItemInstance> BowlFoodItem::useTimeDepleted(shared_ptr<ItemInstance>
|
||||
{
|
||||
FoodItem::useTimeDepleted(instance, level, player);
|
||||
|
||||
return std::make_shared<ItemInstance>(Item::bowl);
|
||||
return shared_ptr<ItemInstance>(new ItemInstance(Item::bowl));
|
||||
}
|
||||
@@ -47,7 +47,7 @@ void BreakDoorGoal::tick()
|
||||
|
||||
breakTime++;
|
||||
|
||||
int progress = static_cast<int>(breakTime / (float)DOOR_BREAK_TIME * 10);
|
||||
int progress = (int) (breakTime / (float) DOOR_BREAK_TIME * 10);
|
||||
if (progress != lastBreakProgress)
|
||||
{
|
||||
mob->level->destroyTileProgress(mob->entityId, doorX, doorY, doorZ, progress);
|
||||
|
||||
@@ -25,12 +25,12 @@ bool BreedGoal::canUse()
|
||||
{
|
||||
if (!animal->isInLove()) return false;
|
||||
partner = weak_ptr<Animal>(getFreePartner());
|
||||
return partner.lock() != nullptr;
|
||||
return partner.lock() != NULL;
|
||||
}
|
||||
|
||||
bool BreedGoal::canContinueToUse()
|
||||
{
|
||||
return partner.lock() != nullptr && partner.lock()->isAlive() && partner.lock()->isInLove() && loveTime < 20 * 3;
|
||||
return partner.lock() != NULL && partner.lock()->isAlive() && partner.lock()->isInLove() && loveTime < 20 * 3;
|
||||
}
|
||||
|
||||
void BreedGoal::stop()
|
||||
@@ -74,21 +74,21 @@ void BreedGoal::breed()
|
||||
shared_ptr<AgableMob> offspring = animal->getBreedOffspring(partner.lock());
|
||||
animal->setDespawnProtected();
|
||||
partner.lock()->setDespawnProtected();
|
||||
if (offspring == nullptr)
|
||||
if (offspring == NULL)
|
||||
{
|
||||
// This will be nullptr if we've hit our limits for spawning any particular type of animal... reset things as normally as we can, without actually producing any offspring
|
||||
// This will be NULL if we've hit our limits for spawning any particular type of animal... reset things as normally as we can, without actually producing any offspring
|
||||
animal->resetLove();
|
||||
partner.lock()->resetLove();
|
||||
return;
|
||||
}
|
||||
|
||||
shared_ptr<Player> loveCause = animal->getLoveCause();
|
||||
if (loveCause == nullptr && partner.lock()->getLoveCause() != nullptr)
|
||||
if (loveCause == NULL && partner.lock()->getLoveCause() != NULL)
|
||||
{
|
||||
loveCause = partner.lock()->getLoveCause();
|
||||
}
|
||||
|
||||
if (loveCause != nullptr)
|
||||
if (loveCause != NULL)
|
||||
{
|
||||
// Record mob bred stat.
|
||||
loveCause->awardStat(GenericStats::breedEntity(offspring->GetType()),GenericStats::param_breedEntity(offspring->GetType()));
|
||||
@@ -118,5 +118,5 @@ void BreedGoal::breed()
|
||||
* 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.
|
||||
level->addEntity(std::make_shared<ExperienceOrb>(level, animal->x, animal->y, animal->z, random->nextInt(7) + 1));
|
||||
level->addEntity( shared_ptr<ExperienceOrb>( new ExperienceOrb(level, animal->x, animal->y, animal->z, random->nextInt(7) + 1) ) );
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(shared_ptr<Player> pla
|
||||
Slot *PotionSlot2 = slots.at(BOTTLE_SLOT_START+1);
|
||||
Slot *PotionSlot3 = slots.at(BOTTLE_SLOT_START+2);
|
||||
|
||||
if (slot != nullptr && slot->hasItem())
|
||||
if (slot != NULL && slot->hasItem())
|
||||
{
|
||||
shared_ptr<ItemInstance> stack = slot->getItem();
|
||||
clicked = stack->copy();
|
||||
@@ -199,7 +199,7 @@ bool BrewingStandMenu::PotionSlot::mayCombine(shared_ptr<ItemInstance> second)
|
||||
|
||||
bool BrewingStandMenu::PotionSlot::mayPlaceItem(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
return item != nullptr && (item->id == Item::potion_Id || item->id == Item::glassBottle_Id);
|
||||
return item != NULL && (item->id == Item::potion_Id || item->id == Item::glassBottle_Id);
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ BrewingStandMenu::IngredientsSlot::IngredientsSlot(shared_ptr<Container> contain
|
||||
|
||||
bool BrewingStandMenu::IngredientsSlot::mayPlace(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
if (item != nullptr)
|
||||
if (item != NULL)
|
||||
{
|
||||
if (PotionBrewing::SIMPLIFIED_BREWING)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
BrewingStandTile::BrewingStandTile(int id) : BaseEntityTile(id, Material::metal, isSolidRender())
|
||||
{
|
||||
random = new Random();
|
||||
iconBase = nullptr;
|
||||
iconBase = NULL;
|
||||
}
|
||||
|
||||
BrewingStandTile::~BrewingStandTile()
|
||||
@@ -30,7 +30,7 @@ int BrewingStandTile::getRenderShape()
|
||||
|
||||
shared_ptr<TileEntity> BrewingStandTile::newTileEntity(Level *level)
|
||||
{
|
||||
return std::make_shared<BrewingStandTileEntity>();
|
||||
return shared_ptr<TileEntity>(new BrewingStandTileEntity());
|
||||
}
|
||||
|
||||
bool BrewingStandTile::isCubeShaped()
|
||||
@@ -60,7 +60,7 @@ bool BrewingStandTile::use(Level *level, int x, int y, int z, shared_ptr<Player>
|
||||
return true;
|
||||
}
|
||||
shared_ptr<BrewingStandTileEntity> brewingStand = dynamic_pointer_cast<BrewingStandTileEntity>(level->getTileEntity(x, y, z));
|
||||
if (brewingStand != nullptr) player->openBrewingStand(brewingStand);
|
||||
if (brewingStand != NULL) player->openBrewingStand(brewingStand);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -86,13 +86,13 @@ void BrewingStandTile::animateTick(Level *level, int xt, int yt, int zt, Random
|
||||
void BrewingStandTile::onRemove(Level *level, int x, int y, int z, int id, int data)
|
||||
{
|
||||
shared_ptr<TileEntity> tileEntity = level->getTileEntity(x, y, z);
|
||||
if (tileEntity != nullptr && ( dynamic_pointer_cast<BrewingStandTileEntity>(tileEntity) != nullptr) )
|
||||
if (tileEntity != NULL && ( dynamic_pointer_cast<BrewingStandTileEntity>(tileEntity) != NULL) )
|
||||
{
|
||||
shared_ptr<BrewingStandTileEntity> container = dynamic_pointer_cast<BrewingStandTileEntity>(tileEntity);
|
||||
for (int i = 0; i < container->getContainerSize(); i++)
|
||||
{
|
||||
shared_ptr<ItemInstance> item = container->getItem(i);
|
||||
if (item != nullptr)
|
||||
if (item != NULL)
|
||||
{
|
||||
float xo = random->nextFloat() * 0.8f + 0.1f;
|
||||
float yo = random->nextFloat() * 0.8f + 0.1f;
|
||||
@@ -104,14 +104,14 @@ void BrewingStandTile::onRemove(Level *level, int x, int y, int z, int id, int d
|
||||
if (count > item->count) count = item->count;
|
||||
item->count -= count;
|
||||
|
||||
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())));
|
||||
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()))));
|
||||
float pow = 0.05f;
|
||||
itemEntity->xd = static_cast<float>(random->nextGaussian()) * pow;
|
||||
itemEntity->yd = static_cast<float>(random->nextGaussian()) * pow + 0.2f;
|
||||
itemEntity->zd = static_cast<float>(random->nextGaussian()) * pow;
|
||||
itemEntity->xd = (float) random->nextGaussian() * pow;
|
||||
itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f;
|
||||
itemEntity->zd = (float) random->nextGaussian() * pow;
|
||||
if (item->hasTag())
|
||||
{
|
||||
itemEntity->getItem()->setTag(static_cast<CompoundTag *>(item->getTag()->copy()));
|
||||
itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy());
|
||||
}
|
||||
level->addEntity(itemEntity);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ int BrewingStandTileEntity::getBrewTime()
|
||||
|
||||
bool BrewingStandTileEntity::isBrewable()
|
||||
{
|
||||
if (items[INGREDIENT_SLOT] == nullptr || items[INGREDIENT_SLOT]->count <= 0)
|
||||
if (items[INGREDIENT_SLOT] == NULL || items[INGREDIENT_SLOT]->count <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ bool BrewingStandTileEntity::isBrewable()
|
||||
bool oneResult = false;
|
||||
for (int dest = 0; dest < 3; dest++)
|
||||
{
|
||||
if (items[dest] != nullptr && items[dest]->id == Item::potion_Id)
|
||||
if (items[dest] != NULL && items[dest]->id == Item::potion_Id)
|
||||
{
|
||||
int currentBrew = items[dest]->getAuxValue();
|
||||
int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) );
|
||||
@@ -129,7 +129,7 @@ bool BrewingStandTileEntity::isBrewable()
|
||||
// TODO - find out whether actually checking pointers to MobEffectInstance classes for equality
|
||||
// is of any use
|
||||
bool equals = false;
|
||||
if( ( currentEffects != nullptr ) && ( newEffects != nullptr ) )
|
||||
if( ( currentEffects != NULL ) && ( newEffects != NULL ) )
|
||||
{
|
||||
if( currentEffects->size() == newEffects->size() )
|
||||
{
|
||||
@@ -141,7 +141,7 @@ bool BrewingStandTileEntity::isBrewable()
|
||||
}
|
||||
|
||||
if ((currentBrew > 0 && currentEffects == newEffects) ||
|
||||
(currentEffects != nullptr && (equals || newEffects == nullptr)))
|
||||
(currentEffects != NULL && (equals || newEffects == NULL)))
|
||||
{
|
||||
}
|
||||
else if (currentBrew != newBrew)
|
||||
@@ -166,7 +166,7 @@ bool BrewingStandTileEntity::isBrewable()
|
||||
bool oneResult = false;
|
||||
for (int dest = 0; dest < 3; dest++)
|
||||
{
|
||||
if (items[dest] != nullptr && items[dest]->id == Item::potion_Id)
|
||||
if (items[dest] != NULL && items[dest]->id == Item::potion_Id)
|
||||
{
|
||||
int currentBrew = items[dest]->getAuxValue();
|
||||
int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) );
|
||||
@@ -176,7 +176,7 @@ bool BrewingStandTileEntity::isBrewable()
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (isWater && items[dest] != nullptr && items[dest]->id == Item::glassBottle_Id)
|
||||
else if (isWater && items[dest] != NULL && items[dest]->id == Item::glassBottle_Id)
|
||||
{
|
||||
oneResult = true;
|
||||
break;
|
||||
@@ -199,7 +199,7 @@ void BrewingStandTileEntity::doBrew()
|
||||
{
|
||||
for (int dest = 0; dest < 3; dest++)
|
||||
{
|
||||
if (items[dest] != nullptr && items[dest]->id == Item::potion_Id)
|
||||
if (items[dest] != NULL && items[dest]->id == Item::potion_Id)
|
||||
{
|
||||
int currentBrew = items[dest]->getAuxValue();
|
||||
int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) );
|
||||
@@ -211,7 +211,7 @@ void BrewingStandTileEntity::doBrew()
|
||||
// TODO - find out whether actually checking pointers to MobEffectInstance classes for equality
|
||||
// is of any use
|
||||
bool equals = false;
|
||||
if( ( currentEffects != nullptr ) && ( newEffects != nullptr ) )
|
||||
if( ( currentEffects != NULL ) && ( newEffects != NULL ) )
|
||||
{
|
||||
if( currentEffects->size() == newEffects->size() )
|
||||
{
|
||||
@@ -223,7 +223,7 @@ void BrewingStandTileEntity::doBrew()
|
||||
}
|
||||
|
||||
if ((currentBrew > 0 && currentEffects == newEffects) ||
|
||||
(currentEffects != nullptr && (equals || newEffects == nullptr)))
|
||||
(currentEffects != NULL && (equals || newEffects == NULL)))
|
||||
{
|
||||
if (!PotionItem::isThrowable(currentBrew) && PotionItem::isThrowable(newBrew))
|
||||
{
|
||||
@@ -246,22 +246,22 @@ void BrewingStandTileEntity::doBrew()
|
||||
|
||||
for (int dest = 0; dest < 3; dest++)
|
||||
{
|
||||
if (items[dest] != nullptr && items[dest]->id == Item::potion_Id)
|
||||
if (items[dest] != NULL && items[dest]->id == Item::potion_Id)
|
||||
{
|
||||
int currentBrew = items[dest]->getAuxValue();
|
||||
int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) );
|
||||
items[dest]->setAuxValue(newBrew);
|
||||
}
|
||||
else if (isWater && items[dest] != nullptr && items[dest]->id == Item::glassBottle_Id)
|
||||
else if (isWater && items[dest] != NULL && items[dest]->id == Item::glassBottle_Id)
|
||||
{
|
||||
items[dest] = std::make_shared<ItemInstance>(Item::potion);
|
||||
items[dest] = shared_ptr<ItemInstance>(new ItemInstance(Item::potion));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Item::items[ingredient->id]->hasCraftingRemainingItem())
|
||||
{
|
||||
items[INGREDIENT_SLOT] = std::make_shared<ItemInstance>(Item::items[ingredient->id]->getCraftingRemainingItem());
|
||||
items[INGREDIENT_SLOT] = shared_ptr<ItemInstance>(new ItemInstance(Item::items[ingredient->id]->getCraftingRemainingItem()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -275,7 +275,7 @@ void BrewingStandTileEntity::doBrew()
|
||||
|
||||
int BrewingStandTileEntity::applyIngredient(int currentBrew, shared_ptr<ItemInstance> ingredient)
|
||||
{
|
||||
if (ingredient == nullptr)
|
||||
if (ingredient == NULL)
|
||||
{
|
||||
return currentBrew;
|
||||
}
|
||||
@@ -322,15 +322,15 @@ void BrewingStandTileEntity::save(CompoundTag *base)
|
||||
{
|
||||
TileEntity::save(base);
|
||||
|
||||
base->putShort(L"BrewTime", static_cast<short>(brewTime));
|
||||
base->putShort(L"BrewTime", (short) (brewTime));
|
||||
ListTag<CompoundTag> *listTag = new ListTag<CompoundTag>();
|
||||
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
if (items[i] != nullptr)
|
||||
if (items[i] != NULL)
|
||||
{
|
||||
CompoundTag *tag = new CompoundTag();
|
||||
tag->putByte(L"Slot", static_cast<byte>(i));
|
||||
tag->putByte(L"Slot", (byte) i);
|
||||
items[i]->save(tag);
|
||||
listTag->add(tag);
|
||||
}
|
||||
@@ -354,7 +354,7 @@ shared_ptr<ItemInstance> BrewingStandTileEntity::removeItem(unsigned int slot, i
|
||||
// option on the ingredients slot
|
||||
// Fix for #65373 - TU8: Content: UI: Command "Take Half" in the Brewing Stand interface doesn't work as intended.
|
||||
|
||||
if (slot >= 0 && slot < items.length && items[slot] != nullptr)
|
||||
if (slot >= 0 && slot < items.length && items[slot] != NULL)
|
||||
{
|
||||
if (items[slot]->count <= count)
|
||||
{
|
||||
@@ -445,7 +445,7 @@ int BrewingStandTileEntity::getPotionBits()
|
||||
int newCount = 0;
|
||||
for (int potion = 0; potion < 3; potion++)
|
||||
{
|
||||
if (items[potion] != nullptr)
|
||||
if (items[potion] != NULL)
|
||||
{
|
||||
newCount |= (1 << potion);
|
||||
}
|
||||
@@ -476,7 +476,7 @@ bool BrewingStandTileEntity::canTakeItemThroughFace(int slot, shared_ptr<ItemIns
|
||||
// 4J Added
|
||||
shared_ptr<TileEntity> BrewingStandTileEntity::clone()
|
||||
{
|
||||
shared_ptr<BrewingStandTileEntity> result = std::make_shared<BrewingStandTileEntity>();
|
||||
shared_ptr<BrewingStandTileEntity> result = shared_ptr<BrewingStandTileEntity>( new BrewingStandTileEntity() );
|
||||
TileEntity::clone(result);
|
||||
|
||||
result->brewTime = brewTime;
|
||||
@@ -485,7 +485,7 @@ shared_ptr<TileEntity> BrewingStandTileEntity::clone()
|
||||
|
||||
for (unsigned int i = 0; i < items.length; i++)
|
||||
{
|
||||
if (items.data[i] != nullptr)
|
||||
if (items.data[i] != NULL)
|
||||
{
|
||||
result->items.data[i] = ItemInstance::clone(items.data[i]);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ bool BucketItem::TestUse(shared_ptr<ItemInstance> itemInstance, Level *level, sh
|
||||
{
|
||||
bool pickLiquid = content == 0;
|
||||
HitResult *hr = getPlayerPOVHitResult(level, player, pickLiquid);
|
||||
if (hr == nullptr) return false;
|
||||
if (hr == NULL) return false;
|
||||
|
||||
if (hr->type == HitResult::TILE)
|
||||
{
|
||||
@@ -105,7 +105,7 @@ shared_ptr<ItemInstance> BucketItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||
|
||||
bool pickLiquid = content == 0;
|
||||
HitResult *hr = getPlayerPOVHitResult(level, player, pickLiquid);
|
||||
if (hr == nullptr) return itemInstance;
|
||||
if (hr == NULL) return itemInstance;
|
||||
|
||||
if (hr->type == HitResult::TILE)
|
||||
{
|
||||
@@ -117,10 +117,10 @@ shared_ptr<ItemInstance> BucketItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||
{
|
||||
app.DebugPrintf("!!!!!!!!!!! Can't place that here\n");
|
||||
shared_ptr<ServerPlayer> servPlayer = dynamic_pointer_cast<ServerPlayer>(player);
|
||||
if( servPlayer != nullptr )
|
||||
if( servPlayer != NULL )
|
||||
{
|
||||
app.DebugPrintf("Sending ChatPacket::e_ChatCannotPlaceLava to player\n");
|
||||
servPlayer->connection->send(std::make_shared<ChatPacket>(L"", ChatPacket::e_ChatCannotPlaceLava));
|
||||
servPlayer->connection->send( shared_ptr<ChatPacket>( new ChatPacket(L"", ChatPacket::e_ChatCannotPlaceLava ) ) );
|
||||
}
|
||||
|
||||
delete hr;
|
||||
@@ -141,13 +141,13 @@ shared_ptr<ItemInstance> BucketItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||
|
||||
if (--itemInstance->count <= 0)
|
||||
{
|
||||
return std::make_shared<ItemInstance>(Item::bucket_water);
|
||||
return shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_water) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!player->inventory->add(std::make_shared<ItemInstance>(Item::bucket_water)))
|
||||
if (!player->inventory->add(shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_water))))
|
||||
{
|
||||
player->drop(std::make_shared<ItemInstance>(Item::bucket_water_Id, 1, 0));
|
||||
player->drop(shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_water_Id, 1, 0)));
|
||||
}
|
||||
return itemInstance;
|
||||
}
|
||||
@@ -168,13 +168,13 @@ shared_ptr<ItemInstance> BucketItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||
}
|
||||
if (--itemInstance->count <= 0)
|
||||
{
|
||||
return std::make_shared<ItemInstance>(Item::bucket_lava);
|
||||
return shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_lava) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!player->inventory->add(std::make_shared<ItemInstance>(Item::bucket_lava)))
|
||||
if (!player->inventory->add(shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_lava))))
|
||||
{
|
||||
player->drop(std::make_shared<ItemInstance>(Item::bucket_lava_Id, 1, 0));
|
||||
player->drop(shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_lava_Id, 1, 0)));
|
||||
}
|
||||
return itemInstance;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ shared_ptr<ItemInstance> BucketItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||
else if (content < 0)
|
||||
{
|
||||
delete hr;
|
||||
return std::make_shared<ItemInstance>(Item::bucket_empty);
|
||||
return shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_empty) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -199,7 +199,7 @@ shared_ptr<ItemInstance> BucketItem::use(shared_ptr<ItemInstance> itemInstance,
|
||||
|
||||
if (emptyBucket(level, xt, yt, zt) && !player->abilities.instabuild)
|
||||
{
|
||||
return std::make_shared<ItemInstance>(Item::bucket_empty);
|
||||
return shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_empty) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ void BufferedOutputStream::write(byteArray b)
|
||||
//b - the byte to be written.
|
||||
void BufferedOutputStream::write(unsigned int b)
|
||||
{
|
||||
buf[count++] = static_cast<byte>(b);
|
||||
buf[count++] = (byte) b;
|
||||
if( count == buf.length )
|
||||
{
|
||||
flush();
|
||||
|
||||
@@ -63,7 +63,7 @@ bool Bush::canSurvive(Level *level, int x, int y, int z)
|
||||
|
||||
AABB *Bush::getAABB(Level *level, int x, int y, int z)
|
||||
{
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Bush::blocksLight()
|
||||
|
||||
@@ -21,7 +21,7 @@ Icon *ButtonTile::getTexture(int face, int data)
|
||||
|
||||
AABB *ButtonTile::getAABB(Level *level, int x, int y, int z)
|
||||
{
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int ButtonTile::getTickDelay(Level *level)
|
||||
@@ -302,7 +302,7 @@ void ButtonTile::checkPressed(Level *level, int x, int y, int z)
|
||||
bool shouldBePressed;
|
||||
|
||||
updateShape(data);
|
||||
Tile::ThreadStorage *tls = static_cast<Tile::ThreadStorage *>(TlsGetValue(Tile::tlsIdxShape));
|
||||
Tile::ThreadStorage *tls = (Tile::ThreadStorage *)TlsGetValue(Tile::tlsIdxShape);
|
||||
vector<shared_ptr<Entity> > *entities = level->getEntitiesOfClass(typeid(Arrow), AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1));
|
||||
shouldBePressed = !entities->empty();
|
||||
delete entities;
|
||||
|
||||
@@ -114,5 +114,5 @@ int64_t ByteArrayInputStream::skip(int64_t n)
|
||||
|
||||
ByteArrayInputStream::~ByteArrayInputStream()
|
||||
{
|
||||
if(buf.data != nullptr) delete [] buf.data;
|
||||
if(buf.data != NULL) delete [] buf.data;
|
||||
}
|
||||
@@ -20,7 +20,7 @@ ByteArrayOutputStream::ByteArrayOutputStream(unsigned int size)
|
||||
|
||||
ByteArrayOutputStream::~ByteArrayOutputStream()
|
||||
{
|
||||
if (buf.data != nullptr)
|
||||
if (buf.data != NULL)
|
||||
delete[] buf.data;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ void ByteArrayOutputStream::write(unsigned int b)
|
||||
if( count + 1 >= buf.length )
|
||||
buf.resize( buf.length * 2 );
|
||||
|
||||
buf[count] = static_cast<byte>(b);
|
||||
buf[count] = (byte) b;
|
||||
count++;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ public:
|
||||
{
|
||||
if (Tag::equals(obj))
|
||||
{
|
||||
ByteArrayTag *o = static_cast<ByteArrayTag *>(obj);
|
||||
return ((data.data == nullptr && o->data.data == nullptr) || (data.data != nullptr && data.length == o->data.length && memcmp(data.data, o->data.data, data.length) == 0) );
|
||||
ByteArrayTag *o = (ByteArrayTag *) obj;
|
||||
return ((data.data == NULL && o->data.data == NULL) || (data.data != NULL && data.length == o->data.length && memcmp(data.data, o->data.data, data.length) == 0) );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
{
|
||||
if (Tag::equals(obj))
|
||||
{
|
||||
ByteTag *o = static_cast<ByteTag *>(obj);
|
||||
ByteTag *o = (ByteTag *) obj;
|
||||
return data == o->data;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -21,7 +21,7 @@ CRITICAL_SECTION C4JThread::ms_threadListCS;
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
// 4J Stu - On XboxOne the main thread is not the one that does all the static init, so we have to set this up later
|
||||
C4JThread *C4JThread::m_mainThread = nullptr;
|
||||
C4JThread *C4JThread::m_mainThread = NULL;
|
||||
|
||||
void C4JThread::StaticInit()
|
||||
{
|
||||
@@ -109,12 +109,12 @@ C4JThread::C4JThread( C4JThreadStartFunc* startFunc, void* param, const char* th
|
||||
CPU = SCE_KERNEL_CPU_MASK_USER_1;
|
||||
}
|
||||
|
||||
m_threadID = sceKernelCreateThread(m_threadName, entryPoint, g_DefaultPriority, m_stackSize, 0, CPU, nullptr);
|
||||
m_threadID = sceKernelCreateThread(m_threadName, entryPoint, g_DefaultPriority, m_stackSize, 0, CPU, NULL);
|
||||
app.DebugPrintf("***************************** start thread %s **************************\n", m_threadName);
|
||||
#else
|
||||
m_threadID = 0;
|
||||
m_threadHandle = 0;
|
||||
m_threadHandle = CreateThread(nullptr, m_stackSize, entryPoint, this, CREATE_SUSPENDED, &m_threadID);
|
||||
m_threadHandle = CreateThread(NULL, m_stackSize, entryPoint, this, CREATE_SUSPENDED, &m_threadID);
|
||||
#endif
|
||||
EnterCriticalSection(&ms_threadListCS);
|
||||
ms_threadList.push_back(this);
|
||||
@@ -128,8 +128,8 @@ C4JThread::C4JThread( const char* mainThreadName)
|
||||
user_registerthread();
|
||||
#endif
|
||||
|
||||
m_startFunc = nullptr;
|
||||
m_threadParam = nullptr;
|
||||
m_startFunc = NULL;
|
||||
m_threadParam = NULL;
|
||||
m_stackSize = 0;
|
||||
|
||||
#ifdef __PS3__
|
||||
@@ -178,7 +178,7 @@ C4JThread::~C4JThread()
|
||||
#endif
|
||||
|
||||
#if defined __ORBIS__
|
||||
scePthreadJoin(m_threadID, nullptr);
|
||||
scePthreadJoin(m_threadID, NULL);
|
||||
#endif
|
||||
|
||||
EnterCriticalSection(&ms_threadListCS);
|
||||
@@ -212,7 +212,7 @@ void * C4JThread::entryPoint(void *param)
|
||||
pThread->m_exitCode = (*pThread->m_startFunc)(pThread->m_threadParam);
|
||||
pThread->m_completionFlag->Set();
|
||||
pThread->m_isRunning = false;
|
||||
scePthreadExit(nullptr);
|
||||
scePthreadExit(NULL);
|
||||
}
|
||||
#elif defined __PSVITA__
|
||||
struct StrArg {
|
||||
@@ -233,14 +233,14 @@ SceInt32 C4JThread::entryPoint(SceSize argSize, void *pArgBlock)
|
||||
PSVitaTLSStorage::RemoveThread(pThread->m_threadID);
|
||||
user_removethread();
|
||||
|
||||
sceKernelExitDeleteThread(nullptr);
|
||||
sceKernelExitDeleteThread(NULL);
|
||||
|
||||
return pThread->m_exitCode;
|
||||
}
|
||||
#else
|
||||
DWORD WINAPI C4JThread::entryPoint(LPVOID lpParam)
|
||||
{
|
||||
C4JThread* pThread = static_cast<C4JThread *>(lpParam);
|
||||
C4JThread* pThread = (C4JThread*)lpParam;
|
||||
SetThreadName(-1, pThread->m_threadName);
|
||||
pThread->m_exitCode = (*pThread->m_startFunc)(pThread->m_threadParam);
|
||||
pThread->m_isRunning = false;
|
||||
@@ -270,7 +270,7 @@ void C4JThread::Run()
|
||||
scePthreadAttrDestroy(&m_threadAttr);
|
||||
#elif defined __PSVITA__
|
||||
StrArg strArg = {this};
|
||||
// m_threadID = sceKernelCreateThread(m_threadName, entryPoint, m_priority, m_stackSize, 0, m_CPUMask, nullptr);
|
||||
// m_threadID = sceKernelCreateThread(m_threadName, entryPoint, m_priority, m_stackSize, 0, m_CPUMask, NULL);
|
||||
sceKernelStartThread( m_threadID, sizeof(strArg), &strArg);
|
||||
#else
|
||||
ResumeThread(m_threadHandle);
|
||||
@@ -439,7 +439,7 @@ C4JThread* C4JThread::getCurrentThread()
|
||||
#endif //__PS3__
|
||||
EnterCriticalSection(&ms_threadListCS);
|
||||
|
||||
for(size_t i=0;i<ms_threadList.size(); i++)
|
||||
for(int i=0;i<ms_threadList.size(); i++)
|
||||
{
|
||||
if(currThreadID == ms_threadList[i]->m_threadID)
|
||||
{
|
||||
@@ -450,7 +450,7 @@ C4JThread* C4JThread::getCurrentThread()
|
||||
|
||||
LeaveCriticalSection(&ms_threadListCS);
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool C4JThread::isMainThread()
|
||||
@@ -480,12 +480,12 @@ C4JThread::Event::Event(EMode mode/* = e_modeAutoClear*/)
|
||||
|
||||
#elif defined __ORBIS__
|
||||
char name[1] = {0};
|
||||
sceKernelCreateEventFlag( &m_event, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr);
|
||||
sceKernelCreateEventFlag( &m_event, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL);
|
||||
#elif defined __PSVITA__
|
||||
char name[1] = {0};
|
||||
m_event = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr);
|
||||
m_event = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL);
|
||||
#else
|
||||
m_event = CreateEvent( nullptr, (m_mode == e_modeManualClear), FALSE, nullptr );
|
||||
m_event = CreateEvent( NULL, (m_mode == e_modeManualClear), FALSE, NULL );
|
||||
#endif //__PS3__
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs )
|
||||
SceKernelUseconds *pTimeoutMicrosecs;
|
||||
if( timeoutMs == INFINITE )
|
||||
{
|
||||
pTimeoutMicrosecs = nullptr;
|
||||
pTimeoutMicrosecs = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -566,7 +566,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs )
|
||||
{
|
||||
waitMode |= SCE_KERNEL_EVF_WAITMODE_CLEAR_PAT;
|
||||
}
|
||||
int err = sceKernelWaitEventFlag(m_event, 1, waitMode, nullptr, pTimeoutMicrosecs);
|
||||
int err = sceKernelWaitEventFlag(m_event, 1, waitMode, NULL, pTimeoutMicrosecs);
|
||||
switch(err)
|
||||
{
|
||||
case SCE_OK: return WAIT_OBJECT_0;
|
||||
@@ -579,7 +579,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs )
|
||||
SceUInt32 *pTimeoutMicrosecs;
|
||||
if( timeoutMs == INFINITE )
|
||||
{
|
||||
pTimeoutMicrosecs = nullptr;
|
||||
pTimeoutMicrosecs = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -591,7 +591,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs )
|
||||
{
|
||||
waitMode |= SCE_KERNEL_EVF_WAITMODE_CLEAR_ALL;
|
||||
}
|
||||
int err = sceKernelWaitEventFlag(m_event, 1, waitMode, nullptr, pTimeoutMicrosecs);
|
||||
int err = sceKernelWaitEventFlag(m_event, 1, waitMode, NULL, pTimeoutMicrosecs);
|
||||
switch(err)
|
||||
{
|
||||
case SCE_OK: return WAIT_OBJECT_0;
|
||||
@@ -623,15 +623,15 @@ C4JThread::EventArray::EventArray( int size, EMode mode/* = e_modeAutoClear*/)
|
||||
assert(err == CELL_OK);
|
||||
#elif defined __ORBIS__
|
||||
char name[1] = {0};
|
||||
sceKernelCreateEventFlag( &m_events, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr);
|
||||
sceKernelCreateEventFlag( &m_events, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL);
|
||||
#elif defined __PSVITA__
|
||||
char name[1] = {0};
|
||||
m_events = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr);
|
||||
m_events = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL);
|
||||
#else
|
||||
m_events = new HANDLE[size];
|
||||
for(int i=0;i<size;i++)
|
||||
{
|
||||
m_events[i] = CreateEvent(nullptr, (m_mode == e_modeManualClear), FALSE, nullptr );
|
||||
m_events[i] = CreateEvent(NULL, (m_mode == e_modeManualClear), FALSE, NULL );
|
||||
}
|
||||
#endif // __PS3__
|
||||
}
|
||||
@@ -713,7 +713,7 @@ DWORD C4JThread::EventArray::WaitForSingle(int index, int timeoutMs )
|
||||
SceKernelUseconds *pTimeoutMicrosecs;
|
||||
if( timeoutMs == INFINITE )
|
||||
{
|
||||
pTimeoutMicrosecs = nullptr;
|
||||
pTimeoutMicrosecs = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -748,7 +748,7 @@ DWORD C4JThread::EventArray::WaitForSingle(int index, int timeoutMs )
|
||||
SceUInt32 *pTimeoutMicrosecs;
|
||||
if( timeoutMs == INFINITE )
|
||||
{
|
||||
pTimeoutMicrosecs = nullptr;
|
||||
pTimeoutMicrosecs = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -760,7 +760,7 @@ DWORD C4JThread::EventArray::WaitForSingle(int index, int timeoutMs )
|
||||
{
|
||||
waitMode |= SCE_KERNEL_EVF_WAITMODE_CLEAR_ALL;
|
||||
}
|
||||
int err = sceKernelWaitEventFlag(m_events, 1<<index, waitMode, nullptr, pTimeoutMicrosecs);
|
||||
int err = sceKernelWaitEventFlag(m_events, 1<<index, waitMode, NULL, pTimeoutMicrosecs);
|
||||
switch(err)
|
||||
{
|
||||
case SCE_OK: return WAIT_OBJECT_0;
|
||||
@@ -814,7 +814,7 @@ DWORD C4JThread::EventArray::WaitForAll(int timeoutMs )
|
||||
SceKernelUseconds *pTimeoutMicrosecs;
|
||||
if( timeoutMs == INFINITE )
|
||||
{
|
||||
pTimeoutMicrosecs = nullptr;
|
||||
pTimeoutMicrosecs = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -829,7 +829,7 @@ DWORD C4JThread::EventArray::WaitForAll(int timeoutMs )
|
||||
{
|
||||
waitMode |= SCE_KERNEL_EVF_WAITMODE_CLEAR_PAT;
|
||||
}
|
||||
int err = sceKernelWaitEventFlag(m_events, bitmask, waitMode, nullptr, pTimeoutMicrosecs);
|
||||
int err = sceKernelWaitEventFlag(m_events, bitmask, waitMode, NULL, pTimeoutMicrosecs);
|
||||
switch(err)
|
||||
{
|
||||
case SCE_OK:
|
||||
@@ -850,7 +850,7 @@ DWORD C4JThread::EventArray::WaitForAll(int timeoutMs )
|
||||
SceUInt32 *pTimeoutMicrosecs;
|
||||
if( timeoutMs == INFINITE )
|
||||
{
|
||||
pTimeoutMicrosecs = nullptr;
|
||||
pTimeoutMicrosecs = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -865,7 +865,7 @@ DWORD C4JThread::EventArray::WaitForAll(int timeoutMs )
|
||||
{
|
||||
waitMode |= SCE_KERNEL_EVF_WAITMODE_CLEAR_ALL;
|
||||
}
|
||||
int err = sceKernelWaitEventFlag(m_events, bitmask, waitMode, nullptr, pTimeoutMicrosecs);
|
||||
int err = sceKernelWaitEventFlag(m_events, bitmask, waitMode, NULL, pTimeoutMicrosecs);
|
||||
switch(err)
|
||||
{
|
||||
case SCE_OK: return WAIT_OBJECT_0;
|
||||
@@ -911,7 +911,7 @@ DWORD C4JThread::EventArray::WaitForAny(int timeoutMs )
|
||||
SceKernelUseconds *pTimeoutMicrosecs;
|
||||
if( timeoutMs == INFINITE )
|
||||
{
|
||||
pTimeoutMicrosecs = nullptr;
|
||||
pTimeoutMicrosecs = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -926,7 +926,7 @@ DWORD C4JThread::EventArray::WaitForAny(int timeoutMs )
|
||||
{
|
||||
waitMode |= SCE_KERNEL_EVF_WAITMODE_CLEAR_PAT;
|
||||
}
|
||||
int err = sceKernelWaitEventFlag(m_events, bitmask, waitMode, nullptr, pTimeoutMicrosecs);
|
||||
int err = sceKernelWaitEventFlag(m_events, bitmask, waitMode, NULL, pTimeoutMicrosecs);
|
||||
switch(err)
|
||||
{
|
||||
case SCE_OK: return WAIT_OBJECT_0;
|
||||
@@ -939,7 +939,7 @@ DWORD C4JThread::EventArray::WaitForAny(int timeoutMs )
|
||||
SceUInt32 *pTimeoutMicrosecs;
|
||||
if( timeoutMs == INFINITE )
|
||||
{
|
||||
pTimeoutMicrosecs = nullptr;
|
||||
pTimeoutMicrosecs = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -954,7 +954,7 @@ DWORD C4JThread::EventArray::WaitForAny(int timeoutMs )
|
||||
{
|
||||
waitMode |= SCE_KERNEL_EVF_WAITMODE_CLEAR_ALL;
|
||||
}
|
||||
int err = sceKernelWaitEventFlag(m_events, bitmask, waitMode, nullptr, pTimeoutMicrosecs);
|
||||
int err = sceKernelWaitEventFlag(m_events, bitmask, waitMode, NULL, pTimeoutMicrosecs);
|
||||
switch(err)
|
||||
{
|
||||
case SCE_OK: return WAIT_OBJECT_0;
|
||||
@@ -970,7 +970,7 @@ DWORD C4JThread::EventArray::WaitForAny(int timeoutMs )
|
||||
#ifdef __PS3__
|
||||
void C4JThread::EventArray::Cancel()
|
||||
{
|
||||
sys_event_flag_cancel(m_events, nullptr);
|
||||
sys_event_flag_cancel(m_events, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -982,9 +982,9 @@ C4JThread::EventQueue::EventQueue( UpdateFunc* updateFunc, ThreadInitFunc thread
|
||||
m_updateFunc = updateFunc;
|
||||
m_threadInitFunc = threadInitFunc;
|
||||
strcpy(m_threadName, szThreadName);
|
||||
m_thread = nullptr;
|
||||
m_startEvent = nullptr;
|
||||
m_finishedEvent = nullptr;
|
||||
m_thread = NULL;
|
||||
m_startEvent = NULL;
|
||||
m_finishedEvent = NULL;
|
||||
m_processor = -1;
|
||||
m_priority = THREAD_PRIORITY_HIGHEST+1;
|
||||
}
|
||||
@@ -1004,7 +1004,7 @@ void C4JThread::EventQueue::init()
|
||||
|
||||
void C4JThread::EventQueue::sendEvent( Level* pLevel )
|
||||
{
|
||||
if(m_thread == nullptr)
|
||||
if(m_thread == NULL)
|
||||
init();
|
||||
EnterCriticalSection(&m_critSect);
|
||||
m_queue.push(pLevel);
|
||||
@@ -1015,7 +1015,7 @@ void C4JThread::EventQueue::sendEvent( Level* pLevel )
|
||||
|
||||
void C4JThread::EventQueue::waitForFinish()
|
||||
{
|
||||
if(m_thread == nullptr)
|
||||
if(m_thread == NULL)
|
||||
init();
|
||||
EnterCriticalSection(&m_critSect);
|
||||
if(m_queue.empty())
|
||||
@@ -1029,7 +1029,7 @@ void C4JThread::EventQueue::waitForFinish()
|
||||
|
||||
int C4JThread::EventQueue::threadFunc( void* lpParam )
|
||||
{
|
||||
EventQueue* p = static_cast<EventQueue *>(lpParam);
|
||||
EventQueue* p = (EventQueue*)lpParam;
|
||||
p->threadPoll();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
CactusTile::CactusTile(int id) : Tile(id, Material::cactus,isSolidRender())
|
||||
{
|
||||
setTicking(true);
|
||||
iconTop = nullptr;
|
||||
iconBottom = nullptr;
|
||||
iconTop = NULL;
|
||||
iconBottom = NULL;
|
||||
}
|
||||
|
||||
void CactusTile::tick(Level *level, int x, int y, int z, Random *random)
|
||||
|
||||
@@ -13,9 +13,9 @@ CakeTile::CakeTile(int id) : Tile(id, Material::cake,isSolidRender())
|
||||
{
|
||||
setTicking(true);
|
||||
|
||||
iconTop = nullptr;
|
||||
iconBottom = nullptr;
|
||||
iconInner = nullptr;
|
||||
iconTop = NULL;
|
||||
iconBottom = NULL;
|
||||
iconInner = NULL;
|
||||
}
|
||||
|
||||
void CakeTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr<TileEntity> forceEntity) // 4J added forceData, forceEntity param
|
||||
|
||||
@@ -141,11 +141,11 @@ void CanyonFeature::addTunnel(int64_t seed, int xOffs, int zOffs, byteArray bloc
|
||||
{
|
||||
if (yy < 10)
|
||||
{
|
||||
blocks[p] = static_cast<byte>(Tile::lava_Id);
|
||||
blocks[p] = (byte) Tile::lava_Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
blocks[p] = static_cast<byte>(0);
|
||||
blocks[p] = (byte) 0;
|
||||
if (hasGrass && blocks[p - 1] == Tile::dirt_Id) blocks[p - 1] = (byte) level->getBiome(xx + xOffs * 16, zz + zOffs * 16)->topMaterial;
|
||||
}
|
||||
}
|
||||
@@ -179,7 +179,7 @@ void CanyonFeature::addFeature(Level *level, int x, int z, int xOffs, int zOffs,
|
||||
addTunnel(random->nextLong(), xOffs, zOffs, blocks, xCave, yCave, zCave, thickness, yRot, xRot, 0, 0, 3.0);
|
||||
|
||||
// 4J Add to feature list
|
||||
app.AddTerrainFeaturePosition(eTerrainFeature_Ravine,static_cast<int>(xCave / 16.0),static_cast<int>(yCave / 16.0));
|
||||
app.AddTerrainFeaturePosition(eTerrainFeature_Ravine,(int)(xCave/16.0),(int)(yCave/16.0));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,7 +35,7 @@ shared_ptr<ItemInstance> CarrotOnAStickItem::use(shared_ptr<ItemInstance> itemIn
|
||||
|
||||
if (itemInstance->count == 0)
|
||||
{
|
||||
shared_ptr<ItemInstance> replacement = std::make_shared<ItemInstance>(Item::fishingRod);
|
||||
shared_ptr<ItemInstance> replacement = shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod));
|
||||
replacement->setTag(itemInstance->tag);
|
||||
return replacement;
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ const wstring CauldronTile::TEXTURE_BOTTOM = L"cauldron_bottom";
|
||||
|
||||
CauldronTile::CauldronTile(int id) : Tile(id, Material::metal, isSolidRender())
|
||||
{
|
||||
iconInner = nullptr;
|
||||
iconTop = nullptr;
|
||||
iconBottom = nullptr;
|
||||
iconInner = NULL;
|
||||
iconTop = NULL;
|
||||
iconBottom = NULL;
|
||||
}
|
||||
|
||||
Icon *CauldronTile::getTexture(int face, int data)
|
||||
@@ -43,7 +43,7 @@ Icon *CauldronTile::getTexture(const wstring &name)
|
||||
{
|
||||
if (name.compare(TEXTURE_INSIDE) == 0) return Tile::cauldron->iconInner;
|
||||
if (name.compare(TEXTURE_BOTTOM) == 0) return Tile::cauldron->iconBottom;
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CauldronTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr<Entity> source)
|
||||
@@ -93,7 +93,7 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr<Player> pla
|
||||
}
|
||||
|
||||
shared_ptr<ItemInstance> item = player->inventory->getSelected();
|
||||
if (item == nullptr)
|
||||
if (item == NULL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr<Player> pla
|
||||
{
|
||||
if (!player->abilities.instabuild)
|
||||
{
|
||||
player->inventory->setItem(player->inventory->selected, std::make_shared<ItemInstance>(Item::bucket_empty));
|
||||
player->inventory->setItem(player->inventory->selected, shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_empty)));
|
||||
}
|
||||
|
||||
level->setData(x, y, z, 3, Tile::UPDATE_CLIENTS);
|
||||
@@ -119,10 +119,10 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr<Player> pla
|
||||
{
|
||||
if (fillLevel > 0)
|
||||
{
|
||||
shared_ptr<ItemInstance> potion = std::make_shared<ItemInstance>(Item::potion, 1, 0);
|
||||
shared_ptr<ItemInstance> potion = shared_ptr<ItemInstance>(new ItemInstance(Item::potion, 1, 0));
|
||||
if (!player->inventory->add(potion))
|
||||
{
|
||||
level->addEntity(std::make_shared<ItemEntity>(level, x + 0.5, y + 1.5, z + 0.5, potion));
|
||||
level->addEntity(shared_ptr<ItemEntity>(new ItemEntity(level, x + 0.5, y + 1.5, z + 0.5, potion)));
|
||||
}
|
||||
// 4J Stu - Brought forward change to update inventory when filling bottles with water
|
||||
else if (player->instanceof(eTYPE_SERVERPLAYER))
|
||||
|
||||
@@ -35,7 +35,7 @@ bool CaveFeature::place(Level *level, Random *random, int x, int y, int z)
|
||||
double hr = (Mth::sin(d / 16.0f * PI) * radius + 1) * ss + 1;
|
||||
|
||||
// 4J Stu Added to stop cave features generating areas previously place by game rule generation
|
||||
if(app.getLevelGenerationOptions() != nullptr)
|
||||
if(app.getLevelGenerationOptions() != NULL)
|
||||
{
|
||||
LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions();
|
||||
bool intersects = levelGenOptions->checkIntersects((xx - r / 2), (yy - hr / 2), (zz - r / 2), (xx + r / 2), (yy + hr / 2), (zz + r / 2));
|
||||
@@ -46,9 +46,9 @@ bool CaveFeature::place(Level *level, Random *random, int x, int y, int z)
|
||||
}
|
||||
}
|
||||
|
||||
for (int x2 = static_cast<int>(xx - r / 2); x2 <= static_cast<int>(xx + r / 2); x2++)
|
||||
for (int y2 = static_cast<int>(yy - hr / 2); y2 <= static_cast<int>(yy + hr / 2); y2++)
|
||||
for (int z2 = static_cast<int>(zz - r / 2); z2 <= static_cast<int>(zz + r / 2); z2++)
|
||||
for (int x2 = (int) (xx - r / 2); x2 <= (int) (xx + r / 2); x2++)
|
||||
for (int y2 = (int) (yy - hr / 2); y2 <= (int) (yy + hr / 2); y2++)
|
||||
for (int z2 = (int) (zz - r / 2); z2 <= (int) (zz + r / 2); z2++)
|
||||
{
|
||||
double xd = ((x2 + 0.5) - xx) / (r / 2);
|
||||
double yd = ((y2 + 0.5) - yy) / (hr / 2);
|
||||
|
||||
@@ -43,7 +43,7 @@ ChatPacket::ChatPacket(const wstring& message, EChatPacketMessage type, int sour
|
||||
// Read chat packet (throws IOException)
|
||||
void ChatPacket::read(DataInputStream *dis)
|
||||
{
|
||||
m_messageType = static_cast<EChatPacketMessage>(dis->readShort());
|
||||
m_messageType = (EChatPacketMessage) dis->readShort();
|
||||
|
||||
short packedCounts = dis->readShort();
|
||||
int stringCount = (packedCounts >> 4) & 0xF;
|
||||
@@ -71,12 +71,12 @@ void ChatPacket::write(DataOutputStream *dos)
|
||||
|
||||
dos->writeShort(packedCounts);
|
||||
|
||||
for(size_t i = 0; i < m_stringArgs.size(); i++)
|
||||
for(int i = 0; i < m_stringArgs.size(); i++)
|
||||
{
|
||||
writeUtf(m_stringArgs[i], dos);
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < m_intArgs.size(); i++)
|
||||
for(int i = 0; i < m_intArgs.size(); i++)
|
||||
{
|
||||
dos->writeInt(m_intArgs[i]);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ void ChatPacket::handle(PacketListener *listener)
|
||||
int ChatPacket::getEstimatedSize()
|
||||
{
|
||||
int stringsSize = 0;
|
||||
for(size_t i = 0; i < m_stringArgs.size(); i++)
|
||||
for(int i = 0; i < m_stringArgs.size(); i++)
|
||||
{
|
||||
stringsSize += m_stringArgs[i].length();
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
virtual int getEstimatedSize();
|
||||
|
||||
public:
|
||||
static shared_ptr<Packet> create() { return std::make_shared<ChatPacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new ChatPacket()); }
|
||||
virtual int getId() { return 3; }
|
||||
};
|
||||
|
||||
|
||||
@@ -208,18 +208,18 @@ void ChestTile::neighborChanged(Level *level, int x, int y, int z, int type)
|
||||
{
|
||||
BaseEntityTile::neighborChanged(level, x, y, z, type);
|
||||
shared_ptr<ChestTileEntity>(cte) = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x, y, z));
|
||||
if (cte != nullptr) cte->clearCache();
|
||||
if (cte != NULL) cte->clearCache();
|
||||
}
|
||||
|
||||
void ChestTile::onRemove(Level *level, int x, int y, int z, int id, int data)
|
||||
{
|
||||
shared_ptr<Container> container = dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z) );
|
||||
if (container != nullptr )
|
||||
if (container != NULL )
|
||||
{
|
||||
for (unsigned int i = 0; i < container->getContainerSize(); i++)
|
||||
{
|
||||
shared_ptr<ItemInstance> item = container->getItem(i);
|
||||
if (item != nullptr)
|
||||
if (item != NULL)
|
||||
{
|
||||
float xo = random->nextFloat() * 0.8f + 0.1f;
|
||||
float yo = random->nextFloat() * 0.8f + 0.1f;
|
||||
@@ -231,16 +231,16 @@ void ChestTile::onRemove(Level *level, int x, int y, int z, int id, int data)
|
||||
if (count > item->count) count = item->count;
|
||||
item->count -= count;
|
||||
|
||||
shared_ptr<ItemInstance> newItem = std::make_shared<ItemInstance>(item->id, count, item->getAuxValue());
|
||||
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>( new ItemInstance(item->id, count, item->getAuxValue()) );
|
||||
newItem->set4JData( item->get4JData() );
|
||||
shared_ptr<ItemEntity> itemEntity = std::make_shared<ItemEntity>(level, x + xo, y + yo, z + zo, newItem);
|
||||
shared_ptr<ItemEntity> itemEntity = shared_ptr<ItemEntity>(new ItemEntity(level, x + xo, y + yo, z + zo, newItem ) );
|
||||
float pow = 0.05f;
|
||||
itemEntity->xd = static_cast<float>(random->nextGaussian()) * pow;
|
||||
itemEntity->yd = static_cast<float>(random->nextGaussian()) * pow + 0.2f;
|
||||
itemEntity->zd = static_cast<float>(random->nextGaussian()) * pow;
|
||||
itemEntity->xd = (float) random->nextGaussian() * pow;
|
||||
itemEntity->yd = (float) random->nextGaussian() * pow + 0.2f;
|
||||
itemEntity->zd = (float) random->nextGaussian() * pow;
|
||||
if (item->hasTag())
|
||||
{
|
||||
itemEntity->getItem()->setTag(static_cast<CompoundTag *>(item->getTag()->copy()));
|
||||
itemEntity->getItem()->setTag((CompoundTag *) item->getTag()->copy());
|
||||
}
|
||||
|
||||
level->addEntity(itemEntity);
|
||||
@@ -272,7 +272,7 @@ bool ChestTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player
|
||||
}
|
||||
shared_ptr<Container> container = getContainer(level, x, y, z);
|
||||
|
||||
if (container != nullptr)
|
||||
if (container != NULL)
|
||||
{
|
||||
player->openContainer(container);
|
||||
}
|
||||
@@ -283,7 +283,7 @@ bool ChestTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player
|
||||
shared_ptr<Container> ChestTile::getContainer(Level *level, int x, int y, int z)
|
||||
{
|
||||
shared_ptr<Container> container = dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z) );
|
||||
if (container == nullptr) return nullptr;
|
||||
if (container == NULL) return nullptr;
|
||||
|
||||
if (level->isSolidBlockingTile(x, y + 1, z)) return nullptr;
|
||||
if (isCatSittingOnChest(level,x, y, z)) return nullptr;
|
||||
@@ -293,10 +293,10 @@ shared_ptr<Container> ChestTile::getContainer(Level *level, int x, int y, int z)
|
||||
if (level->getTile(x, y, z - 1) == id && (level->isSolidBlockingTile(x, y + 1, z - 1) || isCatSittingOnChest(level, x, y, z - 1))) return nullptr;
|
||||
if (level->getTile(x, y, z + 1) == id && (level->isSolidBlockingTile(x, y + 1, z + 1) || isCatSittingOnChest(level, x, y, z + 1))) return nullptr;
|
||||
|
||||
if (level->getTile(x - 1, y, z) == id) container = std::make_shared<CompoundContainer>(IDS_CHEST_LARGE, dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x - 1, y, z)), container);
|
||||
if (level->getTile(x + 1, y, z) == id) container = std::make_shared<CompoundContainer>(IDS_CHEST_LARGE, container, dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x + 1, y, z)));
|
||||
if (level->getTile(x, y, z - 1) == id) container = std::make_shared<CompoundContainer>(IDS_CHEST_LARGE, dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x, y, z - 1)), container);
|
||||
if (level->getTile(x, y, z + 1) == id) container = std::make_shared<CompoundContainer>(IDS_CHEST_LARGE, container, dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x, y, z + 1)));
|
||||
if (level->getTile(x - 1, y, z) == id) container = shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x - 1, y, z) ), container) );
|
||||
if (level->getTile(x + 1, y, z) == id) container = shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x + 1, y, z) )) );
|
||||
if (level->getTile(x, y, z - 1) == id) container = shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z - 1) ), container) );
|
||||
if (level->getTile(x, y, z + 1) == id) container = shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z + 1) )) );
|
||||
|
||||
return container;
|
||||
}
|
||||
@@ -304,7 +304,7 @@ shared_ptr<Container> ChestTile::getContainer(Level *level, int x, int y, int z)
|
||||
shared_ptr<TileEntity> ChestTile::newTileEntity(Level *level)
|
||||
{
|
||||
MemSect(50);
|
||||
shared_ptr<TileEntity> retval = std::make_shared<ChestTileEntity>();
|
||||
shared_ptr<TileEntity> retval = shared_ptr<TileEntity>( new ChestTileEntity() );
|
||||
MemSect(0);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ shared_ptr<ItemInstance> ChestTileEntity::getItem(unsigned int slot)
|
||||
|
||||
shared_ptr<ItemInstance> ChestTileEntity::removeItem(unsigned int slot, int count)
|
||||
{
|
||||
if (items->data[slot] != nullptr)
|
||||
if (items->data[slot] != NULL)
|
||||
{
|
||||
if (items->data[slot]->count <= count)
|
||||
{
|
||||
@@ -91,7 +91,7 @@ shared_ptr<ItemInstance> ChestTileEntity::removeItem(unsigned int slot, int coun
|
||||
|
||||
shared_ptr<ItemInstance> ChestTileEntity::removeItemNoUpdate(int slot)
|
||||
{
|
||||
if (items->data[slot] != nullptr)
|
||||
if (items->data[slot] != NULL)
|
||||
{
|
||||
shared_ptr<ItemInstance> item = items->data[slot];
|
||||
items->data[slot] = nullptr;
|
||||
@@ -103,7 +103,7 @@ shared_ptr<ItemInstance> ChestTileEntity::removeItemNoUpdate(int slot)
|
||||
void ChestTileEntity::setItem(unsigned int slot, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
items->data[slot] = item;
|
||||
if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize();
|
||||
if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize();
|
||||
this->setChanged();
|
||||
}
|
||||
|
||||
@@ -154,10 +154,10 @@ void ChestTileEntity::save(CompoundTag *base)
|
||||
|
||||
for (unsigned int i = 0; i < items->length; i++)
|
||||
{
|
||||
if (items->data[i] != nullptr)
|
||||
if (items->data[i] != NULL)
|
||||
{
|
||||
CompoundTag *tag = new CompoundTag();
|
||||
tag->putByte(L"Slot", static_cast<byte>(i));
|
||||
tag->putByte(L"Slot", (byte) i);
|
||||
items->data[i]->save(tag);
|
||||
listTag->add(tag);
|
||||
}
|
||||
@@ -244,17 +244,17 @@ void ChestTileEntity::checkNeighbors()
|
||||
}
|
||||
|
||||
shared_ptr<ChestTileEntity> cteThis = dynamic_pointer_cast<ChestTileEntity>(shared_from_this());
|
||||
if (n.lock() != nullptr) n.lock()->heyImYourNeighbor(cteThis, Direction::SOUTH);
|
||||
if (s.lock() != nullptr) s.lock()->heyImYourNeighbor(cteThis, Direction::NORTH);
|
||||
if (e.lock() != nullptr) e.lock()->heyImYourNeighbor(cteThis, Direction::WEST);
|
||||
if (w.lock() != nullptr) w.lock()->heyImYourNeighbor(cteThis, Direction::EAST);
|
||||
if (n.lock() != NULL) n.lock()->heyImYourNeighbor(cteThis, Direction::SOUTH);
|
||||
if (s.lock() != NULL) s.lock()->heyImYourNeighbor(cteThis, Direction::NORTH);
|
||||
if (e.lock() != NULL) e.lock()->heyImYourNeighbor(cteThis, Direction::WEST);
|
||||
if (w.lock() != NULL) w.lock()->heyImYourNeighbor(cteThis, Direction::EAST);
|
||||
}
|
||||
|
||||
bool ChestTileEntity::isSameChest(int x, int y, int z)
|
||||
{
|
||||
Tile *tile = Tile::tiles[level->getTile(x, y, z)];
|
||||
if (tile == nullptr || !(dynamic_cast<ChestTile *>(tile) != nullptr)) return false;
|
||||
return static_cast<ChestTile *>(tile)->type == getType();
|
||||
if (tile == NULL || !(dynamic_cast<ChestTile *>(tile) != NULL)) return false;
|
||||
return ((ChestTile *) tile)->type == getType();
|
||||
}
|
||||
|
||||
void ChestTileEntity::tick()
|
||||
@@ -283,7 +283,7 @@ void ChestTileEntity::tick()
|
||||
shared_ptr<Container> container = containerMenu->getContainer();
|
||||
shared_ptr<Container> thisContainer = dynamic_pointer_cast<Container>(shared_from_this());
|
||||
shared_ptr<CompoundContainer> compoundContainer = dynamic_pointer_cast<CompoundContainer>(container);
|
||||
if ((container == thisContainer) || (compoundContainer != nullptr && compoundContainer->contains(thisContainer)))
|
||||
if ((container == thisContainer) || (compoundContainer != NULL && compoundContainer->contains(thisContainer)))
|
||||
{
|
||||
openCount++;
|
||||
}
|
||||
@@ -298,12 +298,12 @@ void ChestTileEntity::tick()
|
||||
float speed = 0.10f;
|
||||
if (openCount > 0 && openness == 0)
|
||||
{
|
||||
if (n.lock() == nullptr && w.lock() == nullptr)
|
||||
if (n.lock() == NULL && w.lock() == NULL)
|
||||
{
|
||||
double xc = x + 0.5;
|
||||
double zc = z + 0.5;
|
||||
if (s.lock() != nullptr) zc += 0.5;
|
||||
if (e.lock() != nullptr) xc += 0.5;
|
||||
if (s.lock() != NULL) zc += 0.5;
|
||||
if (e.lock() != NULL) xc += 0.5;
|
||||
|
||||
// 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit
|
||||
level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_OPEN, 0.2f, level->random->nextFloat() * 0.1f + 0.9f);
|
||||
@@ -323,12 +323,12 @@ void ChestTileEntity::tick()
|
||||
{
|
||||
// Fix for #64546 - Customer Encountered: TU7: Chests placed by the Player are closing too fast.
|
||||
//openness = 0;
|
||||
if (n.lock() == nullptr && w.lock() == nullptr)
|
||||
if (n.lock() == NULL && w.lock() == NULL)
|
||||
{
|
||||
double xc = x + 0.5;
|
||||
double zc = z + 0.5;
|
||||
if (s.lock() != nullptr) zc += 0.5;
|
||||
if (e.lock() != nullptr) xc += 0.5;
|
||||
if (s.lock() != NULL) zc += 0.5;
|
||||
if (e.lock() != NULL) xc += 0.5;
|
||||
|
||||
// 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit
|
||||
level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_CLOSE, 0.2f, level->random->nextFloat() * 0.1f + 0.9f);
|
||||
@@ -366,7 +366,7 @@ void ChestTileEntity::startOpen()
|
||||
|
||||
void ChestTileEntity::stopOpen()
|
||||
{
|
||||
if (getTile() == nullptr || !( dynamic_cast<ChestTile *>( getTile() ) != nullptr)) return;
|
||||
if (getTile() == NULL || !( dynamic_cast<ChestTile *>( getTile() ) != NULL)) return;
|
||||
openCount--;
|
||||
level->tileEvent(x, y, z, getTile()->id, ChestTile::EVENT_SET_OPEN_COUNT, openCount);
|
||||
level->updateNeighborsAt(x, y, z, getTile()->id);
|
||||
@@ -389,9 +389,9 @@ int ChestTileEntity::getType()
|
||||
{
|
||||
if (type == -1)
|
||||
{
|
||||
if (level != nullptr && dynamic_cast<ChestTile *>( getTile() ) != nullptr)
|
||||
if (level != NULL && dynamic_cast<ChestTile *>( getTile() ) != NULL)
|
||||
{
|
||||
type = static_cast<ChestTile *>(getTile())->type;
|
||||
type = ((ChestTile *) getTile())->type;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -405,12 +405,12 @@ int ChestTileEntity::getType()
|
||||
// 4J Added
|
||||
shared_ptr<TileEntity> ChestTileEntity::clone()
|
||||
{
|
||||
shared_ptr<ChestTileEntity> result = std::make_shared<ChestTileEntity>();
|
||||
shared_ptr<ChestTileEntity> result = shared_ptr<ChestTileEntity>( new ChestTileEntity() );
|
||||
TileEntity::clone(result);
|
||||
|
||||
for (unsigned int i = 0; i < items->length; i++)
|
||||
{
|
||||
if (items->data[i] != nullptr)
|
||||
if (items->data[i] != NULL)
|
||||
{
|
||||
result->items->data[i] = ItemInstance::clone(items->data[i]);
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ shared_ptr<AgableMob> Chicken::getBreedOffspring(shared_ptr<AgableMob> target)
|
||||
// 4J - added limit to chickens that can be bred
|
||||
if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) )
|
||||
{
|
||||
return std::make_shared<Chicken>(level);
|
||||
return shared_ptr<Chicken>(new Chicken(level));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@ int64_t ChunkPos::hashCode(int x, int z)
|
||||
int ChunkPos::hashCode()
|
||||
{
|
||||
int64_t hash = hashCode(x, z);
|
||||
const int h1 = static_cast<int>(hash);
|
||||
const int h2 = static_cast<int>(hash >> 32l);
|
||||
int h1 = (int) (hash);
|
||||
int h2 = (int) (hash >> 32l);
|
||||
return h1 ^ h2;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
virtual bool tick() = 0;
|
||||
virtual bool shouldSave() = 0;
|
||||
|
||||
virtual LevelChunk **getCache() { return nullptr; } // 4J added
|
||||
virtual LevelChunk **getCache() { return NULL; } // 4J added
|
||||
virtual void dataReceived(int x, int z) {} // 4J added
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,7 +45,7 @@ void ChunkStorageProfilerDecorator::tick()
|
||||
#ifdef __PSVITA__
|
||||
sprintf(buf,"Average load time: %f (%lld)",0.000001 * (double) timeSpentLoading / (double) loadCount, loadCount);
|
||||
#else
|
||||
sprintf(buf,"Average load time: %f (%I64d)",0.000001 * static_cast<double>(timeSpentLoading) / static_cast<double>(loadCount), loadCount);
|
||||
sprintf(buf,"Average load time: %f (%I64d)",0.000001 * (double) timeSpentLoading / (double) loadCount, loadCount);
|
||||
#endif
|
||||
app.DebugPrintf(buf);
|
||||
#endif
|
||||
@@ -56,7 +56,7 @@ void ChunkStorageProfilerDecorator::tick()
|
||||
#ifdef __PSVITA__
|
||||
sprintf(buf,"Average save time: %f (%lld)",0.000001 * (double) timeSpentSaving / (double) loadCount, loadCount);
|
||||
#else
|
||||
sprintf(buf,"Average save time: %f (%I64d)",0.000001 * static_cast<double>(timeSpentSaving) / static_cast<double>(loadCount), loadCount);
|
||||
sprintf(buf,"Average save time: %f (%I64d)",0.000001 * (double) timeSpentSaving / (double) loadCount, loadCount);
|
||||
#endif
|
||||
app.DebugPrintf(buf);
|
||||
#endif
|
||||
|
||||
@@ -42,8 +42,8 @@ ChunkTilesUpdatePacket::ChunkTilesUpdatePacket(int xc, int zc, shortArray positi
|
||||
int y = (positions[i]) & 255;
|
||||
|
||||
this->positions[i] = positions[i];
|
||||
blocks[i] = static_cast<byte>(levelChunk->getTile(x, y, z));
|
||||
data[i] = static_cast<byte>(levelChunk->getData(x, y, z));
|
||||
blocks[i] = (byte) levelChunk->getTile(x, y, z);
|
||||
data[i] = (byte) levelChunk->getData(x, y, z);
|
||||
}
|
||||
levelIdx = ( ( level->dimension->id == 0 ) ? 0 : ( (level->dimension->id == -1) ? 1 : 2 ) );
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
virtual int getEstimatedSize();
|
||||
|
||||
public:
|
||||
static shared_ptr<Packet> create() { return std::make_shared<ChunkTilesUpdatePacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new ChunkTilesUpdatePacket()); }
|
||||
virtual int getId() { return 52; }
|
||||
};
|
||||
|
||||
|
||||
@@ -25,6 +25,6 @@ public:
|
||||
virtual int getEstimatedSize();
|
||||
|
||||
public:
|
||||
static shared_ptr<Packet> create() { return std::make_shared<ChunkVisibilityAreaPacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new ChunkVisibilityAreaPacket()); }
|
||||
virtual int getId() { return 155; }
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
virtual int getEstimatedSize();
|
||||
|
||||
public:
|
||||
static shared_ptr<Packet> create() { return std::make_shared<ChunkVisibilityPacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new ChunkVisibilityPacket()); }
|
||||
virtual int getId() { return 50; }
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,6 @@ public:
|
||||
int getEstimatedSize();
|
||||
|
||||
public:
|
||||
static shared_ptr<Packet> create() { return std::make_shared<ClientCommandPacket>(); }
|
||||
static shared_ptr<Packet> create() { return shared_ptr<Packet>(new ClientCommandPacket()); }
|
||||
virtual int getId() { return 205; }
|
||||
};
|
||||
@@ -7,8 +7,8 @@ ClientSideMerchant::ClientSideMerchant(shared_ptr<Player> source, const wstring
|
||||
{
|
||||
this->source = source;
|
||||
// 4J Stu - Need to do this after creating as a shared_ptr
|
||||
container = nullptr; //new MerchantContainer(source, this);
|
||||
currentOffers = nullptr;
|
||||
container = NULL; //new MerchantContainer(source, this);
|
||||
currentOffers = NULL;
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ const wstring ClockItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"clockP0",L"cl
|
||||
|
||||
ClockItem::ClockItem(int id) : Item(id)
|
||||
{
|
||||
icons = nullptr;
|
||||
icons = NULL;
|
||||
}
|
||||
|
||||
// 4J Added so that we can override the icon id used to calculate the texture UV's for each player
|
||||
@@ -21,7 +21,7 @@ Icon *ClockItem::getIcon(int auxValue)
|
||||
Icon *icon = Item::getIcon(auxValue);
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
if( pMinecraft->player != nullptr && auxValue == 0 )
|
||||
if( pMinecraft->player != NULL && auxValue == 0 )
|
||||
{
|
||||
icon = icons[pMinecraft->player->GetXboxPad()];
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ void CocoaTile::spawnResources(Level *level, int x, int y, int z, int data, floa
|
||||
}
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
popResource(level, x, y, z, std::make_shared<ItemInstance>(Item::dye_powder, 1, DyePowderItem::BROWN));
|
||||
popResource(level, x, y, z, shared_ptr<ItemInstance>( new ItemInstance(Item::dye_powder, 1, DyePowderItem::BROWN) ));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Color::Color( float r, float g, float b)
|
||||
assert( b >= 0.0f && b <= 1.0f );
|
||||
|
||||
//argb
|
||||
colour = ( (0xFF<<24) | ( static_cast<int>(r * 255)<<16 ) | ( static_cast<int>(g * 255)<<8 ) | static_cast<int>(b * 255) );
|
||||
colour = ( (0xFF<<24) | ( (int)(r*255)<<16 ) | ( (int)(g*255)<<8 ) | ( (int)(b*255) ) );
|
||||
}
|
||||
|
||||
Color::Color( int r, int g, int b)
|
||||
@@ -43,7 +43,7 @@ Color Color::getHSBColor(float hue, float saturation, float brightness)
|
||||
int r = 0, g = 0, b = 0;
|
||||
if (saturation == 0)
|
||||
{
|
||||
r = g = b = static_cast<int>(brightness * 255.0f + 0.5f);
|
||||
r = g = b = (int) (brightness * 255.0f + 0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -52,37 +52,37 @@ Color Color::getHSBColor(float hue, float saturation, float brightness)
|
||||
float p = brightness * (1.0f - saturation);
|
||||
float q = brightness * (1.0f - saturation * f);
|
||||
float t = brightness * (1.0f - (saturation * (1.0f - f)));
|
||||
switch (static_cast<int>(h))
|
||||
switch ((int) h)
|
||||
{
|
||||
case 0:
|
||||
r = static_cast<int>(brightness * 255.0f + 0.5f);
|
||||
g = static_cast<int>(t * 255.0f + 0.5f);
|
||||
b = static_cast<int>(p * 255.0f + 0.5f);
|
||||
r = (int) (brightness * 255.0f + 0.5f);
|
||||
g = (int) (t * 255.0f + 0.5f);
|
||||
b = (int) (p * 255.0f + 0.5f);
|
||||
break;
|
||||
case 1:
|
||||
r = static_cast<int>(q * 255.0f + 0.5f);
|
||||
g = static_cast<int>(brightness * 255.0f + 0.5f);
|
||||
b = static_cast<int>(p * 255.0f + 0.5f);
|
||||
r = (int) (q * 255.0f + 0.5f);
|
||||
g = (int) (brightness * 255.0f + 0.5f);
|
||||
b = (int) (p * 255.0f + 0.5f);
|
||||
break;
|
||||
case 2:
|
||||
r = static_cast<int>(p * 255.0f + 0.5f);
|
||||
g = static_cast<int>(brightness * 255.0f + 0.5f);
|
||||
b = static_cast<int>(t * 255.0f + 0.5f);
|
||||
r = (int) (p * 255.0f + 0.5f);
|
||||
g = (int) (brightness * 255.0f + 0.5f);
|
||||
b = (int) (t * 255.0f + 0.5f);
|
||||
break;
|
||||
case 3:
|
||||
r = static_cast<int>(p * 255.0f + 0.5f);
|
||||
g = static_cast<int>(q * 255.0f + 0.5f);
|
||||
b = static_cast<int>(brightness * 255.0f + 0.5f);
|
||||
r = (int) (p * 255.0f + 0.5f);
|
||||
g = (int) (q * 255.0f + 0.5f);
|
||||
b = (int) (brightness * 255.0f + 0.5f);
|
||||
break;
|
||||
case 4:
|
||||
r = static_cast<int>(t * 255.0f + 0.5f);
|
||||
g = static_cast<int>(p * 255.0f + 0.5f);
|
||||
b = static_cast<int>(brightness * 255.0f + 0.5f);
|
||||
r = (int) (t * 255.0f + 0.5f);
|
||||
g = (int) (p * 255.0f + 0.5f);
|
||||
b = (int) (brightness * 255.0f + 0.5f);
|
||||
break;
|
||||
case 5:
|
||||
r = static_cast<int>(brightness * 255.0f + 0.5f);
|
||||
g = static_cast<int>(p * 255.0f + 0.5f);
|
||||
b = static_cast<int>(q * 255.0f + 0.5f);
|
||||
r = (int) (brightness * 255.0f + 0.5f);
|
||||
g = (int) (p * 255.0f + 0.5f);
|
||||
b = (int) (q * 255.0f + 0.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ ColoredTileItem::ColoredTileItem(int id, bool stackedByData) : TileItem(id)
|
||||
|
||||
ColoredTileItem::~ColoredTileItem()
|
||||
{
|
||||
if(descriptionPostfixes.data != nullptr) delete [] descriptionPostfixes.data;
|
||||
if(descriptionPostfixes.data != NULL) delete [] descriptionPostfixes.data;
|
||||
}
|
||||
|
||||
int ColoredTileItem::getColor(shared_ptr<ItemInstance> item, int spriteLayer)
|
||||
@@ -35,7 +35,7 @@ int ColoredTileItem::getLevelDataForAuxValue(int auxValue)
|
||||
|
||||
ColoredTileItem *ColoredTileItem::setDescriptionPostfixes(intArray descriptionPostfixes)
|
||||
{
|
||||
if(this->descriptionPostfixes.data != nullptr) delete this->descriptionPostfixes.data;
|
||||
if(this->descriptionPostfixes.data != NULL) delete this->descriptionPostfixes.data;
|
||||
this->descriptionPostfixes = intArray(descriptionPostfixes.length);
|
||||
for(unsigned int i = 0; i < descriptionPostfixes.length; ++i )
|
||||
{
|
||||
@@ -47,7 +47,7 @@ ColoredTileItem *ColoredTileItem::setDescriptionPostfixes(intArray descriptionPo
|
||||
|
||||
unsigned int ColoredTileItem::getDescriptionId(shared_ptr<ItemInstance> instance)
|
||||
{
|
||||
if (descriptionPostfixes.data == nullptr)
|
||||
if (descriptionPostfixes.data == NULL)
|
||||
{
|
||||
return TileItem::getDescriptionId(instance);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
CombatEntry::CombatEntry(DamageSource *source, int time, float health, float damage, CombatTracker::eLOCATION location, float fallDistance)
|
||||
{
|
||||
this->source = nullptr;
|
||||
if(source != nullptr)
|
||||
this->source = NULL;
|
||||
if(source != NULL)
|
||||
{
|
||||
// 4J: this might actually be a derived damage source so use copy func
|
||||
this->source = source->copy();
|
||||
@@ -61,7 +61,7 @@ CombatTracker::eLOCATION CombatEntry::getLocation()
|
||||
|
||||
wstring CombatEntry::getAttackerName()
|
||||
{
|
||||
return getSource()->getEntity() == nullptr ? L"" : getSource()->getEntity()->getNetworkName();
|
||||
return getSource()->getEntity() == NULL ? L"" : getSource()->getEntity()->getNetworkName();
|
||||
}
|
||||
|
||||
float CombatEntry::getFallDistance()
|
||||
|
||||
@@ -58,7 +58,7 @@ void CombatTracker::recordDamage(DamageSource *source, float health, float damag
|
||||
|
||||
shared_ptr<ChatPacket> CombatTracker::getDeathMessagePacket()
|
||||
{
|
||||
if (entries.size() == 0) return std::make_shared<ChatPacket>(mob->getNetworkName());
|
||||
if (entries.size() == 0) return shared_ptr<ChatPacket>(new ChatPacket(mob->getNetworkName()));
|
||||
|
||||
CombatEntry *knockOffEntry = getMostSignificantFall();
|
||||
CombatEntry *killingBlow = entries[entries.size() - 1];
|
||||
@@ -67,7 +67,7 @@ shared_ptr<ChatPacket> CombatTracker::getDeathMessagePacket()
|
||||
|
||||
shared_ptr<Entity> killingEntity = killingBlow->getSource()->getEntity();
|
||||
|
||||
if (knockOffEntry != nullptr && killingBlow->getSource()->equals(DamageSource::fall))
|
||||
if (knockOffEntry != NULL && killingBlow->getSource()->equals(DamageSource::fall))
|
||||
{
|
||||
shared_ptr<Entity> attackerEntity = knockOffEntry->getSource()->getEntity();
|
||||
|
||||
@@ -91,36 +91,36 @@ shared_ptr<ChatPacket> CombatTracker::getDeathMessagePacket()
|
||||
break;
|
||||
}
|
||||
|
||||
result = std::make_shared<ChatPacket>(mob->getNetworkName(), message);
|
||||
result = shared_ptr<ChatPacket>(new ChatPacket(mob->getNetworkName(), message));
|
||||
}
|
||||
else if (attackerEntity != nullptr && (killingEntity == nullptr || attackerEntity != killingEntity))
|
||||
else if (attackerEntity != NULL && (killingEntity == NULL || attackerEntity != killingEntity))
|
||||
{
|
||||
shared_ptr<ItemInstance> attackerItem = attackerEntity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast<LivingEntity>(attackerEntity)->getCarriedItem() : nullptr;
|
||||
|
||||
if (attackerItem != nullptr && attackerItem->hasCustomHoverName())
|
||||
if (attackerItem != NULL && attackerItem->hasCustomHoverName())
|
||||
{
|
||||
result = std::make_shared<ChatPacket>(mob->getNetworkName(), ChatPacket::e_ChatDeathFellAssistItem, attackerEntity->GetType(), attackerEntity->getNetworkName(), attackerItem->getHoverName());
|
||||
result = shared_ptr<ChatPacket>(new ChatPacket(mob->getNetworkName(), ChatPacket::e_ChatDeathFellAssistItem, attackerEntity->GetType(), attackerEntity->getNetworkName(), attackerItem->getHoverName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = std::make_shared<ChatPacket>(mob->getNetworkName(), ChatPacket::e_ChatDeathFellAssist, attackerEntity->GetType(), attackerEntity->getNetworkName());
|
||||
result = shared_ptr<ChatPacket>(new ChatPacket(mob->getNetworkName(), ChatPacket::e_ChatDeathFellAssist, attackerEntity->GetType(), attackerEntity->getNetworkName()));
|
||||
}
|
||||
}
|
||||
else if (killingEntity != nullptr)
|
||||
else if (killingEntity != NULL)
|
||||
{
|
||||
shared_ptr<ItemInstance> killerItem = killingEntity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast<LivingEntity>(killingEntity)->getCarriedItem() : nullptr;
|
||||
if (killerItem != nullptr && killerItem->hasCustomHoverName())
|
||||
if (killerItem != NULL && killerItem->hasCustomHoverName())
|
||||
{
|
||||
result = std::make_shared<ChatPacket>(mob->getNetworkName(), ChatPacket::e_ChatDeathFellFinishItem, killingEntity->GetType(), killingEntity->getNetworkName(), killerItem->getHoverName());
|
||||
result = shared_ptr<ChatPacket>(new ChatPacket(mob->getNetworkName(), ChatPacket::e_ChatDeathFellFinishItem, killingEntity->GetType(), killingEntity->getNetworkName(), killerItem->getHoverName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = std::make_shared<ChatPacket>(mob->getNetworkName(), ChatPacket::e_ChatDeathFellFinish, killingEntity->GetType(), killingEntity->getNetworkName());
|
||||
result = shared_ptr<ChatPacket>(new ChatPacket(mob->getNetworkName(), ChatPacket::e_ChatDeathFellFinish, killingEntity->GetType(), killingEntity->getNetworkName()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = std::make_shared<ChatPacket>(mob->getNetworkName(), ChatPacket::e_ChatDeathFellKiller);
|
||||
result = shared_ptr<ChatPacket>(new ChatPacket(mob->getNetworkName(), ChatPacket::e_ChatDeathFellKiller));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -140,20 +140,20 @@ shared_ptr<LivingEntity> CombatTracker::getKiller()
|
||||
|
||||
for ( CombatEntry *entry : entries )
|
||||
{
|
||||
if ( entry->getSource() != nullptr && entry->getSource()->getEntity() != nullptr && entry->getSource()->getEntity()->instanceof(eTYPE_PLAYER) && (bestPlayer == nullptr || entry->getDamage() > bestPlayerDamage))
|
||||
if ( entry->getSource() != NULL && entry->getSource()->getEntity() != NULL && entry->getSource()->getEntity()->instanceof(eTYPE_PLAYER) && (bestPlayer == NULL || entry->getDamage() > bestPlayerDamage))
|
||||
{
|
||||
bestPlayerDamage = entry->getDamage();
|
||||
bestPlayer = dynamic_pointer_cast<Player>(entry->getSource()->getEntity());
|
||||
}
|
||||
|
||||
if ( entry->getSource() != nullptr && entry->getSource()->getEntity() != nullptr && entry->getSource()->getEntity()->instanceof(eTYPE_LIVINGENTITY) && (bestMob == nullptr || entry->getDamage() > bestMobDamage))
|
||||
if ( entry->getSource() != NULL && entry->getSource()->getEntity() != NULL && entry->getSource()->getEntity()->instanceof(eTYPE_LIVINGENTITY) && (bestMob == NULL || entry->getDamage() > bestMobDamage))
|
||||
{
|
||||
bestMobDamage = entry->getDamage();
|
||||
bestMob = dynamic_pointer_cast<LivingEntity>(entry->getSource()->getEntity());
|
||||
}
|
||||
}
|
||||
|
||||
if (bestPlayer != nullptr && bestPlayerDamage >= bestMobDamage / 3)
|
||||
if (bestPlayer != NULL && bestPlayerDamage >= bestMobDamage / 3)
|
||||
{
|
||||
return bestPlayer;
|
||||
}
|
||||
@@ -165,20 +165,20 @@ shared_ptr<LivingEntity> CombatTracker::getKiller()
|
||||
|
||||
CombatEntry *CombatTracker::getMostSignificantFall()
|
||||
{
|
||||
CombatEntry *result = nullptr;
|
||||
CombatEntry *alternative = nullptr;
|
||||
CombatEntry *result = NULL;
|
||||
CombatEntry *alternative = NULL;
|
||||
int altDamage = 0;
|
||||
float bestFall = 0;
|
||||
|
||||
for (size_t i = 0; i < entries.size(); i++)
|
||||
for (int i = 0; i < entries.size(); i++)
|
||||
{
|
||||
CombatEntry *entry = entries.at(i);
|
||||
CombatEntry *previous = i > 0 ? entries.at(i - 1) : nullptr;
|
||||
CombatEntry *previous = i > 0 ? entries.at(i - 1) : NULL;
|
||||
|
||||
bool isFall = entry->getSource()->equals(DamageSource::fall);
|
||||
bool isOutOfWorld = entry->getSource()->equals(DamageSource::outOfWorld);
|
||||
|
||||
if ((isFall || isOutOfWorld) && (entry->getFallDistance() > 0) && (result == nullptr || entry->getFallDistance() > bestFall))
|
||||
if ((isFall || isOutOfWorld) && (entry->getFallDistance() > 0) && (result == NULL || entry->getFallDistance() > bestFall))
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
@@ -191,23 +191,23 @@ CombatEntry *CombatTracker::getMostSignificantFall()
|
||||
bestFall = entry->getFallDistance();
|
||||
}
|
||||
|
||||
if (entry->getLocation() != eLocation_GENERIC && (alternative == nullptr || entry->getDamage() > altDamage))
|
||||
if (entry->getLocation() != eLocation_GENERIC && (alternative == NULL || entry->getDamage() > altDamage))
|
||||
{
|
||||
alternative = entry;
|
||||
}
|
||||
}
|
||||
|
||||
if (bestFall > 5 && result != nullptr)
|
||||
if (bestFall > 5 && result != NULL)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
else if (altDamage > 5 && alternative != nullptr)
|
||||
else if (altDamage > 5 && alternative != NULL)
|
||||
{
|
||||
return alternative;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user