modified Npc and Creature class to let them store a copy of their own ID

This commit is contained in:
Marc Zinnschlag 2010-08-08 14:09:09 +02:00
parent 7afc8ffd2e
commit 8d85211fa1
6 changed files with 88 additions and 25 deletions

View file

@ -180,7 +180,7 @@ int main(int argc, char**argv)
case REC_CREA:
{
Creature b;
b.load(esm);
b.load(esm, id);
if(quiet) break;
cout << " Name: " << b.name << endl;
break;

View file

@ -36,6 +36,23 @@ namespace MWWorld
return false;
}
template<typename T>
bool create (const ESMS::RecListWithIDT<T>& list, const std::string& name)
{
if (const T *instance = list.search (name))
{
ESMS::LiveCellRef<T, RefData> ref;
ref.base = instance;
mRef = ref;
mPtr = Ptr (&boost::any_cast<ESMS::LiveCellRef<T, RefData>&> (mRef), 0);
return true;
}
return false;
}
public:
ManualRef (const ESMS::ESMStore& store, const std::string& name)