forked from teamnwah/openmw-tes3coop
Merge branch 'master' of https://github.com/OpenMW/openmw
This commit is contained in:
commit
2601b26217
16 changed files with 136 additions and 73 deletions
|
@ -154,9 +154,11 @@ void Launcher::DataFilesPage::setProfile(int index, bool savePrevious)
|
||||||
{
|
{
|
||||||
if (index >= -1 && index < ui.profilesComboBox->count())
|
if (index >= -1 && index < ui.profilesComboBox->count())
|
||||||
{
|
{
|
||||||
QString previous = ui.profilesComboBox->itemText(ui.profilesComboBox->currentIndex());
|
QString previous = mPreviousProfile;
|
||||||
QString current = ui.profilesComboBox->itemText(index);
|
QString current = ui.profilesComboBox->itemText(index);
|
||||||
|
|
||||||
|
mPreviousProfile = current;
|
||||||
|
|
||||||
setProfile (previous, current, savePrevious);
|
setProfile (previous, current, savePrevious);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,9 +169,6 @@ void Launcher::DataFilesPage::setProfile (const QString &previous, const QString
|
||||||
if (previous == current)
|
if (previous == current)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (previous.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!previous.isEmpty() && savePrevious)
|
if (!previous.isEmpty() && savePrevious)
|
||||||
saveSettings (previous);
|
saveSettings (previous);
|
||||||
|
|
||||||
|
@ -207,12 +206,16 @@ void Launcher::DataFilesPage::slotProfileRenamed(const QString &previous, const
|
||||||
|
|
||||||
void Launcher::DataFilesPage::slotProfileChanged(int index)
|
void Launcher::DataFilesPage::slotProfileChanged(int index)
|
||||||
{
|
{
|
||||||
|
// in case the event was triggered externally
|
||||||
|
if (ui.profilesComboBox->currentIndex() != index)
|
||||||
|
ui.profilesComboBox->setCurrentIndex(index);
|
||||||
|
|
||||||
setProfile (index, true);
|
setProfile (index, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher::DataFilesPage::on_newProfileAction_triggered()
|
void Launcher::DataFilesPage::on_newProfileAction_triggered()
|
||||||
{
|
{
|
||||||
if (!mProfileDialog->exec() == QDialog::Accepted)
|
if (mProfileDialog->exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString profile = mProfileDialog->lineEdit()->text();
|
QString profile = mProfileDialog->lineEdit()->text();
|
||||||
|
@ -222,9 +225,10 @@ void Launcher::DataFilesPage::on_newProfileAction_triggered()
|
||||||
|
|
||||||
saveSettings();
|
saveSettings();
|
||||||
|
|
||||||
mSelector->clearCheckStates();
|
mLauncherSettings.setValue(QString("Profiles/currentprofile"), profile);
|
||||||
|
|
||||||
addProfile(profile, true);
|
addProfile(profile, true);
|
||||||
|
mSelector->clearCheckStates();
|
||||||
|
|
||||||
mSelector->setGameFile();
|
mSelector->setGameFile();
|
||||||
|
|
||||||
|
@ -238,10 +242,8 @@ void Launcher::DataFilesPage::addProfile (const QString &profile, bool setAsCurr
|
||||||
if (profile.isEmpty())
|
if (profile.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ui.profilesComboBox->findText (profile) != -1)
|
if (ui.profilesComboBox->findText (profile) == -1)
|
||||||
return;
|
ui.profilesComboBox->addItem (profile);
|
||||||
|
|
||||||
ui.profilesComboBox->addItem (profile);
|
|
||||||
|
|
||||||
if (setAsCurrent)
|
if (setAsCurrent)
|
||||||
setProfile (ui.profilesComboBox->findText (profile), false);
|
setProfile (ui.profilesComboBox->findText (profile), false);
|
||||||
|
@ -257,10 +259,12 @@ void Launcher::DataFilesPage::on_deleteProfileAction_triggered()
|
||||||
if (!showDeleteMessageBox (profile))
|
if (!showDeleteMessageBox (profile))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Remove the profile from the combobox
|
// this should work since the Default profile can't be deleted and is always index 0
|
||||||
ui.profilesComboBox->removeItem (ui.profilesComboBox->findText (profile));
|
int next = ui.profilesComboBox->currentIndex()-1;
|
||||||
|
ui.profilesComboBox->setCurrentIndex(next);
|
||||||
|
|
||||||
removeProfile(profile);
|
removeProfile(profile);
|
||||||
|
ui.profilesComboBox->removeItem(ui.profilesComboBox->findText(profile));
|
||||||
|
|
||||||
saveSettings();
|
saveSettings();
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,8 @@ namespace Launcher
|
||||||
Config::GameSettings &mGameSettings;
|
Config::GameSettings &mGameSettings;
|
||||||
Config::LauncherSettings &mLauncherSettings;
|
Config::LauncherSettings &mLauncherSettings;
|
||||||
|
|
||||||
|
QString mPreviousProfile;
|
||||||
|
|
||||||
QString mDataLocal;
|
QString mDataLocal;
|
||||||
|
|
||||||
void setPluginsCheckstates(Qt::CheckState state);
|
void setPluginsCheckstates(Qt::CheckState state);
|
||||||
|
|
|
@ -281,7 +281,8 @@ namespace MWBase
|
||||||
virtual void deleteObject (const MWWorld::Ptr& ptr) = 0;
|
virtual void deleteObject (const MWWorld::Ptr& ptr) = 0;
|
||||||
virtual void undeleteObject (const MWWorld::Ptr& ptr) = 0;
|
virtual void undeleteObject (const MWWorld::Ptr& ptr) = 0;
|
||||||
|
|
||||||
virtual void moveObject (const MWWorld::Ptr& ptr, float x, float y, float z) = 0;
|
virtual MWWorld::Ptr moveObject (const MWWorld::Ptr& ptr, float x, float y, float z) = 0;
|
||||||
|
///< @return an updated Ptr in case the Ptr's cell changes
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
moveObject(const MWWorld::Ptr &ptr, MWWorld::CellStore* newCell, float x, float y, float z) = 0;
|
moveObject(const MWWorld::Ptr &ptr, MWWorld::CellStore* newCell, float x, float y, float z) = 0;
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace MWMechanics
|
||||||
* +---------------->
|
* +---------------->
|
||||||
* high cost
|
* high cost
|
||||||
*/
|
*/
|
||||||
bool PathgridGraph::load(const ESM::Cell* cell)
|
bool PathgridGraph::load(const MWWorld::CellStore *cell)
|
||||||
{
|
{
|
||||||
if(!cell)
|
if(!cell)
|
||||||
return false;
|
return false;
|
||||||
|
@ -103,10 +103,9 @@ namespace MWMechanics
|
||||||
if(mIsGraphConstructed)
|
if(mIsGraphConstructed)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
mCell = cell;
|
mCell = cell->getCell();
|
||||||
mIsExterior = cell->isExterior();
|
mIsExterior = cell->getCell()->isExterior();
|
||||||
mPathgrid = MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*cell);
|
mPathgrid = MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*cell->getCell());
|
||||||
|
|
||||||
if(!mPathgrid)
|
if(!mPathgrid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace MWMechanics
|
||||||
public:
|
public:
|
||||||
PathgridGraph();
|
PathgridGraph();
|
||||||
|
|
||||||
bool load(const ESM::Cell *cell);
|
bool load(const MWWorld::CellStore *cell);
|
||||||
|
|
||||||
// returns true if end point is strongly connected (i.e. reachable
|
// returns true if end point is strongly connected (i.e. reachable
|
||||||
// from start point) both start and end are pathgrid point indexes
|
// from start point) both start and end are pathgrid point indexes
|
||||||
|
|
|
@ -231,8 +231,9 @@ void Debugging::togglePathgrid()
|
||||||
|
|
||||||
void Debugging::enableCellPathgrid(MWWorld::CellStore *store)
|
void Debugging::enableCellPathgrid(MWWorld::CellStore *store)
|
||||||
{
|
{
|
||||||
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
const ESM::Pathgrid *pathgrid =
|
const ESM::Pathgrid *pathgrid =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*store->getCell());
|
world->getStore().get<ESM::Pathgrid>().search(*store->getCell());
|
||||||
if (!pathgrid) return;
|
if (!pathgrid) return;
|
||||||
|
|
||||||
Vector3 cellPathGridPos(0, 0, 0);
|
Vector3 cellPathGridPos(0, 0, 0);
|
||||||
|
|
|
@ -589,4 +589,10 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
return mTargetId;
|
return mTargetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InterpreterContext::updatePtr(const MWWorld::Ptr& updated)
|
||||||
|
{
|
||||||
|
if (!mReference.isEmpty())
|
||||||
|
mReference = updated;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,6 +169,9 @@ namespace MWScript
|
||||||
MWWorld::Ptr getReference(bool required=true);
|
MWWorld::Ptr getReference(bool required=true);
|
||||||
///< Reference, that the script is running from (can be empty)
|
///< Reference, that the script is running from (can be empty)
|
||||||
|
|
||||||
|
void updatePtr(const MWWorld::Ptr& updated);
|
||||||
|
///< Update the Ptr stored in mReference, if there is one stored there. Should be called after the reference has been moved to a new cell.
|
||||||
|
|
||||||
virtual std::string getTargetId() const;
|
virtual std::string getTargetId() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,20 +224,23 @@ namespace MWScript
|
||||||
float ay = ptr.getRefData().getPosition().pos[1];
|
float ay = ptr.getRefData().getPosition().pos[1];
|
||||||
float az = ptr.getRefData().getPosition().pos[2];
|
float az = ptr.getRefData().getPosition().pos[2];
|
||||||
|
|
||||||
|
MWWorld::Ptr updated = ptr;
|
||||||
if(axis == "x")
|
if(axis == "x")
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->moveObject(ptr,pos,ay,az);
|
updated = MWBase::Environment::get().getWorld()->moveObject(ptr,pos,ay,az);
|
||||||
}
|
}
|
||||||
else if(axis == "y")
|
else if(axis == "y")
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->moveObject(ptr,ax,pos,az);
|
updated = MWBase::Environment::get().getWorld()->moveObject(ptr,ax,pos,az);
|
||||||
}
|
}
|
||||||
else if(axis == "z")
|
else if(axis == "z")
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->moveObject(ptr,ax,ay,pos);
|
updated = MWBase::Environment::get().getWorld()->moveObject(ptr,ax,ay,pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::runtime_error ("invalid axis: " + axis);
|
throw std::runtime_error ("invalid axis: " + axis);
|
||||||
|
|
||||||
|
dynamic_cast<MWScript::InterpreterContext&>(runtime.getContext()).updatePtr(updated);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -317,6 +320,8 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->moveObject(ptr,store,x,y,z);
|
MWBase::Environment::get().getWorld()->moveObject(ptr,store,x,y,z);
|
||||||
ptr = MWWorld::Ptr(ptr.getBase(), store);
|
ptr = MWWorld::Ptr(ptr.getBase(), store);
|
||||||
|
dynamic_cast<MWScript::InterpreterContext&>(runtime.getContext()).updatePtr(ptr);
|
||||||
|
|
||||||
float ax = Ogre::Radian(ptr.getRefData().getPosition().rot[0]).valueDegrees();
|
float ax = Ogre::Radian(ptr.getRefData().getPosition().rot[0]).valueDegrees();
|
||||||
float ay = Ogre::Radian(ptr.getRefData().getPosition().rot[1]).valueDegrees();
|
float ay = Ogre::Radian(ptr.getRefData().getPosition().rot[1]).valueDegrees();
|
||||||
// Note that you must specify ZRot in minutes (1 degree = 60 minutes; north = 0, east = 5400, south = 10800, west = 16200)
|
// Note that you must specify ZRot in minutes (1 degree = 60 minutes; north = 0, east = 5400, south = 10800, west = 16200)
|
||||||
|
@ -365,15 +370,18 @@ namespace MWScript
|
||||||
|
|
||||||
// another morrowind oddity: player will be moved to the exterior cell at this location,
|
// another morrowind oddity: player will be moved to the exterior cell at this location,
|
||||||
// non-player actors will move within the cell they are in.
|
// non-player actors will move within the cell they are in.
|
||||||
|
MWWorld::Ptr updated;
|
||||||
if (ptr.getRefData().getHandle() == "player")
|
if (ptr.getRefData().getHandle() == "player")
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->moveObject(ptr,
|
MWWorld::CellStore* cell = MWBase::Environment::get().getWorld()->getExterior(cx,cy);
|
||||||
MWBase::Environment::get().getWorld()->getExterior(cx,cy),x,y,z);
|
MWBase::Environment::get().getWorld()->moveObject(ptr,cell,x,y,z);
|
||||||
|
updated = MWWorld::Ptr(ptr.getBase(), cell);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->moveObject(ptr, x, y, z);
|
updated = MWBase::Environment::get().getWorld()->moveObject(ptr, x, y, z);
|
||||||
}
|
}
|
||||||
|
dynamic_cast<MWScript::InterpreterContext&>(runtime.getContext()).updatePtr(updated);
|
||||||
|
|
||||||
float ax = Ogre::Radian(ptr.getRefData().getPosition().rot[0]).valueDegrees();
|
float ax = Ogre::Radian(ptr.getRefData().getPosition().rot[0]).valueDegrees();
|
||||||
float ay = Ogre::Radian(ptr.getRefData().getPosition().rot[1]).valueDegrees();
|
float ay = Ogre::Radian(ptr.getRefData().getPosition().rot[1]).valueDegrees();
|
||||||
|
@ -640,8 +648,10 @@ namespace MWScript
|
||||||
ptr.getRefData().setLocalRotation(rot);
|
ptr.getRefData().setLocalRotation(rot);
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld()->rotateObject(ptr, 0,0,0,true);
|
MWBase::Environment::get().getWorld()->rotateObject(ptr, 0,0,0,true);
|
||||||
MWBase::Environment::get().getWorld()->moveObject(ptr, ptr.getCellRef().getPosition().pos[0],
|
|
||||||
ptr.getCellRef().getPosition().pos[1], ptr.getCellRef().getPosition().pos[2]);
|
dynamic_cast<MWScript::InterpreterContext&>(runtime.getContext()).updatePtr(
|
||||||
|
MWBase::Environment::get().getWorld()->moveObject(ptr, ptr.getCellRef().getPosition().pos[0],
|
||||||
|
ptr.getCellRef().getPosition().pos[1], ptr.getCellRef().getPosition().pos[2]));
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -680,7 +690,8 @@ namespace MWScript
|
||||||
throw std::runtime_error ("invalid movement axis: " + axis);
|
throw std::runtime_error ("invalid movement axis: " + axis);
|
||||||
|
|
||||||
Ogre::Vector3 worldPos = ptr.getRefData().getBaseNode()->convertLocalToWorldPosition(posChange);
|
Ogre::Vector3 worldPos = ptr.getRefData().getBaseNode()->convertLocalToWorldPosition(posChange);
|
||||||
MWBase::Environment::get().getWorld()->moveObject(ptr, worldPos.x, worldPos.y, worldPos.z);
|
dynamic_cast<MWScript::InterpreterContext&>(runtime.getContext()).updatePtr(
|
||||||
|
MWBase::Environment::get().getWorld()->moveObject(ptr, worldPos.x, worldPos.y, worldPos.z));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -703,17 +714,18 @@ namespace MWScript
|
||||||
|
|
||||||
const float *objPos = ptr.getRefData().getPosition().pos;
|
const float *objPos = ptr.getRefData().getPosition().pos;
|
||||||
|
|
||||||
|
MWWorld::Ptr updated;
|
||||||
if (axis == "x")
|
if (axis == "x")
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->moveObject(ptr, objPos[0]+movement, objPos[1], objPos[2]);
|
updated = MWBase::Environment::get().getWorld()->moveObject(ptr, objPos[0]+movement, objPos[1], objPos[2]);
|
||||||
}
|
}
|
||||||
else if (axis == "y")
|
else if (axis == "y")
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->moveObject(ptr, objPos[0], objPos[1]+movement, objPos[2]);
|
updated = MWBase::Environment::get().getWorld()->moveObject(ptr, objPos[0], objPos[1]+movement, objPos[2]);
|
||||||
}
|
}
|
||||||
else if (axis == "z")
|
else if (axis == "z")
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->moveObject(ptr, objPos[0], objPos[1], objPos[2]+movement);
|
updated = MWBase::Environment::get().getWorld()->moveObject(ptr, objPos[0], objPos[1], objPos[2]+movement);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::runtime_error ("invalid movement axis: " + axis);
|
throw std::runtime_error ("invalid movement axis: " + axis);
|
||||||
|
|
|
@ -413,7 +413,7 @@ namespace MWWorld
|
||||||
|
|
||||||
// TODO: the pathgrid graph only needs to be loaded for active cells, so move this somewhere else.
|
// TODO: the pathgrid graph only needs to be loaded for active cells, so move this somewhere else.
|
||||||
// In a simple test, loading the graph for all cells in MW + expansions took 200 ms
|
// In a simple test, loading the graph for all cells in MW + expansions took 200 ms
|
||||||
mPathgridGraph.load(mCell);
|
mPathgridGraph.load(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,8 @@ namespace MWWorld
|
||||||
mStores[ESM::REC_SSCR] = &mStartScripts;
|
mStores[ESM::REC_SSCR] = &mStartScripts;
|
||||||
mStores[ESM::REC_STAT] = &mStatics;
|
mStores[ESM::REC_STAT] = &mStatics;
|
||||||
mStores[ESM::REC_WEAP] = &mWeapons;
|
mStores[ESM::REC_WEAP] = &mWeapons;
|
||||||
|
|
||||||
|
mPathgrids.setCells(mCells);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearDynamic ()
|
void clearDynamic ()
|
||||||
|
|
|
@ -849,15 +849,28 @@ namespace MWWorld
|
||||||
Interior mInt;
|
Interior mInt;
|
||||||
Exterior mExt;
|
Exterior mExt;
|
||||||
|
|
||||||
|
Store<ESM::Cell>* mCells;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void load(ESM::ESMReader &esm, const std::string &id) {
|
void setCells(Store<ESM::Cell>& cells)
|
||||||
|
{
|
||||||
|
mCells = &cells;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(ESM::ESMReader &esm, const std::string &id) {
|
||||||
ESM::Pathgrid pathgrid;
|
ESM::Pathgrid pathgrid;
|
||||||
pathgrid.load(esm);
|
pathgrid.load(esm);
|
||||||
|
|
||||||
|
// Unfortunately the Pathgrid record model does not specify whether the pathgrid belongs to an interior or exterior cell.
|
||||||
|
// For interior cells, mCell is the cell name, but for exterior cells it is either the cell name or if that doesn't exist, the cell's region name.
|
||||||
|
// mX and mY will be (0,0) for interior cells, but there is also an exterior cell with the coordinates of (0,0), so that doesn't help.
|
||||||
|
// Check whether mCell is an interior cell. This isn't perfect, will break if a Region with the same name as an interior cell is created.
|
||||||
|
// A proper fix should be made for future versions of the file format.
|
||||||
|
bool interior = mCells->search(pathgrid.mCell) != NULL;
|
||||||
|
|
||||||
// Try to overwrite existing record
|
// Try to overwrite existing record
|
||||||
if (!pathgrid.mCell.empty())
|
if (interior)
|
||||||
{
|
{
|
||||||
std::pair<Interior::iterator, bool> ret = mInt.insert(std::make_pair(pathgrid.mCell, pathgrid));
|
std::pair<Interior::iterator, bool> ret = mInt.insert(std::make_pair(pathgrid.mCell, pathgrid));
|
||||||
if (!ret.second)
|
if (!ret.second)
|
||||||
|
@ -865,8 +878,7 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::pair<Exterior::iterator, bool> ret = mExt.insert(std::make_pair(std::make_pair(pathgrid.mData.mX, pathgrid.mData.mY),
|
std::pair<Exterior::iterator, bool> ret = mExt.insert(std::make_pair(std::make_pair(pathgrid.mData.mX, pathgrid.mData.mY), pathgrid));
|
||||||
pathgrid));
|
|
||||||
if (!ret.second)
|
if (!ret.second)
|
||||||
ret.first->second = pathgrid;
|
ret.first->second = pathgrid;
|
||||||
}
|
}
|
||||||
|
@ -886,45 +898,47 @@ namespace MWWorld
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESM::Pathgrid *find(int x, int y) const {
|
const ESM::Pathgrid *search(const std::string& name) const {
|
||||||
const ESM::Pathgrid *ptr = search(x, y);
|
|
||||||
if (ptr == 0) {
|
|
||||||
std::ostringstream msg;
|
|
||||||
msg << "Pathgrid at (" << x << ", " << y << ") not found";
|
|
||||||
throw std::runtime_error(msg.str());
|
|
||||||
}
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ESM::Pathgrid *search(const std::string &name) const {
|
|
||||||
Interior::const_iterator it = mInt.find(name);
|
Interior::const_iterator it = mInt.find(name);
|
||||||
if (it != mInt.end())
|
if (it != mInt.end())
|
||||||
return &(it->second);
|
return &(it->second);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESM::Pathgrid *find(const std::string &name) const {
|
const ESM::Pathgrid *find(int x, int y) const {
|
||||||
const ESM::Pathgrid *ptr = search(name);
|
const ESM::Pathgrid* pathgrid = search(x,y);
|
||||||
if (ptr == 0) {
|
if (!pathgrid)
|
||||||
|
{
|
||||||
|
std::ostringstream msg;
|
||||||
|
msg << "Pathgrid in cell '" << x << " " << y << "' not found";
|
||||||
|
throw std::runtime_error(msg.str());
|
||||||
|
}
|
||||||
|
return pathgrid;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ESM::Pathgrid* find(const std::string& name) const {
|
||||||
|
const ESM::Pathgrid* pathgrid = search(name);
|
||||||
|
if (!pathgrid)
|
||||||
|
{
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
msg << "Pathgrid in cell '" << name << "' not found";
|
msg << "Pathgrid in cell '" << name << "' not found";
|
||||||
throw std::runtime_error(msg.str());
|
throw std::runtime_error(msg.str());
|
||||||
}
|
}
|
||||||
return ptr;
|
return pathgrid;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESM::Pathgrid *search(const ESM::Cell &cell) const {
|
const ESM::Pathgrid *search(const ESM::Cell &cell) const {
|
||||||
if (cell.mData.mFlags & ESM::Cell::Interior) {
|
if (!(cell.mData.mFlags & ESM::Cell::Interior))
|
||||||
|
return search(cell.mData.mX, cell.mData.mY);
|
||||||
|
else
|
||||||
return search(cell.mName);
|
return search(cell.mName);
|
||||||
}
|
|
||||||
return search(cell.mData.mX, cell.mData.mY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESM::Pathgrid *find(const ESM::Cell &cell) const {
|
const ESM::Pathgrid *find(const ESM::Cell &cell) const {
|
||||||
if (cell.mData.mFlags & ESM::Cell::Interior) {
|
if (!(cell.mData.mFlags & ESM::Cell::Interior))
|
||||||
|
return find(cell.mData.mX, cell.mData.mY);
|
||||||
|
else
|
||||||
return find(cell.mName);
|
return find(cell.mName);
|
||||||
}
|
|
||||||
return find(cell.mData.mX, cell.mData.mY);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1158,6 +1158,7 @@ namespace MWWorld
|
||||||
ptr.getClass().copyToCell(ptr, *newCell, pos);
|
ptr.getClass().copyToCell(ptr, *newCell, pos);
|
||||||
|
|
||||||
mRendering->updateObjectCell(ptr, copy);
|
mRendering->updateObjectCell(ptr, copy);
|
||||||
|
ptr.getRefData().setBaseNode(NULL);
|
||||||
MWBase::Environment::get().getSoundManager()->updatePtr (ptr, copy);
|
MWBase::Environment::get().getSoundManager()->updatePtr (ptr, copy);
|
||||||
|
|
||||||
MWBase::MechanicsManager *mechMgr = MWBase::Environment::get().getMechanicsManager();
|
MWBase::MechanicsManager *mechMgr = MWBase::Environment::get().getMechanicsManager();
|
||||||
|
@ -1187,7 +1188,7 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool World::moveObjectImp(const Ptr& ptr, float x, float y, float z)
|
MWWorld::Ptr World::moveObjectImp(const Ptr& ptr, float x, float y, float z)
|
||||||
{
|
{
|
||||||
CellStore *cell = ptr.getCell();
|
CellStore *cell = ptr.getCell();
|
||||||
|
|
||||||
|
@ -1200,12 +1201,14 @@ namespace MWWorld
|
||||||
|
|
||||||
moveObject(ptr, cell, x, y, z);
|
moveObject(ptr, cell, x, y, z);
|
||||||
|
|
||||||
return cell != ptr.getCell();
|
MWWorld::Ptr updated = ptr;
|
||||||
|
updated.mCell = cell;
|
||||||
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::moveObject (const Ptr& ptr, float x, float y, float z)
|
MWWorld::Ptr World::moveObject (const Ptr& ptr, float x, float y, float z)
|
||||||
{
|
{
|
||||||
moveObjectImp(ptr, x, y, z);
|
return moveObjectImp(ptr, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::scaleObject (const Ptr& ptr, float scale)
|
void World::scaleObject (const Ptr& ptr, float scale)
|
||||||
|
|
|
@ -104,8 +104,8 @@ namespace MWWorld
|
||||||
|
|
||||||
void rotateObjectImp (const Ptr& ptr, Ogre::Vector3 rot, bool adjust);
|
void rotateObjectImp (const Ptr& ptr, Ogre::Vector3 rot, bool adjust);
|
||||||
|
|
||||||
bool moveObjectImp (const Ptr& ptr, float x, float y, float z);
|
Ptr moveObjectImp (const Ptr& ptr, float x, float y, float z);
|
||||||
///< @return true if the active cell (cell player is in) changed
|
///< @return an updated Ptr in case the Ptr's cell changes
|
||||||
|
|
||||||
Ptr copyObjectToCell(const Ptr &ptr, CellStore* cell, ESM::Position pos, bool adjustPos=true);
|
Ptr copyObjectToCell(const Ptr &ptr, CellStore* cell, ESM::Position pos, bool adjustPos=true);
|
||||||
|
|
||||||
|
@ -341,7 +341,8 @@ namespace MWWorld
|
||||||
virtual void deleteObject (const Ptr& ptr);
|
virtual void deleteObject (const Ptr& ptr);
|
||||||
virtual void undeleteObject (const Ptr& ptr);
|
virtual void undeleteObject (const Ptr& ptr);
|
||||||
|
|
||||||
virtual void moveObject (const Ptr& ptr, float x, float y, float z);
|
virtual MWWorld::Ptr moveObject (const Ptr& ptr, float x, float y, float z);
|
||||||
|
///< @return an updated Ptr in case the Ptr's cell changes
|
||||||
virtual void moveObject (const Ptr& ptr, CellStore* newCell, float x, float y, float z);
|
virtual void moveObject (const Ptr& ptr, CellStore* newCell, float x, float y, float z);
|
||||||
|
|
||||||
virtual void scaleObject (const Ptr& ptr, float scale);
|
virtual void scaleObject (const Ptr& ptr, float scale);
|
||||||
|
|
|
@ -391,6 +391,10 @@ namespace Compiler
|
||||||
{
|
{
|
||||||
if (get (c))
|
if (get (c))
|
||||||
{
|
{
|
||||||
|
/// \todo hack to allow a space in comparison operators (add option to disable)
|
||||||
|
if (c==' ')
|
||||||
|
get (c);
|
||||||
|
|
||||||
if (c=='=')
|
if (c=='=')
|
||||||
special = S_cmpEQ;
|
special = S_cmpEQ;
|
||||||
else
|
else
|
||||||
|
@ -398,7 +402,7 @@ namespace Compiler
|
||||||
special = S_cmpEQ;
|
special = S_cmpEQ;
|
||||||
putback (c);
|
putback (c);
|
||||||
// return false;
|
// return false;
|
||||||
// Allow = as synonym for ==. \todo optionally disable for post-1.0 scripting improvements.
|
/// Allow = as synonym for ==. \todo optionally disable for post-1.0 scripting improvements.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -411,6 +415,10 @@ namespace Compiler
|
||||||
{
|
{
|
||||||
if (get (c))
|
if (get (c))
|
||||||
{
|
{
|
||||||
|
/// \todo hack to allow a space in comparison operators (add option to disable)
|
||||||
|
if (c==' ' && !get (c))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (c=='=')
|
if (c=='=')
|
||||||
special = S_cmpNE;
|
special = S_cmpNE;
|
||||||
else
|
else
|
||||||
|
@ -441,6 +449,10 @@ namespace Compiler
|
||||||
{
|
{
|
||||||
if (get (c))
|
if (get (c))
|
||||||
{
|
{
|
||||||
|
/// \todo hack to allow a space in comparison operators (add option to disable)
|
||||||
|
if (c==' ')
|
||||||
|
get (c);
|
||||||
|
|
||||||
if (c=='=')
|
if (c=='=')
|
||||||
{
|
{
|
||||||
special = S_cmpLE;
|
special = S_cmpLE;
|
||||||
|
@ -461,6 +473,10 @@ namespace Compiler
|
||||||
{
|
{
|
||||||
if (get (c))
|
if (get (c))
|
||||||
{
|
{
|
||||||
|
/// \todo hack to allow a space in comparison operators (add option to disable)
|
||||||
|
if (c==' ')
|
||||||
|
get (c);
|
||||||
|
|
||||||
if (c=='=')
|
if (c=='=')
|
||||||
{
|
{
|
||||||
special = S_cmpGE;
|
special = S_cmpGE;
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace Config
|
||||||
|
|
||||||
bool readFile(QTextStream &stream)
|
bool readFile(QTextStream &stream)
|
||||||
{
|
{
|
||||||
mCache.clear();
|
Map cache;
|
||||||
|
|
||||||
QString sectionPrefix;
|
QString sectionPrefix;
|
||||||
|
|
||||||
|
@ -79,31 +79,30 @@ namespace Config
|
||||||
|
|
||||||
mSettings.remove(key);
|
mSettings.remove(key);
|
||||||
|
|
||||||
QStringList values = mCache.values(key);
|
QStringList values = cache.values(key);
|
||||||
|
|
||||||
if (!values.contains(value)) {
|
if (!values.contains(value)) {
|
||||||
if (mMultiValue) {
|
if (mMultiValue) {
|
||||||
mCache.insertMulti(key, value);
|
cache.insertMulti(key, value);
|
||||||
} else {
|
} else {
|
||||||
mCache.insert(key, value);
|
cache.insert(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSettings.isEmpty()) {
|
if (mSettings.isEmpty()) {
|
||||||
mSettings = mCache; // This is the first time we read a file
|
mSettings = cache; // This is the first time we read a file
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge the changed keys with those which didn't
|
// Merge the changed keys with those which didn't
|
||||||
mSettings.unite(mCache);
|
mSettings.unite(cache);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Map mSettings;
|
Map mSettings;
|
||||||
Map mCache;
|
|
||||||
|
|
||||||
bool mMultiValue;
|
bool mMultiValue;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue