mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-20 11:53:53 +00:00
store created character classes as dynamic records
This commit is contained in:
parent
78740306db
commit
9ab2c16055
5 changed files with 12 additions and 20 deletions
|
@ -559,9 +559,12 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
|
|||
klass.mData.mSkills[i][1] = majorSkills[i];
|
||||
klass.mData.mSkills[i][0] = minorSkills[i];
|
||||
}
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(klass);
|
||||
mPlayerClass = klass;
|
||||
mWM->setPlayerClass(klass);
|
||||
std::pair<std::string, const ESM::Class *> res =
|
||||
MWBase::Environment::get().getWorld()->createRecord(klass);
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(*res.second);
|
||||
mPlayerClass = *res.second;
|
||||
mWM->setPlayerClass(*res.second);
|
||||
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mCreateClassDialog = 0;
|
||||
|
|
|
@ -83,7 +83,6 @@ WindowManager::WindowManager(
|
|||
, mSpellCreationDialog(NULL)
|
||||
, mEnchantingDialog(NULL)
|
||||
, mTrainingWindow(NULL)
|
||||
, mPlayerClass()
|
||||
, mPlayerName()
|
||||
, mPlayerRaceId()
|
||||
, mPlayerAttributes()
|
||||
|
@ -499,8 +498,7 @@ void WindowManager::setValue (const std::string& id, int value)
|
|||
|
||||
void WindowManager::setPlayerClass (const ESM::Class &class_)
|
||||
{
|
||||
mPlayerClass = class_;
|
||||
mStatsWindow->setValue("class", mPlayerClass.mName);
|
||||
mStatsWindow->setValue("class", class_.mName);
|
||||
}
|
||||
|
||||
void WindowManager::configureSkills (const SkillList& major, const SkillList& minor)
|
||||
|
|
|
@ -261,7 +261,6 @@ namespace MWGui
|
|||
|
||||
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.
|
||||
// Various stats about player as needed by window manager
|
||||
ESM::Class mPlayerClass;
|
||||
std::string mPlayerName;
|
||||
std::string mPlayerRaceId;
|
||||
std::map<int, MWMechanics::Stat<int> > mPlayerAttributes;
|
||||
|
|
|
@ -26,8 +26,7 @@ namespace MWWorld
|
|||
float* playerPos = mPlayer.mData.getPosition().pos;
|
||||
playerPos[0] = playerPos[1] = playerPos[2] = 0;
|
||||
|
||||
/// \todo Do not make a copy of classes defined in esm/p records.
|
||||
mClass = new ESM::Class (*world.getStore().get<ESM::Class>().find (player->mClass));
|
||||
mClass = world.getStore().get<ESM::Class>().find (player->mClass);
|
||||
}
|
||||
|
||||
Player::~Player()
|
||||
|
@ -35,13 +34,6 @@ namespace MWWorld
|
|||
delete mClass;
|
||||
}
|
||||
|
||||
void Player::setClass (const ESM::Class& class_)
|
||||
{
|
||||
ESM::Class *new_class = new ESM::Class (class_);
|
||||
delete mClass;
|
||||
mClass = new_class;
|
||||
}
|
||||
|
||||
void Player::setDrawState (MWMechanics::DrawState_ state)
|
||||
{
|
||||
MWWorld::Ptr ptr = getPlayer();
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef GAME_MWWORLD_PLAYER_H
|
||||
#define GAME_MWWORLD_PLAYER_H
|
||||
|
||||
#include "OgreCamera.h"
|
||||
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/refdata.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
@ -27,7 +25,7 @@ namespace MWWorld
|
|||
bool mMale;
|
||||
std::string mRace;
|
||||
std::string mBirthsign;
|
||||
ESM::Class *mClass;
|
||||
const ESM::Class *mClass;
|
||||
bool mAutoMove;
|
||||
int mForwardBackward;
|
||||
public:
|
||||
|
@ -67,7 +65,9 @@ namespace MWWorld
|
|||
mBirthsign = birthsign;
|
||||
}
|
||||
|
||||
void setClass (const ESM::Class& class_);
|
||||
void setClass (const ESM::Class& class_) {
|
||||
mClass = &class_;
|
||||
}
|
||||
|
||||
void setDrawState (MWMechanics::DrawState_ state);
|
||||
|
||||
|
|
Loading…
Reference in a new issue