fixes: compile: cast error; doors: key id case comparison; character creation: going from CharacterCreation to BirthDialog loses data; character creation: Class/Race/BirthDialog allowing no data; code: clean up a bit

todo: going from CharacterCreation back to CreateClassDialog loses data
This commit is contained in:
emoose 2012-11-02 20:33:08 +00:00
parent 8cdd1e5539
commit 15f972cc62
8 changed files with 24 additions and 34 deletions

View file

@ -81,9 +81,15 @@ namespace MWClass
bool needKey = ptr.getCellRef().mLockLevel>0;
bool hasKey = false;
std::string keyName;
// make key id lowercase
std::string keyId = ptr.getCellRef().mKey;
std::transform(keyId.begin(), keyId.end(), keyId.begin(), ::tolower);
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
{
if (it->getCellRef ().mRefID == ptr.getCellRef().mKey)
std::string refId = it->getCellRef().mRefID;
std::transform(refId.begin(), refId.end(), refId.begin(), ::tolower);
if (refId == keyId)
{
hasKey = true;
keyName = MWWorld::Class::get(*it).getName(*it);

View file

@ -93,6 +93,8 @@ void BirthDialog::setBirthId(const std::string &birthId)
void BirthDialog::onOkClicked(MyGUI::Widget* _sender)
{
if(mBirthList->getIndexSelected() == MyGUI::ITEM_NONE)
return;
eventDone(this);
}

View file

@ -232,6 +232,7 @@ void CharacterCreation::spawnDialog(const char id)
mBirthSignDialog = 0;
mBirthSignDialog = new BirthDialog(*mWM);
mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen);
mBirthSignDialog->setBirthId(mPlayerBirthSignId);
mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone);
mBirthSignDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogBack);
mBirthSignDialog->setVisible(true);

View file

@ -148,6 +148,8 @@ void PickClassDialog::setClassId(const std::string &classId)
void PickClassDialog::onOkClicked(MyGUI::Widget* _sender)
{
if(mClassList->getIndexSelected() == MyGUI::ITEM_NONE)
return;
eventDone(this);
}
@ -641,6 +643,8 @@ void CreateClassDialog::onDescriptionEntered(WindowBase* parWindow)
void CreateClassDialog::onOkClicked(MyGUI::Widget* _sender)
{
if(getName().size() <= 0)
return;
eventDone(this);
}

View file

@ -149,6 +149,8 @@ void RaceDialog::close()
void RaceDialog::onOkClicked(MyGUI::Widget* _sender)
{
if(mRaceList->getIndexSelected() == MyGUI::ITEM_NONE)
return;
eventDone(this);
}

View file

@ -67,7 +67,7 @@ StatsWindow::StatsWindow (MWBase::WindowManager& parWindowManager)
for (int i = 0; i < ESM::Skill::Length; ++i)
{
mSkillValues.insert(std::pair<int, MWMechanics::Stat<float> >(i, MWMechanics::Stat<float>()));
mSkillWidgetMap.insert(std::pair<int, MyGUI::TextBox*>(i, nullptr));
mSkillWidgetMap.insert(std::pair<int, MyGUI::TextBox*>(i, (MyGUI::TextBox*)nullptr));
}
MyGUI::WindowPtr t = static_cast<MyGUI::WindowPtr>(mMainWidget);

View file

@ -345,11 +345,7 @@ namespace MWWorld
bool PhysicsSystem::toggleCollisionMode()
{
if(playerphysics->ps.move_type==PM_NOCLIP)
playerphysics->ps.move_type=PM_NORMAL;
else
playerphysics->ps.move_type=PM_NOCLIP;
playerphysics->ps.move_type = (playerphysics->ps.move_type == PM_NOCLIP ? PM_NORMAL : PM_NOCLIP);
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->PhysicActorMap.begin(); it != mEngine->PhysicActorMap.end();it++)
{
if (it->first=="player")

View file

@ -70,17 +70,9 @@ namespace MWWorld
{
std::cout << "Unloading cell\n";
ListHandles functor;
(*iter)->forEach<ListHandles>(functor);
{
// silence annoying g++ warning
for (std::vector<Ogre::SceneNode*>::const_iterator iter2 (functor.mHandles.begin());
iter2!=functor.mHandles.end(); ++iter2){
@ -96,27 +88,20 @@ namespace MWWorld
}
}
mRendering.removeCell(*iter);
//mPhysics->removeObject("Unnamed_43");
mRendering.removeCell(*iter);
//mPhysics->removeObject("Unnamed_43");
MWBase::Environment::get().getWorld()->getLocalScripts().clearCell (*iter);
MWBase::Environment::get().getMechanicsManager()->dropActors (*iter);
MWBase::Environment::get().getSoundManager()->stopSound (*iter);
mActiveCells.erase(*iter);
mActiveCells.erase(*iter);
}
void Scene::loadCell (Ptr::CellStore *cell)
{
// register local scripts
MWBase::Environment::get().getWorld()->getLocalScripts().addCell (cell);
std::pair<CellStoreCollection::iterator, bool> result =
mActiveCells.insert(cell);
std::pair<CellStoreCollection::iterator, bool> result = mActiveCells.insert(cell);
if(result.second)
{
@ -138,16 +123,10 @@ namespace MWWorld
mRendering.configureAmbient(*cell);
mRendering.requestMap(cell);
mRendering.configureAmbient(*cell);
}
}
void
Scene::playerCellChange(
MWWorld::CellStore *cell,
const ESM::Position& pos,
bool adjustPlayerPos)
void Scene::playerCellChange(MWWorld::CellStore *cell, const ESM::Position& pos, bool adjustPlayerPos)
{
bool hasWater = cell->cell->mData.mFlags & cell->cell->HasWater;
mPhysics->setCurrentWater(hasWater, cell->cell->mWater);