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,10 +72,10 @@ void Explosion::explode()
|
||||
if (t > 0)
|
||||
{
|
||||
Tile *tile = Tile::tiles[t];
|
||||
float resistance = source != nullptr ? source->getTileExplosionResistance(this, level, xt, yt, zt, tile) : tile->getExplosionResistance(source);
|
||||
float resistance = source != NULL ? source->getTileExplosionResistance(this, level, xt, yt, zt, tile) : tile->getExplosionResistance(source);
|
||||
remainingPower -= (resistance + 0.3f) * stepSize;
|
||||
}
|
||||
if (remainingPower > 0&& (source == nullptr || source->shouldTileExplode(this, level, xt, yt, zt, t, remainingPower)))
|
||||
if (remainingPower > 0&& (source == NULL || source->shouldTileExplode(this, level, xt, yt, zt, t, remainingPower)))
|
||||
{
|
||||
toBlow.insert(TilePos(xt, yt, zt));
|
||||
}
|
||||
@@ -143,7 +143,7 @@ void Explosion::explode()
|
||||
|
||||
double sp = level->getSeenPercent(center, e->bb);
|
||||
double pow = (1 - dist) * sp;
|
||||
if(canDamage) e->hurt(DamageSource::explosion(this), static_cast<int>((pow * pow + pow) / 2 * 8 * r + 1));
|
||||
if(canDamage) e->hurt(DamageSource::explosion(this), (int) ((pow * pow + pow) / 2 * 8 * r + 1));
|
||||
|
||||
double kbPower = ProtectionEnchantment::getExplosionKnockbackAfterDampener(e, pow);
|
||||
e->xd += xa *kbPower;
|
||||
@@ -163,7 +163,7 @@ void Explosion::explode()
|
||||
}
|
||||
|
||||
|
||||
void Explosion::finalizeExplosion(bool generateParticles, vector<TilePos> *toBlowDirect/*=nullptr*/) // 4J - added toBlowDirect parameter
|
||||
void Explosion::finalizeExplosion(bool generateParticles, vector<TilePos> *toBlowDirect/*=NULL*/) // 4J - added toBlowDirect parameter
|
||||
{
|
||||
level->playSound(x, y, z, eSoundType_RANDOM_EXPLODE, 4, (1 + (level->random->nextFloat() - level->random->nextFloat()) * 0.2f) * 0.7f);
|
||||
if (r < 2 || !destroyBlocks)
|
||||
@@ -185,7 +185,7 @@ void Explosion::finalizeExplosion(bool generateParticles, vector<TilePos> *toBlo
|
||||
app.DebugPrintf("Finalizing explosion size %d\n",toBlow.size());
|
||||
static const int MAX_EXPLODE_PARTICLES = 50;
|
||||
// 4J - try and make at most MAX_EXPLODE_PARTICLES pairs of particles
|
||||
int fraction = static_cast<int>(toBlowArray->size()) / MAX_EXPLODE_PARTICLES;
|
||||
int fraction = (int)toBlowArray->size() / MAX_EXPLODE_PARTICLES;
|
||||
if( fraction == 0 ) fraction = 1;
|
||||
size_t j = toBlowArray->size() - 1;
|
||||
//for (size_t j = toBlowArray->size() - 1; j >= 0; j--)
|
||||
@@ -262,7 +262,7 @@ void Explosion::finalizeExplosion(bool generateParticles, vector<TilePos> *toBlo
|
||||
}
|
||||
|
||||
PIXEndNamedEvent();
|
||||
if( toBlowDirect == nullptr ) delete toBlowArray;
|
||||
if( toBlowDirect == NULL ) delete toBlowArray;
|
||||
}
|
||||
|
||||
Explosion::playerVec3Map *Explosion::getHitPlayers()
|
||||
@@ -281,7 +281,7 @@ Vec3 *Explosion::getHitPlayerKnockback( shared_ptr<Player> player )
|
||||
|
||||
shared_ptr<LivingEntity> Explosion::getSourceMob()
|
||||
{
|
||||
if (source == nullptr) return nullptr;
|
||||
if (source == NULL) return nullptr;
|
||||
if (source->instanceof(eTYPE_PRIMEDTNT)) return dynamic_pointer_cast<PrimedTnt>(source)->getOwner();
|
||||
if (source->instanceof(eTYPE_LIVINGENTITY)) return dynamic_pointer_cast<LivingEntity>(source);
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user