Skip to content

Commit

Permalink
KOTOR: Change Creature::createPC() to take a reference, not a pointer
Browse files Browse the repository at this point in the history
It needs a CharacterGenerationInfo, which can't be 0.
  • Loading branch information
DrMcCoy committed May 15, 2018
1 parent 1ee7c20 commit 60e1a90
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/engines/kotor/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,16 @@ void Creature::createFakePC() {
_isPC = true;
}

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

PartModels parts;

parts.body = "p";
parts.head = "p";

switch (info->getGender()) {
switch (info.getGender()) {
case kGenderMale:
parts.body += "m";
parts.head += "m";
Expand All @@ -339,15 +339,15 @@ void Creature::createPC(const CharacterGenerationInfo *info) {
throw Common::Exception("Unknown gender");
}

_gender = info->getGender();
_gender = info.getGender();

_race = kRaceHuman;
_subRace = kSubRaceNone;

parts.body += "bb";
parts.head += "h";

switch (info->getClass()) {
switch (info.getClass()) {
case kClassSoldier:
parts.body += "l";
break;
Expand All @@ -363,11 +363,11 @@ void Creature::createPC(const CharacterGenerationInfo *info) {
// set the specific class to level 1
_levels.resize(1);
_levels[0].level = 1;
_levels[0].characterClass = info->getClass();
_levels[0].characterClass = info.getClass();

loadBody(parts);

switch (info->getSkin()) {
switch (info.getSkin()) {
case kSkinA:
parts.head += "a";
break;
Expand All @@ -381,7 +381,7 @@ void Creature::createPC(const CharacterGenerationInfo *info) {
}

parts.head += "0";
parts.head += Common::composeString(info->getFace() + 1);
parts.head += Common::composeString(info.getFace() + 1);

loadHead(parts);
}
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(const CharacterGenerationInfo *info);
void createPC(const CharacterGenerationInfo &info);

// Basic visuals

Expand Down
2 changes: 1 addition & 1 deletion src/engines/kotor/gui/chargen/chargeninfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void CharacterGenerationInfo::setFace(uint8 face) {

Creature *CharacterGenerationInfo::getCharacter() const {
Creature *creature = new Creature();
creature->createPC(this);
creature->createPC(*this);
return creature;
}

Expand Down

0 comments on commit 60e1a90

Please sign in to comment.