mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-31 15:32:45 +00:00
added missing record classes
This commit is contained in:
parent
0851044fa6
commit
f50ced4616
@ -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})
|
||||
|
||||
|
14
apps/openmw/mwclass/apparatus.cpp
Normal file
14
apps/openmw/mwclass/apparatus.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "apparatus.hpp"
|
||||
|
||||
#include <components/esm/loadappa.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Apparatus::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new Apparatus);
|
||||
|
||||
registerClass (typeid (ESM::Apparatus).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/apparatus.hpp
Normal file
17
apps/openmw/mwclass/apparatus.hpp
Normal file
@ -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
|
14
apps/openmw/mwclass/book.cpp
Normal file
14
apps/openmw/mwclass/book.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "book.hpp"
|
||||
|
||||
#include <components/esm/loadbook.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Book::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new Book);
|
||||
|
||||
registerClass (typeid (ESM::Book).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/book.hpp
Normal file
17
apps/openmw/mwclass/book.hpp
Normal file
@ -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
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
14
apps/openmw/mwclass/clothing.cpp
Normal file
14
apps/openmw/mwclass/clothing.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "clothing.hpp"
|
||||
|
||||
#include <components/esm/loadclot.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Clothing::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new Clothing);
|
||||
|
||||
registerClass (typeid (ESM::Clothing).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/clothing.hpp
Normal file
17
apps/openmw/mwclass/clothing.hpp
Normal file
@ -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
|
14
apps/openmw/mwclass/container.cpp
Normal file
14
apps/openmw/mwclass/container.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "container.hpp"
|
||||
|
||||
#include <components/esm/loadcont.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Container::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new Container);
|
||||
|
||||
registerClass (typeid (ESM::Container).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/container.hpp
Normal file
17
apps/openmw/mwclass/container.hpp
Normal file
@ -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
|
14
apps/openmw/mwclass/creaturelevlist.cpp
Normal file
14
apps/openmw/mwclass/creaturelevlist.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "creaturelevlist.hpp"
|
||||
|
||||
#include <components/esm/loadlevlist.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void CreatureLevList::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new CreatureLevList);
|
||||
|
||||
registerClass (typeid (ESM::CreatureLevList).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/creaturelevlist.hpp
Normal file
17
apps/openmw/mwclass/creaturelevlist.hpp
Normal file
@ -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
|
14
apps/openmw/mwclass/door.cpp
Normal file
14
apps/openmw/mwclass/door.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "door.hpp"
|
||||
|
||||
#include <components/esm/loaddoor.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Door::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new Door);
|
||||
|
||||
registerClass (typeid (ESM::Door).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/door.hpp
Normal file
17
apps/openmw/mwclass/door.hpp
Normal file
@ -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
|
14
apps/openmw/mwclass/ingredient.cpp
Normal file
14
apps/openmw/mwclass/ingredient.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "ingredient.hpp"
|
||||
|
||||
#include <components/esm/loadingr.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Ingredient::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new Ingredient);
|
||||
|
||||
registerClass (typeid (ESM::Ingredient).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/ingredient.hpp
Normal file
17
apps/openmw/mwclass/ingredient.hpp
Normal file
@ -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
|
14
apps/openmw/mwclass/itemlevlist.cpp
Normal file
14
apps/openmw/mwclass/itemlevlist.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "itemlevlist.hpp"
|
||||
|
||||
#include <components/esm/loadlevlist.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void ItemLevList::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new ItemLevList);
|
||||
|
||||
registerClass (typeid (ESM::ItemLevList).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/itemlevlist.hpp
Normal file
17
apps/openmw/mwclass/itemlevlist.hpp
Normal file
@ -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
|
14
apps/openmw/mwclass/light.cpp
Normal file
14
apps/openmw/mwclass/light.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "light.hpp"
|
||||
|
||||
#include <components/esm/loadligh.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Light::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new Light);
|
||||
|
||||
registerClass (typeid (ESM::Light).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/light.hpp
Normal file
17
apps/openmw/mwclass/light.hpp
Normal file
@ -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
|
14
apps/openmw/mwclass/lockpick.cpp
Normal file
14
apps/openmw/mwclass/lockpick.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "lockpick.hpp"
|
||||
|
||||
#include <components/esm/loadlocks.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Lockpick::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new Lockpick);
|
||||
|
||||
registerClass (typeid (ESM::Tool).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/lockpick.hpp
Normal file
17
apps/openmw/mwclass/lockpick.hpp
Normal file
@ -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
|
14
apps/openmw/mwclass/misc.cpp
Normal file
14
apps/openmw/mwclass/misc.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "misc.hpp"
|
||||
|
||||
#include <components/esm/loadmisc.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Misc::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new Misc);
|
||||
|
||||
registerClass (typeid (ESM::Misc).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/misc.hpp
Normal file
17
apps/openmw/mwclass/misc.hpp
Normal file
@ -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
|
14
apps/openmw/mwclass/potion.cpp
Normal file
14
apps/openmw/mwclass/potion.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "potion.hpp"
|
||||
|
||||
#include <components/esm/loadalch.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Potion::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new Potion);
|
||||
|
||||
registerClass (typeid (ESM::Potion).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/potion.hpp
Normal file
17
apps/openmw/mwclass/potion.hpp
Normal file
@ -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
|
14
apps/openmw/mwclass/probe.cpp
Normal file
14
apps/openmw/mwclass/probe.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "probe.hpp"
|
||||
|
||||
#include <components/esm/loadlocks.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Probe::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new Probe);
|
||||
|
||||
registerClass (typeid (ESM::Probe).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/probe.hpp
Normal file
17
apps/openmw/mwclass/probe.hpp
Normal file
@ -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
|
14
apps/openmw/mwclass/repair.cpp
Normal file
14
apps/openmw/mwclass/repair.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "repair.hpp"
|
||||
|
||||
#include <components/esm/loadlocks.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Repair::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new Repair);
|
||||
|
||||
registerClass (typeid (ESM::Repair).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/repair.hpp
Normal file
17
apps/openmw/mwclass/repair.hpp
Normal file
@ -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
|
14
apps/openmw/mwclass/static.cpp
Normal file
14
apps/openmw/mwclass/static.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
#include "static.hpp"
|
||||
|
||||
#include <components/esm/loadstat.hpp>
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Static::registerSelf()
|
||||
{
|
||||
boost::shared_ptr<Class> instance (new Static);
|
||||
|
||||
registerClass (typeid (ESM::Static).name(), instance);
|
||||
}
|
||||
}
|
17
apps/openmw/mwclass/static.hpp
Normal file
17
apps/openmw/mwclass/static.hpp
Normal file
@ -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
|
@ -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<ESM::Activator, RefData> *ref = cell.activators.find (name))
|
||||
@ -69,68 +69,68 @@ namespace MWWorld
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Potion, RefData> *ref = cell.potions.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Apparatus, RefData> *ref = cell.appas.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Armor, RefData> *ref = cell.armors.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Book, RefData> *ref = cell.books.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Clothing, RefData> *ref = cell.clothes.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Container, RefData> *ref = cell.containers.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Creature, RefData> *ref = cell.creatures.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Door, RefData> *ref = cell.doors.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Ingredient, RefData> *ref = cell.ingreds.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::CreatureLevList, RefData> *ref = cell.creatureLists.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::ItemLevList, RefData> *ref = cell.itemLists.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Light, RefData> *ref = cell.lights.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Tool, RefData> *ref = cell.lockpicks.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Misc, RefData> *ref = cell.miscItems.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::NPC, RefData> *ref = cell.npcs.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Tool, RefData> *ref = cell.probes.find (name))
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Probe, RefData> *ref = cell.probes.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Tool, RefData> *ref = cell.repairs.find (name))
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Repair, RefData> *ref = cell.repairs.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Static, RefData> *ref = cell.statics.find (name))
|
||||
return Ptr (ref, &cell);
|
||||
|
||||
|
||||
if (ESMS::LiveCellRef<ESM::Weapon, RefData> *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<ESM::NPC, RefData>) ||
|
||||
reference.getType()==typeid (ESMS::LiveCellRef<ESM::Creature, RefData>)))
|
||||
@ -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<ESM::NPC, RefData>) ||
|
||||
reference.getType()==typeid (ESMS::LiveCellRef<ESM::Creature, RefData>)))
|
||||
{
|
||||
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 (day<days)
|
||||
break;
|
||||
|
||||
|
||||
if (month<11)
|
||||
{
|
||||
++month;
|
||||
@ -357,37 +357,37 @@ namespace MWWorld
|
||||
month = 0;
|
||||
mGlobalVariables->setInt ("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;
|
||||
}
|
||||
}
|
||||
|
@ -50,5 +50,16 @@ struct Tool
|
||||
icon = esm.getHNOString("ITEX");
|
||||
}
|
||||
};
|
||||
|
||||
struct Probe : Tool
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
struct Repair : Tool
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -63,7 +63,7 @@ namespace ESMS
|
||||
|
||||
list.push_back(lr);
|
||||
}
|
||||
|
||||
|
||||
LiveRef *find (const std::string& name)
|
||||
{
|
||||
for (typename std::list<LiveRef>::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<Tool, D> lockpicks;
|
||||
CellRefList<Misc, D> miscItems;
|
||||
CellRefList<NPC, D> npcs;
|
||||
CellRefList<Tool, D> probes;
|
||||
CellRefList<Tool, D> repairs;
|
||||
CellRefList<Probe, D> probes;
|
||||
CellRefList<Repair, D> repairs;
|
||||
CellRefList<Static, D> statics;
|
||||
CellRefList<Weapon, D> 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -55,10 +55,10 @@ namespace ESMS
|
||||
RecListT<Misc> miscItems;
|
||||
RecListT<NPC> npcs;
|
||||
RecListT<LoadNPCC> npcChange;
|
||||
RecListT<Tool> probes;
|
||||
RecListT<Probe> probes;
|
||||
RecListT<Race> races;
|
||||
RecListT<Region> regions;
|
||||
RecListT<Tool> repairs;
|
||||
RecListT<Repair> repairs;
|
||||
RecListT<SoundGenerator> soundGens;
|
||||
RecListT<Sound> sounds;
|
||||
RecListT<Spell> spells;
|
||||
|
Loading…
x
Reference in New Issue
Block a user