1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-26 19:36:48 +00:00

Merge branch 'ai_package_type' into 'master'

Remove AI_CNDT from AI package types

See merge request OpenMW/openmw!2400
This commit is contained in:
psi29a 2022-09-13 07:23:51 +00:00
commit c977bd3e6e
4 changed files with 18 additions and 12 deletions

View file

@ -239,14 +239,17 @@ std::string_view weaponTypeLabel(int idx)
return "Invalid"; return "Invalid";
} }
std::string_view aiTypeLabel(int type) std::string_view aiTypeLabel(ESM::AiPackageType type)
{ {
if (type == ESM::AI_Wander) return "Wander"; switch (type)
else if (type == ESM::AI_Travel) return "Travel"; {
else if (type == ESM::AI_Follow) return "Follow"; case ESM::AI_Wander: return "Wander";
else if (type == ESM::AI_Escort) return "Escort"; case ESM::AI_Travel: return "Travel";
else if (type == ESM::AI_Activate) return "Activate"; case ESM::AI_Follow: return "Follow";
else return "Invalid"; case ESM::AI_Escort: return "Escort";
case ESM::AI_Activate: return "Activate";
}
return "Invalid";
} }
std::string_view magicEffectLabel(int idx) std::string_view magicEffectLabel(int idx)

View file

@ -2,6 +2,9 @@
#define OPENMW_ESMTOOL_LABELS_H #define OPENMW_ESMTOOL_LABELS_H
#include <string> #include <string>
#include <string_view>
#include <components/esm3/aipackage.hpp>
std::string_view bodyPartLabel(int idx); std::string_view bodyPartLabel(int idx);
std::string_view meshPartLabel(int idx); std::string_view meshPartLabel(int idx);
@ -16,7 +19,7 @@ std::string_view weaponTypeLabel(int idx);
// This function's a bit different because the types are record types, // This function's a bit different because the types are record types,
// not consecutive values. // not consecutive values.
std::string_view aiTypeLabel(int type); std::string_view aiTypeLabel(ESM::AiPackageType type);
// This one's also a bit different, because it enumerates dialog // This one's also a bit different, because it enumerates dialog
// select rule functions, not types. Structurally, it still converts // select rule functions, not types. Structurally, it still converts

View file

@ -1756,7 +1756,6 @@ namespace CSMWorld
case ESM::AI_Follow: return 2; case ESM::AI_Follow: return 2;
case ESM::AI_Escort: return 3; case ESM::AI_Escort: return 3;
case ESM::AI_Activate: return 4; case ESM::AI_Activate: return 4;
case ESM::AI_CNDT:
default: return QVariant(); default: return QVariant();
} }
case 1: // wander dist case 1: // wander dist

View file

@ -58,21 +58,22 @@ namespace ESM
#pragma pack(pop) #pragma pack(pop)
enum enum AiPackageType : std::uint32_t
{ {
AI_Wander = 0x575f4941, AI_Wander = 0x575f4941,
AI_Travel = 0x545f4941, AI_Travel = 0x545f4941,
AI_Follow = 0x465f4941, AI_Follow = 0x465f4941,
AI_Escort = 0x455f4941, AI_Escort = 0x455f4941,
AI_Activate = 0x415f4941, AI_Activate = 0x415f4941,
AI_CNDT = 0x54444e43
}; };
inline constexpr std::uint32_t AI_CNDT = 0x54444e43;
/// \note Used for storaging packages in a single container /// \note Used for storaging packages in a single container
/// w/o manual memory allocation accordingly to policy standards /// w/o manual memory allocation accordingly to policy standards
struct AIPackage struct AIPackage
{ {
int mType; AiPackageType mType;
// Anonymous union // Anonymous union
union union