mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 05:49:56 +00:00
Merge remote-tracking branch 'zini/master' into animation2
Conflicts: apps/openmw/mwworld/worldimp.cpp
This commit is contained in:
commit
4bd1e63ac1
1 changed files with 25 additions and 23 deletions
|
@ -303,26 +303,26 @@ namespace MWWorld
|
|||
{
|
||||
return mGlobalVariables->getGlobals();
|
||||
}
|
||||
|
||||
|
||||
std::string World::getCurrentCellName () const
|
||||
{
|
||||
std::string name;
|
||||
|
||||
Ptr::CellStore *cell = mWorldScene->getCurrentCell();
|
||||
if (cell->mCell->isExterior())
|
||||
{
|
||||
{
|
||||
if (cell->mCell->mName != "")
|
||||
{
|
||||
{
|
||||
name = cell->mCell->mName;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
const ESM::Region* region =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Region>().search(cell->mCell->mRegion);
|
||||
if (region)
|
||||
name = region->mName;
|
||||
else
|
||||
{
|
||||
{
|
||||
const ESM::GameSetting *setting =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().search("sDefaultCellname");
|
||||
|
||||
|
@ -332,13 +332,13 @@ namespace MWWorld
|
|||
name = "Wilderness";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
name = cell->mCell->mName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
@ -427,12 +427,12 @@ namespace MWWorld
|
|||
if (!reference.getRefData().isEnabled())
|
||||
{
|
||||
reference.getRefData().enable();
|
||||
|
||||
|
||||
if(mWorldScene->getActiveCells().find (reference.getCell()) != mWorldScene->getActiveCells().end() && reference.getRefData().getCount())
|
||||
mWorldScene->addObjectToScene (reference);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void World::removeContainerScripts(const Ptr& reference)
|
||||
{
|
||||
if( reference.getTypeName()==typeid (ESM::Container).name() ||
|
||||
|
@ -457,7 +457,7 @@ namespace MWWorld
|
|||
if (reference.getRefData().isEnabled())
|
||||
{
|
||||
reference.getRefData().disable();
|
||||
|
||||
|
||||
if(mWorldScene->getActiveCells().find (reference.getCell())!=mWorldScene->getActiveCells().end() && reference.getRefData().getCount())
|
||||
mWorldScene->removeObjectFromScene (reference);
|
||||
}
|
||||
|
@ -688,14 +688,14 @@ namespace MWWorld
|
|||
void World::moveObject(const Ptr &ptr, CellStore &newCell, float x, float y, float z)
|
||||
{
|
||||
ESM::Position &pos = ptr.getRefData().getPosition();
|
||||
pos.pos[0] = x, pos.pos[1] = y, pos.pos[2] = z;
|
||||
pos.pos[0] = x;
|
||||
pos.pos[1] = y;
|
||||
pos.pos[2] = z;
|
||||
Ogre::Vector3 vec(x, y, z);
|
||||
|
||||
CellStore *currCell = ptr.getCell();
|
||||
bool isPlayer = ptr == mPlayer->getPlayer();
|
||||
bool haveToMove = mWorldScene->isCellActive(*currCell) || isPlayer;
|
||||
|
||||
removeContainerScripts(ptr);
|
||||
|
||||
if (*currCell != newCell)
|
||||
{
|
||||
|
@ -719,6 +719,7 @@ namespace MWWorld
|
|||
MWWorld::Class::get(ptr).copyToCell(ptr, newCell);
|
||||
mWorldScene->removeObjectFromScene(ptr);
|
||||
mLocalScripts.remove(ptr);
|
||||
removeContainerScripts (ptr);
|
||||
haveToMove = false;
|
||||
}
|
||||
else
|
||||
|
@ -726,17 +727,18 @@ namespace MWWorld
|
|||
MWWorld::Ptr copy =
|
||||
MWWorld::Class::get(ptr).copyToCell(ptr, newCell);
|
||||
|
||||
addContainerScripts(copy, &newCell);
|
||||
|
||||
mRendering->moveObjectToCell(copy, vec, currCell);
|
||||
MWBase::MechanicsManager *mechMgr = MWBase::Environment::get().getMechanicsManager();
|
||||
mechMgr->updateCell(copy);
|
||||
|
||||
std::string script = MWWorld::Class::get(ptr).getScript(ptr);
|
||||
if(!script.empty())
|
||||
std::string script =
|
||||
MWWorld::Class::get(ptr).getScript(ptr);
|
||||
if (!script.empty())
|
||||
{
|
||||
mLocalScripts.remove(ptr);
|
||||
removeContainerScripts (ptr);
|
||||
mLocalScripts.add(script, copy);
|
||||
addContainerScripts (copy, &newCell);
|
||||
}
|
||||
}
|
||||
ptr.getRefData().setCount(0);
|
||||
|
|
Loading…
Reference in a new issue