mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 07:23:52 +00:00
local scripts, move placing to World::placeObject(Ptr, CellStore, Position)
This commit is contained in:
parent
d5fe378a66
commit
bcc47cd5fb
3 changed files with 27 additions and 6 deletions
|
@ -54,6 +54,14 @@ namespace MWBase
|
||||||
World& operator= (const World&);
|
World& operator= (const World&);
|
||||||
///< not implemented
|
///< not implemented
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void
|
||||||
|
placeObject(
|
||||||
|
const MWWorld::Ptr &ptr,
|
||||||
|
MWWorld::CellStore &cell,
|
||||||
|
const ESM::Position &pos) = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum RenderMode
|
enum RenderMode
|
||||||
|
|
|
@ -1021,8 +1021,7 @@ namespace MWWorld
|
||||||
pos.pos[1] = -result.second[2];
|
pos.pos[1] = -result.second[2];
|
||||||
pos.pos[2] = result.second[1];
|
pos.pos[2] = result.second[1];
|
||||||
|
|
||||||
MWWorld::Ptr dropped = cell->insertObject(object, pos);
|
placeObject(object, *cell, pos);
|
||||||
mWorldScene->addObjectToScene(dropped);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1038,6 +1037,20 @@ namespace MWWorld
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
World::placeObject(const Ptr &object, CellStore &cell, const ESM::Position &pos)
|
||||||
|
{
|
||||||
|
mLocalScripts.remove(object);
|
||||||
|
|
||||||
|
MWWorld::Ptr dropped = cell.insertObject(object, pos);
|
||||||
|
mWorldScene->addObjectToScene(dropped);
|
||||||
|
|
||||||
|
std::string script = MWWorld::Class::get(dropped).getScript(dropped);
|
||||||
|
if (!script.empty()) {
|
||||||
|
mLocalScripts.add(script, dropped);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void World::dropObjectOnGround (const Ptr& object)
|
void World::dropObjectOnGround (const Ptr& object)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr::CellStore* cell = getPlayer().getPlayer().getCell();
|
MWWorld::Ptr::CellStore* cell = getPlayer().getPlayer().getCell();
|
||||||
|
@ -1046,10 +1059,7 @@ namespace MWWorld
|
||||||
getPlayer().getPlayer().getRefData().getPosition();
|
getPlayer().getPlayer().getRefData().getPosition();
|
||||||
|
|
||||||
/// \todo fix item dropping at player object center position
|
/// \todo fix item dropping at player object center position
|
||||||
|
placeObject(object, *cell, pos);
|
||||||
MWWorld::Ptr dropped = cell->insertObject(object, pos);
|
|
||||||
|
|
||||||
mWorldScene->addObjectToScene(dropped);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::processChangedSettings(const Settings::CategorySettingVector& settings)
|
void World::processChangedSettings(const Settings::CategorySettingVector& settings)
|
||||||
|
|
|
@ -89,6 +89,9 @@ namespace MWWorld
|
||||||
bool moveObjectImp (const Ptr& ptr, float x, float y, float z);
|
bool moveObjectImp (const Ptr& ptr, float x, float y, float z);
|
||||||
///< @return true if the active cell (cell player is in) changed
|
///< @return true if the active cell (cell player is in) changed
|
||||||
|
|
||||||
|
virtual void
|
||||||
|
placeObject(const Ptr &ptr, CellStore &cell, const ESM::Position &pos);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
World (OEngine::Render::OgreRenderer& renderer,
|
World (OEngine::Render::OgreRenderer& renderer,
|
||||||
|
|
Loading…
Reference in a new issue