mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 19:45:32 +00:00
Fix some problems with the previous commit
This commit is contained in:
parent
076cc9230b
commit
b82ee4b44f
1 changed files with 22 additions and 11 deletions
|
@ -2163,27 +2163,38 @@ namespace MWWorld
|
|||
btVector3 from(pos.x, pos.y, pos.z);
|
||||
btVector3 to(newPos.x, newPos.y, newPos.z);
|
||||
std::vector<std::pair<float, std::string> > collisions = mPhysEngine->rayTest2(from, to);
|
||||
for (std::vector<std::pair<float, std::string> >::iterator cIt = collisions.begin(); cIt != collisions.end(); ++cIt)
|
||||
bool explode = false;
|
||||
for (std::vector<std::pair<float, std::string> >::iterator cIt = collisions.begin(); cIt != collisions.end() && !explode; ++cIt)
|
||||
{
|
||||
MWWorld::Ptr obstacle = searchPtrViaHandle(cIt->second);
|
||||
if (obstacle.isEmpty())
|
||||
{
|
||||
// Terrain. TODO: Explode
|
||||
continue;
|
||||
}
|
||||
if (obstacle == ptr)
|
||||
continue;
|
||||
|
||||
explode = true;
|
||||
|
||||
MWWorld::Ptr caster = searchPtrViaHandle(it->second.mActorHandle);
|
||||
if (caster.isEmpty())
|
||||
caster = obstacle;
|
||||
MWMechanics::CastSpell cast(caster, obstacle);
|
||||
cast.mStack = it->second.mStack;
|
||||
cast.mId = it->second.mId;
|
||||
cast.mSourceName = it->second.mSourceName;
|
||||
cast.inflict(obstacle, caster, it->second.mEffects, ESM::RT_Target, false);
|
||||
if (obstacle.isEmpty())
|
||||
{
|
||||
// Terrain
|
||||
}
|
||||
else
|
||||
{
|
||||
MWMechanics::CastSpell cast(caster, obstacle);
|
||||
cast.mStack = it->second.mStack;
|
||||
cast.mId = it->second.mId;
|
||||
cast.mSourceName = it->second.mSourceName;
|
||||
cast.inflict(obstacle, caster, it->second.mEffects, ESM::RT_Target, false);
|
||||
}
|
||||
|
||||
deleteObject(ptr);
|
||||
mProjectiles.erase(it++);
|
||||
}
|
||||
|
||||
if (explode)
|
||||
{
|
||||
// TODO: Explode
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue