diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index bf188b963..41392def0 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -98,6 +98,21 @@ set(GAMECLASS mwclass/npc.cpp mwclass/weapon.cpp mwclass/armor.cpp + mwclass/potion.cpp + mwclass/apparatus.cpp + mwclass/book.cpp + mwclass/clothing.cpp + mwclass/container.cpp + mwclass/door.cpp + mwclass/ingredient.cpp + mwclass/creaturelevlist.cpp + mwclass/itemlevlist.cpp + mwclass/light.cpp + mwclass/lockpick.cpp + mwclass/misc.cpp + mwclass/probe.cpp + mwclass/repair.cpp + mwclass/static.cpp ) set(GAMECLASS_HEADER mwclass/classes.hpp @@ -106,6 +121,21 @@ set(GAMECLASS_HEADER mwclass/npc.hpp mwclass/weapon.hpp mwclass/armor.hpp + mwclass/potion.hpp + mwclass/apparatus.hpp + mwclass/book.hpp + mwclass/clothing.hpp + mwclass/container.hpp + mwclass/door.hpp + mwclass/ingredient.hpp + mwclass/creaturelevlist.hpp + mwclass/itemlevlist.hpp + mwclass/light.hpp + mwclass/lockpick.hpp + mwclass/misc.hpp + mwclass/probe.hpp + mwclass/repair.hpp + mwclass/static.hpp ) source_group(apps\\openmw\\mwclass FILES ${GAMECLASS} ${GAMECLASS_HEADER}) diff --git a/apps/openmw/mwclass/apparatus.cpp b/apps/openmw/mwclass/apparatus.cpp new file mode 100644 index 000000000..a141ef014 --- /dev/null +++ b/apps/openmw/mwclass/apparatus.cpp @@ -0,0 +1,14 @@ + +#include "apparatus.hpp" + +#include + +namespace MWClass +{ + void Apparatus::registerSelf() + { + boost::shared_ptr instance (new Apparatus); + + registerClass (typeid (ESM::Apparatus).name(), instance); + } +} diff --git a/apps/openmw/mwclass/apparatus.hpp b/apps/openmw/mwclass/apparatus.hpp new file mode 100644 index 000000000..89a097b79 --- /dev/null +++ b/apps/openmw/mwclass/apparatus.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_APPARATUS_H +#define GAME_MWCLASS_APPARATUS_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class Apparatus : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/book.cpp b/apps/openmw/mwclass/book.cpp new file mode 100644 index 000000000..2f89e2481 --- /dev/null +++ b/apps/openmw/mwclass/book.cpp @@ -0,0 +1,14 @@ + +#include "book.hpp" + +#include + +namespace MWClass +{ + void Book::registerSelf() + { + boost::shared_ptr instance (new Book); + + registerClass (typeid (ESM::Book).name(), instance); + } +} diff --git a/apps/openmw/mwclass/book.hpp b/apps/openmw/mwclass/book.hpp new file mode 100644 index 000000000..e7cde69fa --- /dev/null +++ b/apps/openmw/mwclass/book.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_BOOK_H +#define GAME_MWCLASS_BOOK_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class Book : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/classes.cpp b/apps/openmw/mwclass/classes.cpp index 655159e35..745614852 100644 --- a/apps/openmw/mwclass/classes.cpp +++ b/apps/openmw/mwclass/classes.cpp @@ -6,6 +6,21 @@ #include "npc.hpp" #include "weapon.hpp" #include "armor.hpp" +#include "potion.hpp" +#include "apparatus.hpp" +#include "book.hpp" +#include "clothing.hpp" +#include "container.hpp" +#include "door.hpp" +#include "ingredient.hpp" +#include "creaturelevlist.hpp" +#include "itemlevlist.hpp" +#include "light.hpp" +#include "lockpick.hpp" +#include "misc.hpp" +#include "probe.hpp" +#include "repair.hpp" +#include "static.hpp" namespace MWClass { @@ -16,5 +31,20 @@ namespace MWClass Npc::registerSelf(); Weapon::registerSelf(); Armor::registerSelf(); + Potion::registerSelf(); + Apparatus::registerSelf(); + Book::registerSelf(); + Clothing::registerSelf(); + Container::registerSelf(); + Door::registerSelf(); + Ingredient::registerSelf(); + CreatureLevList::registerSelf(); + ItemLevList::registerSelf(); + Light::registerSelf(); + Lockpick::registerSelf(); + Misc::registerSelf(); + Probe::registerSelf(); + Repair::registerSelf(); + Static::registerSelf(); } } diff --git a/apps/openmw/mwclass/clothing.cpp b/apps/openmw/mwclass/clothing.cpp new file mode 100644 index 000000000..820034cbf --- /dev/null +++ b/apps/openmw/mwclass/clothing.cpp @@ -0,0 +1,14 @@ + +#include "clothing.hpp" + +#include + +namespace MWClass +{ + void Clothing::registerSelf() + { + boost::shared_ptr instance (new Clothing); + + registerClass (typeid (ESM::Clothing).name(), instance); + } +} diff --git a/apps/openmw/mwclass/clothing.hpp b/apps/openmw/mwclass/clothing.hpp new file mode 100644 index 000000000..a37ac8f43 --- /dev/null +++ b/apps/openmw/mwclass/clothing.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_CLOTHING_H +#define GAME_MWCLASS_CLOTHING_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class Clothing : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp new file mode 100644 index 000000000..be194d71a --- /dev/null +++ b/apps/openmw/mwclass/container.cpp @@ -0,0 +1,14 @@ + +#include "container.hpp" + +#include + +namespace MWClass +{ + void Container::registerSelf() + { + boost::shared_ptr instance (new Container); + + registerClass (typeid (ESM::Container).name(), instance); + } +} diff --git a/apps/openmw/mwclass/container.hpp b/apps/openmw/mwclass/container.hpp new file mode 100644 index 000000000..c26bb2e48 --- /dev/null +++ b/apps/openmw/mwclass/container.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_CONTAINER_H +#define GAME_MWCLASS_CONTAINER_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class Container : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/creaturelevlist.cpp b/apps/openmw/mwclass/creaturelevlist.cpp new file mode 100644 index 000000000..700a3190b --- /dev/null +++ b/apps/openmw/mwclass/creaturelevlist.cpp @@ -0,0 +1,14 @@ + +#include "creaturelevlist.hpp" + +#include + +namespace MWClass +{ + void CreatureLevList::registerSelf() + { + boost::shared_ptr instance (new CreatureLevList); + + registerClass (typeid (ESM::CreatureLevList).name(), instance); + } +} diff --git a/apps/openmw/mwclass/creaturelevlist.hpp b/apps/openmw/mwclass/creaturelevlist.hpp new file mode 100644 index 000000000..a8e8f5a1d --- /dev/null +++ b/apps/openmw/mwclass/creaturelevlist.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_CREATURELEVLIST_H +#define GAME_MWCLASS_CREATURELEVLIST_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class CreatureLevList : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp new file mode 100644 index 000000000..20472e6f8 --- /dev/null +++ b/apps/openmw/mwclass/door.cpp @@ -0,0 +1,14 @@ + +#include "door.hpp" + +#include + +namespace MWClass +{ + void Door::registerSelf() + { + boost::shared_ptr instance (new Door); + + registerClass (typeid (ESM::Door).name(), instance); + } +} diff --git a/apps/openmw/mwclass/door.hpp b/apps/openmw/mwclass/door.hpp new file mode 100644 index 000000000..2dc15b528 --- /dev/null +++ b/apps/openmw/mwclass/door.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_DOOR_H +#define GAME_MWCLASS_DOOR_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class Door : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/ingredient.cpp b/apps/openmw/mwclass/ingredient.cpp new file mode 100644 index 000000000..4d0d4f567 --- /dev/null +++ b/apps/openmw/mwclass/ingredient.cpp @@ -0,0 +1,14 @@ + +#include "ingredient.hpp" + +#include + +namespace MWClass +{ + void Ingredient::registerSelf() + { + boost::shared_ptr instance (new Ingredient); + + registerClass (typeid (ESM::Ingredient).name(), instance); + } +} diff --git a/apps/openmw/mwclass/ingredient.hpp b/apps/openmw/mwclass/ingredient.hpp new file mode 100644 index 000000000..2ed4aa66b --- /dev/null +++ b/apps/openmw/mwclass/ingredient.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_INGREDIENT_H +#define GAME_MWCLASS_INGREDIENT_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class Ingredient : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/itemlevlist.cpp b/apps/openmw/mwclass/itemlevlist.cpp new file mode 100644 index 000000000..d0e466b01 --- /dev/null +++ b/apps/openmw/mwclass/itemlevlist.cpp @@ -0,0 +1,14 @@ + +#include "itemlevlist.hpp" + +#include + +namespace MWClass +{ + void ItemLevList::registerSelf() + { + boost::shared_ptr instance (new ItemLevList); + + registerClass (typeid (ESM::ItemLevList).name(), instance); + } +} diff --git a/apps/openmw/mwclass/itemlevlist.hpp b/apps/openmw/mwclass/itemlevlist.hpp new file mode 100644 index 000000000..2047d4025 --- /dev/null +++ b/apps/openmw/mwclass/itemlevlist.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_ITEMLEVLIST_H +#define GAME_MWCLASS_ITEMLEVLIST_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class ItemLevList : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp new file mode 100644 index 000000000..4ab18ea70 --- /dev/null +++ b/apps/openmw/mwclass/light.cpp @@ -0,0 +1,14 @@ + +#include "light.hpp" + +#include + +namespace MWClass +{ + void Light::registerSelf() + { + boost::shared_ptr instance (new Light); + + registerClass (typeid (ESM::Light).name(), instance); + } +} diff --git a/apps/openmw/mwclass/light.hpp b/apps/openmw/mwclass/light.hpp new file mode 100644 index 000000000..a1c7b7c0f --- /dev/null +++ b/apps/openmw/mwclass/light.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_LIGHT_H +#define GAME_MWCLASS_LIGHT_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class Light : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/lockpick.cpp b/apps/openmw/mwclass/lockpick.cpp new file mode 100644 index 000000000..ed7ce3eaa --- /dev/null +++ b/apps/openmw/mwclass/lockpick.cpp @@ -0,0 +1,14 @@ + +#include "lockpick.hpp" + +#include + +namespace MWClass +{ + void Lockpick::registerSelf() + { + boost::shared_ptr instance (new Lockpick); + + registerClass (typeid (ESM::Tool).name(), instance); + } +} diff --git a/apps/openmw/mwclass/lockpick.hpp b/apps/openmw/mwclass/lockpick.hpp new file mode 100644 index 000000000..32e641a08 --- /dev/null +++ b/apps/openmw/mwclass/lockpick.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_LOCKPICK_H +#define GAME_MWCLASS_LOCKPICK_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class Lockpick : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp new file mode 100644 index 000000000..04b76fe6a --- /dev/null +++ b/apps/openmw/mwclass/misc.cpp @@ -0,0 +1,14 @@ + +#include "misc.hpp" + +#include + +namespace MWClass +{ + void Misc::registerSelf() + { + boost::shared_ptr instance (new Misc); + + registerClass (typeid (ESM::Misc).name(), instance); + } +} diff --git a/apps/openmw/mwclass/misc.hpp b/apps/openmw/mwclass/misc.hpp new file mode 100644 index 000000000..94b699d53 --- /dev/null +++ b/apps/openmw/mwclass/misc.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_MISC_H +#define GAME_MWCLASS_MISC_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class Misc : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/potion.cpp b/apps/openmw/mwclass/potion.cpp new file mode 100644 index 000000000..21f8f4f99 --- /dev/null +++ b/apps/openmw/mwclass/potion.cpp @@ -0,0 +1,14 @@ + +#include "potion.hpp" + +#include + +namespace MWClass +{ + void Potion::registerSelf() + { + boost::shared_ptr instance (new Potion); + + registerClass (typeid (ESM::Potion).name(), instance); + } +} diff --git a/apps/openmw/mwclass/potion.hpp b/apps/openmw/mwclass/potion.hpp new file mode 100644 index 000000000..c0d3faca6 --- /dev/null +++ b/apps/openmw/mwclass/potion.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_POTION_H +#define GAME_MWCLASS_POTION_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class Potion : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/probe.cpp b/apps/openmw/mwclass/probe.cpp new file mode 100644 index 000000000..c19c873b4 --- /dev/null +++ b/apps/openmw/mwclass/probe.cpp @@ -0,0 +1,14 @@ + +#include "probe.hpp" + +#include + +namespace MWClass +{ + void Probe::registerSelf() + { + boost::shared_ptr instance (new Probe); + + registerClass (typeid (ESM::Probe).name(), instance); + } +} diff --git a/apps/openmw/mwclass/probe.hpp b/apps/openmw/mwclass/probe.hpp new file mode 100644 index 000000000..dd0215c71 --- /dev/null +++ b/apps/openmw/mwclass/probe.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_PROBE_H +#define GAME_MWCLASS_PROBE_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class Probe : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/repair.cpp b/apps/openmw/mwclass/repair.cpp new file mode 100644 index 000000000..d5bc79fc7 --- /dev/null +++ b/apps/openmw/mwclass/repair.cpp @@ -0,0 +1,14 @@ + +#include "repair.hpp" + +#include + +namespace MWClass +{ + void Repair::registerSelf() + { + boost::shared_ptr instance (new Repair); + + registerClass (typeid (ESM::Repair).name(), instance); + } +} diff --git a/apps/openmw/mwclass/repair.hpp b/apps/openmw/mwclass/repair.hpp new file mode 100644 index 000000000..81beec628 --- /dev/null +++ b/apps/openmw/mwclass/repair.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_REPAIR_H +#define GAME_MWCLASS_REPAIR_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class Repair : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwclass/static.cpp b/apps/openmw/mwclass/static.cpp new file mode 100644 index 000000000..ab601ff42 --- /dev/null +++ b/apps/openmw/mwclass/static.cpp @@ -0,0 +1,14 @@ + +#include "static.hpp" + +#include + +namespace MWClass +{ + void Static::registerSelf() + { + boost::shared_ptr instance (new Static); + + registerClass (typeid (ESM::Static).name(), instance); + } +} diff --git a/apps/openmw/mwclass/static.hpp b/apps/openmw/mwclass/static.hpp new file mode 100644 index 000000000..aa462d0a1 --- /dev/null +++ b/apps/openmw/mwclass/static.hpp @@ -0,0 +1,17 @@ +#ifndef GAME_MWCLASS_STATIC_H +#define GAME_MWCLASS_STATIC_H + +#include "../mwworld/class.hpp" + +namespace MWClass +{ + class Static : public MWWorld::Class + { + public: + + + static void registerSelf(); + }; +} + +#endif diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index 55be70f1c..dd46e87ab 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -28,9 +28,9 @@ namespace if (!iter->base->script.empty()) { if (const ESM::Script *script = store.scripts.find (iter->base->script)) - { + { iter->mData.setLocals (*script); - + scriptList.push_back ( std::make_pair (iter->base->script, MWWorld::Ptr (&*iter, cell))); } @@ -61,7 +61,7 @@ namespace MWWorld listCellScripts (mStore, cell.repairs, mLocalScripts, &cell); listCellScripts (mStore, cell.weapons, mLocalScripts, &cell); } - + Ptr World::getPtr (const std::string& name, Ptr::CellStore& cell) { if (ESMS::LiveCellRef *ref = cell.activators.find (name)) @@ -69,68 +69,68 @@ namespace MWWorld if (ESMS::LiveCellRef *ref = cell.potions.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.appas.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.armors.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.books.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.clothes.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.containers.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.creatures.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.doors.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.ingreds.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.creatureLists.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.itemLists.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.lights.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.lockpicks.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.miscItems.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.npcs.find (name)) return Ptr (ref, &cell); - - if (ESMS::LiveCellRef *ref = cell.probes.find (name)) + + if (ESMS::LiveCellRef *ref = cell.probes.find (name)) return Ptr (ref, &cell); - - if (ESMS::LiveCellRef *ref = cell.repairs.find (name)) + + if (ESMS::LiveCellRef *ref = cell.repairs.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.statics.find (name)) return Ptr (ref, &cell); - + if (ESMS::LiveCellRef *ref = cell.weapons.find (name)) return Ptr (ref, &cell); - + return Ptr(); } - + MWRender::CellRender *World::searchRender (Ptr::CellStore *store) { CellRenderCollection::iterator iter = mActiveCells.find (store); - + if (iter!=mActiveCells.end()) { return iter->second; @@ -141,10 +141,10 @@ namespace MWWorld if (iter!=mBufferedCells.end()) return iter->second; } - + return 0; } - + int World::getDaysPerMonth (int month) const { switch (month) @@ -162,84 +162,84 @@ namespace MWWorld case 10: return 30; case 11: return 31; } - + throw std::runtime_error ("month out of range"); } - + World::World (OEngine::Render::OgreRenderer& renderer, const boost::filesystem::path& dataDir, const std::string& master, bool newGame, Environment& environment) : mSkyManager (0), mScene (renderer), mPlayerPos (0), mCurrentCell (0), mGlobalVariables (0), mSky (false), mCellChanged (false), mEnvironment (environment) - { + { boost::filesystem::path masterPath (dataDir); masterPath /= master; - + std::cout << "Loading ESM " << masterPath.string() << "\n"; // This parses the ESM file and loads a sample cell mEsm.open (masterPath.file_string()); mStore.load (mEsm); - + mPlayerPos = new MWRender::PlayerPos (mScene.getCamera(), mStore.npcs.find ("player")); // global variables mGlobalVariables = new Globals (mStore); - + if (newGame) - { + { // set new game mark mGlobalVariables->setInt ("chargenstate", 1); } - + mSkyManager = - MWRender::SkyManager::create(renderer.getWindow(), mScene.getCamera()); + MWRender::SkyManager::create(renderer.getWindow(), mScene.getCamera()); } - + World::~World() { for (CellRenderCollection::iterator iter (mActiveCells.begin()); iter!=mActiveCells.end(); ++iter) delete iter->second; - + for (CellRenderCollection::iterator iter (mBufferedCells.begin()); iter!=mBufferedCells.end(); ++iter) delete iter->second; - + delete mPlayerPos; delete mSkyManager; delete mGlobalVariables; } - + MWRender::PlayerPos& World::getPlayerPos() { return *mPlayerPos; } - + ESMS::ESMStore& World::getStore() { return mStore; } - + const World::ScriptList& World::getLocalScripts() const { return mLocalScripts; } - + bool World::hasCellChanged() const { return mCellChanged; } - + Globals::Data& World::getGlobalVariable (const std::string& name) { return (*mGlobalVariables)[name]; } - + char World::getGlobalVariableType (const std::string& name) const { return mGlobalVariables->getType (name); - } - + } + Ptr World::getPtr (const std::string& name, bool activeOnly) { // the player is always in an active cell. @@ -247,35 +247,35 @@ namespace MWWorld { return mPlayerPos->getPlayer(); } - + // active cells for (CellRenderCollection::iterator iter (mActiveCells.begin()); iter!=mActiveCells.end(); ++iter) { Ptr ptr = getPtr (name, *iter->first); - + if (!ptr.isEmpty()) return ptr; } - + if (!activeOnly) { // TODO: inactive cells } - + throw std::runtime_error ("unknown ID: " + name); } - + void World::enable (Ptr reference) { if (!reference.getRefData().isEnabled()) { reference.getRefData().enable(); - + if (MWRender::CellRender *render = searchRender (reference.getCell())) { render->enable (reference.getRefData().getHandle()); - + if (mActiveCells.find (reference.getCell())!=mActiveCells.end() && (reference.getType()==typeid (ESMS::LiveCellRef) || reference.getType()==typeid (ESMS::LiveCellRef))) @@ -285,69 +285,69 @@ namespace MWWorld } } } - + void World::disable (Ptr reference) { if (!reference.getRefData().isEnabled()) { reference.getRefData().enable(); - + if (MWRender::CellRender *render = searchRender (reference.getCell())) { render->disable (reference.getRefData().getHandle()); - + if (mActiveCells.find (reference.getCell())!=mActiveCells.end() && (reference.getType()==typeid (ESMS::LiveCellRef) || reference.getType()==typeid (ESMS::LiveCellRef))) { mEnvironment.mMechanicsManager->removeActor (reference); - } + } } - } + } } - + void World::advanceTime (double hours) { hours += mGlobalVariables->getFloat ("gamehour"); setHour (hours); - + int days = hours / 24; - + if (days>0) mGlobalVariables->setInt ("dayspassed", days + mGlobalVariables->getInt ("dayspassed")); } - + void World::setHour (double hour) { if (hour<0) hour = 0; - + int days = hour / 24; - + hour = std::fmod (hour, 24); - + mGlobalVariables->setFloat ("gamehour", hour); - + mSkyManager->setHour (hour); - + if (days>0) setDay (days + mGlobalVariables->getInt ("day")); } - + void World::setDay (int day) { if (day<0) day = 0; int month = mGlobalVariables->getInt ("month"); - + while (true) { - int days = getDaysPerMonth (month); + int days = getDaysPerMonth (month); if (daysetInt ("year", mGlobalVariables->getInt ("year")+1); } - + day -= days; - } - - mGlobalVariables->setInt ("day", day); + } + + mGlobalVariables->setInt ("day", day); mGlobalVariables->setInt ("month", month); mSkyManager->setDate (day, month); - } - + } + void World::setMonth (int month) { if (month<0) month = 0; - + int years = month / 12; month = month % 12; - + int days = getDaysPerMonth (month); - + if (mGlobalVariables->getInt ("day")>=days) mGlobalVariables->setInt ("day", days-1); - + mGlobalVariables->setInt ("month", month); - + if (years>0) mGlobalVariables->setInt ("year", years+mGlobalVariables->getInt ("year")); mSkyManager->setDate (mGlobalVariables->getInt ("day"), month); } - + void World::toggleSky() { if (mSky) @@ -405,36 +405,36 @@ namespace MWWorld mSkyManager->enable(); } } - + int World::getMasserPhase() const { return mSkyManager->getMasserPhase(); } - + int World::getSecundaPhase() const { return mSkyManager->getSecundaPhase(); } - + void World::setMoonColour (bool red) { - mSkyManager->setMoonColour (red); + mSkyManager->setMoonColour (red); } - + float World::getTimeScaleFactor() const { return mGlobalVariables->getInt ("timescale"); } - + void World::changeCell (const std::string& cellName, const ESM::Position& position) { - // Load cell. + // Load cell. mInteriors[cellName].loadInt (cellName, mStore, mEsm); Ptr::CellStore *cell = &mInteriors[cellName]; - + // remove active CellRenderCollection::iterator active = mActiveCells.begin(); - + if (active!=mActiveCells.end()) { mEnvironment.mMechanicsManager->dropActors (active->first); @@ -444,7 +444,7 @@ namespace MWWorld } // register local scripts - mLocalScripts.clear(); // FIXME won't work with exteriors + mLocalScripts.clear(); // FIXME won't work with exteriors insertInteriorScripts (*cell); // adjust player @@ -458,11 +458,11 @@ namespace MWWorld new MWRender::InteriorCellRender (*cell, mScene))); if (result.second) - { + { // Load the cell and insert it into the renderer result.first->second->show(); } - + // Actors mEnvironment.mMechanicsManager->addActor (mPlayerPos->getPlayer()); mEnvironment.mMechanicsManager->watchActor (mPlayerPos->getPlayer()); @@ -496,12 +496,12 @@ namespace MWWorld // TODO set weather toggleSky(); } - + mCellChanged = true; } - + void World::markCellAsUnchanged() { - mCellChanged = false; + mCellChanged = false; } } diff --git a/components/esm/loadlocks.hpp b/components/esm/loadlocks.hpp index acd8a7805..3b7913ea9 100644 --- a/components/esm/loadlocks.hpp +++ b/components/esm/loadlocks.hpp @@ -50,5 +50,16 @@ struct Tool icon = esm.getHNOString("ITEX"); } }; + +struct Probe : Tool +{ + +}; + +struct Repair : Tool +{ + +}; + } #endif diff --git a/components/esm_store/cell_store.hpp b/components/esm_store/cell_store.hpp index 941dba6fe..d4d7cc2f8 100644 --- a/components/esm_store/cell_store.hpp +++ b/components/esm_store/cell_store.hpp @@ -63,7 +63,7 @@ namespace ESMS list.push_back(lr); } - + LiveRef *find (const std::string& name) { for (typename std::list::iterator iter (list.begin()); iter!=list.end(); ++iter) @@ -71,9 +71,9 @@ namespace ESMS if (iter->ref.refID==name) return &*iter; } - + return 0; - } + } }; /// A storage struct for one single cell reference. @@ -102,8 +102,8 @@ namespace ESMS CellRefList lockpicks; CellRefList miscItems; CellRefList npcs; - CellRefList probes; - CellRefList repairs; + CellRefList probes; + CellRefList repairs; CellRefList statics; CellRefList weapons; @@ -119,12 +119,12 @@ namespace ESMS throw str_exception("Cell not found - " + name); loadRefs(store, esm); - } + } /** Ditto for exterior cell. */ void loadExt(int X, int Y, const ESMStore &store, ESMReader &esm) { - + } private: @@ -176,7 +176,7 @@ namespace ESMS } } } - + }; } diff --git a/components/esm_store/store.hpp b/components/esm_store/store.hpp index 7c4971ac4..fd4a47d4b 100644 --- a/components/esm_store/store.hpp +++ b/components/esm_store/store.hpp @@ -55,10 +55,10 @@ namespace ESMS RecListT miscItems; RecListT npcs; RecListT npcChange; - RecListT probes; + RecListT probes; RecListT races; RecListT regions; - RecListT repairs; + RecListT repairs; RecListT soundGens; RecListT sounds; RecListT spells;