Continued work on Class Create dialog. Added sub-dialogs for picking specialization, attribute and skill. Also added some definitions in ESM for attributes and specializations.

This commit is contained in:
Jan Borsodi 2010-09-24 15:28:14 +02:00
parent d97dad7a86
commit ee101440a2
19 changed files with 863 additions and 88 deletions

36
components/esm/attr.cpp Normal file
View file

@ -0,0 +1,36 @@
#include "attr.hpp"
using namespace ESM;
const Attribute::AttributeID Attribute::attributeIds[Attribute::Length] = {
Attribute::Strength,
Attribute::Intelligence,
Attribute::Willpower,
Attribute::Agility,
Attribute::Speed,
Attribute::Endurance,
Attribute::Personality,
Attribute::Luck
};
const std::string Attribute::gmstAttributeIds[Attribute::Length] = {
"sAttributeStrength",
"sAttributeIntelligence",
"sAttributeWillpower",
"sAttributeAgility",
"sAttributeSpeed",
"sAttributeEndurance",
"sAttributePersonality",
"sAttributeLuck"
};
const std::string Attribute::gmstAttributeDescIds[Attribute::Length] = {
"sStrDesc",
"sIntDesc",
"sWilDesc",
"sAgiDesc",
"sSpdDesc",
"sEndDesc",
"sPerDesc",
"sLucDesc"
};

42
components/esm/attr.hpp Normal file
View file

@ -0,0 +1,42 @@
#ifndef _ESM_ATTR_H
#define _ESM_ATTR_H
#include <string>
namespace ESM {
/*
* Attribute definitions
*/
struct Attribute
{
enum AttributeID
{
Strength = 0,
Intelligence = 1,
Willpower = 2,
Agility = 3,
Speed = 4,
Endurance = 5,
Personality = 6,
Luck = 7,
Length
};
AttributeID id;
std::string name, description;
static const AttributeID attributeIds[Length];
static const std::string gmstAttributeIds[Length];
static const std::string gmstAttributeDescIds[Length];
Attribute(AttributeID id, const std::string &name, const std::string &description)
: id(id)
, name(name)
, description(description)
{
}
};
}
#endif

15
components/esm/class.cpp Normal file
View file

@ -0,0 +1,15 @@
#include "loadclas.hpp"
using namespace ESM;
const Class::Specialization Class::specializationIds[3] = {
Class::Combat,
Class::Magic,
Class::Stealth
};
const char *Class::gmstSpecializationIds[3] = {
"sSpecializationCombat",
"sSpecializationMagic",
"sSpecializationStealth"
};

View file

@ -42,6 +42,9 @@ struct Class
Stealth = 2
};
static const Specialization specializationIds[3];
static const char *gmstSpecializationIds[3];
struct CLDTstruct
{
int attribute[2]; // Attributes that get class bonus

View file

@ -43,6 +43,9 @@
#include "loadstat.hpp"
#include "loadweap.hpp"
// Special records which are not loaded from ESM
#include "attr.hpp"
namespace ESM {
// Integer versions of all the record names, used for faster lookup

View file

@ -90,6 +90,12 @@ void ESMStore::load(ESMReader &esm)
}
}
for (int i = 0; i < Attribute::Length; ++i)
{
Attribute::AttributeID id = Attribute::attributeIds[i];
attributes.list.insert(std::make_pair(id, Attribute(id, Attribute::gmstAttributeIds[i], Attribute::gmstAttributeDescIds[i])));
}
/* This information isn't needed on screen. But keep the code around
for debugging purposes later.

View file

@ -76,6 +76,9 @@ namespace ESMS
IndexListT<Skill> skills;
//RecListT<PathGrid> pathgrids;
// Special entry which is hardcoded and not loaded from an ESM
IndexListT<Attribute> attributes;
// Lookup of all IDs. Makes looking up references faster. Just
// maps the id name to the record type.
typedef std::map<std::string, int> AllMap;