Skip to content

Commit

Permalink
KOTOR: Enforce const-correctness in the character generator more
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed May 15, 2018
1 parent a914c12 commit 1ee7c20
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/engines/kotor/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void Creature::createFakePC() {
_isPC = true;
}

void Creature::createPC(CharacterGenerationInfo *info) {
void Creature::createPC(const CharacterGenerationInfo *info) {
_name = info->getName();
_isPC = true;

Expand Down
2 changes: 1 addition & 1 deletion src/engines/kotor/creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Creature : public Object {
/** Create a fake player character creature for testing purposes. */
void createFakePC();
/** Create a player character creature from a character info class. */
void createPC(CharacterGenerationInfo *info);
void createPC(const CharacterGenerationInfo *info);

// Basic visuals

Expand Down
14 changes: 7 additions & 7 deletions src/engines/kotor/gui/chargen/chargeninfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ CharacterGenerationInfo *CharacterGenerationInfo::createRandomFemaleScoundrel()
return info;
}

const Common::UString &CharacterGenerationInfo::getName() {
const Common::UString &CharacterGenerationInfo::getName() const {
return _name;
}

Common::UString CharacterGenerationInfo::getPortrait() {
Common::UString CharacterGenerationInfo::getPortrait() const {
Common::UString portrait = "po_p";

switch (_gender) {
Expand Down Expand Up @@ -136,19 +136,19 @@ Common::UString CharacterGenerationInfo::getPortrait() {
return portrait;
}

Skin CharacterGenerationInfo::getSkin() {
Skin CharacterGenerationInfo::getSkin() const {
return _skin;
}

uint8_t CharacterGenerationInfo::getFace() {
uint8_t CharacterGenerationInfo::getFace() const {
return _face;
}

Class CharacterGenerationInfo::getClass() {
Class CharacterGenerationInfo::getClass() const {
return _class;
}

Gender CharacterGenerationInfo::getGender() {
Gender CharacterGenerationInfo::getGender() const {
return _gender;
}

Expand All @@ -164,7 +164,7 @@ void CharacterGenerationInfo::setFace(uint8 face) {
_face = face;
}

Creature *CharacterGenerationInfo::getCharacter() {
Creature *CharacterGenerationInfo::getCharacter() const {
Creature *creature = new Creature();
creature->createPC(this);
return creature;
Expand Down
14 changes: 7 additions & 7 deletions src/engines/kotor/gui/chargen/chargeninfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ class CharacterGenerationInfo {
static CharacterGenerationInfo *createRandomFemaleScoundrel();

/** Get the name of the character. */
const Common::UString &getName();
const Common::UString &getName() const;
/** Get the name of the portrait of this character. */
Common::UString getPortrait();
Common::UString getPortrait() const;
/** Get the skin type of the character. */
Skin getSkin();
Skin getSkin() const;
/** Get the current face index of the character. */
uint8_t getFace();
uint8_t getFace() const;
/** Get the class of the character, defined in types.h. */
Class getClass();
Class getClass() const;
/** Get the gender of the Character. */
Gender getGender();
Gender getGender() const;

/** Set the name of the Character. */
void setName(const Common::UString &name);
Expand All @@ -72,7 +72,7 @@ class CharacterGenerationInfo {
/** Set the face index of the character. */
void setFace(uint8 face);

Creature *getCharacter();
Creature *getCharacter() const;
Graphics::Aurora::Model *getModel();

private:
Expand Down

0 comments on commit 1ee7c20

Please sign in to comment.