mirror of
https://github.com/OpenMW/openmw.git
synced 2025-05-12 04:11:26 +00:00
Fixed mistake in NPC record struct
This commit is contained in:
parent
cf4185faef
commit
5d4dba981f
3 changed files with 58 additions and 42 deletions
|
@ -48,7 +48,10 @@ set(ESM_STORE_HEADER
|
||||||
source_group(components\\esm_store FILES ${ESM_STORE} ${ESM_STORE_HEADER})
|
source_group(components\\esm_store FILES ${ESM_STORE} ${ESM_STORE_HEADER})
|
||||||
|
|
||||||
file(GLOB ESM_HEADER ${COMP_DIR}/esm/*.hpp)
|
file(GLOB ESM_HEADER ${COMP_DIR}/esm/*.hpp)
|
||||||
source_group(components\\esm FILES ${ESM_HEADER})
|
set(ESM
|
||||||
|
${COMP_DIR}/esm/load_impl.cpp
|
||||||
|
)
|
||||||
|
source_group(components\\esm FILES ${ESM_HEADER} ${ESM})
|
||||||
|
|
||||||
set(MISC
|
set(MISC
|
||||||
${COMP_DIR}/misc/stringops.cpp
|
${COMP_DIR}/misc/stringops.cpp
|
||||||
|
@ -68,7 +71,7 @@ file(GLOB INTERPRETER_HEADER ${COMP_DIR}/interpreter/*.hpp)
|
||||||
source_group(components\\interpreter FILES ${INTERPRETER} ${INTERPRETER_HEADER})
|
source_group(components\\interpreter FILES ${INTERPRETER} ${INTERPRETER_HEADER})
|
||||||
|
|
||||||
set(COMPONENTS ${BSA} ${NIF} ${NIFOGRE} ${ESM_STORE} ${MISC}
|
set(COMPONENTS ${BSA} ${NIF} ${NIFOGRE} ${ESM_STORE} ${MISC}
|
||||||
${COMPILER} ${INTERPRETER})
|
${COMPILER} ${INTERPRETER} ${ESM})
|
||||||
set(COMPONENTS_HEADER ${BSA_HEADER} ${NIF_HEADER} ${NIFOGRE_HEADER} ${ESM_STORE_HEADER}
|
set(COMPONENTS_HEADER ${BSA_HEADER} ${NIF_HEADER} ${NIFOGRE_HEADER} ${ESM_STORE_HEADER}
|
||||||
${ESM_HEADER} ${MISC_HEADER} ${COMPILER_HEADER}
|
${ESM_HEADER} ${MISC_HEADER} ${COMPILER_HEADER}
|
||||||
${INTERPRETER_HEADER})
|
${INTERPRETER_HEADER})
|
||||||
|
|
48
components/esm/load_impl.cpp
Normal file
48
components/esm/load_impl.cpp
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
#include "records.hpp"
|
||||||
|
|
||||||
|
/** Implementation for some of the load() functions. Most are found in
|
||||||
|
the header files themselves, but this is a bit irritating to
|
||||||
|
compile if you're changing the functions often, as virtually the
|
||||||
|
entire engine depends on these headers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace ESM
|
||||||
|
{
|
||||||
|
void NPC::load(ESMReader &esm, const std::string& id)
|
||||||
|
{
|
||||||
|
mId = id;
|
||||||
|
|
||||||
|
npdt52.gold = -10;
|
||||||
|
|
||||||
|
model = esm.getHNOString("MODL");
|
||||||
|
name = esm.getHNOString("FNAM");
|
||||||
|
|
||||||
|
race = esm.getHNString("RNAM");
|
||||||
|
cls = esm.getHNString("CNAM");
|
||||||
|
faction = esm.getHNString("ANAM");
|
||||||
|
head = esm.getHNString("BNAM");
|
||||||
|
hair = esm.getHNString("KNAM");
|
||||||
|
|
||||||
|
script = esm.getHNOString("SCRI");
|
||||||
|
|
||||||
|
esm.getSubNameIs("NPDT");
|
||||||
|
esm.getSubHeader();
|
||||||
|
if(esm.getSubSize() == 52) esm.getExact(&npdt52, 52);
|
||||||
|
else if(esm.getSubSize() == 12) esm.getExact(&npdt12, 12);
|
||||||
|
else esm.fail("NPC_NPDT must be 12 or 52 bytes long");
|
||||||
|
|
||||||
|
esm.getHNT(flags, "FLAG");
|
||||||
|
|
||||||
|
inventory.load(esm);
|
||||||
|
spells.load(esm);
|
||||||
|
|
||||||
|
if(esm.isNextSub("AIDT"))
|
||||||
|
{
|
||||||
|
esm.getHExact(&AI, sizeof(AI));
|
||||||
|
hasAI = true;
|
||||||
|
}
|
||||||
|
else hasAI = false;
|
||||||
|
|
||||||
|
esm.skipRecord();
|
||||||
|
}
|
||||||
|
}
|
|
@ -57,10 +57,10 @@ struct NPC
|
||||||
char strength, intelligence, willpower, agility,
|
char strength, intelligence, willpower, agility,
|
||||||
speed, endurance, personality, luck;
|
speed, endurance, personality, luck;
|
||||||
char skills[27];
|
char skills[27];
|
||||||
|
char reputation;
|
||||||
short health, mana, fatigue;
|
short health, mana, fatigue;
|
||||||
char disposition;
|
char disposition, factionID, rank;
|
||||||
char reputation; // Was "factionID", but that makes no sense.
|
char unknown;
|
||||||
char rank, unknown, u2;
|
|
||||||
int gold;
|
int gold;
|
||||||
}; // 52 bytes
|
}; // 52 bytes
|
||||||
|
|
||||||
|
@ -99,43 +99,8 @@ struct NPC
|
||||||
|
|
||||||
std::string mId;
|
std::string mId;
|
||||||
|
|
||||||
void load(ESMReader &esm, const std::string& id)
|
// Implementation moved to load_impl.cpp
|
||||||
{
|
void load(ESMReader &esm, const std::string& id);
|
||||||
mId = id;
|
|
||||||
|
|
||||||
npdt52.gold = -10;
|
|
||||||
|
|
||||||
model = esm.getHNOString("MODL");
|
|
||||||
name = esm.getHNOString("FNAM");
|
|
||||||
|
|
||||||
race = esm.getHNString("RNAM");
|
|
||||||
cls = esm.getHNString("CNAM");
|
|
||||||
faction = esm.getHNString("ANAM");
|
|
||||||
head = esm.getHNString("BNAM");
|
|
||||||
hair = esm.getHNString("KNAM");
|
|
||||||
|
|
||||||
script = esm.getHNOString("SCRI");
|
|
||||||
|
|
||||||
esm.getSubNameIs("NPDT");
|
|
||||||
esm.getSubHeader();
|
|
||||||
if(esm.getSubSize() == 52) esm.getExact(&npdt52, 52);
|
|
||||||
else if(esm.getSubSize() == 12) esm.getExact(&npdt12, 12);
|
|
||||||
else esm.fail("NPC_NPDT must be 12 or 52 bytes long");
|
|
||||||
|
|
||||||
esm.getHNT(flags, "FLAG");
|
|
||||||
|
|
||||||
inventory.load(esm);
|
|
||||||
spells.load(esm);
|
|
||||||
|
|
||||||
if(esm.isNextSub("AIDT"))
|
|
||||||
{
|
|
||||||
esm.getHExact(&AI, sizeof(AI));
|
|
||||||
hasAI = true;
|
|
||||||
}
|
|
||||||
else hasAI = false;
|
|
||||||
|
|
||||||
esm.skipRecord();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue