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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user