forked from mirror/openmw-tes3mp
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 from(pos.x, pos.y, pos.z);
|
||||||
btVector3 to(newPos.x, newPos.y, newPos.z);
|
btVector3 to(newPos.x, newPos.y, newPos.z);
|
||||||
std::vector<std::pair<float, std::string> > collisions = mPhysEngine->rayTest2(from, to);
|
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);
|
MWWorld::Ptr obstacle = searchPtrViaHandle(cIt->second);
|
||||||
if (obstacle.isEmpty())
|
|
||||||
{
|
|
||||||
// Terrain. TODO: Explode
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (obstacle == ptr)
|
if (obstacle == ptr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
explode = true;
|
||||||
|
|
||||||
MWWorld::Ptr caster = searchPtrViaHandle(it->second.mActorHandle);
|
MWWorld::Ptr caster = searchPtrViaHandle(it->second.mActorHandle);
|
||||||
if (caster.isEmpty())
|
if (caster.isEmpty())
|
||||||
caster = obstacle;
|
caster = obstacle;
|
||||||
|
if (obstacle.isEmpty())
|
||||||
|
{
|
||||||
|
// Terrain
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
MWMechanics::CastSpell cast(caster, obstacle);
|
MWMechanics::CastSpell cast(caster, obstacle);
|
||||||
cast.mStack = it->second.mStack;
|
cast.mStack = it->second.mStack;
|
||||||
cast.mId = it->second.mId;
|
cast.mId = it->second.mId;
|
||||||
cast.mSourceName = it->second.mSourceName;
|
cast.mSourceName = it->second.mSourceName;
|
||||||
cast.inflict(obstacle, caster, it->second.mEffects, ESM::RT_Target, false);
|
cast.inflict(obstacle, caster, it->second.mEffects, ESM::RT_Target, false);
|
||||||
|
}
|
||||||
|
|
||||||
deleteObject(ptr);
|
deleteObject(ptr);
|
||||||
mProjectiles.erase(it++);
|
mProjectiles.erase(it++);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (explode)
|
||||||
|
{
|
||||||
|
// TODO: Explode
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue