1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 21:29:56 +00:00

Split up components/esm/loadlocks

This commit is contained in:
scrawl 2013-03-22 05:50:54 +01:00
parent b2f6f67d53
commit 918cdcffc2
26 changed files with 228 additions and 166 deletions

View file

@ -275,7 +275,7 @@ RecordBase::create(ESM::NAME type)
} }
case ESM::REC_LOCK: case ESM::REC_LOCK:
{ {
record = new EsmTool::Record<ESM::Tool>; record = new EsmTool::Record<ESM::Lockpick>;
break; break;
} }
case ESM::REC_LTEX: case ESM::REC_LTEX:
@ -864,14 +864,13 @@ void Record<ESM::Light>::print()
} }
template<> template<>
void Record<ESM::Tool>::print() void Record<ESM::Lockpick>::print()
{ {
std::cout << " Name: " << mData.mName << std::endl; std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Model: " << mData.mModel << std::endl; std::cout << " Model: " << mData.mModel << std::endl;
std::cout << " Icon: " << mData.mIcon << std::endl; std::cout << " Icon: " << mData.mIcon << std::endl;
if (mData.mScript != "") if (mData.mScript != "")
std::cout << " Script: " << mData.mScript << std::endl; std::cout << " Script: " << mData.mScript << std::endl;
std::cout << " Type: " << mData.mType << std::endl;
std::cout << " Weight: " << mData.mData.mWeight << std::endl; std::cout << " Weight: " << mData.mData.mWeight << std::endl;
std::cout << " Value: " << mData.mData.mValue << std::endl; std::cout << " Value: " << mData.mData.mValue << std::endl;
std::cout << " Quality: " << mData.mData.mQuality << std::endl; std::cout << " Quality: " << mData.mData.mQuality << std::endl;
@ -886,8 +885,6 @@ void Record<ESM::Probe>::print()
std::cout << " Icon: " << mData.mIcon << std::endl; std::cout << " Icon: " << mData.mIcon << std::endl;
if (mData.mScript != "") if (mData.mScript != "")
std::cout << " Script: " << mData.mScript << std::endl; std::cout << " Script: " << mData.mScript << std::endl;
// BUG? No Type Label?
std::cout << " Type: " << mData.mType << std::endl;
std::cout << " Weight: " << mData.mData.mWeight << std::endl; std::cout << " Weight: " << mData.mData.mWeight << std::endl;
std::cout << " Value: " << mData.mData.mValue << std::endl; std::cout << " Value: " << mData.mData.mValue << std::endl;
std::cout << " Quality: " << mData.mData.mQuality << std::endl; std::cout << " Quality: " << mData.mData.mQuality << std::endl;
@ -902,7 +899,6 @@ void Record<ESM::Repair>::print()
std::cout << " Icon: " << mData.mIcon << std::endl; std::cout << " Icon: " << mData.mIcon << std::endl;
if (mData.mScript != "") if (mData.mScript != "")
std::cout << " Script: " << mData.mScript << std::endl; std::cout << " Script: " << mData.mScript << std::endl;
std::cout << " Type: " << mData.mType << std::endl;
std::cout << " Weight: " << mData.mData.mWeight << std::endl; std::cout << " Weight: " << mData.mData.mWeight << std::endl;
std::cout << " Value: " << mData.mData.mValue << std::endl; std::cout << " Value: " << mData.mData.mValue << std::endl;
std::cout << " Quality: " << mData.mData.mQuality << std::endl; std::cout << " Quality: " << mData.mData.mQuality << std::endl;

View file

@ -104,7 +104,7 @@ namespace EsmTool
template<> void Record<ESM::CreatureLevList>::print(); template<> void Record<ESM::CreatureLevList>::print();
template<> void Record<ESM::ItemLevList>::print(); template<> void Record<ESM::ItemLevList>::print();
template<> void Record<ESM::Light>::print(); template<> void Record<ESM::Light>::print();
template<> void Record<ESM::Tool>::print(); template<> void Record<ESM::Lockpick>::print();
template<> void Record<ESM::Probe>::print(); template<> void Record<ESM::Probe>::print();
template<> void Record<ESM::Repair>::print(); template<> void Record<ESM::Repair>::print();
template<> void Record<ESM::LandTexture>::print(); template<> void Record<ESM::LandTexture>::print();

View file

@ -1,7 +1,7 @@
#include "lockpick.hpp" #include "lockpick.hpp"
#include <components/esm/loadlocks.hpp> #include <components/esm/loadlock.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -41,8 +41,8 @@ namespace MWClass
std::string Lockpick::getModel(const MWWorld::Ptr &ptr) const std::string Lockpick::getModel(const MWWorld::Ptr &ptr) const
{ {
MWWorld::LiveCellRef<ESM::Tool> *ref = MWWorld::LiveCellRef<ESM::Lockpick> *ref =
ptr.get<ESM::Tool>(); ptr.get<ESM::Lockpick>();
assert(ref->mBase != NULL); assert(ref->mBase != NULL);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
@ -54,8 +54,8 @@ namespace MWClass
std::string Lockpick::getName (const MWWorld::Ptr& ptr) const std::string Lockpick::getName (const MWWorld::Ptr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Tool> *ref = MWWorld::LiveCellRef<ESM::Lockpick> *ref =
ptr.get<ESM::Tool>(); ptr.get<ESM::Lockpick>();
return ref->mBase->mName; return ref->mBase->mName;
} }
@ -75,8 +75,8 @@ namespace MWClass
std::string Lockpick::getScript (const MWWorld::Ptr& ptr) const std::string Lockpick::getScript (const MWWorld::Ptr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Tool> *ref = MWWorld::LiveCellRef<ESM::Lockpick> *ref =
ptr.get<ESM::Tool>(); ptr.get<ESM::Lockpick>();
return ref->mBase->mScript; return ref->mBase->mScript;
} }
@ -92,8 +92,8 @@ namespace MWClass
int Lockpick::getValue (const MWWorld::Ptr& ptr) const int Lockpick::getValue (const MWWorld::Ptr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Tool> *ref = MWWorld::LiveCellRef<ESM::Lockpick> *ref =
ptr.get<ESM::Tool>(); ptr.get<ESM::Lockpick>();
return ref->mBase->mData.mValue; return ref->mBase->mData.mValue;
} }
@ -102,7 +102,7 @@ namespace MWClass
{ {
boost::shared_ptr<Class> instance (new Lockpick); boost::shared_ptr<Class> instance (new Lockpick);
registerClass (typeid (ESM::Tool).name(), instance); registerClass (typeid (ESM::Lockpick).name(), instance);
} }
std::string Lockpick::getUpSoundId (const MWWorld::Ptr& ptr) const std::string Lockpick::getUpSoundId (const MWWorld::Ptr& ptr) const
@ -117,24 +117,24 @@ namespace MWClass
std::string Lockpick::getInventoryIcon (const MWWorld::Ptr& ptr) const std::string Lockpick::getInventoryIcon (const MWWorld::Ptr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Tool> *ref = MWWorld::LiveCellRef<ESM::Lockpick> *ref =
ptr.get<ESM::Tool>(); ptr.get<ESM::Lockpick>();
return ref->mBase->mIcon; return ref->mBase->mIcon;
} }
bool Lockpick::hasToolTip (const MWWorld::Ptr& ptr) const bool Lockpick::hasToolTip (const MWWorld::Ptr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Tool> *ref = MWWorld::LiveCellRef<ESM::Lockpick> *ref =
ptr.get<ESM::Tool>(); ptr.get<ESM::Lockpick>();
return (ref->mBase->mName != ""); return (ref->mBase->mName != "");
} }
MWGui::ToolTipInfo Lockpick::getToolTipInfo (const MWWorld::Ptr& ptr) const MWGui::ToolTipInfo Lockpick::getToolTipInfo (const MWWorld::Ptr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Tool> *ref = MWWorld::LiveCellRef<ESM::Lockpick> *ref =
ptr.get<ESM::Tool>(); ptr.get<ESM::Lockpick>();
MWGui::ToolTipInfo info; MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
@ -171,8 +171,8 @@ namespace MWClass
MWWorld::Ptr MWWorld::Ptr
Lockpick::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const Lockpick::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
{ {
MWWorld::LiveCellRef<ESM::Tool> *ref = MWWorld::LiveCellRef<ESM::Lockpick> *ref =
ptr.get<ESM::Tool>(); ptr.get<ESM::Lockpick>();
return MWWorld::Ptr(&cell.mLockpicks.insert(*ref), &cell); return MWWorld::Ptr(&cell.mLockpicks.insert(*ref), &cell);
} }

View file

@ -1,7 +1,7 @@
#include "probe.hpp" #include "probe.hpp"
#include <components/esm/loadlocks.hpp> #include <components/esm/loadprob.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"

View file

@ -1,7 +1,7 @@
#include "repair.hpp" #include "repair.hpp"
#include <components/esm/loadlocks.hpp> #include <components/esm/loadrepa.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"

View file

@ -45,7 +45,7 @@ namespace
mapping.push_back( typeid(ESM::Book).name() ); mapping.push_back( typeid(ESM::Book).name() );
mapping.push_back( typeid(ESM::Light).name() ); mapping.push_back( typeid(ESM::Light).name() );
mapping.push_back( typeid(ESM::Miscellaneous).name() ); mapping.push_back( typeid(ESM::Miscellaneous).name() );
mapping.push_back( typeid(ESM::Tool).name() ); mapping.push_back( typeid(ESM::Lockpick).name() );
mapping.push_back( typeid(ESM::Repair).name() ); mapping.push_back( typeid(ESM::Repair).name() );
mapping.push_back( typeid(ESM::Probe).name() ); mapping.push_back( typeid(ESM::Probe).name() );

View file

@ -308,7 +308,7 @@ namespace MWGui
&& (type != typeid(ESM::Ingredient).name()) && (type != typeid(ESM::Ingredient).name())
&& (type != typeid(ESM::Light).name()) && (type != typeid(ESM::Light).name())
&& (type != typeid(ESM::Miscellaneous).name()) && (type != typeid(ESM::Miscellaneous).name())
&& (type != typeid(ESM::Tool).name()) && (type != typeid(ESM::Lockpick).name())
&& (type != typeid(ESM::Probe).name()) && (type != typeid(ESM::Probe).name())
&& (type != typeid(ESM::Repair).name()) && (type != typeid(ESM::Repair).name())
&& (type != typeid(ESM::Weapon).name()) && (type != typeid(ESM::Weapon).name())

View file

@ -368,7 +368,7 @@ namespace MWGui
return services & ESM::NPC::Books; return services & ESM::NPC::Books;
else if (item.getTypeName() == typeid(ESM::Ingredient).name()) else if (item.getTypeName() == typeid(ESM::Ingredient).name())
return services & ESM::NPC::Ingredients; return services & ESM::NPC::Ingredients;
else if (item.getTypeName() == typeid(ESM::Tool).name()) else if (item.getTypeName() == typeid(ESM::Lockpick).name())
return services & ESM::NPC::Picks; return services & ESM::NPC::Picks;
else if (item.getTypeName() == typeid(ESM::Probe).name()) else if (item.getTypeName() == typeid(ESM::Probe).name())
return services & ESM::NPC::Probes; return services & ESM::NPC::Probes;

View file

@ -59,7 +59,7 @@ namespace MWScript
store.get<ESM::CreatureLevList>().search (name) || store.get<ESM::CreatureLevList>().search (name) ||
store.get<ESM::ItemLevList>().search (name) || store.get<ESM::ItemLevList>().search (name) ||
store.get<ESM::Light>().search (name) || store.get<ESM::Light>().search (name) ||
store.get<ESM::Tool>().search (name) || store.get<ESM::Lockpick>().search (name) ||
store.get<ESM::Miscellaneous>().search (name) || store.get<ESM::Miscellaneous>().search (name) ||
store.get<ESM::NPC>().search (name) || store.get<ESM::NPC>().search (name) ||
store.get<ESM::Probe>().search (name) || store.get<ESM::Probe>().search (name) ||

View file

@ -206,7 +206,7 @@ MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name, Ptr::CellStore& ce
if (MWWorld::LiveCellRef<ESM::Light> *ref = cell.mLights.find (name)) if (MWWorld::LiveCellRef<ESM::Light> *ref = cell.mLights.find (name))
ptr = Ptr (ref, &cell); ptr = Ptr (ref, &cell);
if (MWWorld::LiveCellRef<ESM::Tool> *ref = cell.mLockpicks.find (name)) if (MWWorld::LiveCellRef<ESM::Lockpick> *ref = cell.mLockpicks.find (name))
ptr = Ptr (ref, &cell); ptr = Ptr (ref, &cell);
if (MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = cell.mMiscItems.find (name)) if (MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = cell.mMiscItems.find (name))

View file

@ -112,7 +112,7 @@ namespace MWWorld
CellRefList<ESM::CreatureLevList> mCreatureLists; CellRefList<ESM::CreatureLevList> mCreatureLists;
CellRefList<ESM::ItemLevList> mItemLists; CellRefList<ESM::ItemLevList> mItemLists;
CellRefList<ESM::Light> mLights; CellRefList<ESM::Light> mLights;
CellRefList<ESM::Tool> mLockpicks; CellRefList<ESM::Lockpick> mLockpicks;
CellRefList<ESM::Miscellaneous> mMiscItems; CellRefList<ESM::Miscellaneous> mMiscItems;
CellRefList<ESM::NPC> mNpcs; CellRefList<ESM::NPC> mNpcs;
CellRefList<ESM::Probe> mProbes; CellRefList<ESM::Probe> mProbes;

View file

@ -171,7 +171,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImpl (const Ptr& ptr
case Type_Clothing: clothes.mList.push_back (*ptr.get<ESM::Clothing>()); it = ContainerStoreIterator(this, --clothes.mList.end()); break; case Type_Clothing: clothes.mList.push_back (*ptr.get<ESM::Clothing>()); it = ContainerStoreIterator(this, --clothes.mList.end()); break;
case Type_Ingredient: ingreds.mList.push_back (*ptr.get<ESM::Ingredient>()); it = ContainerStoreIterator(this, --ingreds.mList.end()); break; case Type_Ingredient: ingreds.mList.push_back (*ptr.get<ESM::Ingredient>()); it = ContainerStoreIterator(this, --ingreds.mList.end()); break;
case Type_Light: lights.mList.push_back (*ptr.get<ESM::Light>()); it = ContainerStoreIterator(this, --lights.mList.end()); break; case Type_Light: lights.mList.push_back (*ptr.get<ESM::Light>()); it = ContainerStoreIterator(this, --lights.mList.end()); break;
case Type_Lockpick: lockpicks.mList.push_back (*ptr.get<ESM::Tool>()); it = ContainerStoreIterator(this, --lockpicks.mList.end()); break; case Type_Lockpick: lockpicks.mList.push_back (*ptr.get<ESM::Lockpick>()); it = ContainerStoreIterator(this, --lockpicks.mList.end()); break;
case Type_Miscellaneous: miscItems.mList.push_back (*ptr.get<ESM::Miscellaneous>()); it = ContainerStoreIterator(this, --miscItems.mList.end()); break; case Type_Miscellaneous: miscItems.mList.push_back (*ptr.get<ESM::Miscellaneous>()); it = ContainerStoreIterator(this, --miscItems.mList.end()); break;
case Type_Probe: probes.mList.push_back (*ptr.get<ESM::Probe>()); it = ContainerStoreIterator(this, --probes.mList.end()); break; case Type_Probe: probes.mList.push_back (*ptr.get<ESM::Probe>()); it = ContainerStoreIterator(this, --probes.mList.end()); break;
case Type_Repair: repairs.mList.push_back (*ptr.get<ESM::Repair>()); it = ContainerStoreIterator(this, --repairs.mList.end()); break; case Type_Repair: repairs.mList.push_back (*ptr.get<ESM::Repair>()); it = ContainerStoreIterator(this, --repairs.mList.end()); break;
@ -272,7 +272,7 @@ int MWWorld::ContainerStore::getType (const Ptr& ptr)
if (ptr.getTypeName()==typeid (ESM::Light).name()) if (ptr.getTypeName()==typeid (ESM::Light).name())
return Type_Light; return Type_Light;
if (ptr.getTypeName()==typeid (ESM::Tool).name()) if (ptr.getTypeName()==typeid (ESM::Lockpick).name())
return Type_Lockpick; return Type_Lockpick;
if (ptr.getTypeName()==typeid (ESM::Miscellaneous).name()) if (ptr.getTypeName()==typeid (ESM::Miscellaneous).name())
@ -321,7 +321,7 @@ MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *contain
: mType(MWWorld::ContainerStore::Type_Ingredient), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mIngredient(iterator){} : mType(MWWorld::ContainerStore::Type_Ingredient), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mIngredient(iterator){}
MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Light>::List::iterator iterator) MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Light>::List::iterator iterator)
: mType(MWWorld::ContainerStore::Type_Light), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mLight(iterator){} : mType(MWWorld::ContainerStore::Type_Light), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mLight(iterator){}
MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Tool>::List::iterator iterator) MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Lockpick>::List::iterator iterator)
: mType(MWWorld::ContainerStore::Type_Lockpick), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mLockpick(iterator){} : mType(MWWorld::ContainerStore::Type_Lockpick), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mLockpick(iterator){}
MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Miscellaneous>::List::iterator iterator) MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Miscellaneous>::List::iterator iterator)
: mType(MWWorld::ContainerStore::Type_Miscellaneous), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mMiscellaneous(iterator){} : mType(MWWorld::ContainerStore::Type_Miscellaneous), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mMiscellaneous(iterator){}

View file

@ -44,7 +44,7 @@ namespace MWWorld
MWWorld::CellRefList<ESM::Clothing> clothes; MWWorld::CellRefList<ESM::Clothing> clothes;
MWWorld::CellRefList<ESM::Ingredient> ingreds; MWWorld::CellRefList<ESM::Ingredient> ingreds;
MWWorld::CellRefList<ESM::Light> lights; MWWorld::CellRefList<ESM::Light> lights;
MWWorld::CellRefList<ESM::Tool> lockpicks; MWWorld::CellRefList<ESM::Lockpick> lockpicks;
MWWorld::CellRefList<ESM::Miscellaneous> miscItems; MWWorld::CellRefList<ESM::Miscellaneous> miscItems;
MWWorld::CellRefList<ESM::Probe> probes; MWWorld::CellRefList<ESM::Probe> probes;
MWWorld::CellRefList<ESM::Repair> repairs; MWWorld::CellRefList<ESM::Repair> repairs;
@ -127,7 +127,7 @@ namespace MWWorld
MWWorld::CellRefList<ESM::Clothing>::List::iterator mClothing; MWWorld::CellRefList<ESM::Clothing>::List::iterator mClothing;
MWWorld::CellRefList<ESM::Ingredient>::List::iterator mIngredient; MWWorld::CellRefList<ESM::Ingredient>::List::iterator mIngredient;
MWWorld::CellRefList<ESM::Light>::List::iterator mLight; MWWorld::CellRefList<ESM::Light>::List::iterator mLight;
MWWorld::CellRefList<ESM::Tool>::List::iterator mLockpick; MWWorld::CellRefList<ESM::Lockpick>::List::iterator mLockpick;
MWWorld::CellRefList<ESM::Miscellaneous>::List::iterator mMiscellaneous; MWWorld::CellRefList<ESM::Miscellaneous>::List::iterator mMiscellaneous;
MWWorld::CellRefList<ESM::Probe>::List::iterator mProbe; MWWorld::CellRefList<ESM::Probe>::List::iterator mProbe;
MWWorld::CellRefList<ESM::Repair>::List::iterator mRepair; MWWorld::CellRefList<ESM::Repair>::List::iterator mRepair;
@ -149,7 +149,7 @@ namespace MWWorld
ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Clothing>::List::iterator); ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Clothing>::List::iterator);
ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Ingredient>::List::iterator); ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Ingredient>::List::iterator);
ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Light>::List::iterator); ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Light>::List::iterator);
ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Tool>::List::iterator); ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Lockpick>::List::iterator);
ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Miscellaneous>::List::iterator); ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Miscellaneous>::List::iterator);
ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Probe>::List::iterator); ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Probe>::List::iterator);
ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Repair>::List::iterator); ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList<ESM::Repair>::List::iterator);

View file

@ -32,7 +32,7 @@ namespace MWWorld
Store<ESM::CreatureLevList> mCreatureLists; Store<ESM::CreatureLevList> mCreatureLists;
Store<ESM::ItemLevList> mItemLists; Store<ESM::ItemLevList> mItemLists;
Store<ESM::Light> mLights; Store<ESM::Light> mLights;
Store<ESM::Tool> mLockpicks; Store<ESM::Lockpick> mLockpicks;
Store<ESM::Miscellaneous> mMiscItems; Store<ESM::Miscellaneous> mMiscItems;
Store<ESM::NPC> mNpcs; Store<ESM::NPC> mNpcs;
Store<ESM::LoadNPCC> mNpcChange; Store<ESM::LoadNPCC> mNpcChange;
@ -312,7 +312,7 @@ namespace MWWorld
} }
template <> template <>
inline const Store<ESM::Tool> &ESMStore::get<ESM::Tool>() const { inline const Store<ESM::Lockpick> &ESMStore::get<ESM::Lockpick>() const {
return mLockpicks; return mLockpicks;
} }

View file

@ -53,7 +53,7 @@ namespace MWWorld
!create (store.get<ESM::CreatureLevList>(), name) && !create (store.get<ESM::CreatureLevList>(), name) &&
!create (store.get<ESM::ItemLevList>(), name) && !create (store.get<ESM::ItemLevList>(), name) &&
!create (store.get<ESM::Light>(), name) && !create (store.get<ESM::Light>(), name) &&
!create (store.get<ESM::Tool>(), name) && !create (store.get<ESM::Lockpick>(), name) &&
!create (store.get<ESM::Miscellaneous>(), name) && !create (store.get<ESM::Miscellaneous>(), name) &&
!create (store.get<ESM::NPC>(), name) && !create (store.get<ESM::NPC>(), name) &&
!create (store.get<ESM::Probe>(), name) && !create (store.get<ESM::Probe>(), name) &&

View file

@ -101,7 +101,7 @@ namespace MWWorld
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (MWWorld::LiveCellRef<ESM::Light> *ref = searchViaHandle (handle, cell.mLights)) if (MWWorld::LiveCellRef<ESM::Light> *ref = searchViaHandle (handle, cell.mLights))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (MWWorld::LiveCellRef<ESM::Tool> *ref = searchViaHandle (handle, cell.mLockpicks)) if (MWWorld::LiveCellRef<ESM::Lockpick> *ref = searchViaHandle (handle, cell.mLockpicks))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = searchViaHandle (handle, cell.mMiscItems)) if (MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = searchViaHandle (handle, cell.mMiscItems))
return Ptr (ref, &cell); return Ptr (ref, &cell);

View file

@ -37,7 +37,7 @@ add_component_dir (file_finder
add_component_dir (esm add_component_dir (esm
attr defs esmcommon esmreader esmwriter loadacti loadalch loadappa loadarmo loadbody loadbook loadbsgn loadcell attr defs esmcommon esmreader esmwriter loadacti loadalch loadappa loadarmo loadbody loadbook loadbsgn loadcell
loadclas loadclot loadcont loadcrea loadcrec loaddial loaddoor loadench loadfact loadglob loadgmst loadclas loadclot loadcont loadcrea loadcrec loaddial loaddoor loadench loadfact loadglob loadgmst
loadinfo loadingr loadland loadlevlist loadligh loadlocks loadltex loadmgef loadmisc loadnpcc loadinfo loadingr loadland loadlevlist loadligh loadlock loadprob loadrepa loadltex loadmgef loadmisc loadnpcc
loadnpc loadpgrd loadrace loadregn loadscpt loadskil loadsndg loadsoun loadspel loadsscr loadstat loadnpc loadpgrd loadrace loadregn loadscpt loadskil loadsndg loadsoun loadspel loadsscr loadstat
loadweap records aipackage effectlist spelllist variant variantimp loadtes3 loadweap records aipackage effectlist spelllist variant variantimp loadtes3
) )

View file

@ -0,0 +1,31 @@
#include "loadlock.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
void Lockpick::load(ESMReader &esm)
{
mModel = esm.getHNString("MODL");
mName = esm.getHNString("FNAM");
esm.getHNT(mData, "LKDT", 16);
mScript = esm.getHNOString("SCRI");
mIcon = esm.getHNOString("ITEX");
}
void Lockpick::save(ESMWriter &esm)
{
esm.writeHNCString("MODL", mModel);
esm.writeHNCString("FNAM", mName);
esm.writeHNT("LKDT", mData, 16);
esm.writeHNOString("SCRI", mScript);
esm.writeHNOCString("ITEX", mIcon);
}
}

View file

@ -0,0 +1,31 @@
#ifndef OPENMW_ESM_LOCK_H
#define OPENMW_ESM_LOCK_H
#include <string>
namespace ESM
{
class ESMReader;
class ESMWriter;
struct Lockpick
{
struct Data
{
float mWeight;
int mValue;
float mQuality;
int mUses;
}; // Size = 16
Data mData;
std::string mId, mName, mModel, mIcon, mScript;
void load(ESMReader &esm);
void save(ESMWriter &esm);
};
}
#endif

View file

@ -1,65 +0,0 @@
#include "loadlocks.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
void Tool::load(ESMReader &esm)
{
mModel = esm.getHNString("MODL");
mName = esm.getHNString("FNAM");
esm.getSubName();
NAME n = esm.retSubName();
// The data name varies, RIDT for repair items, LKDT for lock
// picks, PBDT for probes
esm.getHT(mData, 16);
if (n == "RIDT")
{
mType = Type_Repair;
// Swap t.data.quality and t.data.uses for repair items (sigh)
float tmp = *((float*) &mData.mUses);
mData.mUses = *((int*) &mData.mQuality);
mData.mQuality = tmp;
}
else if (n == "LKDT")
mType = Type_Pick;
else if (n == "PBDT")
mType = Type_Probe;
mScript = esm.getHNOString("SCRI");
mIcon = esm.getHNOString("ITEX");
}
void Tool::save(ESMWriter &esm)
{
esm.writeHNCString("MODL", mModel);
esm.writeHNCString("FNAM", mName);
std::string typeName;
switch(mType)
{
case Type_Repair: typeName = "RIDT"; break;
case Type_Pick: typeName = "LKDT"; break;
case Type_Probe: typeName = "PBDT"; break;
}
Data write = mData;
if (mType == Type_Repair)
{
float tmp = *((float*) &write.mUses);
write.mUses = *((int*) &write.mQuality);
write.mQuality = tmp;
}
esm.writeHNT(typeName, write, 16);
esm.writeHNOString("SCRI", mScript);
esm.writeHNOCString("ITEX", mIcon);
}
}

View file

@ -1,56 +0,0 @@
#ifndef OPENMW_ESM_LOCKS_H
#define OPENMW_ESM_LOCKS_H
#include <string>
namespace ESM
{
class ESMReader;
class ESMWriter;
/*
* This file covers lockpicks (LOCK), probes (PROB) and armor repair
* items (REPA). These have nearly identical data structures.
*/
struct Tool
{
enum Type
{
Type_Pick,
Type_Probe,
Type_Repair
};
struct Data
{
float mWeight;
int mValue;
float mQuality; // And when I say nearly identical structure, I
int mUses; // mean perfectly identical except that these two
// variables are swaped for repair items. Don't ask
// me why.
}; // Size = 16
Data mData;
Type mType;
std::string mId, mName, mModel, mIcon, mScript;
void load(ESMReader &esm);
void save(ESMWriter &esm);
};
struct Probe: Tool
{
Probe() { mType = Type_Probe; }
};
struct Repair: Tool
{
Repair() { mType = Type_Repair; }
};
}
#endif

View file

@ -0,0 +1,30 @@
#include "loadprob.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
void Probe::load(ESMReader &esm)
{
mModel = esm.getHNString("MODL");
mName = esm.getHNString("FNAM");
esm.getHNT(mData, "PBDT", 16);
mScript = esm.getHNOString("SCRI");
mIcon = esm.getHNOString("ITEX");
}
void Probe::save(ESMWriter &esm)
{
esm.writeHNCString("MODL", mModel);
esm.writeHNCString("FNAM", mName);
esm.writeHNT("PBDT", mData, 16);
esm.writeHNOString("SCRI", mScript);
esm.writeHNOCString("ITEX", mIcon);
}
}

View file

@ -0,0 +1,31 @@
#ifndef OPENMW_ESM_PROBE_H
#define OPENMW_ESM_PROBE_H
#include <string>
namespace ESM
{
class ESMReader;
class ESMWriter;
struct Probe
{
struct Data
{
float mWeight;
int mValue;
float mQuality;
int mUses;
}; // Size = 16
Data mData;
std::string mId, mName, mModel, mIcon, mScript;
void load(ESMReader &esm);
void save(ESMWriter &esm);
};
}
#endif

View file

@ -0,0 +1,31 @@
#include "loadrepa.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
void Repair::load(ESMReader &esm)
{
mModel = esm.getHNString("MODL");
mName = esm.getHNString("FNAM");
esm.getHNT(mData, "RIDT", 16);
mScript = esm.getHNOString("SCRI");
mIcon = esm.getHNOString("ITEX");
}
void Repair::save(ESMWriter &esm)
{
esm.writeHNCString("MODL", mModel);
esm.writeHNCString("FNAM", mName);
esm.writeHNT("RIDT", mData, 16);
esm.writeHNOString("SCRI", mScript);
esm.writeHNOCString("ITEX", mIcon);
}
}

View file

@ -0,0 +1,31 @@
#ifndef OPENMW_ESM_REPA_H
#define OPENMW_ESM_REPA_H
#include <string>
namespace ESM
{
class ESMReader;
class ESMWriter;
struct Repair
{
struct Data
{
float mWeight;
int mValue;
int mUses;
float mQuality;
}; // Size = 16
Data mData;
std::string mId, mName, mModel, mIcon, mScript;
void load(ESMReader &esm);
void save(ESMWriter &esm);
};
}
#endif

View file

@ -26,7 +26,9 @@
#include "loadland.hpp" #include "loadland.hpp"
#include "loadlevlist.hpp" #include "loadlevlist.hpp"
#include "loadligh.hpp" #include "loadligh.hpp"
#include "loadlocks.hpp" #include "loadlock.hpp"
#include "loadrepa.hpp"
#include "loadprob.hpp"
#include "loadltex.hpp" #include "loadltex.hpp"
#include "loadmgef.hpp" #include "loadmgef.hpp"
#include "loadmisc.hpp" #include "loadmisc.hpp"