mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 06:45:35 +00:00
Split apps/openmw/mwmechanics/actorutil.hpp
This commit is contained in:
parent
39d7f2c95b
commit
fdf6e58ea3
27 changed files with 182 additions and 104 deletions
|
@ -5,9 +5,9 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
#include "../mwmechanics/greetingstate.hpp"
|
||||||
// For MWMechanics::GreetingState
|
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
#include "../mwrender/renderinginterface.hpp"
|
#include "../mwrender/renderinginterface.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
#include "../mwmechanics/inventory.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,12 @@
|
||||||
#include "../mwmechanics/disease.hpp"
|
#include "../mwmechanics/disease.hpp"
|
||||||
#include "../mwmechanics/spellcasting.hpp"
|
#include "../mwmechanics/spellcasting.hpp"
|
||||||
#include "../mwmechanics/difficultyscaling.hpp"
|
#include "../mwmechanics/difficultyscaling.hpp"
|
||||||
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
#include "../mwmechanics/combat.hpp"
|
||||||
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
#include "../mwmechanics/creaturecustomdataresetter.hpp"
|
||||||
|
#include "../mwmechanics/aisetting.hpp"
|
||||||
|
#include "../mwmechanics/inventory.hpp"
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
|
@ -27,18 +33,14 @@
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/localscripts.hpp"
|
#include "../mwworld/localscripts.hpp"
|
||||||
|
#include "../mwworld/inventorystore.hpp"
|
||||||
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
#include "../mwrender/renderinginterface.hpp"
|
#include "../mwrender/renderinginterface.hpp"
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
|
|
||||||
#include "../mwgui/tooltips.hpp"
|
#include "../mwgui/tooltips.hpp"
|
||||||
|
|
||||||
#include "../mwworld/inventorystore.hpp"
|
|
||||||
|
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
|
||||||
#include "../mwmechanics/combat.hpp"
|
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
bool isFlagBitSet(const MWWorld::ConstPtr &ptr, ESM::Creature::Flags bitMask)
|
bool isFlagBitSet(const MWWorld::ConstPtr &ptr, ESM::Creature::Flags bitMask)
|
||||||
|
@ -117,7 +119,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
auto tempData = std::make_unique<CreatureCustomData>();
|
auto tempData = std::make_unique<CreatureCustomData>();
|
||||||
CreatureCustomData* data = tempData.get();
|
CreatureCustomData* data = tempData.get();
|
||||||
MWMechanics::CreatureCustomDataResetter resetter(ptr);
|
MWMechanics::CreatureCustomDataResetter resetter {ptr};
|
||||||
ptr.getRefData().setCustomData(std::move(tempData));
|
ptr.getRefData().setCustomData(std::move(tempData));
|
||||||
|
|
||||||
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||||
|
|
|
@ -7,8 +7,14 @@
|
||||||
|
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/customdata.hpp"
|
#include "../mwworld/customdata.hpp"
|
||||||
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
#include "../mwworld/manualref.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/creaturestats.hpp"
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
class CreatureLevListCustomData : public MWWorld::TypedCustomData<CreatureLevListCustomData>
|
class CreatureLevListCustomData : public MWWorld::TypedCustomData<CreatureLevListCustomData>
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
#include <components/esm3/loadnpc.hpp>
|
#include <components/esm3/loadnpc.hpp>
|
||||||
#include <components/esm3/npcstate.hpp>
|
#include <components/esm3/npcstate.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
|
#include <components/esm3/loadrace.hpp>
|
||||||
|
#include <components/esm3/loadclas.hpp>
|
||||||
|
#include <components/esm3/loadnpc.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
@ -31,6 +34,9 @@
|
||||||
#include "../mwmechanics/difficultyscaling.hpp"
|
#include "../mwmechanics/difficultyscaling.hpp"
|
||||||
#include "../mwmechanics/weapontype.hpp"
|
#include "../mwmechanics/weapontype.hpp"
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
#include "../mwmechanics/creaturecustomdataresetter.hpp"
|
||||||
|
#include "../mwmechanics/inventory.hpp"
|
||||||
|
#include "../mwmechanics/aisetting.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontalk.hpp"
|
#include "../mwworld/actiontalk.hpp"
|
||||||
|
@ -40,6 +46,7 @@
|
||||||
#include "../mwworld/customdata.hpp"
|
#include "../mwworld/customdata.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/localscripts.hpp"
|
#include "../mwworld/localscripts.hpp"
|
||||||
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
#include "../mwrender/renderinginterface.hpp"
|
#include "../mwrender/renderinginterface.hpp"
|
||||||
|
@ -311,7 +318,7 @@ namespace MWClass
|
||||||
bool recalculate = false;
|
bool recalculate = false;
|
||||||
auto tempData = std::make_unique<NpcCustomData>();
|
auto tempData = std::make_unique<NpcCustomData>();
|
||||||
NpcCustomData* data = tempData.get();
|
NpcCustomData* data = tempData.get();
|
||||||
MWMechanics::CreatureCustomDataResetter resetter(ptr);
|
MWMechanics::CreatureCustomDataResetter resetter {ptr};
|
||||||
ptr.getRefData().setCustomData(std::move(tempData));
|
ptr.getRefData().setCustomData(std::move(tempData));
|
||||||
|
|
||||||
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
|
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
#include <MyGUI_Macros.h>
|
#include <MyGUI_Macros.h>
|
||||||
#include <components/esm/records.hpp>
|
#include <components/esm/records.hpp>
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "../mwworld/actionequip.hpp"
|
#include "../mwworld/actionequip.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
#include "itemview.hpp"
|
#include "itemview.hpp"
|
||||||
#include "inventoryitemmodel.hpp"
|
#include "inventoryitemmodel.hpp"
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <MyGUI_Button.h>
|
#include <MyGUI_Button.h>
|
||||||
#include <MyGUI_ScrollView.h>
|
#include <MyGUI_ScrollView.h>
|
||||||
|
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
@ -11,7 +13,9 @@
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,11 +10,16 @@
|
||||||
|
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
#include "../mwworld/store.hpp"
|
||||||
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/spellutil.hpp"
|
#include "../mwmechanics/spellutil.hpp"
|
||||||
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
#include "tooltips.hpp"
|
#include "tooltips.hpp"
|
||||||
#include "class.hpp"
|
#include "class.hpp"
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <MyGUI_Gui.h>
|
#include <MyGUI_Gui.h>
|
||||||
|
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
|
#include <components/esm3/loadgmst.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
@ -16,7 +17,10 @@
|
||||||
#include "../mwworld/actionteleport.hpp"
|
#include "../mwworld/actionteleport.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/cellutils.hpp"
|
#include "../mwworld/cellutils.hpp"
|
||||||
|
#include "../mwworld/store.hpp"
|
||||||
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,11 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "actorutil.hpp"
|
|
||||||
#include "character.hpp"
|
#include "character.hpp"
|
||||||
|
#include "greetingstate.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
#include <components/misc/timer.hpp>
|
#include <components/misc/timer.hpp>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "actorutil.hpp"
|
|
||||||
#include "actor.hpp"
|
#include "actor.hpp"
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
|
#include <components/esm3/loadmgef.hpp>
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
MWWorld::Ptr getPlayer()
|
MWWorld::Ptr getPlayer()
|
||||||
|
@ -29,12 +31,4 @@ namespace MWMechanics
|
||||||
const MWMechanics::MagicEffects& effects = actor.getClass().getCreatureStats(actor).getMagicEffects();
|
const MWMechanics::MagicEffects& effects = actor.getClass().getCreatureStats(actor).getMagicEffects();
|
||||||
return effects.get(ESM::MagicEffect::WaterWalking).getMagnitude() > 0;
|
return effects.get(ESM::MagicEffect::WaterWalking).getMagnitude() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatureCustomDataResetter::CreatureCustomDataResetter(const MWWorld::Ptr& ptr) : mPtr(ptr) {}
|
|
||||||
|
|
||||||
CreatureCustomDataResetter::~CreatureCustomDataResetter()
|
|
||||||
{
|
|
||||||
if(!mPtr.isEmpty())
|
|
||||||
mPtr.getRefData().setCustomData({});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,6 @@
|
||||||
#ifndef OPENMW_MWMECHANICS_ACTORUTIL_H
|
#ifndef OPENMW_MWMECHANICS_ACTORUTIL_H
|
||||||
#define OPENMW_MWMECHANICS_ACTORUTIL_H
|
#define OPENMW_MWMECHANICS_ACTORUTIL_H
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
#include <components/esm3/loadcont.hpp>
|
|
||||||
#include <components/esm3/loadcrea.hpp>
|
|
||||||
#include <components/esm3/loadnpc.hpp>
|
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
|
||||||
#include "../mwbase/world.hpp"
|
|
||||||
|
|
||||||
#include "../mwworld/esmstore.hpp"
|
|
||||||
|
|
||||||
#include "./creaturestats.hpp"
|
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class Ptr;
|
class Ptr;
|
||||||
|
@ -21,79 +8,10 @@ namespace MWWorld
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
enum GreetingState
|
|
||||||
{
|
|
||||||
Greet_None,
|
|
||||||
Greet_InProgress,
|
|
||||||
Greet_Done
|
|
||||||
};
|
|
||||||
|
|
||||||
MWWorld::Ptr getPlayer();
|
MWWorld::Ptr getPlayer();
|
||||||
bool isPlayerInCombat();
|
bool isPlayerInCombat();
|
||||||
bool canActorMoveByZAxis(const MWWorld::Ptr& actor);
|
bool canActorMoveByZAxis(const MWWorld::Ptr& actor);
|
||||||
bool hasWaterWalking(const MWWorld::Ptr& actor);
|
bool hasWaterWalking(const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void setBaseAISetting(const std::string& id, MWMechanics::CreatureStats::AiSetting setting, int value)
|
|
||||||
{
|
|
||||||
T copy = *MWBase::Environment::get().getWorld()->getStore().get<T>().find(id);
|
|
||||||
switch(setting)
|
|
||||||
{
|
|
||||||
case MWMechanics::CreatureStats::AiSetting::AI_Hello:
|
|
||||||
copy.mAiData.mHello = value;
|
|
||||||
break;
|
|
||||||
case MWMechanics::CreatureStats::AiSetting::AI_Fight:
|
|
||||||
copy.mAiData.mFight = value;
|
|
||||||
break;
|
|
||||||
case MWMechanics::CreatureStats::AiSetting::AI_Flee:
|
|
||||||
copy.mAiData.mFlee = value;
|
|
||||||
break;
|
|
||||||
case MWMechanics::CreatureStats::AiSetting::AI_Alarm:
|
|
||||||
copy.mAiData.mAlarm = value;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void modifyBaseInventory(const std::string& actorId, const std::string& itemId, int amount)
|
|
||||||
{
|
|
||||||
T copy = *MWBase::Environment::get().getWorld()->getStore().get<T>().find(actorId);
|
|
||||||
for(auto& it : copy.mInventory.mList)
|
|
||||||
{
|
|
||||||
if(Misc::StringUtils::ciEqual(it.mItem, itemId))
|
|
||||||
{
|
|
||||||
int sign = it.mCount < 1 ? -1 : 1;
|
|
||||||
it.mCount = sign * std::max(it.mCount * sign + amount, 0);
|
|
||||||
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(amount > 0)
|
|
||||||
{
|
|
||||||
ESM::ContItem cont;
|
|
||||||
cont.mItem = itemId;
|
|
||||||
cont.mCount = amount;
|
|
||||||
copy.mInventory.mList.push_back(cont);
|
|
||||||
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template void setBaseAISetting<ESM::Creature>(const std::string& id, MWMechanics::CreatureStats::AiSetting setting, int value);
|
|
||||||
template void setBaseAISetting<ESM::NPC>(const std::string& id, MWMechanics::CreatureStats::AiSetting setting, int value);
|
|
||||||
template void modifyBaseInventory<ESM::Creature>(const std::string& actorId, const std::string& itemId, int amount);
|
|
||||||
template void modifyBaseInventory<ESM::NPC>(const std::string& actorId, const std::string& itemId, int amount);
|
|
||||||
template void modifyBaseInventory<ESM::Container>(const std::string& containerId, const std::string& itemId, int amount);
|
|
||||||
|
|
||||||
struct CreatureCustomDataResetter
|
|
||||||
{
|
|
||||||
MWWorld::Ptr mPtr;
|
|
||||||
|
|
||||||
CreatureCustomDataResetter(const MWWorld::Ptr& ptr);
|
|
||||||
~CreatureCustomDataResetter();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
40
apps/openmw/mwmechanics/aisetting.hpp
Normal file
40
apps/openmw/mwmechanics/aisetting.hpp
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#ifndef OPENMW_MWMECHANICS_AISETTING_H
|
||||||
|
#define OPENMW_MWMECHANICS_AISETTING_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
|
#include "creaturestats.hpp"
|
||||||
|
|
||||||
|
namespace MWMechanics
|
||||||
|
{
|
||||||
|
template<class T>
|
||||||
|
void setBaseAISetting(const std::string& id, MWMechanics::CreatureStats::AiSetting setting, int value)
|
||||||
|
{
|
||||||
|
T copy = *MWBase::Environment::get().getWorld()->getStore().get<T>().find(id);
|
||||||
|
switch (setting)
|
||||||
|
{
|
||||||
|
case MWMechanics::CreatureStats::AiSetting::AI_Hello:
|
||||||
|
copy.mAiData.mHello = value;
|
||||||
|
break;
|
||||||
|
case MWMechanics::CreatureStats::AiSetting::AI_Fight:
|
||||||
|
copy.mAiData.mFight = value;
|
||||||
|
break;
|
||||||
|
case MWMechanics::CreatureStats::AiSetting::AI_Flee:
|
||||||
|
copy.mAiData.mFlee = value;
|
||||||
|
break;
|
||||||
|
case MWMechanics::CreatureStats::AiSetting::AI_Alarm:
|
||||||
|
copy.mAiData.mAlarm = value;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
20
apps/openmw/mwmechanics/creaturecustomdataresetter.hpp
Normal file
20
apps/openmw/mwmechanics/creaturecustomdataresetter.hpp
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef OPENMW_MWMECHANICS_CREATURECUSTOMDATARESETTER_H
|
||||||
|
#define OPENMW_MWMECHANICS_CREATURECUSTOMDATARESETTER_H
|
||||||
|
|
||||||
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
|
namespace MWMechanics
|
||||||
|
{
|
||||||
|
struct CreatureCustomDataResetter
|
||||||
|
{
|
||||||
|
MWWorld::Ptr mPtr;
|
||||||
|
|
||||||
|
~CreatureCustomDataResetter()
|
||||||
|
{
|
||||||
|
if (!mPtr.isEmpty())
|
||||||
|
mPtr.getRefData().setCustomData({});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
14
apps/openmw/mwmechanics/greetingstate.hpp
Normal file
14
apps/openmw/mwmechanics/greetingstate.hpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef OPENMW_MWMECHANICS_GREETINGSTATE_H
|
||||||
|
#define OPENMW_MWMECHANICS_GREETINGSTATE_H
|
||||||
|
|
||||||
|
namespace MWMechanics
|
||||||
|
{
|
||||||
|
enum GreetingState
|
||||||
|
{
|
||||||
|
Greet_None,
|
||||||
|
Greet_InProgress,
|
||||||
|
Greet_Done
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
42
apps/openmw/mwmechanics/inventory.hpp
Normal file
42
apps/openmw/mwmechanics/inventory.hpp
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#ifndef OPENMW_MWMECHANICS_INVENTORY_H
|
||||||
|
#define OPENMW_MWMECHANICS_INVENTORY_H
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
|
#include <components/esm3/loadcont.hpp>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace MWMechanics
|
||||||
|
{
|
||||||
|
template <class T>
|
||||||
|
void modifyBaseInventory(const std::string& actorId, const std::string& itemId, int amount)
|
||||||
|
{
|
||||||
|
T copy = *MWBase::Environment::get().getWorld()->getStore().get<T>().find(actorId);
|
||||||
|
for (auto& it : copy.mInventory.mList)
|
||||||
|
{
|
||||||
|
if (Misc::StringUtils::ciEqual(it.mItem, itemId))
|
||||||
|
{
|
||||||
|
const int sign = it.mCount < 1 ? -1 : 1;
|
||||||
|
it.mCount = sign * std::max(it.mCount * sign + amount, 0);
|
||||||
|
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (amount > 0)
|
||||||
|
{
|
||||||
|
ESM::ContItem cont;
|
||||||
|
cont.mItem = itemId;
|
||||||
|
cont.mCount = amount;
|
||||||
|
copy.mInventory.mList.push_back(cont);
|
||||||
|
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -9,11 +9,15 @@
|
||||||
#include <components/misc/barrier.hpp>
|
#include <components/misc/barrier.hpp>
|
||||||
#include "components/misc/convert.hpp"
|
#include "components/misc/convert.hpp"
|
||||||
#include "components/settings/settings.hpp"
|
#include "components/settings/settings.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
#include "../mwmechanics/movement.hpp"
|
#include "../mwmechanics/movement.hpp"
|
||||||
#include "../mwrender/bulletdebugdraw.hpp"
|
#include "../mwrender/bulletdebugdraw.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
#include "actor.hpp"
|
#include "actor.hpp"
|
||||||
#include "contacttestwrapper.h"
|
#include "contacttestwrapper.h"
|
||||||
#include "movementsolver.hpp"
|
#include "movementsolver.hpp"
|
||||||
|
|
|
@ -52,14 +52,18 @@
|
||||||
|
|
||||||
#include <components/detournavigator/navigator.hpp>
|
#include <components/detournavigator/navigator.hpp>
|
||||||
|
|
||||||
#include "../mwbase/windowmanager.hpp"
|
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/groundcoverstore.hpp"
|
#include "../mwworld/groundcoverstore.hpp"
|
||||||
|
|
||||||
#include "../mwgui/loadingscreen.hpp"
|
#include "../mwgui/loadingscreen.hpp"
|
||||||
#include "../mwgui/postprocessorhud.hpp"
|
#include "../mwgui/postprocessorhud.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
#include "sky.hpp"
|
#include "sky.hpp"
|
||||||
#include "effectmanager.hpp"
|
#include "effectmanager.hpp"
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <components/misc/stringops.hpp>
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
#include <components/esm3/loadskil.hpp>
|
#include <components/esm3/loadskil.hpp>
|
||||||
|
#include <components/esm3/loadlevlist.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/manualref.hpp"
|
#include "../mwworld/manualref.hpp"
|
||||||
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
#include "../mwmechanics/levelledlist.hpp"
|
#include "../mwmechanics/levelledlist.hpp"
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/disease.hpp"
|
#include "../mwmechanics/disease.hpp"
|
||||||
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "actionteleport.hpp"
|
#include "actionteleport.hpp"
|
||||||
|
|
||||||
|
#include <components/esm3/loadcell.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
#include <components/esm3/inventorystate.hpp>
|
#include <components/esm3/inventorystate.hpp>
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
@ -19,6 +20,7 @@
|
||||||
#include "class.hpp"
|
#include "class.hpp"
|
||||||
#include "localscripts.hpp"
|
#include "localscripts.hpp"
|
||||||
#include "player.hpp"
|
#include "player.hpp"
|
||||||
|
#include "esmstore.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/soundmanager.hpp"
|
#include "../mwbase/soundmanager.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "../mwmechanics/combat.hpp"
|
#include "../mwmechanics/combat.hpp"
|
||||||
#include "../mwmechanics/aiavoiddoor.hpp" //Used to tell actors to avoid doors
|
#include "../mwmechanics/aiavoiddoor.hpp" //Used to tell actors to avoid doors
|
||||||
#include "../mwmechanics/summoning.hpp"
|
#include "../mwmechanics/summoning.hpp"
|
||||||
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
#include "../mwrender/animation.hpp"
|
#include "../mwrender/animation.hpp"
|
||||||
#include "../mwrender/npcanimation.hpp"
|
#include "../mwrender/npcanimation.hpp"
|
||||||
|
|
Loading…
Reference in a new issue