Merge remote-tracking branch 'ace/include-cleanup'

celladd
Marc Zinnschlag 10 years ago
commit e9d6e4f6df

@ -371,8 +371,6 @@ configure_file(${OpenMW_SOURCE_DIR}/files/opencs/defaultfilters
if (NOT WIN32 AND NOT APPLE) if (NOT WIN32 AND NOT APPLE)
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.desktop configure_file(${OpenMW_SOURCE_DIR}/files/openmw.desktop
"${OpenMW_BINARY_DIR}/openmw.desktop") "${OpenMW_BINARY_DIR}/openmw.desktop")
configure_file(${OpenMW_SOURCE_DIR}/files/openmw-mimeinfo.xml
"${OpenMW_BINARY_DIR}/openmw-mimeinfo.xml")
configure_file(${OpenMW_SOURCE_DIR}/files/openmw-cs.desktop configure_file(${OpenMW_SOURCE_DIR}/files/openmw-cs.desktop
"${OpenMW_BINARY_DIR}/openmw-cs.desktop") "${OpenMW_BINARY_DIR}/openmw-cs.desktop")
endif() endif()
@ -441,7 +439,6 @@ IF(NOT WIN32 AND NOT APPLE)
# Install icon and desktop file # Install icon and desktop file
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.desktop" DESTINATION "${DATAROOTDIR}/applications" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.desktop" DESTINATION "${DATAROOTDIR}/applications" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw-mimeinfo.xml" DESTINATION "${DATAROOTDIR}/mime/packages" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/launcher/images/openmw.png" DESTINATION "${ICONDIR}" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw") INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/launcher/images/openmw.png" DESTINATION "${ICONDIR}" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
IF(BUILD_OPENCS) IF(BUILD_OPENCS)
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw-cs.desktop" DESTINATION "${DATAROOTDIR}/applications" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "opencs") INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw-cs.desktop" DESTINATION "${DATAROOTDIR}/applications" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "opencs")
@ -761,7 +758,7 @@ if (APPLE)
set(OPENMW_APP "\${CMAKE_INSTALL_PREFIX}/${INSTALL_SUBDIR}/${APP_BUNDLE_NAME}") set(OPENMW_APP "\${CMAKE_INSTALL_PREFIX}/${INSTALL_SUBDIR}/${APP_BUNDLE_NAME}")
set(OPENCS_BUNDLE_NAME "OpenCS.app") set(OPENCS_BUNDLE_NAME "OpenMW-CS.app")
set(OPENCS_APP "\${CMAKE_INSTALL_PREFIX}/${INSTALL_SUBDIR}/${OPENCS_BUNDLE_NAME}") set(OPENCS_APP "\${CMAKE_INSTALL_PREFIX}/${INSTALL_SUBDIR}/${OPENCS_BUNDLE_NAME}")
set(ABSOLUTE_PLUGINS "") set(ABSOLUTE_PLUGINS "")

@ -211,5 +211,5 @@ target_link_libraries(openmw-cs
) )
if(APPLE) if(APPLE)
INSTALL(TARGETS openmw-cs BUNDLE DESTINATION OpenMW-CS COMPONENT BUNDLE) INSTALL(TARGETS openmw-cs BUNDLE DESTINATION OpenMW COMPONENT BUNDLE)
endif() endif()

@ -1,4 +1,5 @@
#include "cell.hpp"
#include "idcollection.hpp"
#include "pathgrid.hpp" #include "pathgrid.hpp"
#include <sstream> #include <sstream>

