1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Activation fix

This commit is contained in:
Jason Hooks 2011-11-19 17:45:05 -05:00
parent 7319f7a8c6
commit d8367f4968
2 changed files with 2 additions and 24 deletions

View File

@ -417,15 +417,11 @@ void OMW::Engine::activate()
try try
{ {
std::string handle = mEnvironment.mWorld->getFacedHandle(); std::string handle = mEnvironment.mWorld->getFacedHandle();
if (handle.empty()) if (handle.empty())
return; return;
MWWorld::Ptr ptr = mEnvironment.mWorld->getPtrViaHandle (handle); MWWorld::Ptr ptr = mEnvironment.mWorld->getPtrViaHandle (handle);
if (ptr.isEmpty()) if (ptr.isEmpty())
return; return;
MWScript::InterpreterContext interpreterContext (mEnvironment, MWScript::InterpreterContext interpreterContext (mEnvironment,
&ptr.getRefData().getLocals(), ptr); &ptr.getRefData().getLocals(), ptr);

View File

@ -53,12 +53,13 @@ namespace
for (iterator iter (refList.list.begin()); iter!=refList.list.end(); ++iter) for (iterator iter (refList.list.begin()); iter!=refList.list.end(); ++iter)
{ {
if(iter->mData.getBaseNode()){
if (iter->mData.getHandle()==handle) if (iter->mData.getHandle()==handle)
{ {
return &*iter; return &*iter;
} }
}
} }
return 0; return 0;
} }
} }
@ -70,61 +71,43 @@ namespace MWWorld
if (ESMS::LiveCellRef<ESM::Activator, RefData> *ref = if (ESMS::LiveCellRef<ESM::Activator, RefData> *ref =
searchViaHandle (handle, cell.activators)) searchViaHandle (handle, cell.activators))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Potion, RefData> *ref = searchViaHandle (handle, cell.potions)) if (ESMS::LiveCellRef<ESM::Potion, RefData> *ref = searchViaHandle (handle, cell.potions))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Apparatus, RefData> *ref = searchViaHandle (handle, cell.appas)) if (ESMS::LiveCellRef<ESM::Apparatus, RefData> *ref = searchViaHandle (handle, cell.appas))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Armor, RefData> *ref = searchViaHandle (handle, cell.armors)) if (ESMS::LiveCellRef<ESM::Armor, RefData> *ref = searchViaHandle (handle, cell.armors))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Book, RefData> *ref = searchViaHandle (handle, cell.books)) if (ESMS::LiveCellRef<ESM::Book, RefData> *ref = searchViaHandle (handle, cell.books))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Clothing, RefData> *ref = searchViaHandle (handle, cell.clothes)) if (ESMS::LiveCellRef<ESM::Clothing, RefData> *ref = searchViaHandle (handle, cell.clothes))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Container, RefData> *ref = if (ESMS::LiveCellRef<ESM::Container, RefData> *ref =
searchViaHandle (handle, cell.containers)) searchViaHandle (handle, cell.containers))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Creature, RefData> *ref = if (ESMS::LiveCellRef<ESM::Creature, RefData> *ref =
searchViaHandle (handle, cell.creatures)) searchViaHandle (handle, cell.creatures))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Door, RefData> *ref = searchViaHandle (handle, cell.doors)) if (ESMS::LiveCellRef<ESM::Door, RefData> *ref = searchViaHandle (handle, cell.doors))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Ingredient, RefData> *ref = if (ESMS::LiveCellRef<ESM::Ingredient, RefData> *ref =
searchViaHandle (handle, cell.ingreds)) searchViaHandle (handle, cell.ingreds))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Light, RefData> *ref = searchViaHandle (handle, cell.lights)) if (ESMS::LiveCellRef<ESM::Light, RefData> *ref = searchViaHandle (handle, cell.lights))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Tool, RefData> *ref = searchViaHandle (handle, cell.lockpicks)) if (ESMS::LiveCellRef<ESM::Tool, RefData> *ref = searchViaHandle (handle, cell.lockpicks))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Miscellaneous, RefData> *ref = searchViaHandle (handle, cell.miscItems)) if (ESMS::LiveCellRef<ESM::Miscellaneous, RefData> *ref = searchViaHandle (handle, cell.miscItems))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::NPC, RefData> *ref = searchViaHandle (handle, cell.npcs)) if (ESMS::LiveCellRef<ESM::NPC, RefData> *ref = searchViaHandle (handle, cell.npcs))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Probe, RefData> *ref = searchViaHandle (handle, cell.probes)) if (ESMS::LiveCellRef<ESM::Probe, RefData> *ref = searchViaHandle (handle, cell.probes))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Repair, RefData> *ref = searchViaHandle (handle, cell.repairs)) if (ESMS::LiveCellRef<ESM::Repair, RefData> *ref = searchViaHandle (handle, cell.repairs))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Static, RefData> *ref = searchViaHandle (handle, cell.statics)) if (ESMS::LiveCellRef<ESM::Static, RefData> *ref = searchViaHandle (handle, cell.statics))
return Ptr (ref, &cell); return Ptr (ref, &cell);
if (ESMS::LiveCellRef<ESM::Weapon, RefData> *ref = searchViaHandle (handle, cell.weapons)) if (ESMS::LiveCellRef<ESM::Weapon, RefData> *ref = searchViaHandle (handle, cell.weapons))
return Ptr (ref, &cell); return Ptr (ref, &cell);
return Ptr(); return Ptr();
} }
@ -317,7 +300,6 @@ namespace MWWorld
{ {
if (mPlayer->getPlayer().getRefData().getHandle()==handle) if (mPlayer->getPlayer().getRefData().getHandle()==handle)
return mPlayer->getPlayer(); return mPlayer->getPlayer();
for (Scene::CellStoreCollection::const_iterator iter (mWorldScene->getActiveCells().begin()); for (Scene::CellStoreCollection::const_iterator iter (mWorldScene->getActiveCells().begin());
iter!=mWorldScene->getActiveCells().end(); ++iter) iter!=mWorldScene->getActiveCells().end(); ++iter)
{ {