forked from teamnwah/openmw-tes3coop
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:
parent
8cdd1e5539
commit
15f972cc62
8 changed files with 24 additions and 34 deletions
|
@ -81,9 +81,15 @@ namespace MWClass
|
||||||
bool needKey = ptr.getCellRef().mLockLevel>0;
|
bool needKey = ptr.getCellRef().mLockLevel>0;
|
||||||
bool hasKey = false;
|
bool hasKey = false;
|
||||||
std::string keyName;
|
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)
|
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;
|
hasKey = true;
|
||||||
keyName = MWWorld::Class::get(*it).getName(*it);
|
keyName = MWWorld::Class::get(*it).getName(*it);
|
||||||
|
|
|
@ -93,6 +93,8 @@ void BirthDialog::setBirthId(const std::string &birthId)
|
||||||
|
|
||||||
void BirthDialog::onOkClicked(MyGUI::Widget* _sender)
|
void BirthDialog::onOkClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
|
if(mBirthList->getIndexSelected() == MyGUI::ITEM_NONE)
|
||||||
|
return;
|
||||||
eventDone(this);
|
eventDone(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,6 +232,7 @@ void CharacterCreation::spawnDialog(const char id)
|
||||||
mBirthSignDialog = 0;
|
mBirthSignDialog = 0;
|
||||||
mBirthSignDialog = new BirthDialog(*mWM);
|
mBirthSignDialog = new BirthDialog(*mWM);
|
||||||
mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen);
|
mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen);
|
||||||
|
mBirthSignDialog->setBirthId(mPlayerBirthSignId);
|
||||||
mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone);
|
mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone);
|
||||||
mBirthSignDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogBack);
|
mBirthSignDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogBack);
|
||||||
mBirthSignDialog->setVisible(true);
|
mBirthSignDialog->setVisible(true);
|
||||||
|
|
|
@ -148,6 +148,8 @@ void PickClassDialog::setClassId(const std::string &classId)
|
||||||
|
|
||||||
void PickClassDialog::onOkClicked(MyGUI::Widget* _sender)
|
void PickClassDialog::onOkClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
|
if(mClassList->getIndexSelected() == MyGUI::ITEM_NONE)
|
||||||
|
return;
|
||||||
eventDone(this);
|
eventDone(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,6 +643,8 @@ void CreateClassDialog::onDescriptionEntered(WindowBase* parWindow)
|
||||||
|
|
||||||
void CreateClassDialog::onOkClicked(MyGUI::Widget* _sender)
|
void CreateClassDialog::onOkClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
|
if(getName().size() <= 0)
|
||||||
|
return;
|
||||||
eventDone(this);
|
eventDone(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,8 @@ void RaceDialog::close()
|
||||||
|
|
||||||
void RaceDialog::onOkClicked(MyGUI::Widget* _sender)
|
void RaceDialog::onOkClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
|
if(mRaceList->getIndexSelected() == MyGUI::ITEM_NONE)
|
||||||
|
return;
|
||||||
eventDone(this);
|
eventDone(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ StatsWindow::StatsWindow (MWBase::WindowManager& parWindowManager)
|
||||||
for (int i = 0; i < ESM::Skill::Length; ++i)
|
for (int i = 0; i < ESM::Skill::Length; ++i)
|
||||||
{
|
{
|
||||||
mSkillValues.insert(std::pair<int, MWMechanics::Stat<float> >(i, MWMechanics::Stat<float>()));
|
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);
|
MyGUI::WindowPtr t = static_cast<MyGUI::WindowPtr>(mMainWidget);
|
||||||
|
|
|
@ -345,11 +345,7 @@ namespace MWWorld
|
||||||
|
|
||||||
bool PhysicsSystem::toggleCollisionMode()
|
bool PhysicsSystem::toggleCollisionMode()
|
||||||
{
|
{
|
||||||
if(playerphysics->ps.move_type==PM_NOCLIP)
|
playerphysics->ps.move_type = (playerphysics->ps.move_type == PM_NOCLIP ? PM_NORMAL : PM_NOCLIP);
|
||||||
playerphysics->ps.move_type=PM_NORMAL;
|
|
||||||
|
|
||||||
else
|
|
||||||
playerphysics->ps.move_type=PM_NOCLIP;
|
|
||||||
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->PhysicActorMap.begin(); it != mEngine->PhysicActorMap.end();it++)
|
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->PhysicActorMap.begin(); it != mEngine->PhysicActorMap.end();it++)
|
||||||
{
|
{
|
||||||
if (it->first=="player")
|
if (it->first=="player")
|
||||||
|
|
|
@ -70,17 +70,9 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
std::cout << "Unloading cell\n";
|
std::cout << "Unloading cell\n";
|
||||||
ListHandles functor;
|
ListHandles functor;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(*iter)->forEach<ListHandles>(functor);
|
(*iter)->forEach<ListHandles>(functor);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// silence annoying g++ warning
|
// silence annoying g++ warning
|
||||||
for (std::vector<Ogre::SceneNode*>::const_iterator iter2 (functor.mHandles.begin());
|
for (std::vector<Ogre::SceneNode*>::const_iterator iter2 (functor.mHandles.begin());
|
||||||
iter2!=functor.mHandles.end(); ++iter2){
|
iter2!=functor.mHandles.end(); ++iter2){
|
||||||
|
@ -96,27 +88,20 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mRendering.removeCell(*iter);
|
mRendering.removeCell(*iter);
|
||||||
//mPhysics->removeObject("Unnamed_43");
|
//mPhysics->removeObject("Unnamed_43");
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld()->getLocalScripts().clearCell (*iter);
|
MWBase::Environment::get().getWorld()->getLocalScripts().clearCell (*iter);
|
||||||
MWBase::Environment::get().getMechanicsManager()->dropActors (*iter);
|
MWBase::Environment::get().getMechanicsManager()->dropActors (*iter);
|
||||||
MWBase::Environment::get().getSoundManager()->stopSound (*iter);
|
MWBase::Environment::get().getSoundManager()->stopSound (*iter);
|
||||||
mActiveCells.erase(*iter);
|
mActiveCells.erase(*iter);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::loadCell (Ptr::CellStore *cell)
|
void Scene::loadCell (Ptr::CellStore *cell)
|
||||||
{
|
{
|
||||||
// register local scripts
|
// register local scripts
|
||||||
MWBase::Environment::get().getWorld()->getLocalScripts().addCell (cell);
|
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)
|
if(result.second)
|
||||||
{
|
{
|
||||||
|
@ -138,16 +123,10 @@ namespace MWWorld
|
||||||
mRendering.configureAmbient(*cell);
|
mRendering.configureAmbient(*cell);
|
||||||
mRendering.requestMap(cell);
|
mRendering.requestMap(cell);
|
||||||
mRendering.configureAmbient(*cell);
|
mRendering.configureAmbient(*cell);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void Scene::playerCellChange(MWWorld::CellStore *cell, const ESM::Position& pos, bool adjustPlayerPos)
|
||||||
Scene::playerCellChange(
|
|
||||||
MWWorld::CellStore *cell,
|
|
||||||
const ESM::Position& pos,
|
|
||||||
bool adjustPlayerPos)
|
|
||||||
{
|
{
|
||||||
bool hasWater = cell->cell->mData.mFlags & cell->cell->HasWater;
|
bool hasWater = cell->cell->mData.mFlags & cell->cell->HasWater;
|
||||||
mPhysics->setCurrentWater(hasWater, cell->cell->mWater);
|
mPhysics->setCurrentWater(hasWater, cell->cell->mWater);
|
||||||
|
|
Loading…
Reference in a new issue