@ -6,11 +6,12 @@
#include <components/esm/loadpgrd.hpp> #include <components/esm/loadpgrd.hpp>
#include "idcollection.hpp"
#include "cell.hpp"
namespace CSMWorld namespace CSMWorld
{ {
struct Cell;
template<typename T, typename AT>
class IdCollection;
/// \brief Wrapper for Pathgrid record /// \brief Wrapper for Pathgrid record
/// ///
/// \attention The mData.mX and mData.mY fields of the ESM::Pathgrid struct are not used. /// \attention The mData.mX and mData.mY fields of the ESM::Pathgrid struct are not used.

@ -1,10 +1,17 @@
#ifndef CSM_WOLRD_SUBCOLLECTION_H #ifndef CSM_WOLRD_SUBCOLLECTION_H
#define CSM_WOLRD_SUBCOLLECTION_H #define CSM_WOLRD_SUBCOLLECTION_H
#include "idcollection.hpp" namespace ESM
{
class ESMReader;
}
namespace CSMWorld namespace CSMWorld
{ {
struct Cell;
template<typename T, typename AT>
class IdCollection;
/// \brief Single type collection of top level records that are associated with cells /// \brief Single type collection of top level records that are associated with cells
template<typename ESXRecordT, typename IdAccessorT = IdAccessor<ESXRecordT> > template<typename ESXRecordT, typename IdAccessorT = IdAccessor<ESXRecordT> >
class SubCellCollection : public IdCollection<ESXRecordT, IdAccessorT> class SubCellCollection : public IdCollection<ESXRecordT, IdAccessorT>

@ -1,11 +1,11 @@
#ifndef GAME_MWBASE_WINDOWMANAGER_H #ifndef GAME_MWBASE_WINDOWMANAGER_H
#define GAME_MWBASE_WINDOWMANAGER_H #define GAME_MWBASE_WINDOWMANAGER_H
#include <stdint.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
#include <set>
#include "../mwmechanics/stat.hpp"
#include "../mwgui/mode.hpp" #include "../mwgui/mode.hpp"
@ -42,6 +42,14 @@ namespace ESM
struct CellId; struct CellId;
} }
namespace MWMechanics
{
class AttributeValue;
template<typename T>
class DynamicStat;
class SkillValue;
}
namespace MWWorld namespace MWWorld
{ {
class CellStore; class CellStore;

@ -12,6 +12,7 @@
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwworld/physicssystem.hpp" #include "../mwworld/physicssystem.hpp"
#include "../mwworld/manualref.hpp" #include "../mwworld/manualref.hpp"
#include "../mwworld/nullaction.hpp" #include "../mwworld/nullaction.hpp"

@ -3,6 +3,7 @@
#include <iostream> #include <iostream>
#include "../mwworld/manualref.hpp" #include "../mwworld/manualref.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"

@ -11,6 +11,7 @@
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/function.hpp> #include <boost/function.hpp>
#include <components/misc/stringops.hpp>
#include <components/widgets/imagebutton.hpp> #include <components/widgets/imagebutton.hpp>
#include <components/widgets/list.hpp> #include <components/widgets/list.hpp>

@ -14,6 +14,7 @@
#include <SDL_video.h> #include <SDL_video.h>
#include <components/misc/stringops.hpp>
#include <components/widgets/sharedstatebutton.hpp> #include <components/widgets/sharedstatebutton.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>

@ -16,6 +16,7 @@
#include "../mwworld/manualref.hpp" #include "../mwworld/manualref.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/containerstore.hpp" #include "../mwworld/containerstore.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/creaturestats.hpp"

@ -42,6 +42,7 @@
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwworld/esmstore.hpp" #include "../mwworld/esmstore.hpp"
#include "../mwmechanics/stat.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
#include "../mwsound/soundmanagerimp.hpp" #include "../mwsound/soundmanagerimp.hpp"

@ -12,6 +12,7 @@
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include <components/to_utf8/to_utf8.hpp>
#include "mapwindow.hpp" #include "mapwindow.hpp"

@ -17,6 +17,7 @@
namespace ESM namespace ESM
{ {
class Cell;
namespace AiSequence namespace AiSequence
{ {
struct AiWander; struct AiWander;

@ -2,6 +2,7 @@
#include "../mwworld/manualref.hpp" #include "../mwworld/manualref.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/containerstore.hpp" #include "../mwworld/containerstore.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "creaturestats.hpp" #include "creaturestats.hpp"

@ -2,6 +2,7 @@
#define OPENMW_MECHANICS_LEVELLEDLIST_H #define OPENMW_MECHANICS_LEVELLEDLIST_H
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwworld/manualref.hpp" #include "../mwworld/manualref.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"

@ -125,6 +125,21 @@ bool MWMechanics::NpcStats::isInFaction (const std::string& faction) const
return (mFactionRank.find(Misc::StringUtils::lowerCase(faction)) != mFactionRank.end()); return (mFactionRank.find(Misc::StringUtils::lowerCase(faction)) != mFactionRank.end());
} }
int MWMechanics::NpcStats::getFactionReputation (const std::string& faction) const
{
std::map<std::string, int>::const_iterator iter = mFactionReputation.find (Misc::StringUtils::lowerCase(faction));
if (iter==mFactionReputation.end())
return 0;
return iter->second;
}
void MWMechanics::NpcStats::setFactionReputation (const std::string& faction, int value)
{
mFactionReputation[Misc::StringUtils::lowerCase(faction)] = value;
}
float MWMechanics::NpcStats::getSkillProgressRequirement (int skillIndex, const ESM::Class& class_) const float MWMechanics::NpcStats::getSkillProgressRequirement (int skillIndex, const ESM::Class& class_) const
{ {
float progressRequirement = 1 + getSkill (skillIndex).getBase(); float progressRequirement = 1 + getSkill (skillIndex).getBase();
@ -327,21 +342,6 @@ void MWMechanics::NpcStats::setBounty (int bounty)
mBounty = bounty; mBounty = bounty;
} }
int MWMechanics::NpcStats::getFactionReputation (const std::string& faction) const
{
std::map<std::string, int>::const_iterator iter = mFactionReputation.find (faction);
if (iter==mFactionReputation.end())
return 0;
return iter->second;
}
void MWMechanics::NpcStats::setFactionReputation (const std::string& faction, int value)
{
mFactionReputation[faction] = value;
}
int MWMechanics::NpcStats::getReputation() const int MWMechanics::NpcStats::getReputation() const
{ {
return mReputation; return mReputation;
@ -513,7 +513,7 @@ void MWMechanics::NpcStats::readState (const ESM::NpcStats& state)
mFactionRank[iter->first] = iter->second.mRank; mFactionRank[iter->first] = iter->second.mRank;
if (iter->second.mReputation) if (iter->second.mReputation)
mFactionReputation[iter->first] = iter->second.mReputation; mFactionReputation[Misc::StringUtils::lowerCase(iter->first)] = iter->second.mReputation;
} }
mDisposition = state.mDisposition; mDisposition = state.mDisposition;

@ -6,8 +6,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "stat.hpp"
#include "creaturestats.hpp" #include "creaturestats.hpp"
namespace ESM namespace ESM

@ -1,10 +1,6 @@
#ifndef OPENMW_MECHANICS_OBSTACLE_H #ifndef OPENMW_MECHANICS_OBSTACLE_H
#define OPENMW_MECHANICS_OBSTACLE_H #define OPENMW_MECHANICS_OBSTACLE_H
//#include "../mwbase/world.hpp"
//#include "../mwworld/class.hpp"
#include "../mwworld/cellstore.hpp"
namespace MWWorld namespace MWWorld
{ {
class Ptr; class Ptr;

@ -297,6 +297,8 @@ void RenderingManager::rotateObject(const MWWorld::Ptr &ptr)
void void
RenderingManager::updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &cur) RenderingManager::updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &cur)
{ {
if (!old.getRefData().getBaseNode())
return;
Ogre::SceneNode *child = Ogre::SceneNode *child =
mRendering.getScene()->getSceneNode(old.getRefData().getHandle()); mRendering.getScene()->getSceneNode(old.getRefData().getHandle());

@ -11,6 +11,7 @@
#include <components/interpreter/runtime.hpp> #include <components/interpreter/runtime.hpp>
#include <components/interpreter/opcodes.hpp> #include <components/interpreter/opcodes.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "interpretercontext.hpp" #include "interpretercontext.hpp"

@ -14,10 +14,13 @@
#include <components/interpreter/runtime.hpp> #include <components/interpreter/runtime.hpp>
#include <components/interpreter/opcodes.hpp> #include <components/interpreter/opcodes.hpp>
#include <components/misc/stringops.hpp>
#include <components/esm/loadskil.hpp> #include <components/esm/loadskil.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/containerstore.hpp" #include "../mwworld/containerstore.hpp"

@ -10,6 +10,7 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/inputmanager.hpp" #include "../mwbase/inputmanager.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"

@ -11,6 +11,7 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/dialoguemanager.hpp" #include "../mwbase/dialoguemanager.hpp"
#include "../mwbase/journal.hpp" #include "../mwbase/journal.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"

@ -12,7 +12,7 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "interpretercontext.hpp" #include "interpretercontext.hpp"

@ -17,6 +17,7 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/scriptmanager.hpp" #include "../mwbase/scriptmanager.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"

@ -0,0 +1,29 @@
#include "ref.hpp"
#include <components/interpreter/runtime.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "interpretercontext.hpp"
MWWorld::Ptr MWScript::ExplicitRef::operator() (Interpreter::Runtime& runtime, bool required,
bool activeOnly) const
{
std::string id = runtime.getStringLiteral(runtime[0].mInteger);
runtime.pop();
if (required)
return MWBase::Environment::get().getWorld()->getPtr(id, activeOnly);
else
return MWBase::Environment::get().getWorld()->searchPtr(id, activeOnly);
}
MWWorld::Ptr MWScript::ImplicitRef::operator() (Interpreter::Runtime& runtime, bool required,
bool activeOnly) const
{
MWScript::InterpreterContext& context
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
return context.getReference(required);
}

@ -3,14 +3,12 @@
#include <string> #include <string>
#include <components/interpreter/runtime.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "interpretercontext.hpp" namespace Interpreter
{
class Runtime;
}
namespace MWScript namespace MWScript
{ {
@ -18,31 +16,16 @@ namespace MWScript
{ {
static const bool implicit = false; static const bool implicit = false;
MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true, MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required = true,
bool activeOnly = false) const bool activeOnly = false) const;
{
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
runtime.pop();
if (required)
return MWBase::Environment::get().getWorld()->getPtr (id, activeOnly);
else
return MWBase::Environment::get().getWorld()->searchPtr (id, activeOnly);
}
}; };
struct ImplicitRef struct ImplicitRef
{ {
static const bool implicit = true; static const bool implicit = true;
MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true, MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required = true,
bool activeOnly = false) const bool activeOnly = false) const;
{
MWScript::InterpreterContext& context
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
return context.getReference(required);
}
}; };
} }

@ -18,6 +18,7 @@
#include "../mwbase/dialoguemanager.hpp" #include "../mwbase/dialoguemanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"

@ -10,7 +10,9 @@
#include <components/interpreter/opcodes.hpp> #include <components/interpreter/opcodes.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/manualref.hpp" #include "../mwworld/manualref.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"

@ -723,9 +723,9 @@ namespace MWSound
MWWorld::Ptr player = MWWorld::Ptr player =
MWBase::Environment::get().getWorld()->getPlayerPtr(); MWBase::Environment::get().getWorld()->getPlayerPtr();
const ESM::Cell *cell = player.getCell()->getCell(); const MWWorld::CellStore *cell = player.getCell();
mListenerUnderwater = ((cell->mData.mFlags&cell->HasWater) && mListenerPos.z < cell->mWater); mListenerUnderwater = ((cell->getCell()->mData.mFlags&ESM::Cell::HasWater) && mListenerPos.z < cell->getWaterLevel());
} }
void SoundManager::updatePtr(const MWWorld::Ptr &old, const MWWorld::Ptr &updated) void SoundManager::updatePtr(const MWWorld::Ptr &old, const MWWorld::Ptr &updated)

@ -241,26 +241,30 @@ MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name)
void MWWorld::Cells::getExteriorPtrs(const std::string &name, std::vector<MWWorld::Ptr> &out) void MWWorld::Cells::getExteriorPtrs(const std::string &name, std::vector<MWWorld::Ptr> &out)
{ {
for (std::map<std::pair<int, int>, CellStore>::iterator iter = mExteriors.begin(); const MWWorld::Store<ESM::Cell> &cells = mStore.get<ESM::Cell>();
iter!=mExteriors.end(); ++iter) for (MWWorld::Store<ESM::Cell>::iterator iter = cells.extBegin(); iter != cells.extEnd(); ++iter)
{ {
Ptr ptr = getPtrAndCache (name, iter->second); CellStore *cellStore = getCellStore (&(*iter));
Ptr ptr = getPtrAndCache (name, *cellStore);
if (!ptr.isEmpty()) if (!ptr.isEmpty())
out.push_back(ptr); out.push_back(ptr);
} }
} }
void MWWorld::Cells::getInteriorPtrs(const std::string &name, std::vector<MWWorld::Ptr> &out) void MWWorld::Cells::getInteriorPtrs(const std::string &name, std::vector<MWWorld::Ptr> &out)
{ {
for (std::map<std::string, CellStore>::iterator iter = mInteriors.begin(); const MWWorld::Store<ESM::Cell> &cells = mStore.get<ESM::Cell>();
iter!=mInteriors.end(); ++iter) for (MWWorld::Store<ESM::Cell>::iterator iter = cells.intBegin(); iter != cells.intEnd(); ++iter)
{ {
Ptr ptr = getPtrAndCache (name, iter->second); CellStore *cellStore = getCellStore (&(*iter));
Ptr ptr = getPtrAndCache (name, *cellStore);
if (!ptr.isEmpty()) if (!ptr.isEmpty())
out.push_back(ptr); out.push_back(ptr);
} }
} }
int MWWorld::Cells::countSavedGameRecords() const int MWWorld::Cells::countSavedGameRecords() const

@ -0,0 +1,67 @@
#include "manualref.hpp"
#include "esmstore.hpp"
#include "cellstore.hpp"
namespace
{
template<typename T>
void create(const MWWorld::Store<T>& list, const std::string& name, boost::any& refValue, MWWorld::Ptr& ptrValue)
{
const T* base = list.find(name);
ESM::CellRef cellRef;
cellRef.mRefNum.unset();
cellRef.mRefID = name;
cellRef.mScale = 1;
cellRef.mFactionRank = 0;
cellRef.mChargeInt = -1;
cellRef.mGoldValue = 1;
cellRef.mEnchantmentCharge = -1;
cellRef.mTeleport = false;
cellRef.mLockLevel = 0;
cellRef.mReferenceBlocked = 0;
MWWorld::LiveCellRef<T> ref(cellRef, base);
refValue = ref;
ptrValue = MWWorld::Ptr(&boost::any_cast<MWWorld::LiveCellRef<T>&>(refValue), 0);
}
}
MWWorld::ManualRef::ManualRef(const MWWorld::ESMStore& store, const std::string& name, const int count)
{
std::string lowerName = Misc::StringUtils::lowerCase(name);
switch (store.find(lowerName))
{
case ESM::REC_ACTI: create(store.get<ESM::Activator>(), lowerName, mRef, mPtr); break;
case ESM::REC_ALCH: create(store.get<ESM::Potion>(), lowerName, mRef, mPtr); break;
case ESM::REC_APPA: create(store.get<ESM::Apparatus>(), lowerName, mRef, mPtr); break;
case ESM::REC_ARMO: create(store.get<ESM::Armor>(), lowerName, mRef, mPtr); break;
case ESM::REC_BOOK: create(store.get<ESM::Book>(), lowerName, mRef, mPtr); break;
case ESM::REC_CLOT: create(store.get<ESM::Clothing>(), lowerName, mRef, mPtr); break;
case ESM::REC_CONT: create(store.get<ESM::Container>(), lowerName, mRef, mPtr); break;
case ESM::REC_CREA: create(store.get<ESM::Creature>(), lowerName, mRef, mPtr); break;
case ESM::REC_DOOR: create(store.get<ESM::Door>(), lowerName, mRef, mPtr); break;
case ESM::REC_INGR: create(store.get<ESM::Ingredient>(), lowerName, mRef, mPtr); break;
case ESM::REC_LEVC: create(store.get<ESM::CreatureLevList>(), lowerName, mRef, mPtr); break;
case ESM::REC_LEVI: create(store.get<ESM::ItemLevList>(), lowerName, mRef, mPtr); break;
case ESM::REC_LIGH: create(store.get<ESM::Light>(), lowerName, mRef, mPtr); break;
case ESM::REC_LOCK: create(store.get<ESM::Lockpick>(), lowerName, mRef, mPtr); break;
case ESM::REC_MISC: create(store.get<ESM::Miscellaneous>(), lowerName, mRef, mPtr); break;
case ESM::REC_NPC_: create(store.get<ESM::NPC>(), lowerName, mRef, mPtr); break;
case ESM::REC_PROB: create(store.get<ESM::Probe>(), lowerName, mRef, mPtr); break;
case ESM::REC_REPA: create(store.get<ESM::Repair>(), lowerName, mRef, mPtr); break;
case ESM::REC_STAT: create(store.get<ESM::Static>(), lowerName, mRef, mPtr); break;
case ESM::REC_WEAP: create(store.get<ESM::Weapon>(), lowerName, mRef, mPtr); break;
case 0:
throw std::logic_error("failed to create manual cell ref for " + lowerName + " (unknown ID)");
default:
throw std::logic_error("failed to create manual cell ref for " + lowerName + " (unknown type)");
}
mPtr.getRefData().setCount(count);
}

@ -3,9 +3,7 @@
#include <boost/any.hpp> #include <boost/any.hpp>
#include "esmstore.hpp"
#include "ptr.hpp" #include "ptr.hpp"
#include "cellstore.hpp"
namespace MWWorld namespace MWWorld
{ {
@ -18,66 +16,8 @@ namespace MWWorld
ManualRef (const ManualRef&); ManualRef (const ManualRef&);
ManualRef& operator= (const ManualRef&); ManualRef& operator= (const ManualRef&);
template<typename T>
void create (const MWWorld::Store<T>& list, const std::string& name)
{
const T* base = list.find(name);
ESM::CellRef cellRef;
cellRef.mRefNum.unset();
cellRef.mRefID = name;
cellRef.mScale = 1;
cellRef.mFactionRank = 0;
cellRef.mChargeInt = -1;
cellRef.mGoldValue = 1;
cellRef.mEnchantmentCharge = -1;
cellRef.mTeleport = false;
cellRef.mLockLevel = 0;
cellRef.mReferenceBlocked = 0;
LiveCellRef<T> ref(cellRef, base);
mRef = ref;
mPtr = Ptr (&boost::any_cast<LiveCellRef<T>&> (mRef), 0);
}
public: public:
ManualRef(const MWWorld::ESMStore& store, const std::string& name, const int count = 1);
ManualRef (const MWWorld::ESMStore& store, const std::string& name, const int count=1)
{
std::string lowerName = Misc::StringUtils::lowerCase (name);
switch (store.find (lowerName))
{
case ESM::REC_ACTI: create (store.get<ESM::Activator>(), lowerName); break;
case ESM::REC_ALCH: create (store.get<ESM::Potion>(), lowerName); break;
case ESM::REC_APPA: create (store.get<ESM::Apparatus>(), lowerName); break;
case ESM::REC_ARMO: create (store.get<ESM::Armor>(), lowerName); break;
case ESM::REC_BOOK: create (store.get<ESM::Book>(), lowerName); break;
case ESM::REC_CLOT: create (store.get<ESM::Clothing>(), lowerName); break;
case ESM::REC_CONT: create (store.get<ESM::Container>(), lowerName); break;
case ESM::REC_CREA: create (store.get<ESM::Creature>(), lowerName); break;
case ESM::REC_DOOR: create (store.get<ESM::Door>(), lowerName); break;
case ESM::REC_INGR: create (store.get<ESM::Ingredient>(), lowerName); break;
case ESM::REC_LEVC: create (store.get<ESM::CreatureLevList>(), lowerName); break;
case ESM::REC_LEVI: create (store.get<ESM::ItemLevList>(), lowerName); break;
case ESM::REC_LIGH: create (store.get<ESM::Light>(), lowerName); break;
case ESM::REC_LOCK: create (store.get<ESM::Lockpick>(), lowerName); break;
case ESM::REC_MISC: create (store.get<ESM::Miscellaneous>(), lowerName); break;
case ESM::REC_NPC_: create (store.get<ESM::NPC>(), lowerName); break;
case ESM::REC_PROB: create (store.get<ESM::Probe>(), lowerName); break;
case ESM::REC_REPA: create (store.get<ESM::Repair>(), lowerName); break;
case ESM::REC_STAT: create (store.get<ESM::Static>(), lowerName); break;
case ESM::REC_WEAP: create (store.get<ESM::Weapon>(), lowerName); break;
case 0:
throw std::logic_error ("failed to create manual cell ref for " + lowerName + " (unknown ID)");
default:
throw std::logic_error ("failed to create manual cell ref for " + lowerName + " (unknown type)");
}
mPtr.getRefData().setCount(count);
}
const Ptr& getPtr() const const Ptr& getPtr() const
{ {

@ -862,9 +862,9 @@ namespace MWWorld
for(;iter != mMovementQueue.end();++iter) for(;iter != mMovementQueue.end();++iter)
{ {
float waterlevel = -std::numeric_limits<float>::max(); float waterlevel = -std::numeric_limits<float>::max();
const ESM::Cell *cell = iter->first.getCell()->getCell(); const MWWorld::CellStore *cell = iter->first.getCell();
if(cell->hasWater()) if(cell->getCell()->hasWater())
waterlevel = cell->mWater; waterlevel = cell->getWaterLevel();
float oldHeight = iter->first.getRefData().getPosition().pos[2]; float oldHeight = iter->first.getRefData().getPosition().pos[2];
@ -872,7 +872,7 @@ namespace MWWorld
bool waterCollision = false; bool waterCollision = false;
if (effects.get(ESM::MagicEffect::WaterWalking).getMagnitude() if (effects.get(ESM::MagicEffect::WaterWalking).getMagnitude()
&& cell->hasWater() && cell->getCell()->hasWater()
&& !world->isUnderwater(iter->first.getCell(), && !world->isUnderwater(iter->first.getCell(),
Ogre::Vector3(iter->first.getRefData().getPosition().pos))) Ogre::Vector3(iter->first.getRefData().getPosition().pos)))
waterCollision = true; waterCollision = true;

@ -9,6 +9,7 @@
#include "../mwworld/manualref.hpp" #include "../mwworld/manualref.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwworld/inventorystore.hpp" #include "../mwworld/inventorystore.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"

@ -44,6 +44,7 @@
#include "player.hpp" #include "player.hpp"
#include "manualref.hpp" #include "manualref.hpp"
#include "cellstore.hpp"
#include "cellfunctors.hpp" #include "cellfunctors.hpp"
#include "containerstore.hpp" #include "containerstore.hpp"
#include "inventorystore.hpp" #include "inventorystore.hpp"

@ -1,11 +0,0 @@
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-openmw-savegame">
<icon name="openmw" />
<generic-icon name="applications-games"/>
<comment>OpenMW Savegame</comment>
<glob weight="60" pattern="*.omwsave"/>
</mime-type>
</mime-info>

@ -8,16 +8,3 @@ TryExec=openmw-launcher
Exec=openmw-launcher Exec=openmw-launcher
Icon=openmw Icon=openmw
Categories=Game;RolePlaying; Categories=Game;RolePlaying;
[Desktop Entry]
Type=Application
Name=OpenMW
GenericName=Role Playing Game
Comment=An engine replacement for The Elder Scrolls III: Morrowind
Keywords=Morrowind;Reimplementation Mods;esm;bsa;
Exec=openmw --load-savegame=%f
Icon=openmw
Categories=Game;RolePlaying;
Terminal=false
NoDisplay=true
MimeType=application/x-openmw-savegame;

Loading…
Cancel
Save