forked from teamnwah/openmw-tes3coop
Merge branch 'master' of https://github.com/zinnschlag/openmw.git into AI
This commit is contained in:
commit
b5b0e7a656
271 changed files with 7401 additions and 2820 deletions
40
.travis.yml
Normal file
40
.travis.yml
Normal file
|
@ -0,0 +1,40 @@
|
|||
language: cpp
|
||||
compiler:
|
||||
- gcc
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- next
|
||||
before_install:
|
||||
- pwd
|
||||
- git submodule update --init --recursive
|
||||
- echo "yes" | sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
|
||||
- echo "yes" | sudo apt-add-repository ppa:openmw/deps
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq libboost-all-dev libgtest-dev google-mock libzzip-dev
|
||||
- sudo apt-get install -qq libqt4-dev libxaw7-dev libxrandr-dev libfreeimage-dev libpng-dev
|
||||
- sudo apt-get install -qq libopenal-dev libmpg123-dev libsndfile1-dev
|
||||
- sudo apt-get install -qq libcg nvidia-cg-toolkit
|
||||
- sudo apt-get install -qq libavcodec-dev libavformat-dev libavdevice-dev libavutil-dev libswscale-dev libpostproc-dev
|
||||
- sudo apt-get install -qq libois-dev libbullet-dev libogre-static-dev libmygui-static-dev
|
||||
- sudo mkdir /usr/src/gtest/build
|
||||
- cd /usr/src/gtest/build
|
||||
- sudo cmake .. -DBUILD_SHARED_LIBS=1
|
||||
- sudo make -j4
|
||||
- sudo ln -s /usr/src/gtest/build/libgtest.so /usr/lib/libgtest.so
|
||||
- sudo ln -s /usr/src/gtest/build/libgtest_main.so /usr/lib/libgtest_main.so
|
||||
before_script:
|
||||
- cd -
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake .. -DOGRE_STATIC=1 -DMYGUI_STATIC=1 -DBUILD_WITH_CODE_COVERAGE=1 -DBUILD_UNITTESTS=1
|
||||
script:
|
||||
- make -j4
|
||||
after_script:
|
||||
- ./openmw_test_suite
|
||||
notifications:
|
||||
recipients:
|
||||
- lgromanowski+travis.ci@gmail.com
|
||||
email:
|
||||
on_success: change
|
||||
on_failure: always
|
|
@ -75,6 +75,7 @@ set(LIBDIR ${CMAKE_SOURCE_DIR}/libs)
|
|||
set(OENGINE_OGRE
|
||||
${LIBDIR}/openengine/ogre/renderer.cpp
|
||||
${LIBDIR}/openengine/ogre/fader.cpp
|
||||
${LIBDIR}/openengine/ogre/particles.cpp
|
||||
${LIBDIR}/openengine/ogre/selectionbuffer.cpp
|
||||
)
|
||||
set(OENGINE_GUI
|
||||
|
|
|
@ -679,14 +679,14 @@ void Record<ESM::Faction>::print()
|
|||
std::cout << " Hidden: " << mData.mData.mIsHidden << std::endl;
|
||||
if (mData.mData.mUnknown != -1)
|
||||
std::cout << " Unknown: " << mData.mData.mUnknown << std::endl;
|
||||
std::cout << " Attribute1: " << attributeLabel(mData.mData.mAttribute1)
|
||||
<< " (" << mData.mData.mAttribute1 << ")" << std::endl;
|
||||
std::cout << " Attribute2: " << attributeLabel(mData.mData.mAttribute2)
|
||||
<< " (" << mData.mData.mAttribute2 << ")" << std::endl;
|
||||
std::cout << " Attribute1: " << attributeLabel(mData.mData.mAttribute[0])
|
||||
<< " (" << mData.mData.mAttribute[0] << ")" << std::endl;
|
||||
std::cout << " Attribute2: " << attributeLabel(mData.mData.mAttribute[1])
|
||||
<< " (" << mData.mData.mAttribute[1] << ")" << std::endl;
|
||||
for (int i = 0; i != 6; i++)
|
||||
if (mData.mData.mSkillID[i] != -1)
|
||||
std::cout << " Skill: " << skillLabel(mData.mData.mSkillID[i])
|
||||
<< " (" << mData.mData.mSkillID[i] << ")" << std::endl;
|
||||
if (mData.mData.mSkills[i] != -1)
|
||||
std::cout << " Skill: " << skillLabel(mData.mData.mSkills[i])
|
||||
<< " (" << mData.mData.mSkills[i] << ")" << std::endl;
|
||||
for (int i = 0; i != 10; i++)
|
||||
if (mData.mRanks[i] != "")
|
||||
{
|
||||
|
@ -1099,53 +1099,29 @@ void Record<ESM::Pathgrid>::print()
|
|||
template<>
|
||||
void Record<ESM::Race>::print()
|
||||
{
|
||||
static const char *sAttributeNames[8] =
|
||||
{
|
||||
"Strength", "Intelligence", "Willpower", "Agility",
|
||||
"Speed", "Endurance", "Personality", "Luck"
|
||||
};
|
||||
|
||||
std::cout << " Name: " << mData.mName << std::endl;
|
||||
std::cout << " Description: " << mData.mDescription << std::endl;
|
||||
std::cout << " Flags: " << raceFlags(mData.mData.mFlags) << std::endl;
|
||||
|
||||
std::cout << " Male:" << std::endl;
|
||||
std::cout << " Strength: "
|
||||
<< mData.mData.mStrength.mMale << std::endl;
|
||||
std::cout << " Intelligence: "
|
||||
<< mData.mData.mIntelligence.mMale << std::endl;
|
||||
std::cout << " Willpower: "
|
||||
<< mData.mData.mWillpower.mMale << std::endl;
|
||||
std::cout << " Agility: "
|
||||
<< mData.mData.mAgility.mMale << std::endl;
|
||||
std::cout << " Speed: "
|
||||
<< mData.mData.mSpeed.mMale << std::endl;
|
||||
std::cout << " Endurance: "
|
||||
<< mData.mData.mEndurance.mMale << std::endl;
|
||||
std::cout << " Personality: "
|
||||
<< mData.mData.mPersonality.mMale << std::endl;
|
||||
std::cout << " Luck: "
|
||||
<< mData.mData.mLuck.mMale << std::endl;
|
||||
std::cout << " Height: "
|
||||
<< mData.mData.mHeight.mMale << std::endl;
|
||||
std::cout << " Weight: "
|
||||
<< mData.mData.mWeight.mMale << std::endl;
|
||||
for (int i=0; i<2; ++i)
|
||||
{
|
||||
bool male = i==0;
|
||||
|
||||
std::cout << " Female:" << std::endl;
|
||||
std::cout << " Strength: "
|
||||
<< mData.mData.mStrength.mFemale << std::endl;
|
||||
std::cout << " Intelligence: "
|
||||
<< mData.mData.mIntelligence.mFemale << std::endl;
|
||||
std::cout << " Willpower: "
|
||||
<< mData.mData.mWillpower.mFemale << std::endl;
|
||||
std::cout << " Agility: "
|
||||
<< mData.mData.mAgility.mFemale << std::endl;
|
||||
std::cout << " Speed: "
|
||||
<< mData.mData.mSpeed.mFemale << std::endl;
|
||||
std::cout << " Endurance: "
|
||||
<< mData.mData.mEndurance.mFemale << std::endl;
|
||||
std::cout << " Personality: "
|
||||
<< mData.mData.mPersonality.mFemale << std::endl;
|
||||
std::cout << " Luck: "
|
||||
<< mData.mData.mLuck.mFemale << std::endl;
|
||||
std::cout << " Height: "
|
||||
<< mData.mData.mHeight.mFemale << std::endl;
|
||||
std::cout << " Weight: "
|
||||
<< mData.mData.mWeight.mFemale << std::endl;
|
||||
std::cout << (male ? " Male:" : " Female:") << std::endl;
|
||||
|
||||
for (int i=0; i<8; ++i)
|
||||
std::cout << " " << sAttributeNames[i] << ": "
|
||||
<< mData.mData.mAttributeValues[i].getValue (male) << std::endl;
|
||||
|
||||
std::cout << " Height: " << mData.mData.mHeight.getValue (male) << std::endl;
|
||||
std::cout << " Weight: " << mData.mData.mWeight.getValue (male) << std::endl;
|
||||
}
|
||||
|
||||
for (int i = 0; i != 7; i++)
|
||||
// Not all races have 7 skills.
|
||||
|
@ -1206,7 +1182,7 @@ void Record<ESM::Script>::print()
|
|||
std::cout << " Variable: " << *vit << std::endl;
|
||||
|
||||
std::cout << " ByteCode: ";
|
||||
std::vector<char>::iterator cit;
|
||||
std::vector<unsigned char>::iterator cit;
|
||||
for (cit = mData.mScriptData.begin(); cit != mData.mScriptData.end(); cit++)
|
||||
std::cout << boost::format("%02X") % (int)(*cit);
|
||||
std::cout << std::endl;
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
#define MAINDIALOG_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
|
||||
#endif
|
||||
#include "settings/gamesettings.hpp"
|
||||
#include "settings/graphicssettings.hpp"
|
||||
#include "settings/launchersettings.hpp"
|
||||
|
|
|
@ -22,7 +22,7 @@ opencs_units (model/world
|
|||
|
||||
|
||||
opencs_units_noqt (model/world
|
||||
universalid data record idcollection commands columnbase
|
||||
universalid data record idcollection commands columnbase scriptcontext
|
||||
)
|
||||
|
||||
opencs_hdrs_noqt (model/world
|
||||
|
@ -35,7 +35,8 @@ opencs_units (model/tools
|
|||
)
|
||||
|
||||
opencs_units_noqt (model/tools
|
||||
stage verifier mandatoryid skillcheck
|
||||
stage verifier mandatoryid skillcheck classcheck factioncheck racecheck soundcheck regioncheck
|
||||
birthsigncheck spellcheck
|
||||
)
|
||||
|
||||
|
||||
|
@ -54,11 +55,11 @@ opencs_hdrs_noqt (view/doc
|
|||
|
||||
|
||||
opencs_units (view/world
|
||||
table tablesubview
|
||||
table tablesubview scriptsubview
|
||||
)
|
||||
|
||||
opencs_units_noqt (view/world
|
||||
dialoguesubview util subviews enumdelegate vartypedelegate
|
||||
dialoguesubview util subviews enumdelegate vartypedelegate scripthighlighter
|
||||
)
|
||||
|
||||
|
||||
|
|
39
apps/opencs/model/tools/birthsigncheck.cpp
Normal file
39
apps/opencs/model/tools/birthsigncheck.cpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
|
||||
#include "birthsigncheck.hpp"
|
||||
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
|
||||
#include <components/esm/loadbsgn.hpp>
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
CSMTools::BirthsignCheckStage::BirthsignCheckStage (const CSMWorld::IdCollection<ESM::BirthSign>& birthsigns)
|
||||
: mBirthsigns (birthsigns)
|
||||
{}
|
||||
|
||||
int CSMTools::BirthsignCheckStage::setup()
|
||||
{
|
||||
return mBirthsigns.getSize();
|
||||
}
|
||||
|
||||
void CSMTools::BirthsignCheckStage::perform (int stage, std::vector<std::string>& messages)
|
||||
{
|
||||
const ESM::BirthSign& birthsign = mBirthsigns.getRecord (stage).get();
|
||||
|
||||
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Birthsign, birthsign.mId);
|
||||
|
||||
// test for empty name, description and texture
|
||||
if (birthsign.mName.empty())
|
||||
messages.push_back (id.toString() + "|" + birthsign.mId + " has an empty name");
|
||||
|
||||
if (birthsign.mDescription.empty())
|
||||
messages.push_back (id.toString() + "|" + birthsign.mId + " has an empty description");
|
||||
|
||||
if (birthsign.mTexture.empty())
|
||||
messages.push_back (id.toString() + "|" + birthsign.mId + " is missing a texture");
|
||||
|
||||
/// \todo test if the texture exists
|
||||
|
||||
/// \todo check data members that can't be edited in the table view
|
||||
}
|
29
apps/opencs/model/tools/birthsigncheck.hpp
Normal file
29
apps/opencs/model/tools/birthsigncheck.hpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef CSM_TOOLS_BIRTHSIGNCHECK_H
|
||||
#define CSM_TOOLS_BIRTHSIGNCHECK_H
|
||||
|
||||
#include <components/esm/loadbsgn.hpp>
|
||||
|
||||
#include "../world/idcollection.hpp"
|
||||
|
||||
#include "stage.hpp"
|
||||
|
||||
namespace CSMTools
|
||||
{
|
||||
/// \brief VerifyStage: make sure that birthsign records are internally consistent
|
||||
class BirthsignCheckStage : public Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::BirthSign>& mBirthsigns;
|
||||
|
||||
public:
|
||||
|
||||
BirthsignCheckStage (const CSMWorld::IdCollection<ESM::BirthSign>& birthsigns);
|
||||
|
||||
virtual int setup();
|
||||
///< \return number of steps
|
||||
|
||||
virtual void perform (int stage, std::vector<std::string>& messages);
|
||||
///< Messages resulting from this tage will be appended to \a messages.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
72
apps/opencs/model/tools/classcheck.cpp
Normal file
72
apps/opencs/model/tools/classcheck.cpp
Normal file
|
@ -0,0 +1,72 @@
|
|||
|
||||
#include "classcheck.hpp"
|
||||
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
|
||||
#include <components/esm/loadclas.hpp>
|
||||
#include <components/esm/loadskil.hpp>
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
CSMTools::ClassCheckStage::ClassCheckStage (const CSMWorld::IdCollection<ESM::Class>& classes)
|
||||
: mClasses (classes)
|
||||
{}
|
||||
|
||||
int CSMTools::ClassCheckStage::setup()
|
||||
{
|
||||
return mClasses.getSize();
|
||||
}
|
||||
|
||||
void CSMTools::ClassCheckStage::perform (int stage, std::vector<std::string>& messages)
|
||||
{
|
||||
const ESM::Class& class_= mClasses.getRecord (stage).get();
|
||||
|
||||
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Class, class_.mId);
|
||||
|
||||
// test for empty name and description
|
||||
if (class_.mName.empty())
|
||||
messages.push_back (id.toString() + "|" + class_.mId + " has an empty name");
|
||||
|
||||
if (class_.mDescription.empty())
|
||||
messages.push_back (id.toString() + "|" + class_.mId + " has an empty description");
|
||||
|
||||
// test for invalid attributes
|
||||
for (int i=0; i<2; ++i)
|
||||
if (class_.mData.mAttribute[i]==-1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
|
||||
stream << id.toString() << "|Attribute #" << i << " of " << class_.mId << " is not set";
|
||||
|
||||
messages.push_back (stream.str());
|
||||
}
|
||||
|
||||
if (class_.mData.mAttribute[0]==class_.mData.mAttribute[1] && class_.mData.mAttribute[0]!=-1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
|
||||
stream << id.toString() << "|Class lists same attribute twice";
|
||||
|
||||
messages.push_back (stream.str());
|
||||
}
|
||||
|
||||
// test for non-unique skill
|
||||
std::map<int, int> skills; // ID, number of occurrences
|
||||
|
||||
for (int i=0; i<5; ++i)
|
||||
for (int i2=0; i2<2; ++i2)
|
||||
++skills[class_.mData.mSkills[i][i2]];
|
||||
|
||||
for (std::map<int, int>::const_iterator iter (skills.begin()); iter!=skills.end(); ++iter)
|
||||
if (iter->second>1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
|
||||
stream
|
||||
<< id.toString() << "|"
|
||||
<< ESM::Skill::indexToId (iter->first) << " is listed more than once";
|
||||
|
||||
messages.push_back (stream.str());
|
||||
}
|
||||
}
|
29
apps/opencs/model/tools/classcheck.hpp
Normal file
29
apps/opencs/model/tools/classcheck.hpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef CSM_TOOLS_CLASSCHECK_H
|
||||
#define CSM_TOOLS_CLASSCHECK_H
|
||||
|
||||
#include <components/esm/loadclas.hpp>
|
||||
|
||||
#include "../world/idcollection.hpp"
|
||||
|
||||
#include "stage.hpp"
|
||||
|
||||
namespace CSMTools
|
||||
{
|
||||
/// \brief VerifyStage: make sure that class records are internally consistent
|
||||
class ClassCheckStage : public Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::Class>& mClasses;
|
||||
|
||||
public:
|
||||
|
||||
ClassCheckStage (const CSMWorld::IdCollection<ESM::Class>& classes);
|
||||
|
||||
virtual int setup();
|
||||
///< \return number of steps
|
||||
|
||||
virtual void perform (int stage, std::vector<std::string>& messages);
|
||||
///< Messages resulting from this tage will be appended to \a messages.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
61
apps/opencs/model/tools/factioncheck.cpp
Normal file
61
apps/opencs/model/tools/factioncheck.cpp
Normal file
|
@ -0,0 +1,61 @@
|
|||
|
||||
#include "factioncheck.hpp"
|
||||
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
|
||||
#include <components/esm/loadfact.hpp>
|
||||
#include <components/esm/loadskil.hpp>
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
CSMTools::FactionCheckStage::FactionCheckStage (const CSMWorld::IdCollection<ESM::Faction>& factions)
|
||||
: mFactions (factions)
|
||||
{}
|
||||
|
||||
int CSMTools::FactionCheckStage::setup()
|
||||
{
|
||||
return mFactions.getSize();
|
||||
}
|
||||
|
||||
void CSMTools::FactionCheckStage::perform (int stage, std::vector<std::string>& messages)
|
||||
{
|
||||
const ESM::Faction& faction = mFactions.getRecord (stage).get();
|
||||
|
||||
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Faction, faction.mId);
|
||||
|
||||
// test for empty name
|
||||
if (faction.mName.empty())
|
||||
messages.push_back (id.toString() + "|" + faction.mId + " has an empty name");
|
||||
|
||||
// test for invalid attributes
|
||||
if (faction.mData.mAttribute[0]==faction.mData.mAttribute[1] && faction.mData.mAttribute[0]!=-1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
|
||||
stream << id.toString() << "|Faction lists same attribute twice";
|
||||
|
||||
messages.push_back (stream.str());
|
||||
}
|
||||
|
||||
// test for non-unique skill
|
||||
std::map<int, int> skills; // ID, number of occurrences
|
||||
|
||||
for (int i=0; i<6; ++i)
|
||||
if (faction.mData.mSkills[i]!=-1)
|
||||
++skills[faction.mData.mSkills[i]];
|
||||
|
||||
for (std::map<int, int>::const_iterator iter (skills.begin()); iter!=skills.end(); ++iter)
|
||||
if (iter->second>1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
|
||||
stream
|
||||
<< id.toString() << "|"
|
||||
<< ESM::Skill::indexToId (iter->first) << " is listed more than once";
|
||||
|
||||
messages.push_back (stream.str());
|
||||
}
|
||||
|
||||
/// \todo check data members that can't be edited in the table view
|
||||
}
|
29
apps/opencs/model/tools/factioncheck.hpp
Normal file
29
apps/opencs/model/tools/factioncheck.hpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef CSM_TOOLS_FACTIONCHECK_H
|
||||
#define CSM_TOOLS_FACTIONCHECK_H
|
||||
|
||||
#include <components/esm/loadfact.hpp>
|
||||
|
||||
#include "../world/idcollection.hpp"
|
||||
|
||||
#include "stage.hpp"
|
||||
|
||||
namespace CSMTools
|
||||
{
|
||||
/// \brief VerifyStage: make sure that faction records are internally consistent
|
||||
class FactionCheckStage : public Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::Faction>& mFactions;
|
||||
|
||||
public:
|
||||
|
||||
FactionCheckStage (const CSMWorld::IdCollection<ESM::Faction>& factions);
|
||||
|
||||
virtual int setup();
|
||||
///< \return number of steps
|
||||
|
||||
virtual void perform (int stage, std::vector<std::string>& messages);
|
||||
///< Messages resulting from this tage will be appended to \a messages.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
68
apps/opencs/model/tools/racecheck.cpp
Normal file
68
apps/opencs/model/tools/racecheck.cpp
Normal file
|
@ -0,0 +1,68 @@
|
|||
|
||||
#include "racecheck.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <components/esm/loadrace.hpp>
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
void CSMTools::RaceCheckStage::performPerRecord (int stage, std::vector<std::string>& messages)
|
||||
{
|
||||
const ESM::Race& race = mRaces.getRecord (stage).get();
|
||||
|
||||
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Race, race.mId);
|
||||
|
||||
// test for empty name and description
|
||||
if (race.mName.empty())
|
||||
messages.push_back (id.toString() + "|" + race.mId + " has an empty name");
|
||||
|
||||
if (race.mDescription.empty())
|
||||
messages.push_back (id.toString() + "|" + race.mId + " has an empty description");
|
||||
|
||||
// test for positive height
|
||||
if (race.mData.mHeight.mMale<=0)
|
||||
messages.push_back (id.toString() + "|male " + race.mId + " has non-positive height");
|
||||
|
||||
if (race.mData.mHeight.mFemale<=0)
|
||||
messages.push_back (id.toString() + "|female " + race.mId + " has non-positive height");
|
||||
|
||||
// test for non-negative weight
|
||||
if (race.mData.mWeight.mMale<0)
|
||||
messages.push_back (id.toString() + "|male " + race.mId + " has negative weight");
|
||||
|
||||
if (race.mData.mWeight.mFemale<0)
|
||||
messages.push_back (id.toString() + "|female " + race.mId + " has negative weight");
|
||||
|
||||
// remember playable flag
|
||||
if (race.mData.mFlags & 0x1)
|
||||
mPlayable = true;
|
||||
|
||||
/// \todo check data members that can't be edited in the table view
|
||||
}
|
||||
|
||||
void CSMTools::RaceCheckStage::performFinal (std::vector<std::string>& messages)
|
||||
{
|
||||
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Races);
|
||||
|
||||
if (!mPlayable)
|
||||
messages.push_back (id.toString() + "|No playable race");
|
||||
}
|
||||
|
||||
CSMTools::RaceCheckStage::RaceCheckStage (const CSMWorld::IdCollection<ESM::Race>& races)
|
||||
: mRaces (races), mPlayable (false)
|
||||
{}
|
||||
|
||||
int CSMTools::RaceCheckStage::setup()
|
||||
{
|
||||
mPlayable = false;
|
||||
return mRaces.getSize()+1;
|
||||
}
|
||||
|
||||
void CSMTools::RaceCheckStage::perform (int stage, std::vector<std::string>& messages)
|
||||
{
|
||||
if (stage==mRaces.getSize())
|
||||
performFinal (messages);
|
||||
else
|
||||
performPerRecord (stage, messages);
|
||||
}
|
34
apps/opencs/model/tools/racecheck.hpp
Normal file
34
apps/opencs/model/tools/racecheck.hpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#ifndef CSM_TOOLS_RACECHECK_H
|
||||
#define CSM_TOOLS_RACECHECK_H
|
||||
|
||||
#include <components/esm/loadrace.hpp>
|
||||
|
||||
#include "../world/idcollection.hpp"
|
||||
|
||||
#include "stage.hpp"
|
||||
|
||||
namespace CSMTools
|
||||
{
|
||||
/// \brief VerifyStage: make sure that race records are internally consistent
|
||||
class RaceCheckStage : public Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::Race>& mRaces;
|
||||
bool mPlayable;
|
||||
|
||||
void performPerRecord (int stage, std::vector<std::string>& messages);
|
||||
|
||||
void performFinal (std::vector<std::string>& messages);
|
||||
|
||||
public:
|
||||
|
||||
RaceCheckStage (const CSMWorld::IdCollection<ESM::Race>& races);
|
||||
|
||||
virtual int setup();
|
||||
///< \return number of steps
|
||||
|
||||
virtual void perform (int stage, std::vector<std::string>& messages);
|
||||
///< Messages resulting from this tage will be appended to \a messages.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
33
apps/opencs/model/tools/regioncheck.cpp
Normal file
33
apps/opencs/model/tools/regioncheck.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
|
||||
#include "regioncheck.hpp"
|
||||
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
|
||||
#include <components/esm/loadregn.hpp>
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
CSMTools::RegionCheckStage::RegionCheckStage (const CSMWorld::IdCollection<ESM::Region>& regions)
|
||||
: mRegions (regions)
|
||||
{}
|
||||
|
||||
int CSMTools::RegionCheckStage::setup()
|
||||
{
|
||||
return mRegions.getSize();
|
||||
}
|
||||
|
||||
void CSMTools::RegionCheckStage::perform (int stage, std::vector<std::string>& messages)
|
||||
{
|
||||
const ESM::Region& region = mRegions.getRecord (stage).get();
|
||||
|
||||
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Region, region.mId);
|
||||
|
||||
// test for empty name
|
||||
if (region.mName.empty())
|
||||
messages.push_back (id.toString() + "|" + region.mId + " has an empty name");
|
||||
|
||||
/// \todo test that the ID in mSleeplist exists
|
||||
|
||||
/// \todo check data members that can't be edited in the table view
|
||||
}
|
29
apps/opencs/model/tools/regioncheck.hpp
Normal file
29
apps/opencs/model/tools/regioncheck.hpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef CSM_TOOLS_REGIONCHECK_H
|
||||
#define CSM_TOOLS_REGIONCHECK_H
|
||||
|
||||
#include <components/esm/loadregn.hpp>
|
||||
|
||||
#include "../world/idcollection.hpp"
|
||||
|
||||
#include "stage.hpp"
|
||||
|
||||
namespace CSMTools
|
||||
{
|
||||
/// \brief VerifyStage: make sure that region records are internally consistent
|
||||
class RegionCheckStage : public Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::Region>& mRegions;
|
||||
|
||||
public:
|
||||
|
||||
RegionCheckStage (const CSMWorld::IdCollection<ESM::Region>& regions);
|
||||
|
||||
virtual int setup();
|
||||
///< \return number of steps
|
||||
|
||||
virtual void perform (int stage, std::vector<std::string>& messages);
|
||||
///< Messages resulting from this tage will be appended to \a messages.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
29
apps/opencs/model/tools/soundcheck.cpp
Normal file
29
apps/opencs/model/tools/soundcheck.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
|
||||
#include "soundcheck.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <components/esm/loadskil.hpp>
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
CSMTools::SoundCheckStage::SoundCheckStage (const CSMWorld::IdCollection<ESM::Sound>& sounds)
|
||||
: mSounds (sounds)
|
||||
{}
|
||||
|
||||
int CSMTools::SoundCheckStage::setup()
|
||||
{
|
||||
return mSounds.getSize();
|
||||
}
|
||||
|
||||
void CSMTools::SoundCheckStage::perform (int stage, std::vector<std::string>& messages)
|
||||
{
|
||||
const ESM::Sound& sound = mSounds.getRecord (stage).get();
|
||||
|
||||
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Sound, sound.mId);
|
||||
|
||||
if (sound.mData.mMinRange>sound.mData.mMaxRange)
|
||||
messages.push_back (id.toString() + "|Maximum range larger than minimum range");
|
||||
|
||||
/// \todo check, if the sound file exists
|
||||
}
|
29
apps/opencs/model/tools/soundcheck.hpp
Normal file
29
apps/opencs/model/tools/soundcheck.hpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef CSM_TOOLS_SOUNDCHECK_H
|
||||
#define CSM_TOOLS_SOUNDCHECK_H
|
||||
|
||||
#include <components/esm/loadsoun.hpp>
|
||||
|
||||
#include "../world/idcollection.hpp"
|
||||
|
||||
#include "stage.hpp"
|
||||
|
||||
namespace CSMTools
|
||||
{
|
||||
/// \brief VerifyStage: make sure that sound records are internally consistent
|
||||
class SoundCheckStage : public Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::Sound>& mSounds;
|
||||
|
||||
public:
|
||||
|
||||
SoundCheckStage (const CSMWorld::IdCollection<ESM::Sound>& sounds);
|
||||
|
||||
virtual int setup();
|
||||
///< \return number of steps
|
||||
|
||||
virtual void perform (int stage, std::vector<std::string>& messages);
|
||||
///< Messages resulting from this tage will be appended to \a messages.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
35
apps/opencs/model/tools/spellcheck.cpp
Normal file
35
apps/opencs/model/tools/spellcheck.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
#include "spellcheck.hpp"
|
||||
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
|
||||
#include <components/esm/loadspel.hpp>
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
CSMTools::SpellCheckStage::SpellCheckStage (const CSMWorld::IdCollection<ESM::Spell>& spells)
|
||||
: mSpells (spells)
|
||||
{}
|
||||
|
||||
int CSMTools::SpellCheckStage::setup()
|
||||
{
|
||||
return mSpells.getSize();
|
||||
}
|
||||
|
||||
void CSMTools::SpellCheckStage::perform (int stage, std::vector<std::string>& messages)
|
||||
{
|
||||
const ESM::Spell& spell = mSpells.getRecord (stage).get();
|
||||
|
||||
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Spell, spell.mId);
|
||||
|
||||
// test for empty name and description
|
||||
if (spell.mName.empty())
|
||||
messages.push_back (id.toString() + "|" + spell.mId + " has an empty name");
|
||||
|
||||
// test for invalid cost values
|
||||
if (spell.mData.mCost<0)
|
||||
messages.push_back (id.toString() + "|" + spell.mId + " has a negative spell costs");
|
||||
|
||||
/// \todo check data members that can't be edited in the table view
|
||||
}
|
29
apps/opencs/model/tools/spellcheck.hpp
Normal file
29
apps/opencs/model/tools/spellcheck.hpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef CSM_TOOLS_SPELLCHECK_H
|
||||
#define CSM_TOOLS_SPELLCHECK_H
|
||||
|
||||
#include <components/esm/loadspel.hpp>
|
||||
|
||||
#include "../world/idcollection.hpp"
|
||||
|
||||
#include "stage.hpp"
|
||||
|
||||
namespace CSMTools
|
||||
{
|
||||
/// \brief VerifyStage: make sure that spell records are internally consistent
|
||||
class SpellCheckStage : public Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::Spell>& mSpells;
|
||||
|
||||
public:
|
||||
|
||||
SpellCheckStage (const CSMWorld::IdCollection<ESM::Spell>& spells);
|
||||
|
||||
virtual int setup();
|
||||
///< \return number of steps
|
||||
|
||||
virtual void perform (int stage, std::vector<std::string>& messages);
|
||||
///< Messages resulting from this tage will be appended to \a messages.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -13,6 +13,13 @@
|
|||
#include "reportmodel.hpp"
|
||||
#include "mandatoryid.hpp"
|
||||
#include "skillcheck.hpp"
|
||||
#include "classcheck.hpp"
|
||||
#include "factioncheck.hpp"
|
||||
#include "racecheck.hpp"
|
||||
#include "soundcheck.hpp"
|
||||
#include "regioncheck.hpp"
|
||||
#include "birthsigncheck.hpp"
|
||||
#include "spellcheck.hpp"
|
||||
|
||||
CSMTools::Operation *CSMTools::Tools::get (int type)
|
||||
{
|
||||
|
@ -54,6 +61,20 @@ CSMTools::Verifier *CSMTools::Tools::getVerifier()
|
|||
CSMWorld::UniversalId (CSMWorld::UniversalId::Type_Globals), mandatoryIds));
|
||||
|
||||
mVerifier->appendStage (new SkillCheckStage (mData.getSkills()));
|
||||
|
||||
mVerifier->appendStage (new ClassCheckStage (mData.getClasses()));
|
||||
|
||||
mVerifier->appendStage (new FactionCheckStage (mData.getFactions()));
|
||||
|
||||
mVerifier->appendStage (new RaceCheckStage (mData.getRaces()));
|
||||
|
||||
mVerifier->appendStage (new SoundCheckStage (mData.getSounds()));
|
||||
|
||||
mVerifier->appendStage (new RegionCheckStage (mData.getRegions()));
|
||||
|
||||
mVerifier->appendStage (new BirthsignCheckStage (mData.getBirthsigns()));
|
||||
|
||||
mVerifier->appendStage (new SpellCheckStage (mData.getSpells()));
|
||||
}
|
||||
|
||||
return mVerifier;
|
||||
|
|
|
@ -34,7 +34,9 @@ namespace CSMWorld
|
|||
Display_GlobalVarType,
|
||||
Display_Specialisation,
|
||||
Display_Attribute,
|
||||
Display_Boolean
|
||||
Display_Boolean,
|
||||
Display_SpellType,
|
||||
Display_Script
|
||||
};
|
||||
|
||||
std::string mTitle;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <QColor>
|
||||
|
||||
#include "columnbase.hpp"
|
||||
|
||||
namespace CSMWorld
|
||||
|
@ -347,15 +349,15 @@ namespace CSMWorld
|
|||
int mIndex;
|
||||
bool mMajor;
|
||||
|
||||
SkillsColumn (int index, bool major)
|
||||
: Column<ESXRecordT> ((major ? "Major Skill #" : "Minor Skill #")+
|
||||
SkillsColumn (int index, bool typePrefix = false, bool major = false)
|
||||
: Column<ESXRecordT> ((typePrefix ? (major ? "Major Skill #" : "Minor Skill #") : "Skill #")+
|
||||
boost::lexical_cast<std::string> (index), ColumnBase::Display_String),
|
||||
mIndex (index), mMajor (major)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
int skill = record.get().mData.mSkills[mIndex][mMajor ? 1 : 0];
|
||||
int skill = record.get().mData.getSkill (mIndex, mMajor);
|
||||
|
||||
return QString::fromUtf8 (ESM::Skill::indexToId (skill).c_str());
|
||||
}
|
||||
|
@ -373,7 +375,7 @@ namespace CSMWorld
|
|||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mData.mSkills[mIndex][mMajor ? 1 : 0] = index;
|
||||
record2.mData.getSkill (mIndex, mMajor) = index;
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
@ -409,6 +411,343 @@ namespace CSMWorld
|
|||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct HiddenColumn : public Column<ESXRecordT>
|
||||
{
|
||||
HiddenColumn() : Column<ESXRecordT> ("Hidden", ColumnBase::Display_Boolean) {}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return record.get().mData.mIsHidden!=0;
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mData.mIsHidden = data.toInt();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct FlagColumn : public Column<ESXRecordT>
|
||||
{
|
||||
int mMask;
|
||||
|
||||
FlagColumn (const std::string& name, int mask)
|
||||
: Column<ESXRecordT> (name, ColumnBase::Display_Boolean), mMask (mask)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return (record.get().mData.mFlags & mMask)!=0;
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
int flags = record2.mData.mFlags & ~mMask;
|
||||
|
||||
if (data.toInt())
|
||||
flags |= mMask;
|
||||
|
||||
record2.mData.mFlags = flags;
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct WeightHeightColumn : public Column<ESXRecordT>
|
||||
{
|
||||
bool mMale;
|
||||
bool mWeight;
|
||||
|
||||
WeightHeightColumn (bool male, bool weight)
|
||||
: Column<ESXRecordT> (male ? (weight ? "Male Weight" : "Male Height") :
|
||||
(weight ? "Female Weight" : "Female Height"), ColumnBase::Display_Float),
|
||||
mMale (male), mWeight (weight)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
const ESM::Race::MaleFemaleF& value =
|
||||
mWeight ? record.get().mData.mWeight : record.get().mData.mHeight;
|
||||
|
||||
return mMale ? value.mMale : value.mFemale;
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
ESM::Race::MaleFemaleF& value =
|
||||
mWeight ? record2.mData.mWeight : record2.mData.mHeight;
|
||||
|
||||
(mMale ? value.mMale : value.mFemale) = data.toFloat();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct SoundParamColumn : public Column<ESXRecordT>
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
Type_Volume,
|
||||
Type_MinRange,
|
||||
Type_MaxRange
|
||||
};
|
||||
|
||||
Type mType;
|
||||
|
||||
SoundParamColumn (Type type)
|
||||
: Column<ESXRecordT> (
|
||||
type==Type_Volume ? "Volume" : (type==Type_MinRange ? "Min Range" : "Max Range"),
|
||||
ColumnBase::Display_Integer),
|
||||
mType (type)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
int value = 0;
|
||||
|
||||
switch (mType)
|
||||
{
|
||||
case Type_Volume: value = record.get().mData.mVolume; break;
|
||||
case Type_MinRange: value = record.get().mData.mMinRange; break;
|
||||
case Type_MaxRange: value = record.get().mData.mMaxRange; break;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
int value = data.toInt();
|
||||
|
||||
if (value<0)
|
||||
value = 0;
|
||||
else if (value>255)
|
||||
value = 255;
|
||||
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
switch (mType)
|
||||
{
|
||||
case Type_Volume: record2.mData.mVolume = static_cast<unsigned char> (value); break;
|
||||
case Type_MinRange: record2.mData.mMinRange = static_cast<unsigned char> (value); break;
|
||||
case Type_MaxRange: record2.mData.mMaxRange = static_cast<unsigned char> (value); break;
|
||||
}
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct SoundFileColumn : public Column<ESXRecordT>
|
||||
{
|
||||
SoundFileColumn() : Column<ESXRecordT> ("Sound File", ColumnBase::Display_String) {}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return QString::fromUtf8 (record.get().mSound.c_str());
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mSound = data.toString().toUtf8().constData();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/// \todo QColor is a GUI class and should not be in model. Need to think of an alternative
|
||||
/// solution.
|
||||
template<typename ESXRecordT>
|
||||
struct MapColourColumn : public Column<ESXRecordT>
|
||||
{
|
||||
/// \todo Replace Display_Integer with something that displays the colour value more directly.
|
||||
MapColourColumn() : Column<ESXRecordT> ("Map Colour", ColumnBase::Display_Integer) {}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
int colour = record.get().mMapColor;
|
||||
|
||||
return QColor (colour & 0xff, (colour>>8) & 0xff, (colour>>16) & 0xff);
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
QColor colour = data.value<QColor>();
|
||||
|
||||
record2.mMapColor = colour.rgb() & 0xffffff;
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct SleepListColumn : public Column<ESXRecordT>
|
||||
{
|
||||
SleepListColumn() : Column<ESXRecordT> ("Sleep Encounter", ColumnBase::Display_String) {}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return QString::fromUtf8 (record.get().mSleepList.c_str());
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mSleepList = data.toString().toUtf8().constData();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct TextureColumn : public Column<ESXRecordT>
|
||||
{
|
||||
TextureColumn() : Column<ESXRecordT> ("Texture", ColumnBase::Display_String) {}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return QString::fromUtf8 (record.get().mTexture.c_str());
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mTexture = data.toString().toUtf8().constData();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct SpellTypeColumn : public Column<ESXRecordT>
|
||||
{
|
||||
SpellTypeColumn() : Column<ESXRecordT> ("Type", ColumnBase::Display_SpellType) {}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return record.get().mData.mType;
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mData.mType = data.toInt();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct CostColumn : public Column<ESXRecordT>
|
||||
{
|
||||
CostColumn() : Column<ESXRecordT> ("Cost", ColumnBase::Display_Integer) {}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return record.get().mData.mCost;
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
record2.mData.mCost = data.toInt();
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct ScriptColumn : public Column<ESXRecordT>
|
||||
{
|
||||
ScriptColumn() : Column<ESXRecordT> ("Script", ColumnBase::Display_Script, 0) {}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return QString::fromUtf8 (record.get().mScriptText.c_str());
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mScriptText = data.toString().toUtf8().constData();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -33,11 +33,13 @@ CSMWorld::Data::Data()
|
|||
mGmsts.addColumn (new StringIdColumn<ESM::GameSetting>);
|
||||
mGmsts.addColumn (new RecordStateColumn<ESM::GameSetting>);
|
||||
mGmsts.addColumn (new FixedRecordTypeColumn<ESM::GameSetting> (UniversalId::Type_Gmst));
|
||||
mGmsts.addColumn (new FixedRecordTypeColumn<ESM::GameSetting> (UniversalId::Type_Gmst));
|
||||
mGmsts.addColumn (new VarTypeColumn<ESM::GameSetting> (ColumnBase::Display_GmstVarType));
|
||||
mGmsts.addColumn (new VarValueColumn<ESM::GameSetting>);
|
||||
|
||||
mSkills.addColumn (new StringIdColumn<ESM::Skill>);
|
||||
mSkills.addColumn (new RecordStateColumn<ESM::Skill>);
|
||||
mSkills.addColumn (new FixedRecordTypeColumn<ESM::Skill> (UniversalId::Type_Skill));
|
||||
mSkills.addColumn (new AttributeColumn<ESM::Skill>);
|
||||
mSkills.addColumn (new SpecialisationColumn<ESM::Skill>);
|
||||
for (int i=0; i<4; ++i)
|
||||
|
@ -46,21 +48,88 @@ CSMWorld::Data::Data()
|
|||
|
||||
mClasses.addColumn (new StringIdColumn<ESM::Class>);
|
||||
mClasses.addColumn (new RecordStateColumn<ESM::Class>);
|
||||
mClasses.addColumn (new FixedRecordTypeColumn<ESM::Class> (UniversalId::Type_Class));
|
||||
mClasses.addColumn (new NameColumn<ESM::Class>);
|
||||
mClasses.addColumn (new AttributesColumn<ESM::Class> (0));
|
||||
mClasses.addColumn (new AttributesColumn<ESM::Class> (1));
|
||||
mClasses.addColumn (new SpecialisationColumn<ESM::Class>);
|
||||
for (int i=0; i<5; ++i)
|
||||
mClasses.addColumn (new SkillsColumn<ESM::Class> (i, true));
|
||||
mClasses.addColumn (new SkillsColumn<ESM::Class> (i, true, true));
|
||||
for (int i=0; i<5; ++i)
|
||||
mClasses.addColumn (new SkillsColumn<ESM::Class> (i, false));
|
||||
mClasses.addColumn (new SkillsColumn<ESM::Class> (i, true, false));
|
||||
mClasses.addColumn (new PlayableColumn<ESM::Class>);
|
||||
mClasses.addColumn (new DescriptionColumn<ESM::Class>);
|
||||
|
||||
mFactions.addColumn (new StringIdColumn<ESM::Faction>);
|
||||
mFactions.addColumn (new RecordStateColumn<ESM::Faction>);
|
||||
mFactions.addColumn (new FixedRecordTypeColumn<ESM::Faction> (UniversalId::Type_Faction));
|
||||
mFactions.addColumn (new NameColumn<ESM::Faction>);
|
||||
mFactions.addColumn (new AttributesColumn<ESM::Faction> (0));
|
||||
mFactions.addColumn (new AttributesColumn<ESM::Faction> (1));
|
||||
mFactions.addColumn (new HiddenColumn<ESM::Faction>);
|
||||
for (int i=0; i<6; ++i)
|
||||
mFactions.addColumn (new SkillsColumn<ESM::Faction> (i));
|
||||
|
||||
mRaces.addColumn (new StringIdColumn<ESM::Race>);
|
||||
mRaces.addColumn (new RecordStateColumn<ESM::Race>);
|
||||
mRaces.addColumn (new FixedRecordTypeColumn<ESM::Race> (UniversalId::Type_Race));
|
||||
mRaces.addColumn (new NameColumn<ESM::Race>);
|
||||
mRaces.addColumn (new DescriptionColumn<ESM::Race>);
|
||||
mRaces.addColumn (new FlagColumn<ESM::Race> ("Playable", 0x1));
|
||||
mRaces.addColumn (new FlagColumn<ESM::Race> ("Beast Race", 0x2));
|
||||
mRaces.addColumn (new WeightHeightColumn<ESM::Race> (true, true));
|
||||
mRaces.addColumn (new WeightHeightColumn<ESM::Race> (true, false));
|
||||
mRaces.addColumn (new WeightHeightColumn<ESM::Race> (false, true));
|
||||
mRaces.addColumn (new WeightHeightColumn<ESM::Race> (false, false));
|
||||
|
||||
mSounds.addColumn (new StringIdColumn<ESM::Sound>);
|
||||
mSounds.addColumn (new RecordStateColumn<ESM::Sound>);
|
||||
mSounds.addColumn (new FixedRecordTypeColumn<ESM::Sound> (UniversalId::Type_Sound));
|
||||
mSounds.addColumn (new SoundParamColumn<ESM::Sound> (SoundParamColumn<ESM::Sound>::Type_Volume));
|
||||
mSounds.addColumn (new SoundParamColumn<ESM::Sound> (SoundParamColumn<ESM::Sound>::Type_MinRange));
|
||||
mSounds.addColumn (new SoundParamColumn<ESM::Sound> (SoundParamColumn<ESM::Sound>::Type_MaxRange));
|
||||
mSounds.addColumn (new SoundFileColumn<ESM::Sound>);
|
||||
|
||||
mScripts.addColumn (new StringIdColumn<ESM::Script>);
|
||||
mScripts.addColumn (new RecordStateColumn<ESM::Script>);
|
||||
mScripts.addColumn (new FixedRecordTypeColumn<ESM::Script> (UniversalId::Type_Script));
|
||||
mScripts.addColumn (new ScriptColumn<ESM::Script>);
|
||||
|
||||
mRegions.addColumn (new StringIdColumn<ESM::Region>);
|
||||
mRegions.addColumn (new RecordStateColumn<ESM::Region>);
|
||||
mRegions.addColumn (new FixedRecordTypeColumn<ESM::Region> (UniversalId::Type_Region));
|
||||
mRegions.addColumn (new NameColumn<ESM::Region>);
|
||||
mRegions.addColumn (new MapColourColumn<ESM::Region>);
|
||||
mRegions.addColumn (new SleepListColumn<ESM::Region>);
|
||||
|
||||
mBirthsigns.addColumn (new StringIdColumn<ESM::BirthSign>);
|
||||
mBirthsigns.addColumn (new RecordStateColumn<ESM::BirthSign>);
|
||||
mBirthsigns.addColumn (new FixedRecordTypeColumn<ESM::BirthSign> (UniversalId::Type_Birthsign));
|
||||
mBirthsigns.addColumn (new NameColumn<ESM::BirthSign>);
|
||||
mBirthsigns.addColumn (new TextureColumn<ESM::BirthSign>);
|
||||
mBirthsigns.addColumn (new DescriptionColumn<ESM::BirthSign>);
|
||||
|
||||
mSpells.addColumn (new StringIdColumn<ESM::Spell>);
|
||||
mSpells.addColumn (new RecordStateColumn<ESM::Spell>);
|
||||
mSpells.addColumn (new FixedRecordTypeColumn<ESM::Spell> (UniversalId::Type_Spell));
|
||||
mSpells.addColumn (new NameColumn<ESM::Spell>);
|
||||
mSpells.addColumn (new SpellTypeColumn<ESM::Spell>);
|
||||
mSpells.addColumn (new CostColumn<ESM::Spell>);
|
||||
mSpells.addColumn (new FlagColumn<ESM::Spell> ("Autocalc", 0x1));
|
||||
mSpells.addColumn (new FlagColumn<ESM::Spell> ("Starter Spell", 0x2));
|
||||
mSpells.addColumn (new FlagColumn<ESM::Spell> ("Always Succeeds", 0x4));
|
||||
|
||||
addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global);
|
||||
addModel (new IdTable (&mGmsts), UniversalId::Type_Gmsts, UniversalId::Type_Gmst);
|
||||
addModel (new IdTable (&mSkills), UniversalId::Type_Skills, UniversalId::Type_Skill);
|
||||
addModel (new IdTable (&mClasses), UniversalId::Type_Classes, UniversalId::Type_Class);
|
||||
addModel (new IdTable (&mFactions), UniversalId::Type_Factions, UniversalId::Type_Faction);
|
||||
addModel (new IdTable (&mRaces), UniversalId::Type_Races, UniversalId::Type_Race);
|
||||
addModel (new IdTable (&mSounds), UniversalId::Type_Sounds, UniversalId::Type_Sound);
|
||||
addModel (new IdTable (&mScripts), UniversalId::Type_Scripts, UniversalId::Type_Script);
|
||||
addModel (new IdTable (&mRegions), UniversalId::Type_Regions, UniversalId::Type_Region);
|
||||
addModel (new IdTable (&mBirthsigns), UniversalId::Type_Birthsigns, UniversalId::Type_Birthsign);
|
||||
addModel (new IdTable (&mSpells), UniversalId::Type_Spells, UniversalId::Type_Spell);
|
||||
}
|
||||
|
||||
CSMWorld::Data::~Data()
|
||||
|
@ -99,6 +168,86 @@ CSMWorld::IdCollection<ESM::Skill>& CSMWorld::Data::getSkills()
|
|||
return mSkills;
|
||||
}
|
||||
|
||||
const CSMWorld::IdCollection<ESM::Class>& CSMWorld::Data::getClasses() const
|
||||
{
|
||||
return mClasses;
|
||||
}
|
||||
|
||||
CSMWorld::IdCollection<ESM::Class>& CSMWorld::Data::getClasses()
|
||||
{
|
||||
return mClasses;
|
||||
}
|
||||
|
||||
const CSMWorld::IdCollection<ESM::Faction>& CSMWorld::Data::getFactions() const
|
||||
{
|
||||
return mFactions;
|
||||
}
|
||||
|
||||
CSMWorld::IdCollection<ESM::Faction>& CSMWorld::Data::getFactions()
|
||||
{
|
||||
return mFactions;
|
||||
}
|
||||
|
||||
const CSMWorld::IdCollection<ESM::Race>& CSMWorld::Data::getRaces() const
|
||||
{
|
||||
return mRaces;
|
||||
}
|
||||
|
||||
CSMWorld::IdCollection<ESM::Race>& CSMWorld::Data::getRaces()
|
||||
{
|
||||
return mRaces;
|
||||
}
|
||||
|
||||
const CSMWorld::IdCollection<ESM::Sound>& CSMWorld::Data::getSounds() const
|
||||
{
|
||||
return mSounds;
|
||||
}
|
||||
|
||||
CSMWorld::IdCollection<ESM::Sound>& CSMWorld::Data::getSounds()
|
||||
{
|
||||
return mSounds;
|
||||
}
|
||||
|
||||
const CSMWorld::IdCollection<ESM::Script>& CSMWorld::Data::getScripts() const
|
||||
{
|
||||
return mScripts;
|
||||
}
|
||||
|
||||
CSMWorld::IdCollection<ESM::Script>& CSMWorld::Data::getScripts()
|
||||
{
|
||||
return mScripts;
|
||||
}
|
||||
|
||||
const CSMWorld::IdCollection<ESM::Region>& CSMWorld::Data::getRegions() const
|
||||
{
|
||||
return mRegions;
|
||||
}
|
||||
|
||||
CSMWorld::IdCollection<ESM::Region>& CSMWorld::Data::getRegions()
|
||||
{
|
||||
return mRegions;
|
||||
}
|
||||
|
||||
const CSMWorld::IdCollection<ESM::BirthSign>& CSMWorld::Data::getBirthsigns() const
|
||||
{
|
||||
return mBirthsigns;
|
||||
}
|
||||
|
||||
CSMWorld::IdCollection<ESM::BirthSign>& CSMWorld::Data::getBirthsigns()
|
||||
{
|
||||
return mBirthsigns;
|
||||
}
|
||||
|
||||
const CSMWorld::IdCollection<ESM::Spell>& CSMWorld::Data::getSpells() const
|
||||
{
|
||||
return mSpells;
|
||||
}
|
||||
|
||||
CSMWorld::IdCollection<ESM::Spell>& CSMWorld::Data::getSpells()
|
||||
{
|
||||
return mSpells;
|
||||
}
|
||||
|
||||
QAbstractItemModel *CSMWorld::Data::getTableModel (const UniversalId& id)
|
||||
{
|
||||
std::map<UniversalId::Type, QAbstractItemModel *>::iterator iter = mModelIndex.find (id.getType());
|
||||
|
@ -137,6 +286,13 @@ void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base)
|
|||
case ESM::REC_GMST: mGmsts.load (reader, base); break;
|
||||
case ESM::REC_SKIL: mSkills.load (reader, base); break;
|
||||
case ESM::REC_CLAS: mClasses.load (reader, base); break;
|
||||
case ESM::REC_FACT: mFactions.load (reader, base); break;
|
||||
case ESM::REC_RACE: mRaces.load (reader, base); break;
|
||||
case ESM::REC_SOUN: mSounds.load (reader, base); break;
|
||||
case ESM::REC_SCPT: mScripts.load (reader, base); break;
|
||||
case ESM::REC_REGN: mRegions.load (reader, base); break;
|
||||
case ESM::REC_BSGN: mBirthsigns.load (reader, base); break;
|
||||
case ESM::REC_SPEL: mSpells.load (reader, base); break;
|
||||
|
||||
default:
|
||||
|
||||
|
|
|
@ -10,6 +10,13 @@
|
|||
#include <components/esm/loadgmst.hpp>
|
||||
#include <components/esm/loadskil.hpp>
|
||||
#include <components/esm/loadclas.hpp>
|
||||
#include <components/esm/loadfact.hpp>
|
||||
#include <components/esm/loadrace.hpp>
|
||||
#include <components/esm/loadsoun.hpp>
|
||||
#include <components/esm/loadscpt.hpp>
|
||||
#include <components/esm/loadregn.hpp>
|
||||
#include <components/esm/loadbsgn.hpp>
|
||||
#include <components/esm/loadspel.hpp>
|
||||
|
||||
#include "idcollection.hpp"
|
||||
#include "universalid.hpp"
|
||||
|
@ -24,6 +31,13 @@ namespace CSMWorld
|
|||
IdCollection<ESM::GameSetting> mGmsts;
|
||||
IdCollection<ESM::Skill> mSkills;
|
||||
IdCollection<ESM::Class> mClasses;
|
||||
IdCollection<ESM::Faction> mFactions;
|
||||
IdCollection<ESM::Race> mRaces;
|
||||
IdCollection<ESM::Sound> mSounds;
|
||||
IdCollection<ESM::Script> mScripts;
|
||||
IdCollection<ESM::Region> mRegions;
|
||||
IdCollection<ESM::BirthSign> mBirthsigns;
|
||||
IdCollection<ESM::Spell> mSpells;
|
||||
std::vector<QAbstractItemModel *> mModels;
|
||||
std::map<UniversalId::Type, QAbstractItemModel *> mModelIndex;
|
||||
|
||||
|
@ -52,6 +66,38 @@ namespace CSMWorld
|
|||
|
||||
IdCollection<ESM::Skill>& getSkills();
|
||||
|
||||
const IdCollection<ESM::Class>& getClasses() const;
|
||||
|
||||
IdCollection<ESM::Class>& getClasses();
|
||||
|
||||
const IdCollection<ESM::Faction>& getFactions() const;
|
||||
|
||||
IdCollection<ESM::Faction>& getFactions();
|
||||
|
||||
const IdCollection<ESM::Race>& getRaces() const;
|
||||
|
||||
IdCollection<ESM::Race>& getRaces();
|
||||
|
||||
const IdCollection<ESM::Sound>& getSounds() const;
|
||||
|
||||
IdCollection<ESM::Sound>& getSounds();
|
||||
|
||||
const IdCollection<ESM::Script>& getScripts() const;
|
||||
|
||||
IdCollection<ESM::Script>& getScripts();
|
||||
|
||||
const IdCollection<ESM::Region>& getRegions() const;
|
||||
|
||||
IdCollection<ESM::Region>& getRegions();
|
||||
|
||||
const IdCollection<ESM::BirthSign>& getBirthsigns() const;
|
||||
|
||||
IdCollection<ESM::BirthSign>& getBirthsigns();
|
||||
|
||||
const IdCollection<ESM::Spell>& getSpells() const;
|
||||
|
||||
IdCollection<ESM::Spell>& getSpells();
|
||||
|
||||
QAbstractItemModel *getTableModel (const UniversalId& id);
|
||||
///< If no table model is available for \a id, an exception is thrown.
|
||||
///
|
||||
|
|
22
apps/opencs/model/world/scriptcontext.cpp
Normal file
22
apps/opencs/model/world/scriptcontext.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
#include "scriptcontext.hpp"
|
||||
|
||||
bool CSMWorld::ScriptContext::canDeclareLocals() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char CSMWorld::ScriptContext::getGlobalType (const std::string& name) const
|
||||
{
|
||||
return ' ';
|
||||
}
|
||||
|
||||
char CSMWorld::ScriptContext::getMemberType (const std::string& name, const std::string& id) const
|
||||
{
|
||||
return ' ';
|
||||
}
|
||||
|
||||
bool CSMWorld::ScriptContext::isId (const std::string& name) const
|
||||
{
|
||||
return false;
|
||||
}
|
26
apps/opencs/model/world/scriptcontext.hpp
Normal file
26
apps/opencs/model/world/scriptcontext.hpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef CSM_WORLD_SCRIPTCONTEXT_H
|
||||
#define CSM_WORLD_SCRIPTCONTEXT_H
|
||||
|
||||
#include <components/compiler/context.hpp>
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
class ScriptContext : public Compiler::Context
|
||||
{
|
||||
public:
|
||||
|
||||
virtual bool canDeclareLocals() const;
|
||||
///< Is the compiler allowed to declare local variables?
|
||||
|
||||
virtual char getGlobalType (const std::string& name) const;
|
||||
///< 'l: long, 's': short, 'f': float, ' ': does not exist.
|
||||
|
||||
virtual char getMemberType (const std::string& name, const std::string& id) const;
|
||||
///< 'l: long, 's': short, 'f': float, ' ': does not exist.
|
||||
|
||||
virtual bool isId (const std::string& name) const;
|
||||
///< Does \a name match an ID, that can be referenced?
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -21,6 +21,13 @@ namespace
|
|||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Gmsts, "Game Settings" },
|
||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Skills, "Skills" },
|
||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Classes, "Classes" },
|
||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Factions, "Factions" },
|
||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Races, "Races" },
|
||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Sounds, "Sounds" },
|
||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Scripts, "Scripts" },
|
||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Regions, "Regions" },
|
||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Birthsigns, "Birthsigns" },
|
||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Spells, "Spells" },
|
||||
|
||||
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0 } // end marker
|
||||
};
|
||||
|
@ -31,6 +38,13 @@ namespace
|
|||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Gmst, "Game Setting" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Skill, "Skill" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Class, "Class" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Faction, "Faction" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Race, "Race" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Sound, "Sound" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Script, "Script" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Region, "Region" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Birthsign, "Birthsign" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Spell, "Spell" },
|
||||
|
||||
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0 } // end marker
|
||||
};
|
||||
|
@ -51,44 +65,41 @@ CSMWorld::UniversalId::UniversalId (const std::string& universalId)
|
|||
{
|
||||
std::string type = universalId.substr (0, index);
|
||||
|
||||
if (index==std::string::npos)
|
||||
{
|
||||
for (int i=0; sNoArg[i].mName; ++i)
|
||||
if (type==sNoArg[i].mName)
|
||||
{
|
||||
mArgumentType = ArgumentType_None;
|
||||
mType = sNoArg[i].mType;
|
||||
mClass = sNoArg[i].mClass;
|
||||
for (int i=0; sIdArg[i].mName; ++i)
|
||||
if (type==sIdArg[i].mName)
|
||||
{
|
||||
mArgumentType = ArgumentType_Id;
|
||||
mType = sIdArg[i].mType;
|
||||
mClass = sIdArg[i].mClass;
|
||||
mId = universalId.substr (index+2);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i=0; sIndexArg[i].mName; ++i)
|
||||
if (type==sIndexArg[i].mName)
|
||||
{
|
||||
mArgumentType = ArgumentType_Index;
|
||||
mType = sIndexArg[i].mType;
|
||||
mClass = sIndexArg[i].mClass;
|
||||
|
||||
std::istringstream stream (universalId.substr (index+2));
|
||||
|
||||
if (stream >> mIndex)
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0; sIdArg[i].mName; ++i)
|
||||
if (type==sIdArg[i].mName)
|
||||
{
|
||||
mArgumentType = ArgumentType_Id;
|
||||
mType = sIdArg[i].mType;
|
||||
mClass = sIdArg[i].mClass;
|
||||
mId = universalId.substr (0, index);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i=0; sIndexArg[i].mName; ++i)
|
||||
if (type==sIndexArg[i].mName)
|
||||
{
|
||||
mArgumentType = ArgumentType_Index;
|
||||
mType = sIndexArg[i].mType;
|
||||
mClass = sIndexArg[i].mClass;
|
||||
|
||||
std::istringstream stream (universalId.substr (0, index));
|
||||
|
||||
if (stream >> mIndex)
|
||||
return;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0; sNoArg[i].mName; ++i)
|
||||
if (universalId==sNoArg[i].mName)
|
||||
{
|
||||
mArgumentType = ArgumentType_None;
|
||||
mType = sNoArg[i].mType;
|
||||
mClass = sNoArg[i].mClass;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw std::runtime_error ("invalid UniversalId: " + universalId);
|
||||
|
|
|
@ -41,7 +41,21 @@ namespace CSMWorld
|
|||
Type_Skills,
|
||||
Type_Skill,
|
||||
Type_Classes,
|
||||
Type_Class
|
||||
Type_Class,
|
||||
Type_Factions,
|
||||
Type_Faction,
|
||||
Type_Races,
|
||||
Type_Race,
|
||||
Type_Sounds,
|
||||
Type_Sound,
|
||||
Type_Scripts,
|
||||
Type_Script,
|
||||
Type_Regions,
|
||||
Type_Region,
|
||||
Type_Birthsigns,
|
||||
Type_Birthsign,
|
||||
Type_Spells,
|
||||
Type_Spell
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -41,6 +41,10 @@ void CSVDoc::View::setupFileMenu()
|
|||
connect (mSave, SIGNAL (triggered()), this, SLOT (save()));
|
||||
file->addAction (mSave);
|
||||
|
||||
mVerify = new QAction (tr ("&Verify"), this);
|
||||
connect (mVerify, SIGNAL (triggered()), this, SLOT (verify()));
|
||||
file->addAction (mVerify);
|
||||
|
||||
QAction *close = new QAction (tr ("&Close"), this);
|
||||
connect (close, SIGNAL (triggered()), this, SLOT (close()));
|
||||
file->addAction(close);
|
||||
|
@ -94,9 +98,33 @@ void CSVDoc::View::setupWorldMenu()
|
|||
connect (classes, SIGNAL (triggered()), this, SLOT (addClassesSubView()));
|
||||
world->addAction (classes);
|
||||
|
||||
mVerify = new QAction (tr ("&Verify"), this);
|
||||
connect (mVerify, SIGNAL (triggered()), this, SLOT (verify()));
|
||||
world->addAction (mVerify);
|
||||
QAction *factions = new QAction (tr ("Factions"), this);
|
||||
connect (factions, SIGNAL (triggered()), this, SLOT (addFactionsSubView()));
|
||||
world->addAction (factions);
|
||||
|
||||
QAction *races = new QAction (tr ("Races"), this);
|
||||
connect (races, SIGNAL (triggered()), this, SLOT (addRacesSubView()));
|
||||
world->addAction (races);
|
||||
|
||||
QAction *sounds = new QAction (tr ("Sounds"), this);
|
||||
connect (sounds, SIGNAL (triggered()), this, SLOT (addSoundsSubView()));
|
||||
world->addAction (sounds);
|
||||
|
||||
QAction *scripts = new QAction (tr ("Scripts"), this);
|
||||
connect (scripts, SIGNAL (triggered()), this, SLOT (addScriptsSubView()));
|
||||
world->addAction (scripts);
|
||||
|
||||
QAction *regions = new QAction (tr ("Regions"), this);
|
||||
connect (regions, SIGNAL (triggered()), this, SLOT (addRegionsSubView()));
|
||||
world->addAction (regions);
|
||||
|
||||
QAction *birthsigns = new QAction (tr ("Birthsigns"), this);
|
||||
connect (birthsigns, SIGNAL (triggered()), this, SLOT (addBirthsignsSubView()));
|
||||
world->addAction (birthsigns);
|
||||
|
||||
QAction *spells = new QAction (tr ("Spells"), this);
|
||||
connect (spells, SIGNAL (triggered()), this, SLOT (addSpellsSubView()));
|
||||
world->addAction (spells);
|
||||
}
|
||||
|
||||
void CSVDoc::View::setupUi()
|
||||
|
@ -262,6 +290,41 @@ void CSVDoc::View::addClassesSubView()
|
|||
addSubView (CSMWorld::UniversalId::Type_Classes);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addFactionsSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_Factions);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addRacesSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_Races);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addSoundsSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_Sounds);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addScriptsSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_Scripts);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addRegionsSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_Regions);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addBirthsignsSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_Birthsigns);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addSpellsSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_Spells);
|
||||
}
|
||||
|
||||
void CSVDoc::View::abortOperation (int type)
|
||||
{
|
||||
mDocument->abortOperation (type);
|
||||
|
|
|
@ -119,6 +119,20 @@ namespace CSVDoc
|
|||
void addSkillsSubView();
|
||||
|
||||
void addClassesSubView();
|
||||
|
||||
void addFactionsSubView();
|
||||
|
||||
void addRacesSubView();
|
||||
|
||||
void addSoundsSubView();
|
||||
|
||||
void addScriptsSubView();
|
||||
|
||||
void addRegionsSubView();
|
||||
|
||||
void addBirthsignsSubView();
|
||||
|
||||
void addSpellsSubView();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,11 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
|
|||
"Luck", 0
|
||||
};
|
||||
|
||||
static const char *sSpellTypes[] =
|
||||
{
|
||||
"Spell", "Ability", "Blight", "Disease", "Curse", "Power", 0
|
||||
};
|
||||
|
||||
mDelegateFactories = new CSVWorld::CommandDelegateFactoryCollection;
|
||||
|
||||
mDelegateFactories->add (CSMWorld::ColumnBase::Display_GmstVarType,
|
||||
|
@ -61,7 +66,10 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
|
|||
new CSVWorld::EnumDelegateFactory (sSpecialisations));
|
||||
|
||||
mDelegateFactories->add (CSMWorld::ColumnBase::Display_Attribute,
|
||||
new CSVWorld::EnumDelegateFactory (sAttributes));
|
||||
new CSVWorld::EnumDelegateFactory (sAttributes, true));
|
||||
|
||||
mDelegateFactories->add (CSMWorld::ColumnBase::Display_SpellType,
|
||||
new CSVWorld::EnumDelegateFactory (sSpellTypes));
|
||||
}
|
||||
|
||||
CSVDoc::ViewManager::~ViewManager()
|
||||
|
|
|
@ -92,10 +92,13 @@ void CSVWorld::EnumDelegate::paint (QPainter *painter, const QStyleOptionViewIte
|
|||
|
||||
CSVWorld::EnumDelegateFactory::EnumDelegateFactory() {}
|
||||
|
||||
CSVWorld::EnumDelegateFactory::EnumDelegateFactory (const char **names)
|
||||
CSVWorld::EnumDelegateFactory::EnumDelegateFactory (const char **names, bool allowNone)
|
||||
{
|
||||
assert (names);
|
||||
|
||||
if (allowNone)
|
||||
add (-1, "");
|
||||
|
||||
for (int i=0; names[i]; ++i)
|
||||
add (i, names[i]);
|
||||
}
|
||||
|
|
|
@ -47,8 +47,9 @@ namespace CSVWorld
|
|||
|
||||
EnumDelegateFactory();
|
||||
|
||||
EnumDelegateFactory (const char **names);
|
||||
EnumDelegateFactory (const char **names, bool allowNone = false);
|
||||
///< \param names Array of char pointer with a 0-pointer as end mark
|
||||
/// \param allowNone Use value of -1 for "none selected" (empty string)
|
||||
|
||||
virtual CommandDelegate *makeDelegate (QUndoStack& undoStack, QObject *parent) const;
|
||||
///< The ownership of the returned CommandDelegate is transferred to the caller.
|
||||
|
|
118
apps/opencs/view/world/scripthighlighter.cpp
Normal file
118
apps/opencs/view/world/scripthighlighter.cpp
Normal file
|
@ -0,0 +1,118 @@
|
|||
|
||||
#include "scripthighlighter.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <components/compiler/scanner.hpp>
|
||||
|
||||
bool CSVWorld::ScriptHighlighter::parseInt (int value, const Compiler::TokenLoc& loc,
|
||||
Compiler::Scanner& scanner)
|
||||
{
|
||||
highlight (loc, Type_Int);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSVWorld::ScriptHighlighter::parseFloat (float value, const Compiler::TokenLoc& loc,
|
||||
Compiler::Scanner& scanner)
|
||||
{
|
||||
highlight (loc, Type_Float);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSVWorld::ScriptHighlighter::parseName (const std::string& name, const Compiler::TokenLoc& loc,
|
||||
Compiler::Scanner& scanner)
|
||||
{
|
||||
highlight (loc, Type_Name);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSVWorld::ScriptHighlighter::parseKeyword (int keyword, const Compiler::TokenLoc& loc,
|
||||
Compiler::Scanner& scanner)
|
||||
{
|
||||
highlight (loc, Type_Keyword);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSVWorld::ScriptHighlighter::parseSpecial (int code, const Compiler::TokenLoc& loc,
|
||||
Compiler::Scanner& scanner)
|
||||
{
|
||||
highlight (loc, Type_Special);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSVWorld::ScriptHighlighter::parseComment (const std::string& comment,
|
||||
const Compiler::TokenLoc& loc, Compiler::Scanner& scanner)
|
||||
{
|
||||
highlight (loc, Type_Comment);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSVWorld::ScriptHighlighter::parseEOF (Compiler::Scanner& scanner)
|
||||
{}
|
||||
|
||||
void CSVWorld::ScriptHighlighter::highlight (const Compiler::TokenLoc& loc, Type type)
|
||||
{
|
||||
int length = static_cast<int> (loc.mLiteral.size());
|
||||
|
||||
int index = loc.mColumn;
|
||||
|
||||
// compensate for bug in Compiler::Scanner (position of token is the character after the token)
|
||||
index -= length;
|
||||
|
||||
setFormat (index, length, mScheme[type]);
|
||||
}
|
||||
|
||||
CSVWorld::ScriptHighlighter::ScriptHighlighter (QTextDocument *parent)
|
||||
: QSyntaxHighlighter (parent), Compiler::Parser (mErrorHandler, mContext)
|
||||
{
|
||||
/// \ŧodo replace this with user settings
|
||||
{
|
||||
QTextCharFormat format;
|
||||
format.setForeground (Qt::darkMagenta);
|
||||
mScheme.insert (std::make_pair (Type_Int, format));
|
||||
}
|
||||
|
||||
{
|
||||
QTextCharFormat format;
|
||||
format.setForeground (Qt::magenta);
|
||||
mScheme.insert (std::make_pair (Type_Float, format));
|
||||
}
|
||||
|
||||
{
|
||||
QTextCharFormat format;
|
||||
format.setForeground (Qt::gray);
|
||||
mScheme.insert (std::make_pair (Type_Name, format));
|
||||
}
|
||||
|
||||
{
|
||||
QTextCharFormat format;
|
||||
format.setForeground (Qt::red);
|
||||
mScheme.insert (std::make_pair (Type_Keyword, format));
|
||||
}
|
||||
|
||||
{
|
||||
QTextCharFormat format;
|
||||
format.setForeground (Qt::darkYellow);
|
||||
mScheme.insert (std::make_pair (Type_Special, format));
|
||||
}
|
||||
|
||||
{
|
||||
QTextCharFormat format;
|
||||
format.setForeground (Qt::green);
|
||||
mScheme.insert (std::make_pair (Type_Comment, format));
|
||||
}
|
||||
}
|
||||
|
||||
void CSVWorld::ScriptHighlighter::highlightBlock (const QString& text)
|
||||
{
|
||||
std::istringstream stream (text.toUtf8().constData());
|
||||
|
||||
Compiler::Scanner scanner (mErrorHandler, stream, mContext.getExtensions());
|
||||
|
||||
try
|
||||
{
|
||||
scanner.scan (*this);
|
||||
}
|
||||
catch (...) {} // ignore syntax errors
|
||||
|
||||
}
|
80
apps/opencs/view/world/scripthighlighter.hpp
Normal file
80
apps/opencs/view/world/scripthighlighter.hpp
Normal file
|
@ -0,0 +1,80 @@
|
|||
#ifndef CSV_WORLD_SCRIPTHIGHLIGHTER_H
|
||||
#define CSV_WORLD_SCRIPTHIGHLIGHTER_H
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <QSyntaxHighlighter>
|
||||
|
||||
#include <components/compiler/nullerrorhandler.hpp>
|
||||
#include <components/compiler/parser.hpp>
|
||||
|
||||
#include "../../model/world/scriptcontext.hpp"
|
||||
|
||||
namespace CSVWorld
|
||||
{
|
||||
class ScriptHighlighter : public QSyntaxHighlighter, private Compiler::Parser
|
||||
{
|
||||
public:
|
||||
|
||||
enum Type
|
||||
{
|
||||
Type_Int,
|
||||
Type_Float,
|
||||
Type_Name,
|
||||
Type_Keyword,
|
||||
Type_Special,
|
||||
Type_Comment
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Compiler::NullErrorHandler mErrorHandler;
|
||||
CSMWorld::ScriptContext mContext;
|
||||
std::map<Type, QTextCharFormat> mScheme;
|
||||
|
||||
private:
|
||||
|
||||
virtual bool parseInt (int value, const Compiler::TokenLoc& loc,
|
||||
Compiler::Scanner& scanner);
|
||||
///< Handle an int token.
|
||||
/// \return fetch another token?
|
||||
|
||||
virtual bool parseFloat (float value, const Compiler::TokenLoc& loc,
|
||||
Compiler::Scanner& scanner);
|
||||
///< Handle a float token.
|
||||
/// \return fetch another token?
|
||||
|
||||
virtual bool parseName (const std::string& name,
|
||||
const Compiler::TokenLoc& loc, Compiler::Scanner& scanner);
|
||||
///< Handle a name token.
|
||||
/// \return fetch another token?
|
||||
|
||||
virtual bool parseKeyword (int keyword, const Compiler::TokenLoc& loc,
|
||||
Compiler::Scanner& scanner);
|
||||
///< Handle a keyword token.
|
||||
/// \return fetch another token?
|
||||
|
||||
virtual bool parseSpecial (int code, const Compiler::TokenLoc& loc,
|
||||
Compiler::Scanner& scanner);
|
||||
///< Handle a special character token.
|
||||
/// \return fetch another token?
|
||||
|
||||
virtual bool parseComment (const std::string& comment, const Compiler::TokenLoc& loc,
|
||||
Compiler::Scanner& scanner);
|
||||
///< Handle comment token.
|
||||
/// \return fetch another token?
|
||||
|
||||
virtual void parseEOF (Compiler::Scanner& scanner);
|
||||
///< Handle EOF token.
|
||||
|
||||
void highlight (const Compiler::TokenLoc& loc, Type type);
|
||||
|
||||
public:
|
||||
|
||||
ScriptHighlighter (QTextDocument *parent);
|
||||
|
||||
virtual void highlightBlock (const QString& text);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
99
apps/opencs/view/world/scriptsubview.cpp
Normal file
99
apps/opencs/view/world/scriptsubview.cpp
Normal file
|
@ -0,0 +1,99 @@
|
|||
|
||||
#include "scriptsubview.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <QTextEdit>
|
||||
|
||||
#include "../../model/doc/document.hpp"
|
||||
#include "../../model/world/universalid.hpp"
|
||||
#include "../../model/world/data.hpp"
|
||||
#include "../../model/world/columnbase.hpp"
|
||||
#include "../../model/world/commands.hpp"
|
||||
#include "../../model/world/idtable.hpp"
|
||||
|
||||
#include "scripthighlighter.hpp"
|
||||
|
||||
CSVWorld::ScriptSubView::ChangeLock::ChangeLock (ScriptSubView& view) : mView (view)
|
||||
{
|
||||
++mView.mChangeLocked;
|
||||
}
|
||||
|
||||
CSVWorld::ScriptSubView::ChangeLock::~ChangeLock()
|
||||
{
|
||||
--mView.mChangeLocked;
|
||||
}
|
||||
|
||||
CSVWorld::ScriptSubView::ScriptSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
||||
: SubView (id), mDocument (document), mColumn (-1), mChangeLocked (0)
|
||||
{
|
||||
setWidget (mEditor = new QTextEdit (this));
|
||||
|
||||
mEditor->setAcceptRichText (false);
|
||||
mEditor->setLineWrapMode (QTextEdit::NoWrap);
|
||||
mEditor->setTabStopWidth (4);
|
||||
mEditor->setUndoRedoEnabled (false); // we use OpenCS-wide undo/redo instead
|
||||
|
||||
mModel = &dynamic_cast<CSMWorld::IdTable&> (
|
||||
*document.getData().getTableModel (CSMWorld::UniversalId::Type_Scripts));
|
||||
|
||||
for (int i=0; i<mModel->columnCount(); ++i)
|
||||
if (mModel->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display)==
|
||||
CSMWorld::ColumnBase::Display_Script)
|
||||
{
|
||||
mColumn = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mColumn==-1)
|
||||
throw std::logic_error ("Can't find script column");
|
||||
|
||||
mEditor->setPlainText (mModel->data (mModel->getModelIndex (id.getId(), mColumn)).toString());
|
||||
|
||||
connect (mEditor, SIGNAL (textChanged()), this, SLOT (textChanged()));
|
||||
|
||||
connect (mModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
||||
this, SLOT (dataChanged (const QModelIndex&, const QModelIndex&)));
|
||||
|
||||
connect (mModel, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)),
|
||||
this, SLOT (rowsAboutToBeRemoved (const QModelIndex&, int, int)));
|
||||
|
||||
new ScriptHighlighter (mEditor->document());
|
||||
}
|
||||
|
||||
void CSVWorld::ScriptSubView::setEditLock (bool locked)
|
||||
{
|
||||
mEditor->setReadOnly (locked);
|
||||
}
|
||||
|
||||
void CSVWorld::ScriptSubView::textChanged()
|
||||
{
|
||||
ChangeLock lock (*this);
|
||||
|
||||
mDocument.getUndoStack().push (new CSMWorld::ModifyCommand (*mModel,
|
||||
mModel->getModelIndex (getUniversalId().getId(), mColumn), mEditor->toPlainText()));
|
||||
}
|
||||
|
||||
void CSVWorld::ScriptSubView::dataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight)
|
||||
{
|
||||
if (mChangeLocked)
|
||||
return;
|
||||
|
||||
QModelIndex index = mModel->getModelIndex (getUniversalId().getId(), mColumn);
|
||||
|
||||
if (index.row()>=topLeft.row() && index.row()<=bottomRight.row() &&
|
||||
index.column()>=topLeft.column() && index.column()<=bottomRight.column())
|
||||
{
|
||||
QTextCursor cursor = mEditor->textCursor();
|
||||
mEditor->setPlainText (mModel->data (index).toString());
|
||||
mEditor->setTextCursor (cursor);
|
||||
}
|
||||
}
|
||||
|
||||
void CSVWorld::ScriptSubView::rowsAboutToBeRemoved (const QModelIndex& parent, int start, int end)
|
||||
{
|
||||
QModelIndex index = mModel->getModelIndex (getUniversalId().getId(), mColumn);
|
||||
|
||||
if (!parent.isValid() && index.row()>=start && index.row()<=end)
|
||||
deleteLater();
|
||||
}
|
62
apps/opencs/view/world/scriptsubview.hpp
Normal file
62
apps/opencs/view/world/scriptsubview.hpp
Normal file
|
@ -0,0 +1,62 @@
|
|||
#ifndef CSV_WORLD_SCRIPTSUBVIEW_H
|
||||
#define CSV_WORLD_SCRIPTSUBVIEW_H
|
||||
|
||||
#include "../doc/subview.hpp"
|
||||
|
||||
class QTextEdit;
|
||||
class QModelIndex;
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
class Document;
|
||||
}
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
class IdTable;
|
||||
}
|
||||
|
||||
namespace CSVWorld
|
||||
{
|
||||
class ScriptSubView : public CSVDoc::SubView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QTextEdit *mEditor;
|
||||
CSMDoc::Document& mDocument;
|
||||
CSMWorld::IdTable *mModel;
|
||||
int mColumn;
|
||||
int mChangeLocked;
|
||||
|
||||
class ChangeLock
|
||||
{
|
||||
ScriptSubView& mView;
|
||||
|
||||
ChangeLock (const ChangeLock&);
|
||||
ChangeLock& operator= (const ChangeLock&);
|
||||
|
||||
public:
|
||||
|
||||
ChangeLock (ScriptSubView& view);
|
||||
~ChangeLock();
|
||||
};
|
||||
|
||||
friend class ChangeLock;
|
||||
|
||||
public:
|
||||
|
||||
ScriptSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document);
|
||||
|
||||
virtual void setEditLock (bool locked);
|
||||
|
||||
private slots:
|
||||
|
||||
void textChanged();
|
||||
|
||||
void dataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
||||
|
||||
void rowsAboutToBeRemoved (const QModelIndex& parent, int start, int end);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -5,20 +5,35 @@
|
|||
|
||||
#include "tablesubview.hpp"
|
||||
#include "dialoguesubview.hpp"
|
||||
#include "scriptsubview.hpp"
|
||||
|
||||
void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
||||
{
|
||||
manager.add (CSMWorld::UniversalId::Type_Globals,
|
||||
new CSVDoc::SubViewFactoryWithCreateFlag<TableSubView> (true));
|
||||
|
||||
manager.add (CSMWorld::UniversalId::Type_Gmsts,
|
||||
new CSVDoc::SubViewFactoryWithCreateFlag<TableSubView> (false));
|
||||
|
||||
manager.add (CSMWorld::UniversalId::Type_Skills,
|
||||
new CSVDoc::SubViewFactoryWithCreateFlag<TableSubView> (false));
|
||||
|
||||
manager.add (CSMWorld::UniversalId::Type_Classes,
|
||||
new CSVDoc::SubViewFactoryWithCreateFlag<TableSubView> (true));
|
||||
static const CSMWorld::UniversalId::Type sTableTypes[] =
|
||||
{
|
||||
CSMWorld::UniversalId::Type_Globals,
|
||||
CSMWorld::UniversalId::Type_Classes,
|
||||
CSMWorld::UniversalId::Type_Factions,
|
||||
CSMWorld::UniversalId::Type_Races,
|
||||
CSMWorld::UniversalId::Type_Sounds,
|
||||
CSMWorld::UniversalId::Type_Scripts,
|
||||
CSMWorld::UniversalId::Type_Regions,
|
||||
CSMWorld::UniversalId::Type_Birthsigns,
|
||||
CSMWorld::UniversalId::Type_Spells,
|
||||
|
||||
CSMWorld::UniversalId::Type_None // end marker
|
||||
};
|
||||
|
||||
for (int i=0; sTableTypes[i]!=CSMWorld::UniversalId::Type_None; ++i)
|
||||
manager.add (sTableTypes[i], new CSVDoc::SubViewFactoryWithCreateFlag<TableSubView> (true));
|
||||
|
||||
manager.add (CSMWorld::UniversalId::Type_Script, new CSVDoc::SubViewFactory<ScriptSubView>);
|
||||
|
||||
// manager.add (CSMWorld::UniversalId::Type_Global,
|
||||
// new CSVDoc::SubViewFactoryWithCreateFlag<DialogueSubView> (true));
|
||||
|
|
|
@ -21,6 +21,5 @@ void CSVWorld::TableSubView::setEditLock (bool locked)
|
|||
|
||||
void CSVWorld::TableSubView::rowActivated (const QModelIndex& index)
|
||||
{
|
||||
/// \todo re-enable, after dialogue sub views have been fixed up
|
||||
// focusId (mTable->getUniversalId (index.row()));
|
||||
focusId (mTable->getUniversalId (index.row()));
|
||||
}
|
|
@ -24,9 +24,9 @@ add_openmw_dir (mwinput
|
|||
)
|
||||
|
||||
add_openmw_dir (mwgui
|
||||
text_input widgets race class birth review windowmanagerimp console dialogue
|
||||
dialogue_history window_base stats_window messagebox journalwindow charactercreation
|
||||
map_window window_pinnable_base tooltips scrollwindow bookwindow list
|
||||
textinput widgets race class birth review windowmanagerimp console dialogue
|
||||
dialoguehistory windowbase statswindow messagebox journalwindow charactercreation
|
||||
mapwindow windowpinnablebase tooltips scrollwindow bookwindow list
|
||||
formatting inventorywindow container hud countdialog tradewindow settingswindow
|
||||
confirmationdialog alchemywindow referenceinterface spellwindow mainmenu quickkeysmenu
|
||||
itemselection spellbuyingwindow loadingscreen levelupdialog waitdialog spellcreationdialog
|
||||
|
@ -54,7 +54,7 @@ add_openmw_dir (mwworld
|
|||
containerstore actiontalk actiontake manualref player cellfunctors failedaction
|
||||
cells localscripts customdata weather inventorystore ptr actionopen actionread
|
||||
actionequip timestamp actionalchemy cellstore actionapply actioneat
|
||||
esmstore store recordcmp fallback actionrepair actionsoulgem
|
||||
esmstore store recordcmp fallback actionrepair actionsoulgem livecellref
|
||||
)
|
||||
|
||||
add_openmw_dir (mwclass
|
||||
|
|
|
@ -66,6 +66,7 @@ bool OMW::Engine::frameStarted (const Ogre::FrameEvent& evt)
|
|||
{
|
||||
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||
MWBase::Environment::get().getWorld()->frameStarted(evt.timeSinceLastFrame);
|
||||
MWBase::Environment::get().getWindowManager ()->frameStarted(evt.timeSinceLastFrame);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -153,28 +154,42 @@ OMW::Engine::~Engine()
|
|||
|
||||
void OMW::Engine::loadBSA()
|
||||
{
|
||||
// We use separate resource groups to handle location priority.
|
||||
const Files::PathContainer& dataDirs = mFileCollections.getPaths();
|
||||
|
||||
int i=0;
|
||||
for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
|
||||
{
|
||||
// Last data dir has the highest priority
|
||||
std::string groupName = "Data" + Ogre::StringConverter::toString(dataDirs.size()-i);
|
||||
Ogre::ResourceGroupManager::getSingleton ().createResourceGroup (groupName);
|
||||
|
||||
std::string dataDirectory = iter->string();
|
||||
std::cout << "Data dir " << dataDirectory << std::endl;
|
||||
Bsa::addDir(dataDirectory, mFSStrict, groupName);
|
||||
++i;
|
||||
}
|
||||
|
||||
i=0;
|
||||
for (std::vector<std::string>::const_iterator archive = mArchives.begin(); archive != mArchives.end(); ++archive)
|
||||
{
|
||||
if (mFileCollections.doesExist(*archive))
|
||||
{
|
||||
// Last BSA has the highest priority
|
||||
std::string groupName = "DataBSA" + Ogre::StringConverter::toString(dataDirs.size()-i);
|
||||
|
||||
Ogre::ResourceGroupManager::getSingleton ().createResourceGroup (groupName);
|
||||
|
||||
const std::string archivePath = mFileCollections.getPath(*archive).string();
|
||||
std::cout << "Adding BSA archive " << archivePath << std::endl;
|
||||
Bsa::addBSA(archivePath);
|
||||
Bsa::addBSA(archivePath, groupName);
|
||||
++i;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Archive " << *archive << " not found" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
const Files::PathContainer& dataDirs = mFileCollections.getPaths();
|
||||
std::string dataDirectory;
|
||||
for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
|
||||
{
|
||||
dataDirectory = iter->string();
|
||||
std::cout << "Data dir " << dataDirectory << std::endl;
|
||||
Bsa::addDir(dataDirectory, mFSStrict);
|
||||
}
|
||||
}
|
||||
|
||||
// add resources directory
|
||||
|
|
|
@ -182,8 +182,8 @@ namespace MWBase
|
|||
virtual void activateQuickKey (int index) = 0;
|
||||
|
||||
virtual void setSelectedSpell(const std::string& spellId, int successChancePercent) = 0;
|
||||
virtual void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent) = 0;
|
||||
virtual void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent) = 0;
|
||||
virtual void setSelectedEnchantItem(const MWWorld::Ptr& item) = 0;
|
||||
virtual void setSelectedWeapon(const MWWorld::Ptr& item) = 0;
|
||||
virtual void unsetSelectedSpell() = 0;
|
||||
virtual void unsetSelectedWeapon() = 0;
|
||||
|
||||
|
@ -246,6 +246,8 @@ namespace MWBase
|
|||
|
||||
virtual void showSoulgemDialog (MWWorld::Ptr item) = 0;
|
||||
|
||||
virtual void frameStarted(float dt) = 0;
|
||||
|
||||
virtual void changePointer (const std::string& name) = 0;
|
||||
|
||||
virtual const Translation::Storage& getTranslationDataStorage() const = 0;
|
||||
|
|
|
@ -216,6 +216,9 @@ namespace MWBase
|
|||
virtual MWWorld::Ptr getFacedObject() = 0;
|
||||
///< Return pointer to the object the player is looking at, if it is within activation range
|
||||
|
||||
virtual void adjustPosition (const MWWorld::Ptr& ptr) = 0;
|
||||
///< Adjust position after load to be on ground. Must be called after model load.
|
||||
|
||||
virtual void deleteObject (const MWWorld::Ptr& ptr) = 0;
|
||||
|
||||
virtual void moveObject (const MWWorld::Ptr& ptr, float x, float y, float z) = 0;
|
||||
|
@ -316,6 +319,7 @@ namespace MWBase
|
|||
virtual void allowVanityMode(bool allow) = 0;
|
||||
virtual void togglePlayerLooking(bool enable) = 0;
|
||||
virtual void changeVanityModeScale(float factor) = 0;
|
||||
virtual bool vanityRotateCamera(float * rot) = 0;
|
||||
|
||||
virtual void renderPlayer() = 0;
|
||||
|
||||
|
|
|
@ -159,4 +159,9 @@ namespace MWClass
|
|||
|
||||
return MWWorld::Ptr(&cell.mAppas.insert(*ref), &cell);
|
||||
}
|
||||
|
||||
bool Apparatus::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Apparatus;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,8 @@ namespace MWClass
|
|||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
#include "../mwworld/nullaction.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
@ -260,6 +262,8 @@ namespace MWClass
|
|||
}
|
||||
|
||||
info.enchant = ref->mBase->mEnchant;
|
||||
if (!info.enchant.empty())
|
||||
info.remainingEnchantCharge = ptr.getCellRef().mEnchantmentCharge;
|
||||
|
||||
info.text = text;
|
||||
|
||||
|
@ -274,7 +278,7 @@ namespace MWClass
|
|||
return ref->mBase->mEnchant;
|
||||
}
|
||||
|
||||
std::string Armor::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
void Armor::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
@ -285,7 +289,77 @@ namespace MWClass
|
|||
newItem.mData.mEnchant=enchCharge;
|
||||
newItem.mEnchant=enchId;
|
||||
const ESM::Armor *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
||||
return record->mId;
|
||||
ref->mBase = record;
|
||||
}
|
||||
|
||||
int Armor::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
||||
{
|
||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(npc).getInventoryStore(npc);
|
||||
|
||||
// slots that this item can be equipped in
|
||||
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
|
||||
|
||||
std::string npcRace = npc.get<ESM::NPC>()->mBase->mRace;
|
||||
|
||||
for (std::vector<int>::const_iterator slot=slots.first.begin();
|
||||
slot!=slots.first.end(); ++slot)
|
||||
{
|
||||
|
||||
// Beast races cannot equip shoes / boots, or full helms (head part vs hair part)
|
||||
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npcRace);
|
||||
if(race->mData.mFlags & ESM::Race::Beast)
|
||||
{
|
||||
std::vector<ESM::PartReference> parts = ptr.get<ESM::Armor>()->mBase->mParts.mParts;
|
||||
|
||||
if(*slot == MWWorld::InventoryStore::Slot_Helmet)
|
||||
{
|
||||
for(std::vector<ESM::PartReference>::iterator itr = parts.begin(); itr != parts.end(); ++itr)
|
||||
{
|
||||
if((*itr).mPart == ESM::PRT_Head)
|
||||
{
|
||||
if(npc == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() )
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage13}");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*slot == MWWorld::InventoryStore::Slot_Boots)
|
||||
{
|
||||
for(std::vector<ESM::PartReference>::iterator itr = parts.begin(); itr != parts.end(); ++itr)
|
||||
{
|
||||
if((*itr).mPart == ESM::PRT_LFoot || (*itr).mPart == ESM::PRT_RFoot)
|
||||
{
|
||||
if(npc == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() )
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage14}");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(*slot == MWWorld::InventoryStore::Slot_CarriedLeft)
|
||||
{
|
||||
MWWorld::ContainerStoreIterator weapon = invStore.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||
|
||||
if(weapon == invStore.end())
|
||||
return 1;
|
||||
|
||||
if(weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::LongBladeTwoHand ||
|
||||
weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoClose ||
|
||||
weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoWide ||
|
||||
weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::SpearTwoWide ||
|
||||
weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::AxeTwoHand ||
|
||||
weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanBow ||
|
||||
weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanCrossbow)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Armor::use (const MWWorld::Ptr& ptr) const
|
||||
|
@ -313,4 +387,9 @@ namespace MWClass
|
|||
|
||||
return ref->mBase->mData.mEnchant;
|
||||
}
|
||||
|
||||
bool Armor::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Armor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,10 @@ namespace MWClass
|
|||
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||
|
||||
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
|
||||
virtual int canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const;
|
||||
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
||||
|
||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
|
@ -74,6 +77,8 @@ namespace MWClass
|
|||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual short getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ namespace MWClass
|
|||
return ref->mBase->mEnchant;
|
||||
}
|
||||
|
||||
std::string Book::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
void Book::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
@ -159,7 +159,7 @@ namespace MWClass
|
|||
newItem.mData.mEnchant=enchCharge;
|
||||
newItem.mEnchant=enchId;
|
||||
const ESM::Book *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
||||
return record->mId;
|
||||
ref->mBase = record;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Book::use (const MWWorld::Ptr& ptr) const
|
||||
|
@ -183,4 +183,9 @@ namespace MWClass
|
|||
|
||||
return ref->mBase->mData.mEnchant;
|
||||
}
|
||||
|
||||
bool Book::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Books;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace MWClass
|
|||
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||
|
||||
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
|
||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
@ -59,6 +59,8 @@ namespace MWClass
|
|||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual short getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
#include "../mwworld/nullaction.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
|
@ -207,6 +208,8 @@ namespace MWClass
|
|||
}
|
||||
|
||||
info.enchant = ref->mBase->mEnchant;
|
||||
if (!info.enchant.empty())
|
||||
info.remainingEnchantCharge = ptr.getCellRef().mEnchantmentCharge;
|
||||
|
||||
info.text = text;
|
||||
|
||||
|
@ -221,7 +224,7 @@ namespace MWClass
|
|||
return ref->mBase->mEnchant;
|
||||
}
|
||||
|
||||
std::string Clothing::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
void Clothing::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
@ -232,7 +235,58 @@ namespace MWClass
|
|||
newItem.mData.mEnchant=enchCharge;
|
||||
newItem.mEnchant=enchId;
|
||||
const ESM::Clothing *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
||||
return record->mId;
|
||||
ref->mBase = record;
|
||||
}
|
||||
|
||||
int Clothing::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
||||
{
|
||||
// slots that this item can be equipped in
|
||||
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
|
||||
|
||||
std::string npcRace = npc.get<ESM::NPC>()->mBase->mRace;
|
||||
|
||||
for (std::vector<int>::const_iterator slot=slots.first.begin();
|
||||
slot!=slots.first.end(); ++slot)
|
||||
{
|
||||
|
||||
// Beast races cannot equip shoes / boots, or full helms (head part vs hair part)
|
||||
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npcRace);
|
||||
if(race->mData.mFlags & ESM::Race::Beast)
|
||||
{
|
||||
std::vector<ESM::PartReference> parts = ptr.get<ESM::Clothing>()->mBase->mParts.mParts;
|
||||
|
||||
if(*slot == MWWorld::InventoryStore::Slot_Helmet)
|
||||
{
|
||||
for(std::vector<ESM::PartReference>::iterator itr = parts.begin(); itr != parts.end(); ++itr)
|
||||
{
|
||||
if((*itr).mPart == ESM::PRT_Head)
|
||||
{
|
||||
if(npc == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() )
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage13}");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*slot == MWWorld::InventoryStore::Slot_Boots)
|
||||
{
|
||||
for(std::vector<ESM::PartReference>::iterator itr = parts.begin(); itr != parts.end(); ++itr)
|
||||
{
|
||||
if((*itr).mPart == ESM::PRT_LFoot || (*itr).mPart == ESM::PRT_RFoot)
|
||||
{
|
||||
if(npc == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() )
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage15}");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Clothing::use (const MWWorld::Ptr& ptr) const
|
||||
|
@ -260,4 +314,9 @@ namespace MWClass
|
|||
|
||||
return ref->mBase->mData.mEnchant;
|
||||
}
|
||||
|
||||
bool Clothing::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Clothing;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,10 @@ namespace MWClass
|
|||
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||
|
||||
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
|
||||
virtual int canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const;
|
||||
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
||||
|
||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
|
@ -68,6 +71,8 @@ namespace MWClass
|
|||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual short getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontalk.hpp"
|
||||
|
@ -86,6 +87,11 @@ namespace MWClass
|
|||
return ref->mBase->mId;
|
||||
}
|
||||
|
||||
void Creature::adjustPosition(const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->adjustPosition(ptr);
|
||||
}
|
||||
|
||||
void Creature::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWRender::Actors& actors = renderingInterface.getActors();
|
||||
|
|
|
@ -22,6 +22,8 @@ namespace MWClass
|
|||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
|
||||
virtual void adjustPosition(const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
|
|
|
@ -197,4 +197,9 @@ namespace MWClass
|
|||
|
||||
return MWWorld::Ptr(&cell.mIngreds.insert(*ref), &cell);
|
||||
}
|
||||
|
||||
bool Ingredient::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Ingredients;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,8 @@ namespace MWClass
|
|||
///< Return name of inventory icon.
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -203,4 +203,9 @@ namespace MWClass
|
|||
|
||||
return MWWorld::Ptr(&cell.mLights.insert(*ref), &cell);
|
||||
}
|
||||
|
||||
bool Light::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Lights;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,8 @@ namespace MWClass
|
|||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -176,4 +176,9 @@ namespace MWClass
|
|||
|
||||
return MWWorld::Ptr(&cell.mLockpicks.insert(*ref), &cell);
|
||||
}
|
||||
|
||||
bool Lockpick::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Picks;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,8 @@ namespace MWClass
|
|||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -246,4 +246,12 @@ namespace MWClass
|
|||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionSoulgem(ptr));
|
||||
}
|
||||
|
||||
bool Miscellaneous::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
item.get<ESM::Miscellaneous>();
|
||||
|
||||
return !ref->mBase->mData.mIsKey && (npcServices & ESM::NPC::Misc);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,6 +53,8 @@ namespace MWClass
|
|||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -160,6 +160,11 @@ namespace MWClass
|
|||
return ref->mBase->mId;
|
||||
}
|
||||
|
||||
void Npc::adjustPosition(const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->adjustPosition(ptr);
|
||||
}
|
||||
|
||||
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
renderingInterface.getActors().insertNPC(ptr, getInventoryStore(ptr));
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace MWClass
|
|||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
|
||||
virtual void adjustPosition(const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
|
|
|
@ -194,4 +194,9 @@ namespace MWClass
|
|||
|
||||
return MWWorld::Ptr(&cell.mPotions.insert(*ref), &cell);
|
||||
}
|
||||
|
||||
bool Potion::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Potions;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,8 @@ namespace MWClass
|
|||
///< Return name of inventory icon.
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -175,4 +175,9 @@ namespace MWClass
|
|||
|
||||
return MWWorld::Ptr(&cell.mProbes.insert(*ref), &cell);
|
||||
}
|
||||
|
||||
bool Probe::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Probes;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,8 @@ namespace MWClass
|
|||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -175,4 +175,9 @@ namespace MWClass
|
|||
{
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionRepair(ptr));
|
||||
}
|
||||
|
||||
bool Repair::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::RepairItem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,8 @@ namespace MWClass
|
|||
virtual int getItemMaxHealth (const MWWorld::Ptr& ptr) const;
|
||||
///< Return item max health or throw an exception, if class does not have item health
|
||||
/// (default implementation: throw an exceoption)
|
||||
|
||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -349,6 +349,9 @@ namespace MWClass
|
|||
|
||||
info.enchant = ref->mBase->mEnchant;
|
||||
|
||||
if (!info.enchant.empty())
|
||||
info.remainingEnchantCharge = ptr.getCellRef().mEnchantmentCharge;
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
|
@ -367,7 +370,7 @@ namespace MWClass
|
|||
return ref->mBase->mEnchant;
|
||||
}
|
||||
|
||||
std::string Weapon::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
void Weapon::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
@ -378,7 +381,33 @@ namespace MWClass
|
|||
newItem.mData.mEnchant=enchCharge;
|
||||
newItem.mEnchant=enchId;
|
||||
const ESM::Weapon *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
||||
return record->mId;
|
||||
ref->mBase = record;
|
||||
}
|
||||
|
||||
int Weapon::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
|
||||
{
|
||||
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
|
||||
|
||||
// equip the item in the first free slot
|
||||
for (std::vector<int>::const_iterator slot=slots.first.begin();
|
||||
slot!=slots.first.end(); ++slot)
|
||||
{
|
||||
if(*slot == MWWorld::InventoryStore::Slot_CarriedRight)
|
||||
{
|
||||
if(ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::LongBladeTwoHand ||
|
||||
ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoClose ||
|
||||
ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoWide ||
|
||||
ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::SpearTwoWide ||
|
||||
ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::AxeTwoHand ||
|
||||
ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanBow ||
|
||||
ptr.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanCrossbow)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Weapon::use (const MWWorld::Ptr& ptr) const
|
||||
|
@ -406,4 +435,9 @@ namespace MWClass
|
|||
|
||||
return ref->mBase->mData.mEnchant;
|
||||
}
|
||||
|
||||
bool Weapon::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Weapon;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,10 @@ namespace MWClass
|
|||
virtual std::string getEnchantment (const MWWorld::Ptr& ptr) const;
|
||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||
|
||||
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
virtual void applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
|
||||
|
||||
virtual int canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const;
|
||||
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
||||
|
||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
|
@ -73,6 +76,8 @@ namespace MWClass
|
|||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||
|
||||
virtual short getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -569,8 +569,8 @@ bool MWDialogue::Filter::hasFactionRankSkillRequirements (const MWWorld::Ptr& ac
|
|||
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get (actor).getCreatureStats (actor);
|
||||
|
||||
return stats.getAttribute (faction.mData.mAttribute1).getBase()>=faction.mData.mRankData[rank].mAttribute1 &&
|
||||
stats.getAttribute (faction.mData.mAttribute2).getBase()>=faction.mData.mRankData[rank].mAttribute2;
|
||||
return stats.getAttribute (faction.mData.mAttribute[0]).getBase()>=faction.mData.mRankData[rank].mAttribute1 &&
|
||||
stats.getAttribute (faction.mData.mAttribute[1]).getBase()>=faction.mData.mRankData[rank].mAttribute2;
|
||||
}
|
||||
|
||||
bool MWDialogue::Filter::hasFactionRankReputationRequirements (const MWWorld::Ptr& actor,
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
AlchemyWindow::AlchemyWindow(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_alchemy_window.layout", parWindowManager)
|
||||
AlchemyWindow::AlchemyWindow()
|
||||
: WindowBase("openmw_alchemy_window.layout")
|
||||
, ContainerBase(0), mApparatus (4), mIngredients (4)
|
||||
{
|
||||
getWidget(mCreateButton, "CreateButton");
|
||||
|
@ -64,8 +64,8 @@ namespace MWGui
|
|||
{
|
||||
mAlchemy.clear();
|
||||
|
||||
mWindowManager.removeGuiMode(GM_Alchemy);
|
||||
mWindowManager.removeGuiMode(GM_Inventory);
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Alchemy);
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Inventory);
|
||||
}
|
||||
|
||||
void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender)
|
||||
|
@ -77,40 +77,40 @@ namespace MWGui
|
|||
|
||||
if (result == MWMechanics::Alchemy::Result_NoName)
|
||||
{
|
||||
mWindowManager.messageBox("#{sNotifyMessage37}");
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage37}");
|
||||
return;
|
||||
}
|
||||
|
||||
// check if mortar & pestle is available (always needed)
|
||||
if (result == MWMechanics::Alchemy::Result_NoMortarAndPestle)
|
||||
{
|
||||
mWindowManager.messageBox("#{sNotifyMessage45}");
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage45}");
|
||||
return;
|
||||
}
|
||||
|
||||
// make sure 2 or more ingredients were selected
|
||||
if (result == MWMechanics::Alchemy::Result_LessThanTwoIngredients)
|
||||
{
|
||||
mWindowManager.messageBox("#{sNotifyMessage6a}");
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage6a}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (result == MWMechanics::Alchemy::Result_NoEffects)
|
||||
{
|
||||
mWindowManager.messageBox("#{sNotifyMessage8}");
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage8}");
|
||||
MWBase::Environment::get().getSoundManager()->playSound("potion fail", 1.f, 1.f);
|
||||
return;
|
||||
}
|
||||
|
||||
if (result == MWMechanics::Alchemy::Result_Success)
|
||||
{
|
||||
mWindowManager.messageBox("#{sPotionSuccess}");
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sPotionSuccess}");
|
||||
MWBase::Environment::get().getSoundManager()->playSound("potion success", 1.f, 1.f);
|
||||
}
|
||||
else if (result == MWMechanics::Alchemy::Result_RandomFailure)
|
||||
{
|
||||
// potion failed
|
||||
mWindowManager.messageBox("#{sNotifyMessage8}");
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage8}");
|
||||
MWBase::Environment::get().getSoundManager()->playSound("potion fail", 1.f, 1.f);
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,6 @@ namespace MWGui
|
|||
MyGUI::IntCoord coord(0, 0, mEffectsBox->getWidth(), 24);
|
||||
Widgets::MWEffectListPtr effectsWidget = mEffectsBox->createWidget<Widgets::MWEffectList>
|
||||
("MW_StatName", coord, MyGUI::Align::Left | MyGUI::Align::Top);
|
||||
effectsWidget->setWindowManager(&mWindowManager);
|
||||
|
||||
Widgets::SpellEffectList _list = Widgets::MWEffectList::effectListFromESM(&list);
|
||||
effectsWidget->setEffectList(_list);
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
|
||||
#include "../mwmechanics/alchemy.hpp"
|
||||
|
||||
#include "window_base.hpp"
|
||||
#include "container.hpp"
|
||||
#include "widgets.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
class AlchemyWindow : public WindowBase, public ContainerBase
|
||||
{
|
||||
public:
|
||||
AlchemyWindow(MWBase::WindowManager& parWindowManager);
|
||||
AlchemyWindow();
|
||||
|
||||
virtual void open();
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace MWGui
|
|||
virtual void onReferenceUnavailable() { ; }
|
||||
|
||||
void update();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
MWMechanics::Alchemy mAlchemy;
|
||||
|
|
|
@ -24,8 +24,8 @@ bool sortBirthSigns(const std::pair<std::string, const ESM::BirthSign*>& left, c
|
|||
|
||||
}
|
||||
|
||||
BirthDialog::BirthDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowModal("openmw_chargen_birth.layout", parWindowManager)
|
||||
BirthDialog::BirthDialog()
|
||||
: WindowModal("openmw_chargen_birth.layout")
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
@ -46,7 +46,7 @@ BirthDialog::BirthDialog(MWBase::WindowManager& parWindowManager)
|
|||
|
||||
MyGUI::Button* okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
||||
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
|
||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onOkClicked);
|
||||
|
||||
updateBirths();
|
||||
|
@ -59,9 +59,9 @@ void BirthDialog::setNextButtonShow(bool shown)
|
|||
getWidget(okButton, "OKButton");
|
||||
|
||||
if (shown)
|
||||
okButton->setCaption(mWindowManager.getGameSettingString("sNext", ""));
|
||||
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", ""));
|
||||
else
|
||||
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
||||
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
|
||||
}
|
||||
|
||||
void BirthDialog::open()
|
||||
|
@ -221,7 +221,7 @@ void BirthDialog::updateSpells()
|
|||
if (!categories[category].spells.empty())
|
||||
{
|
||||
MyGUI::TextBox* label = mSpellArea->createWidget<MyGUI::TextBox>("SandBrightText", coord, MyGUI::Align::Default, std::string("Label"));
|
||||
label->setCaption(mWindowManager.getGameSettingString(categories[category].label, ""));
|
||||
label->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString(categories[category].label, ""));
|
||||
mSpellItems.push_back(label);
|
||||
coord.top += lineHeight;
|
||||
|
||||
|
@ -230,7 +230,6 @@ void BirthDialog::updateSpells()
|
|||
{
|
||||
const std::string &spellId = *it;
|
||||
spellWidget = mSpellArea->createWidget<MWSpell>("MW_StatName", coord, MyGUI::Align::Default, std::string("Spell") + boost::lexical_cast<std::string>(i));
|
||||
spellWidget->setWindowManager(&mWindowManager);
|
||||
spellWidget->setSpellId(spellId);
|
||||
|
||||
mSpellItems.push_back(spellWidget);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef MWGUI_BIRTH_H
|
||||
#define MWGUI_BIRTH_H
|
||||
|
||||
#include "window_base.hpp"
|
||||
#include "windowbase.hpp"
|
||||
|
||||
/*
|
||||
This file contains the dialog for choosing a birth sign.
|
||||
|
@ -13,7 +13,7 @@ namespace MWGui
|
|||
class BirthDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
BirthDialog(MWBase::WindowManager& parWindowManager);
|
||||
BirthDialog();
|
||||
|
||||
enum Gender
|
||||
{
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
using namespace MWGui;
|
||||
|
||||
BookWindow::BookWindow (MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_book.layout", parWindowManager)
|
||||
BookWindow::BookWindow ()
|
||||
: WindowBase("openmw_book.layout")
|
||||
, mTakeButtonShow(true)
|
||||
, mTakeButtonAllowed(true)
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ void BookWindow::onCloseButtonClicked (MyGUI::Widget* sender)
|
|||
// no 3d sounds because the object could be in a container.
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0);
|
||||
|
||||
mWindowManager.removeGuiMode(GM_Book);
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
|
||||
}
|
||||
|
||||
void BookWindow::onTakeButtonClicked (MyGUI::Widget* sender)
|
||||
|
@ -112,7 +112,7 @@ void BookWindow::onTakeButtonClicked (MyGUI::Widget* sender)
|
|||
MWWorld::ActionTake take(mBook);
|
||||
take.execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
|
||||
mWindowManager.removeGuiMode(GM_Book);
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
|
||||
}
|
||||
|
||||
void BookWindow::onNextPageButtonClicked (MyGUI::Widget* sender)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef MWGUI_BOOKWINDOW_H
|
||||
#define MWGUI_BOOKWINDOW_H
|
||||
|
||||
#include "window_base.hpp"
|
||||
#include "windowbase.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace MWGui
|
|||
class BookWindow : public WindowBase
|
||||
{
|
||||
public:
|
||||
BookWindow(MWBase::WindowManager& parWindowManager);
|
||||
BookWindow();
|
||||
|
||||
void open(MWWorld::Ptr book);
|
||||
void setTakeButtonShow(bool show);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "charactercreation.hpp"
|
||||
|
||||
#include "text_input.hpp"
|
||||
#include "textinput.hpp"
|
||||
#include "race.hpp"
|
||||
#include "class.hpp"
|
||||
#include "birth.hpp"
|
||||
|
@ -47,7 +47,7 @@ namespace
|
|||
|
||||
using namespace MWGui;
|
||||
|
||||
CharacterCreation::CharacterCreation(MWBase::WindowManager* _wm)
|
||||
CharacterCreation::CharacterCreation()
|
||||
: mNameDialog(0)
|
||||
, mRaceDialog(0)
|
||||
, mClassChoiceDialog(0)
|
||||
|
@ -58,7 +58,6 @@ CharacterCreation::CharacterCreation(MWBase::WindowManager* _wm)
|
|||
, mBirthSignDialog(0)
|
||||
, mReviewDialog(0)
|
||||
, mGenerateClassStep(0)
|
||||
, mWM(_wm)
|
||||
{
|
||||
mCreationStage = CSE_NotStarted;
|
||||
}
|
||||
|
@ -118,10 +117,10 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
switch (id)
|
||||
{
|
||||
case GM_Name:
|
||||
mWM->removeDialog(mNameDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mNameDialog);
|
||||
mNameDialog = 0;
|
||||
mNameDialog = new TextInputDialog(*mWM);
|
||||
mNameDialog->setTextLabel(mWM->getGameSettingString("sName", "Name"));
|
||||
mNameDialog = new TextInputDialog();
|
||||
mNameDialog->setTextLabel(MWBase::Environment::get().getWindowManager()->getGameSettingString("sName", "Name"));
|
||||
mNameDialog->setTextInput(mPlayerName);
|
||||
mNameDialog->setNextButtonShow(mCreationStage >= CSE_NameChosen);
|
||||
mNameDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onNameDialogDone);
|
||||
|
@ -129,9 +128,9 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
break;
|
||||
|
||||
case GM_Race:
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
mRaceDialog = new RaceDialog(*mWM);
|
||||
mRaceDialog = new RaceDialog();
|
||||
mRaceDialog->setNextButtonShow(mCreationStage >= CSE_RaceChosen);
|
||||
mRaceDialog->setRaceId(mPlayerRaceId);
|
||||
mRaceDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogDone);
|
||||
|
@ -142,9 +141,9 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
break;
|
||||
|
||||
case GM_Class:
|
||||
mWM->removeDialog(mClassChoiceDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mClassChoiceDialog);
|
||||
mClassChoiceDialog = 0;
|
||||
mClassChoiceDialog = new ClassChoiceDialog(*mWM);
|
||||
mClassChoiceDialog = new ClassChoiceDialog();
|
||||
mClassChoiceDialog->eventButtonSelected += MyGUI::newDelegate(this, &CharacterCreation::onClassChoice);
|
||||
mClassChoiceDialog->setVisible(true);
|
||||
if (mCreationStage < CSE_RaceChosen)
|
||||
|
@ -152,9 +151,9 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
break;
|
||||
|
||||
case GM_ClassPick:
|
||||
mWM->removeDialog(mPickClassDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mPickClassDialog);
|
||||
mPickClassDialog = 0;
|
||||
mPickClassDialog = new PickClassDialog(*mWM);
|
||||
mPickClassDialog = new PickClassDialog();
|
||||
mPickClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
|
||||
mPickClassDialog->setClassId(mPlayerClass.mName);
|
||||
mPickClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogDone);
|
||||
|
@ -165,9 +164,9 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
break;
|
||||
|
||||
case GM_Birth:
|
||||
mWM->removeDialog(mBirthSignDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mBirthSignDialog);
|
||||
mBirthSignDialog = 0;
|
||||
mBirthSignDialog = new BirthDialog(*mWM);
|
||||
mBirthSignDialog = new BirthDialog();
|
||||
mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen);
|
||||
mBirthSignDialog->setBirthId(mPlayerBirthSignId);
|
||||
mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone);
|
||||
|
@ -178,9 +177,9 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
break;
|
||||
|
||||
case GM_ClassCreate:
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mCreateClassDialog);
|
||||
mCreateClassDialog = 0;
|
||||
mCreateClassDialog = new CreateClassDialog(*mWM);
|
||||
mCreateClassDialog = new CreateClassDialog();
|
||||
mCreateClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
|
||||
mCreateClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogDone);
|
||||
mCreateClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogBack);
|
||||
|
@ -199,9 +198,9 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
mCreationStage = CSE_RaceChosen;
|
||||
break;
|
||||
case GM_Review:
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
mReviewDialog = new ReviewDialog(*mWM);
|
||||
mReviewDialog = new ReviewDialog();
|
||||
mReviewDialog->setPlayerName(mPlayerName);
|
||||
mReviewDialog->setRace(mPlayerRaceId);
|
||||
mReviewDialog->setClass(mPlayerClass);
|
||||
|
@ -212,7 +211,7 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
mReviewDialog->setFatigue(mPlayerFatigue);
|
||||
|
||||
{
|
||||
std::map<int, MWMechanics::Stat<int> > attributes = mWM->getPlayerAttributeValues();
|
||||
std::map<int, MWMechanics::Stat<int> > attributes = MWBase::Environment::get().getWindowManager()->getPlayerAttributeValues();
|
||||
for (std::map<int, MWMechanics::Stat<int> >::iterator it = attributes.begin();
|
||||
it != attributes.end(); ++it)
|
||||
{
|
||||
|
@ -221,13 +220,13 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
}
|
||||
|
||||
{
|
||||
std::map<int, MWMechanics::Stat<float> > skills = mWM->getPlayerSkillValues();
|
||||
std::map<int, MWMechanics::Stat<float> > skills = MWBase::Environment::get().getWindowManager()->getPlayerSkillValues();
|
||||
for (std::map<int, MWMechanics::Stat<float> >::iterator it = skills.begin();
|
||||
it != skills.end(); ++it)
|
||||
{
|
||||
mReviewDialog->setSkillValue(static_cast<ESM::Skill::SkillEnum> (it->first), it->second);
|
||||
}
|
||||
mReviewDialog->configureSkills(mWM->getPlayerMajorSkills(), mWM->getPlayerMinorSkills());
|
||||
mReviewDialog->configureSkills(MWBase::Environment::get().getWindowManager()->getPlayerMajorSkills(), MWBase::Environment::get().getWindowManager()->getPlayerMinorSkills());
|
||||
}
|
||||
|
||||
mReviewDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onReviewDialogDone);
|
||||
|
@ -257,41 +256,41 @@ void CharacterCreation::setPlayerFatigue (const MWMechanics::DynamicStat<float>&
|
|||
|
||||
void CharacterCreation::onReviewDialogDone(WindowBase* parWindow)
|
||||
{
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
|
||||
mWM->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
}
|
||||
|
||||
void CharacterCreation::onReviewDialogBack()
|
||||
{
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
|
||||
mWM->pushGuiMode(GM_Birth);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
|
||||
}
|
||||
|
||||
void CharacterCreation::onReviewActivateDialog(int parDialog)
|
||||
{
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
mCreationStage = CSE_ReviewNext;
|
||||
|
||||
mWM->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
|
||||
switch(parDialog)
|
||||
{
|
||||
case ReviewDialog::NAME_DIALOG:
|
||||
mWM->pushGuiMode(GM_Name);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Name);
|
||||
break;
|
||||
case ReviewDialog::RACE_DIALOG:
|
||||
mWM->pushGuiMode(GM_Race);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Race);
|
||||
break;
|
||||
case ReviewDialog::CLASS_DIALOG:
|
||||
mWM->pushGuiMode(GM_Class);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
||||
break;
|
||||
case ReviewDialog::BIRTHSIGN_DIALOG:
|
||||
mWM->pushGuiMode(GM_Birth);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -308,27 +307,27 @@ void CharacterCreation::onPickClassDialogDone(WindowBase* parWindow)
|
|||
if (klass)
|
||||
{
|
||||
mPlayerClass = *klass;
|
||||
mWM->setPlayerClass(mPlayerClass);
|
||||
MWBase::Environment::get().getWindowManager()->setPlayerClass(mPlayerClass);
|
||||
}
|
||||
mWM->removeDialog(mPickClassDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mPickClassDialog);
|
||||
mPickClassDialog = 0;
|
||||
}
|
||||
|
||||
//TODO This bit gets repeated a few times; wrap it in a function
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Review);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||
}
|
||||
else if (mCreationStage >= CSE_ClassChosen)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Birth);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreationStage = CSE_ClassChosen;
|
||||
mWM->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,34 +338,34 @@ void CharacterCreation::onPickClassDialogBack()
|
|||
const std::string classId = mPickClassDialog->getClassId();
|
||||
if (!classId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId);
|
||||
mWM->removeDialog(mPickClassDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mPickClassDialog);
|
||||
mPickClassDialog = 0;
|
||||
}
|
||||
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Class);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
||||
}
|
||||
|
||||
void CharacterCreation::onClassChoice(int _index)
|
||||
{
|
||||
mWM->removeDialog(mClassChoiceDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mClassChoiceDialog);
|
||||
mClassChoiceDialog = 0;
|
||||
|
||||
mWM->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
|
||||
switch(_index)
|
||||
{
|
||||
case ClassChoiceDialog::Class_Generate:
|
||||
mWM->pushGuiMode(GM_ClassGenerate);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_ClassGenerate);
|
||||
break;
|
||||
case ClassChoiceDialog::Class_Pick:
|
||||
mWM->pushGuiMode(GM_ClassPick);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_ClassPick);
|
||||
break;
|
||||
case ClassChoiceDialog::Class_Create:
|
||||
mWM->pushGuiMode(GM_ClassCreate);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_ClassCreate);
|
||||
break;
|
||||
case ClassChoiceDialog::Class_Back:
|
||||
mWM->pushGuiMode(GM_Race);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Race);
|
||||
break;
|
||||
|
||||
};
|
||||
|
@ -377,26 +376,26 @@ void CharacterCreation::onNameDialogDone(WindowBase* parWindow)
|
|||
if (mNameDialog)
|
||||
{
|
||||
mPlayerName = mNameDialog->getTextInput();
|
||||
mWM->setValue("name", mPlayerName);
|
||||
MWBase::Environment::get().getWindowManager()->setValue("name", mPlayerName);
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerName(mPlayerName);
|
||||
mWM->removeDialog(mNameDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mNameDialog);
|
||||
mNameDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Review);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||
}
|
||||
else if (mCreationStage >= CSE_NameChosen)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Race);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Race);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreationStage = CSE_NameChosen;
|
||||
mWM->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -414,12 +413,12 @@ void CharacterCreation::onRaceDialogBack()
|
|||
data.mHair
|
||||
);
|
||||
}
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
}
|
||||
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Name);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Name);
|
||||
}
|
||||
|
||||
void CharacterCreation::onRaceDialogDone(WindowBase* parWindow)
|
||||
|
@ -436,26 +435,26 @@ void CharacterCreation::onRaceDialogDone(WindowBase* parWindow)
|
|||
data.mHair
|
||||
);
|
||||
}
|
||||
mWM->getInventoryWindow()->rebuildAvatar();
|
||||
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->rebuildAvatar();
|
||||
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Review);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||
}
|
||||
else if (mCreationStage >= CSE_RaceChosen)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Class);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreationStage = CSE_RaceChosen;
|
||||
mWM->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -466,19 +465,19 @@ void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
|
|||
mPlayerBirthSignId = mBirthSignDialog->getBirthId();
|
||||
if (!mPlayerBirthSignId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mPlayerBirthSignId);
|
||||
mWM->removeDialog(mBirthSignDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mBirthSignDialog);
|
||||
mBirthSignDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage >= CSE_BirthSignChosen)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Review);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreationStage = CSE_BirthSignChosen;
|
||||
mWM->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -487,12 +486,12 @@ void CharacterCreation::onBirthSignDialogBack()
|
|||
if (mBirthSignDialog)
|
||||
{
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mBirthSignDialog->getBirthId());
|
||||
mWM->removeDialog(mBirthSignDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mBirthSignDialog);
|
||||
mBirthSignDialog = 0;
|
||||
}
|
||||
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Class);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
||||
}
|
||||
|
||||
void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
|
||||
|
@ -522,49 +521,49 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
|
|||
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(klass);
|
||||
mPlayerClass = klass;
|
||||
mWM->setPlayerClass(klass);
|
||||
MWBase::Environment::get().getWindowManager()->setPlayerClass(klass);
|
||||
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mCreateClassDialog);
|
||||
mCreateClassDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Review);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||
}
|
||||
else if (mCreationStage >= CSE_ClassChosen)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Birth);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreationStage = CSE_ClassChosen;
|
||||
mWM->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterCreation::onCreateClassDialogBack()
|
||||
{
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mCreateClassDialog);
|
||||
mCreateClassDialog = 0;
|
||||
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Class);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
||||
}
|
||||
|
||||
void CharacterCreation::onClassQuestionChosen(int _index)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->stopSay();
|
||||
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mGenerateClassQuestionDialog);
|
||||
mGenerateClassQuestionDialog = 0;
|
||||
|
||||
if (_index < 0 || _index >= 3)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Class);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -637,10 +636,10 @@ void CharacterCreation::showClassQuestionDialog()
|
|||
}
|
||||
}
|
||||
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mGenerateClassResultDialog);
|
||||
mGenerateClassResultDialog = 0;
|
||||
|
||||
mGenerateClassResultDialog = new GenerateClassResultDialog(*mWM);
|
||||
mGenerateClassResultDialog = new GenerateClassResultDialog();
|
||||
mGenerateClassResultDialog->setClassId(mGenerateClass);
|
||||
mGenerateClassResultDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onGenerateClassBack);
|
||||
mGenerateClassResultDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onGenerateClassDone);
|
||||
|
@ -650,15 +649,15 @@ void CharacterCreation::showClassQuestionDialog()
|
|||
|
||||
if (mGenerateClassStep > 10)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Class);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
||||
return;
|
||||
}
|
||||
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mGenerateClassQuestionDialog);
|
||||
mGenerateClassQuestionDialog = 0;
|
||||
|
||||
mGenerateClassQuestionDialog = new InfoBoxDialog(*mWM);
|
||||
mGenerateClassQuestionDialog = new InfoBoxDialog();
|
||||
|
||||
InfoBoxDialog::ButtonList buttons;
|
||||
mGenerateClassQuestionDialog->setText(sGenerateClassSteps(mGenerateClassStep).mText);
|
||||
|
@ -674,18 +673,18 @@ void CharacterCreation::showClassQuestionDialog()
|
|||
|
||||
void CharacterCreation::onGenerateClassBack()
|
||||
{
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mGenerateClassResultDialog);
|
||||
mGenerateClassResultDialog = 0;
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
||||
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Class);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
||||
}
|
||||
|
||||
void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
|
||||
{
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mGenerateClassResultDialog);
|
||||
mGenerateClassResultDialog = 0;
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
||||
|
@ -694,22 +693,22 @@ void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
|
|||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(mGenerateClass);
|
||||
|
||||
mPlayerClass = *klass;
|
||||
mWM->setPlayerClass(mPlayerClass);
|
||||
MWBase::Environment::get().getWindowManager()->setPlayerClass(mPlayerClass);
|
||||
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Review);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||
}
|
||||
else if (mCreationStage >= CSE_ClassChosen)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Birth);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreationStage = CSE_ClassChosen;
|
||||
mWM->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
#ifndef CHARACTER_CREATION_HPP
|
||||
#define CHARACTER_CREATION_HPP
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowBase;
|
||||
|
@ -29,7 +25,7 @@ namespace MWGui
|
|||
public:
|
||||
typedef std::vector<int> SkillList;
|
||||
|
||||
CharacterCreation(MWBase::WindowManager* _wm);
|
||||
CharacterCreation();
|
||||
~CharacterCreation();
|
||||
|
||||
//Show a dialog
|
||||
|
@ -58,8 +54,6 @@ namespace MWGui
|
|||
BirthDialog* mBirthSignDialog;
|
||||
ReviewDialog* mReviewDialog;
|
||||
|
||||
MWBase::WindowManager* mWM;
|
||||
|
||||
//Player data
|
||||
std::string mPlayerName;
|
||||
std::string mPlayerRaceId;
|
||||
|
|
|
@ -20,13 +20,13 @@ using namespace MWGui;
|
|||
|
||||
/* GenerateClassResultDialog */
|
||||
|
||||
GenerateClassResultDialog::GenerateClassResultDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowModal("openmw_chargen_generate_class_result.layout", parWindowManager)
|
||||
GenerateClassResultDialog::GenerateClassResultDialog()
|
||||
: WindowModal("openmw_chargen_generate_class_result.layout")
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
||||
setText("ReflectT", mWindowManager.getGameSettingString("sMessageQuestionAnswer1", ""));
|
||||
setText("ReflectT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sMessageQuestionAnswer1", ""));
|
||||
|
||||
getWidget(mClassImage, "ClassImage");
|
||||
getWidget(mClassName, "ClassName");
|
||||
|
@ -37,7 +37,7 @@ GenerateClassResultDialog::GenerateClassResultDialog(MWBase::WindowManager& parW
|
|||
|
||||
MyGUI::Button* okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
||||
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
|
||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GenerateClassResultDialog::onOkClicked);
|
||||
}
|
||||
|
||||
|
@ -67,8 +67,8 @@ void GenerateClassResultDialog::onBackClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* PickClassDialog */
|
||||
|
||||
PickClassDialog::PickClassDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowModal("openmw_chargen_class.layout", parWindowManager)
|
||||
PickClassDialog::PickClassDialog()
|
||||
: WindowModal("openmw_chargen_class.layout")
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
@ -77,16 +77,12 @@ PickClassDialog::PickClassDialog(MWBase::WindowManager& parWindowManager)
|
|||
|
||||
getWidget(mFavoriteAttribute[0], "FavoriteAttribute0");
|
||||
getWidget(mFavoriteAttribute[1], "FavoriteAttribute1");
|
||||
mFavoriteAttribute[0]->setWindowManager(&mWindowManager);
|
||||
mFavoriteAttribute[1]->setWindowManager(&mWindowManager);
|
||||
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
char theIndex = '0'+i;
|
||||
getWidget(mMajorSkill[i], std::string("MajorSkill").append(1, theIndex));
|
||||
getWidget(mMinorSkill[i], std::string("MinorSkill").append(1, theIndex));
|
||||
mMajorSkill[i]->setWindowManager(&mWindowManager);
|
||||
mMinorSkill[i]->setWindowManager(&mWindowManager);
|
||||
}
|
||||
|
||||
getWidget(mClassList, "ClassList");
|
||||
|
@ -115,9 +111,9 @@ void PickClassDialog::setNextButtonShow(bool shown)
|
|||
getWidget(okButton, "OKButton");
|
||||
|
||||
if (shown)
|
||||
okButton->setCaption(mWindowManager.getGameSettingString("sNext", ""));
|
||||
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", ""));
|
||||
else
|
||||
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
||||
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
|
||||
}
|
||||
|
||||
void PickClassDialog::open()
|
||||
|
@ -224,7 +220,7 @@ void PickClassDialog::updateStats()
|
|||
"sSpecializationMagic",
|
||||
"sSpecializationStealth"
|
||||
};
|
||||
std::string specName = mWindowManager.getGameSettingString(specIds[specialization], specIds[specialization]);
|
||||
std::string specName = MWBase::Environment::get().getWindowManager()->getGameSettingString(specIds[specialization], specIds[specialization]);
|
||||
mSpecializationName->setCaption(specName);
|
||||
ToolTips::createSpecializationToolTip(mSpecializationName, specName, specialization);
|
||||
|
||||
|
@ -276,8 +272,8 @@ void InfoBoxDialog::layoutVertically(MyGUI::Widget* widget, int margin)
|
|||
widget->setSize(width, pos);
|
||||
}
|
||||
|
||||
InfoBoxDialog::InfoBoxDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowModal("openmw_infobox.layout", parWindowManager)
|
||||
InfoBoxDialog::InfoBoxDialog()
|
||||
: WindowModal("openmw_infobox.layout")
|
||||
, mCurrentButton(-1)
|
||||
{
|
||||
getWidget(mTextBox, "TextBox");
|
||||
|
@ -360,22 +356,22 @@ void InfoBoxDialog::onButtonClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* ClassChoiceDialog */
|
||||
|
||||
ClassChoiceDialog::ClassChoiceDialog(MWBase::WindowManager& parWindowManager)
|
||||
: InfoBoxDialog(parWindowManager)
|
||||
ClassChoiceDialog::ClassChoiceDialog()
|
||||
: InfoBoxDialog()
|
||||
{
|
||||
setText("");
|
||||
ButtonList buttons;
|
||||
buttons.push_back(mWindowManager.getGameSettingString("sClassChoiceMenu1", ""));
|
||||
buttons.push_back(mWindowManager.getGameSettingString("sClassChoiceMenu2", ""));
|
||||
buttons.push_back(mWindowManager.getGameSettingString("sClassChoiceMenu3", ""));
|
||||
buttons.push_back(mWindowManager.getGameSettingString("sBack", ""));
|
||||
buttons.push_back(MWBase::Environment::get().getWindowManager()->getGameSettingString("sClassChoiceMenu1", ""));
|
||||
buttons.push_back(MWBase::Environment::get().getWindowManager()->getGameSettingString("sClassChoiceMenu2", ""));
|
||||
buttons.push_back(MWBase::Environment::get().getWindowManager()->getGameSettingString("sClassChoiceMenu3", ""));
|
||||
buttons.push_back(MWBase::Environment::get().getWindowManager()->getGameSettingString("sBack", ""));
|
||||
setButtons(buttons);
|
||||
}
|
||||
|
||||
/* CreateClassDialog */
|
||||
|
||||
CreateClassDialog::CreateClassDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowModal("openmw_chargen_create_class.layout", parWindowManager)
|
||||
CreateClassDialog::CreateClassDialog()
|
||||
: WindowModal("openmw_chargen_create_class.layout")
|
||||
, mSpecDialog(NULL)
|
||||
, mAttribDialog(NULL)
|
||||
, mSkillDialog(NULL)
|
||||
|
@ -384,20 +380,18 @@ CreateClassDialog::CreateClassDialog(MWBase::WindowManager& parWindowManager)
|
|||
// Centre dialog
|
||||
center();
|
||||
|
||||
setText("SpecializationT", mWindowManager.getGameSettingString("sChooseClassMenu1", "Specialization"));
|
||||
setText("SpecializationT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sChooseClassMenu1", "Specialization"));
|
||||
getWidget(mSpecializationName, "SpecializationName");
|
||||
mSpecializationName->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationClicked);
|
||||
|
||||
setText("FavoriteAttributesT", mWindowManager.getGameSettingString("sChooseClassMenu2", "Favorite Attributes:"));
|
||||
setText("FavoriteAttributesT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sChooseClassMenu2", "Favorite Attributes:"));
|
||||
getWidget(mFavoriteAttribute0, "FavoriteAttribute0");
|
||||
getWidget(mFavoriteAttribute1, "FavoriteAttribute1");
|
||||
mFavoriteAttribute0->setWindowManager(&mWindowManager);
|
||||
mFavoriteAttribute1->setWindowManager(&mWindowManager);
|
||||
mFavoriteAttribute0->eventClicked += MyGUI::newDelegate(this, &CreateClassDialog::onAttributeClicked);
|
||||
mFavoriteAttribute1->eventClicked += MyGUI::newDelegate(this, &CreateClassDialog::onAttributeClicked);
|
||||
|
||||
setText("MajorSkillT", mWindowManager.getGameSettingString("sSkillClassMajor", ""));
|
||||
setText("MinorSkillT", mWindowManager.getGameSettingString("sSkillClassMinor", ""));
|
||||
setText("MajorSkillT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sSkillClassMajor", ""));
|
||||
setText("MinorSkillT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sSkillClassMinor", ""));
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
char theIndex = '0'+i;
|
||||
|
@ -410,11 +404,10 @@ CreateClassDialog::CreateClassDialog(MWBase::WindowManager& parWindowManager)
|
|||
std::vector<Widgets::MWSkillPtr>::const_iterator end = mSkills.end();
|
||||
for (std::vector<Widgets::MWSkillPtr>::const_iterator it = mSkills.begin(); it != end; ++it)
|
||||
{
|
||||
(*it)->setWindowManager(&mWindowManager);
|
||||
(*it)->eventClicked += MyGUI::newDelegate(this, &CreateClassDialog::onSkillClicked);
|
||||
}
|
||||
|
||||
setText("LabelT", mWindowManager.getGameSettingString("sName", ""));
|
||||
setText("LabelT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sName", ""));
|
||||
getWidget(mEditName, "EditName");
|
||||
|
||||
// Make sure the edit box has focus
|
||||
|
@ -522,32 +515,32 @@ void CreateClassDialog::setNextButtonShow(bool shown)
|
|||
getWidget(okButton, "OKButton");
|
||||
|
||||
if (shown)
|
||||
okButton->setCaption(mWindowManager.getGameSettingString("sNext", ""));
|
||||
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", ""));
|
||||
else
|
||||
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
||||
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
|
||||
}
|
||||
|
||||
// widget controls
|
||||
|
||||
void CreateClassDialog::onDialogCancel()
|
||||
{
|
||||
mWindowManager.removeDialog(mSpecDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mSpecDialog);
|
||||
mSpecDialog = 0;
|
||||
|
||||
mWindowManager.removeDialog(mAttribDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mAttribDialog);
|
||||
mAttribDialog = 0;
|
||||
|
||||
mWindowManager.removeDialog(mSkillDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mSkillDialog);
|
||||
mSkillDialog = 0;
|
||||
|
||||
mWindowManager.removeDialog(mDescDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mDescDialog);
|
||||
mDescDialog = 0;
|
||||
}
|
||||
|
||||
void CreateClassDialog::onSpecializationClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
delete mSpecDialog;
|
||||
mSpecDialog = new SelectSpecializationDialog(mWindowManager);
|
||||
mSpecDialog = new SelectSpecializationDialog();
|
||||
mSpecDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
||||
mSpecDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationSelected);
|
||||
mSpecDialog->setVisible(true);
|
||||
|
@ -558,7 +551,7 @@ void CreateClassDialog::onSpecializationSelected()
|
|||
mSpecializationId = mSpecDialog->getSpecializationId();
|
||||
setSpecialization(mSpecializationId);
|
||||
|
||||
mWindowManager.removeDialog(mSpecDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mSpecDialog);
|
||||
mSpecDialog = 0;
|
||||
}
|
||||
|
||||
|
@ -570,7 +563,7 @@ void CreateClassDialog::setSpecialization(int id)
|
|||
"sSpecializationMagic",
|
||||
"sSpecializationStealth"
|
||||
};
|
||||
std::string specName = mWindowManager.getGameSettingString(specIds[mSpecializationId], specIds[mSpecializationId]);
|
||||
std::string specName = MWBase::Environment::get().getWindowManager()->getGameSettingString(specIds[mSpecializationId], specIds[mSpecializationId]);
|
||||
mSpecializationName->setCaption(specName);
|
||||
ToolTips::createSpecializationToolTip(mSpecializationName, specName, mSpecializationId);
|
||||
}
|
||||
|
@ -578,7 +571,7 @@ void CreateClassDialog::setSpecialization(int id)
|
|||
void CreateClassDialog::onAttributeClicked(Widgets::MWAttributePtr _sender)
|
||||
{
|
||||
delete mAttribDialog;
|
||||
mAttribDialog = new SelectAttributeDialog(mWindowManager);
|
||||
mAttribDialog = new SelectAttributeDialog();
|
||||
mAffectedAttribute = _sender;
|
||||
mAttribDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
||||
mAttribDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onAttributeSelected);
|
||||
|
@ -599,7 +592,7 @@ void CreateClassDialog::onAttributeSelected()
|
|||
mFavoriteAttribute0->setAttributeId(mFavoriteAttribute1->getAttributeId());
|
||||
}
|
||||
mAffectedAttribute->setAttributeId(id);
|
||||
mWindowManager.removeDialog(mAttribDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mAttribDialog);
|
||||
mAttribDialog = 0;
|
||||
|
||||
update();
|
||||
|
@ -608,7 +601,7 @@ void CreateClassDialog::onAttributeSelected()
|
|||
void CreateClassDialog::onSkillClicked(Widgets::MWSkillPtr _sender)
|
||||
{
|
||||
delete mSkillDialog;
|
||||
mSkillDialog = new SelectSkillDialog(mWindowManager);
|
||||
mSkillDialog = new SelectSkillDialog();
|
||||
mAffectedSkill = _sender;
|
||||
mSkillDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
||||
mSkillDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onSkillSelected);
|
||||
|
@ -633,14 +626,14 @@ void CreateClassDialog::onSkillSelected()
|
|||
}
|
||||
|
||||
mAffectedSkill->setSkillId(mSkillDialog->getSkillId());
|
||||
mWindowManager.removeDialog(mSkillDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mSkillDialog);
|
||||
mSkillDialog = 0;
|
||||
update();
|
||||
}
|
||||
|
||||
void CreateClassDialog::onDescriptionClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
mDescDialog = new DescriptionDialog(mWindowManager);
|
||||
mDescDialog = new DescriptionDialog();
|
||||
mDescDialog->setTextInput(mDescription);
|
||||
mDescDialog->eventDone += MyGUI::newDelegate(this, &CreateClassDialog::onDescriptionEntered);
|
||||
mDescDialog->setVisible(true);
|
||||
|
@ -649,7 +642,7 @@ void CreateClassDialog::onDescriptionClicked(MyGUI::Widget* _sender)
|
|||
void CreateClassDialog::onDescriptionEntered(WindowBase* parWindow)
|
||||
{
|
||||
mDescription = mDescDialog->getTextInput();
|
||||
mWindowManager.removeDialog(mDescDialog);
|
||||
MWBase::Environment::get().getWindowManager()->removeDialog(mDescDialog);
|
||||
mDescDialog = 0;
|
||||
}
|
||||
|
||||
|
@ -667,20 +660,20 @@ void CreateClassDialog::onBackClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* SelectSpecializationDialog */
|
||||
|
||||
SelectSpecializationDialog::SelectSpecializationDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowModal("openmw_chargen_select_specialization.layout", parWindowManager)
|
||||
SelectSpecializationDialog::SelectSpecializationDialog()
|
||||
: WindowModal("openmw_chargen_select_specialization.layout")
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
||||
setText("LabelT", mWindowManager.getGameSettingString("sSpecializationMenu1", ""));
|
||||
setText("LabelT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sSpecializationMenu1", ""));
|
||||
|
||||
getWidget(mSpecialization0, "Specialization0");
|
||||
getWidget(mSpecialization1, "Specialization1");
|
||||
getWidget(mSpecialization2, "Specialization2");
|
||||
std::string combat = mWindowManager.getGameSettingString(ESM::Class::sGmstSpecializationIds[ESM::Class::Combat], "");
|
||||
std::string magic = mWindowManager.getGameSettingString(ESM::Class::sGmstSpecializationIds[ESM::Class::Magic], "");
|
||||
std::string stealth = mWindowManager.getGameSettingString(ESM::Class::sGmstSpecializationIds[ESM::Class::Stealth], "");
|
||||
std::string combat = MWBase::Environment::get().getWindowManager()->getGameSettingString(ESM::Class::sGmstSpecializationIds[ESM::Class::Combat], "");
|
||||
std::string magic = MWBase::Environment::get().getWindowManager()->getGameSettingString(ESM::Class::sGmstSpecializationIds[ESM::Class::Magic], "");
|
||||
std::string stealth = MWBase::Environment::get().getWindowManager()->getGameSettingString(ESM::Class::sGmstSpecializationIds[ESM::Class::Stealth], "");
|
||||
|
||||
mSpecialization0->setCaption(combat);
|
||||
mSpecialization0->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
|
||||
|
@ -696,7 +689,7 @@ SelectSpecializationDialog::SelectSpecializationDialog(MWBase::WindowManager& pa
|
|||
|
||||
MyGUI::Button* cancelButton;
|
||||
getWidget(cancelButton, "CancelButton");
|
||||
cancelButton->setCaption(mWindowManager.getGameSettingString("sCancel", ""));
|
||||
cancelButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sCancel", ""));
|
||||
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onCancelClicked);
|
||||
}
|
||||
|
||||
|
@ -727,13 +720,13 @@ void SelectSpecializationDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* SelectAttributeDialog */
|
||||
|
||||
SelectAttributeDialog::SelectAttributeDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowModal("openmw_chargen_select_attribute.layout", parWindowManager)
|
||||
SelectAttributeDialog::SelectAttributeDialog()
|
||||
: WindowModal("openmw_chargen_select_attribute.layout")
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
||||
setText("LabelT", mWindowManager.getGameSettingString("sAttributesMenu1", ""));
|
||||
setText("LabelT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sAttributesMenu1", ""));
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
|
@ -741,7 +734,6 @@ SelectAttributeDialog::SelectAttributeDialog(MWBase::WindowManager& parWindowMan
|
|||
char theIndex = '0'+i;
|
||||
|
||||
getWidget(attribute, std::string("Attribute").append(1, theIndex));
|
||||
attribute->setWindowManager(&parWindowManager);
|
||||
attribute->setAttributeId(ESM::Attribute::sAttributeIds[i]);
|
||||
attribute->eventClicked += MyGUI::newDelegate(this, &SelectAttributeDialog::onAttributeClicked);
|
||||
ToolTips::createAttributeToolTip(attribute, attribute->getAttributeId());
|
||||
|
@ -749,7 +741,7 @@ SelectAttributeDialog::SelectAttributeDialog(MWBase::WindowManager& parWindowMan
|
|||
|
||||
MyGUI::Button* cancelButton;
|
||||
getWidget(cancelButton, "CancelButton");
|
||||
cancelButton->setCaption(mWindowManager.getGameSettingString("sCancel", ""));
|
||||
cancelButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sCancel", ""));
|
||||
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectAttributeDialog::onCancelClicked);
|
||||
}
|
||||
|
||||
|
@ -774,16 +766,16 @@ void SelectAttributeDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* SelectSkillDialog */
|
||||
|
||||
SelectSkillDialog::SelectSkillDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowModal("openmw_chargen_select_skill.layout", parWindowManager)
|
||||
SelectSkillDialog::SelectSkillDialog()
|
||||
: WindowModal("openmw_chargen_select_skill.layout")
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
||||
setText("LabelT", mWindowManager.getGameSettingString("sSkillsMenu1", ""));
|
||||
setText("CombatLabelT", mWindowManager.getGameSettingString("sSpecializationCombat", ""));
|
||||
setText("MagicLabelT", mWindowManager.getGameSettingString("sSpecializationMagic", ""));
|
||||
setText("StealthLabelT", mWindowManager.getGameSettingString("sSpecializationStealth", ""));
|
||||
setText("LabelT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sSkillsMenu1", ""));
|
||||
setText("CombatLabelT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sSpecializationCombat", ""));
|
||||
setText("MagicLabelT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sSpecializationMagic", ""));
|
||||
setText("StealthLabelT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sSpecializationStealth", ""));
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
|
@ -833,7 +825,6 @@ SelectSkillDialog::SelectSkillDialog(MWBase::WindowManager& parWindowManager)
|
|||
{
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
mSkills[spec][i].widget->setWindowManager(&mWindowManager);
|
||||
mSkills[spec][i].widget->setSkillId(mSkills[spec][i].skillId);
|
||||
mSkills[spec][i].widget->eventClicked += MyGUI::newDelegate(this, &SelectSkillDialog::onSkillClicked);
|
||||
ToolTips::createSkillToolTip(mSkills[spec][i].widget, mSkills[spec][i].widget->getSkillId());
|
||||
|
@ -842,7 +833,7 @@ SelectSkillDialog::SelectSkillDialog(MWBase::WindowManager& parWindowManager)
|
|||
|
||||
MyGUI::Button* cancelButton;
|
||||
getWidget(cancelButton, "CancelButton");
|
||||
cancelButton->setCaption(mWindowManager.getGameSettingString("sCancel", ""));
|
||||
cancelButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sCancel", ""));
|
||||
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSkillDialog::onCancelClicked);
|
||||
}
|
||||
|
||||
|
@ -865,8 +856,8 @@ void SelectSkillDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* DescriptionDialog */
|
||||
|
||||
DescriptionDialog::DescriptionDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowModal("openmw_chargen_class_description.layout", parWindowManager)
|
||||
DescriptionDialog::DescriptionDialog()
|
||||
: WindowModal("openmw_chargen_class_description.layout")
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
@ -876,7 +867,7 @@ DescriptionDialog::DescriptionDialog(MWBase::WindowManager& parWindowManager)
|
|||
MyGUI::Button* okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &DescriptionDialog::onOkClicked);
|
||||
okButton->setCaption(mWindowManager.getGameSettingString("sInputMenu1", ""));
|
||||
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sInputMenu1", ""));
|
||||
|
||||
// Make sure the edit box has focus
|
||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(mTextEdit);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
|
||||
#include "widgets.hpp"
|
||||
#include "window_base.hpp"
|
||||
#include "windowbase.hpp"
|
||||
|
||||
/*
|
||||
This file contains the dialogs for choosing a class.
|
||||
|
@ -15,7 +15,7 @@ namespace MWGui
|
|||
class InfoBoxDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
InfoBoxDialog(MWBase::WindowManager& parWindowManager);
|
||||
InfoBoxDialog();
|
||||
|
||||
typedef std::vector<std::string> ButtonList;
|
||||
|
||||
|
@ -60,13 +60,13 @@ namespace MWGui
|
|||
Class_Create = 2,
|
||||
Class_Back = 3
|
||||
};
|
||||
ClassChoiceDialog(MWBase::WindowManager& parWindowManager);
|
||||
ClassChoiceDialog();
|
||||
};
|
||||
|
||||
class GenerateClassResultDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
GenerateClassResultDialog(MWBase::WindowManager& parWindowManager);
|
||||
GenerateClassResultDialog();
|
||||
|
||||
std::string getClassId() const;
|
||||
void setClassId(const std::string &classId);
|
||||
|
@ -93,7 +93,7 @@ namespace MWGui
|
|||
class PickClassDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
PickClassDialog(MWBase::WindowManager& parWindowManager);
|
||||
PickClassDialog();
|
||||
|
||||
const std::string &getClassId() const { return mCurrentClassId; }
|
||||
void setClassId(const std::string &classId);
|
||||
|
@ -132,7 +132,7 @@ namespace MWGui
|
|||
class SelectSpecializationDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
SelectSpecializationDialog(MWBase::WindowManager& parWindowManager);
|
||||
SelectSpecializationDialog();
|
||||
~SelectSpecializationDialog();
|
||||
|
||||
ESM::Class::Specialization getSpecializationId() const { return mSpecializationId; }
|
||||
|
@ -163,7 +163,7 @@ namespace MWGui
|
|||
class SelectAttributeDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
SelectAttributeDialog(MWBase::WindowManager& parWindowManager);
|
||||
SelectAttributeDialog();
|
||||
~SelectAttributeDialog();
|
||||
|
||||
ESM::Attribute::AttributeID getAttributeId() const { return mAttributeId; }
|
||||
|
@ -192,7 +192,7 @@ namespace MWGui
|
|||
class SelectSkillDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
SelectSkillDialog(MWBase::WindowManager& parWindowManager);
|
||||
SelectSkillDialog();
|
||||
~SelectSkillDialog();
|
||||
|
||||
ESM::Skill::SkillEnum getSkillId() const { return mSkillId; }
|
||||
|
@ -225,7 +225,7 @@ namespace MWGui
|
|||
class DescriptionDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
DescriptionDialog(MWBase::WindowManager& parWindowManager);
|
||||
DescriptionDialog();
|
||||
~DescriptionDialog();
|
||||
|
||||
std::string getTextInput() const { return mTextEdit ? mTextEdit->getOnlyText() : ""; }
|
||||
|
@ -241,7 +241,7 @@ namespace MWGui
|
|||
class CreateClassDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
CreateClassDialog(MWBase::WindowManager& parWindowManager);
|
||||
CreateClassDialog();
|
||||
virtual ~CreateClassDialog();
|
||||
|
||||
std::string getName() const;
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
namespace MWGui
|
||||
{
|
||||
|
||||
CompanionWindow::CompanionWindow(MWBase::WindowManager &parWindowManager, DragAndDrop *dragAndDrop, MessageBoxManager* manager)
|
||||
CompanionWindow::CompanionWindow(DragAndDrop *dragAndDrop, MessageBoxManager* manager)
|
||||
: ContainerBase(dragAndDrop)
|
||||
, WindowBase("openmw_companion_window.layout", parWindowManager)
|
||||
, WindowBase("openmw_companion_window.layout")
|
||||
, mMessageBoxManager(manager)
|
||||
{
|
||||
MyGUI::ScrollView* itemView;
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace MWGui
|
|||
class CompanionWindow : public ContainerBase, public WindowBase
|
||||
{
|
||||
public:
|
||||
CompanionWindow(MWBase::WindowManager& parWindowManager,DragAndDrop* dragAndDrop, MessageBoxManager* manager);
|
||||
CompanionWindow(DragAndDrop* dragAndDrop, MessageBoxManager* manager);
|
||||
virtual ~CompanionWindow() {}
|
||||
|
||||
void open(MWWorld::Ptr npc);
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
ConfirmationDialog::ConfirmationDialog(MWBase::WindowManager& parWindowManager) :
|
||||
WindowModal("openmw_confirmation_dialog.layout", parWindowManager)
|
||||
ConfirmationDialog::ConfirmationDialog() :
|
||||
WindowModal("openmw_confirmation_dialog.layout")
|
||||
{
|
||||
getWidget(mMessage, "Message");
|
||||
getWidget(mOkButton, "OkButton");
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#ifndef MWGUI_CONFIRMATIONDIALOG_H
|
||||
#define MWGUI_CONFIRMATIONDIALOG_H
|
||||
|
||||
#include "window_base.hpp"
|
||||
#include "windowbase.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class ConfirmationDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
ConfirmationDialog(MWBase::WindowManager& parWindowManager);
|
||||
ConfirmationDialog();
|
||||
void open(const std::string& message);
|
||||
|
||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
|
|
@ -649,9 +649,9 @@ MWWorld::ContainerStore& ContainerBase::getContainerStore()
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
ContainerWindow::ContainerWindow(MWBase::WindowManager& parWindowManager,DragAndDrop* dragAndDrop)
|
||||
ContainerWindow::ContainerWindow(DragAndDrop* dragAndDrop)
|
||||
: ContainerBase(dragAndDrop)
|
||||
, WindowBase("openmw_container_window.layout", parWindowManager)
|
||||
, WindowBase("openmw_container_window.layout")
|
||||
{
|
||||
getWidget(mDisposeCorpseButton, "DisposeCorpseButton");
|
||||
getWidget(mTakeButton, "TakeButton");
|
||||
|
@ -751,7 +751,7 @@ void ContainerWindow::onDisposeCorpseButtonClicked(MyGUI::Widget *sender)
|
|||
|
||||
/// \todo I don't think this is the correct flag to check
|
||||
if (MWWorld::Class::get(mPtr).isEssential(mPtr))
|
||||
mWindowManager.messageBox("#{sDisposeCorpseFail}");
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sDisposeCorpseFail}");
|
||||
else
|
||||
MWBase::Environment::get().getWorld()->deleteObject(mPtr);
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
#ifndef MGUI_CONTAINER_H
|
||||
#define MGUI_CONTAINER_H
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "window_base.hpp"
|
||||
#include "windowbase.hpp"
|
||||
#include "referenceinterface.hpp"
|
||||
|
||||
#include "../mwclass/container.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
|
||||
|
@ -134,7 +131,7 @@ namespace MWGui
|
|||
class ContainerWindow : public ContainerBase, public WindowBase
|
||||
{
|
||||
public:
|
||||
ContainerWindow(MWBase::WindowManager& parWindowManager,DragAndDrop* dragAndDrop);
|
||||
ContainerWindow(DragAndDrop* dragAndDrop);
|
||||
|
||||
virtual ~ContainerWindow();
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
CountDialog::CountDialog(MWBase::WindowManager& parWindowManager) :
|
||||
WindowModal("openmw_count_window.layout", parWindowManager)
|
||||
CountDialog::CountDialog() :
|
||||
WindowModal("openmw_count_window.layout")
|
||||
{
|
||||
getWidget(mSlider, "CountSlider");
|
||||
getWidget(mItemEdit, "ItemEdit");
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#ifndef MWGUI_COUNTDIALOG_H
|
||||
#define MWGUI_COUNTDIALOG_H
|
||||
|
||||
#include "window_base.hpp"
|
||||
#include "windowbase.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class CountDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
CountDialog(MWBase::WindowManager& parWindowManager);
|
||||
CountDialog();
|
||||
void open(const std::string& item, const std::string& message, const int maxCount);
|
||||
|
||||
typedef MyGUI::delegates::CMultiDelegate2<MyGUI::Widget*, int> EventHandle_WidgetInt;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <MyGUI_IPointer.h>
|
||||
#include <MyGUI_ResourceImageSet.h>
|
||||
#include <MyGUI_RTTI.h>
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "../mwdialogue/dialoguemanagerimp.hpp"
|
||||
|
||||
#include "dialogue_history.hpp"
|
||||
#include "dialoguehistory.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include "list.hpp"
|
||||
#include "tradewindow.hpp"
|
||||
|
@ -55,8 +55,8 @@ bool sortByLength (const std::string& left, const std::string& right)
|
|||
|
||||
|
||||
|
||||
PersuasionDialog::PersuasionDialog(MWBase::WindowManager &parWindowManager)
|
||||
: WindowModal("openmw_persuasion_dialog.layout", parWindowManager)
|
||||
PersuasionDialog::PersuasionDialog()
|
||||
: WindowModal("openmw_persuasion_dialog.layout")
|
||||
{
|
||||
getWidget(mCancelButton, "CancelButton");
|
||||
getWidget(mAdmireButton, "AdmireButton");
|
||||
|
@ -89,17 +89,17 @@ void PersuasionDialog::onPersuade(MyGUI::Widget *sender)
|
|||
else if (sender == mTauntButton) type = MWBase::MechanicsManager::PT_Taunt;
|
||||
else if (sender == mBribe10Button)
|
||||
{
|
||||
mWindowManager.getTradeWindow()->addOrRemoveGold(-10);
|
||||
MWBase::Environment::get().getWindowManager()->getTradeWindow()->addOrRemoveGold(-10);
|
||||
type = MWBase::MechanicsManager::PT_Bribe10;
|
||||
}
|
||||
else if (sender == mBribe100Button)
|
||||
{
|
||||
mWindowManager.getTradeWindow()->addOrRemoveGold(-100);
|
||||
MWBase::Environment::get().getWindowManager()->getTradeWindow()->addOrRemoveGold(-100);
|
||||
type = MWBase::MechanicsManager::PT_Bribe100;
|
||||
}
|
||||
else /*if (sender == mBribe1000Button)*/
|
||||
{
|
||||
mWindowManager.getTradeWindow()->addOrRemoveGold(-1000);
|
||||
MWBase::Environment::get().getWindowManager()->getTradeWindow()->addOrRemoveGold(-1000);
|
||||
type = MWBase::MechanicsManager::PT_Bribe1000;
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ void PersuasionDialog::open()
|
|||
WindowModal::open();
|
||||
center();
|
||||
|
||||
int playerGold = mWindowManager.getInventoryWindow()->getPlayerGold();
|
||||
int playerGold = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold();
|
||||
|
||||
mBribe10Button->setEnabled (playerGold >= 10);
|
||||
mBribe100Button->setEnabled (playerGold >= 100);
|
||||
|
@ -124,9 +124,9 @@ void PersuasionDialog::open()
|
|||
|
||||
// --------------------------------------------------------------------------------------------------
|
||||
|
||||
DialogueWindow::DialogueWindow(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_dialogue_window.layout", parWindowManager)
|
||||
, mPersuasionDialog(parWindowManager)
|
||||
DialogueWindow::DialogueWindow()
|
||||
: WindowBase("openmw_dialogue_window.layout")
|
||||
, mPersuasionDialog()
|
||||
, mEnabled(false)
|
||||
, mServices(0)
|
||||
{
|
||||
|
@ -251,45 +251,45 @@ void DialogueWindow::onSelectTopic(const std::string& topic, int id)
|
|||
}
|
||||
else if (topic == gmst.find("sCompanionShare")->getString())
|
||||
{
|
||||
mWindowManager.pushGuiMode(GM_Companion);
|
||||
mWindowManager.showCompanionWindow(mPtr);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Companion);
|
||||
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mPtr);
|
||||
}
|
||||
else if (!MWBase::Environment::get().getDialogueManager()->checkServiceRefused())
|
||||
{
|
||||
if (topic == gmst.find("sBarter")->getString())
|
||||
{
|
||||
mWindowManager.pushGuiMode(GM_Barter);
|
||||
mWindowManager.getTradeWindow()->startTrade(mPtr);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Barter);
|
||||
MWBase::Environment::get().getWindowManager()->getTradeWindow()->startTrade(mPtr);
|
||||
}
|
||||
else if (topic == gmst.find("sSpells")->getString())
|
||||
{
|
||||
mWindowManager.pushGuiMode(GM_SpellBuying);
|
||||
mWindowManager.getSpellBuyingWindow()->startSpellBuying(mPtr);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellBuying);
|
||||
MWBase::Environment::get().getWindowManager()->getSpellBuyingWindow()->startSpellBuying(mPtr);
|
||||
}
|
||||
else if (topic == gmst.find("sTravel")->getString())
|
||||
{
|
||||
mWindowManager.pushGuiMode(GM_Travel);
|
||||
mWindowManager.getTravelWindow()->startTravel(mPtr);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Travel);
|
||||
MWBase::Environment::get().getWindowManager()->getTravelWindow()->startTravel(mPtr);
|
||||
}
|
||||
else if (topic == gmst.find("sSpellMakingMenuTitle")->getString())
|
||||
{
|
||||
mWindowManager.pushGuiMode(GM_SpellCreation);
|
||||
mWindowManager.startSpellMaking (mPtr);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellCreation);
|
||||
MWBase::Environment::get().getWindowManager()->startSpellMaking (mPtr);
|
||||
}
|
||||
else if (topic == gmst.find("sEnchanting")->getString())
|
||||
{
|
||||
mWindowManager.pushGuiMode(GM_Enchanting);
|
||||
mWindowManager.startEnchanting (mPtr);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Enchanting);
|
||||
MWBase::Environment::get().getWindowManager()->startEnchanting (mPtr);
|
||||
}
|
||||
else if (topic == gmst.find("sServiceTrainingTitle")->getString())
|
||||
{
|
||||
mWindowManager.pushGuiMode(GM_Training);
|
||||
mWindowManager.startTraining (mPtr);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Training);
|
||||
MWBase::Environment::get().getWindowManager()->startTraining (mPtr);
|
||||
}
|
||||
else if (topic == gmst.find("sRepair")->getString())
|
||||
{
|
||||
mWindowManager.pushGuiMode(GM_MerchantRepair);
|
||||
mWindowManager.startRepair (mPtr);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_MerchantRepair);
|
||||
MWBase::Environment::get().getWindowManager()->startRepair (mPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ std::string DialogueWindow::parseText(const std::string& text)
|
|||
}
|
||||
else
|
||||
{
|
||||
if( !mWindowManager.getTranslationDataStorage().hasTranslation() )
|
||||
if( !MWBase::Environment::get().getWindowManager()->getTranslationDataStorage().hasTranslation() )
|
||||
{
|
||||
for(std::vector<std::string>::const_iterator it = topics.begin(); it != topics.end(); ++it)
|
||||
{
|
||||
|
@ -528,7 +528,7 @@ void DialogueWindow::goodbye()
|
|||
|
||||
void DialogueWindow::onReferenceUnavailable()
|
||||
{
|
||||
mWindowManager.removeGuiMode(GM_Dialogue);
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
|
||||
}
|
||||
|
||||
void DialogueWindow::onFrame()
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#ifndef MWGUI_DIALOGE_H
|
||||
#define MWGUI_DIALOGE_H
|
||||
|
||||
#include "window_base.hpp"
|
||||
#include "windowbase.hpp"
|
||||
#include "referenceinterface.hpp"
|
||||
#include <boost/array.hpp>
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
@ -29,7 +26,7 @@ namespace MWGui
|
|||
class PersuasionDialog : public WindowModal
|
||||
{
|
||||
public:
|
||||
PersuasionDialog(MWBase::WindowManager& parWindowManager);
|
||||
PersuasionDialog();
|
||||
|
||||
virtual void open();
|
||||
|
||||
|
@ -50,7 +47,7 @@ namespace MWGui
|
|||
class DialogueWindow: public WindowBase, public ReferenceInterface
|
||||
{
|
||||
public:
|
||||
DialogueWindow(MWBase::WindowManager& parWindowManager);
|
||||
DialogueWindow();
|
||||
|
||||
// Events
|
||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "dialogue_history.hpp"
|
||||
#include "dialoguehistory.hpp"
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef MWGUI_DIALOGE_HISTORY_H
|
||||
#define MWGUI_DIALOGE_HISTORY_H
|
||||
|
||||
#include <openengine/gui/layout.hpp>
|
||||
|
||||
namespace MWGui
|
|
@ -15,11 +15,10 @@ namespace MWGui
|
|||
{
|
||||
|
||||
|
||||
EnchantingDialog::EnchantingDialog(MWBase::WindowManager &parWindowManager)
|
||||
: WindowBase("openmw_enchanting_dialog.layout", parWindowManager)
|
||||
, EffectEditorBase(parWindowManager)
|
||||
EnchantingDialog::EnchantingDialog()
|
||||
: WindowBase("openmw_enchanting_dialog.layout")
|
||||
, EffectEditorBase()
|
||||
, mItemSelectionDialog(NULL)
|
||||
, mEnchanting(MWBase::Environment::get().getWorld()->getPlayer().getPlayer())
|
||||
{
|
||||
getWidget(mName, "NameEdit");
|
||||
getWidget(mCancelButton, "CancelButton");
|
||||
|
@ -33,6 +32,7 @@ namespace MWGui
|
|||
getWidget(mTypeButton, "TypeButton");
|
||||
getWidget(mBuyButton, "BuyButton");
|
||||
getWidget(mPrice, "PriceLabel");
|
||||
getWidget(mPriceText, "PriceTextLabel");
|
||||
|
||||
setWidgets(mAvailableEffectsList, mUsedEffectsView);
|
||||
|
||||
|
@ -64,22 +64,24 @@ namespace MWGui
|
|||
|
||||
mCastCost->setCaption(boost::lexical_cast<std::string>(mEnchanting.getEnchantCost()));
|
||||
|
||||
mPrice->setCaption(boost::lexical_cast<std::string>(mEnchanting.getEnchantPrice()));
|
||||
|
||||
switch(mEnchanting.getEnchantType())
|
||||
{
|
||||
case 0:
|
||||
mTypeButton->setCaption(mWindowManager.getGameSettingString("sItemCastOnce","Cast Once"));
|
||||
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastOnce","Cast Once"));
|
||||
mAddEffectDialog.constantEffect=false;
|
||||
break;
|
||||
case 1:
|
||||
mTypeButton->setCaption(mWindowManager.getGameSettingString("sItemCastWhenStrikes", "When Strikes"));
|
||||
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastWhenStrikes", "When Strikes"));
|
||||
mAddEffectDialog.constantEffect=false;
|
||||
break;
|
||||
case 2:
|
||||
mTypeButton->setCaption(mWindowManager.getGameSettingString("sItemCastWhenUsed", "When Used"));
|
||||
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastWhenUsed", "When Used"));
|
||||
mAddEffectDialog.constantEffect=false;
|
||||
break;
|
||||
case 3:
|
||||
mTypeButton->setCaption(mWindowManager.getGameSettingString("sItemCastConstant", "Cast Constant"));
|
||||
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastConstant", "Cast Constant"));
|
||||
mAddEffectDialog.constantEffect=true;
|
||||
break;
|
||||
}
|
||||
|
@ -87,6 +89,9 @@ namespace MWGui
|
|||
|
||||
void EnchantingDialog::startEnchanting (MWWorld::Ptr actor)
|
||||
{
|
||||
mEnchanting.setSelfEnchanting(false);
|
||||
mEnchanting.setEnchanter(actor);
|
||||
|
||||
mPtr = actor;
|
||||
|
||||
startEditing ();
|
||||
|
@ -94,25 +99,47 @@ namespace MWGui
|
|||
|
||||
void EnchantingDialog::startSelfEnchanting(MWWorld::Ptr soulgem)
|
||||
{
|
||||
/// \todo
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
|
||||
mEnchanting.setSelfEnchanting(true);
|
||||
mEnchanting.setEnchanter(player);
|
||||
|
||||
mPtr = player;
|
||||
startEditing();
|
||||
mEnchanting.setSoulGem(soulgem);
|
||||
|
||||
MyGUI::ImageBox* image = mSoulBox->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default);
|
||||
std::string path = std::string("icons\\");
|
||||
path += MWWorld::Class::get(soulgem).getInventoryIcon(soulgem);
|
||||
int pos = path.rfind(".");
|
||||
path.erase(pos);
|
||||
path.append(".dds");
|
||||
image->setImageTexture (path);
|
||||
image->setUserString ("ToolTipType", "ItemPtr");
|
||||
image->setUserData(soulgem);
|
||||
image->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onRemoveSoul);
|
||||
|
||||
mPrice->setVisible(false);
|
||||
mPriceText->setVisible(false);
|
||||
updateLabels();
|
||||
}
|
||||
|
||||
void EnchantingDialog::onReferenceUnavailable ()
|
||||
{
|
||||
mWindowManager.removeGuiMode (GM_Dialogue);
|
||||
mWindowManager.removeGuiMode (GM_Enchanting);
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Dialogue);
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
|
||||
}
|
||||
|
||||
void EnchantingDialog::onCancelButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
mWindowManager.removeGuiMode (GM_Enchanting);
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
|
||||
}
|
||||
|
||||
void EnchantingDialog::onSelectItem(MyGUI::Widget *sender)
|
||||
{
|
||||
delete mItemSelectionDialog;
|
||||
mItemSelectionDialog = new ItemSelectionDialog("#{sEnchantItems}",
|
||||
ContainerBase::Filter_Apparel|ContainerBase::Filter_Weapon|ContainerBase::Filter_NoMagic, mWindowManager);
|
||||
ContainerBase::Filter_Apparel|ContainerBase::Filter_Weapon|ContainerBase::Filter_NoMagic);
|
||||
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onItemSelected);
|
||||
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onItemCancel);
|
||||
mItemSelectionDialog->setVisible(true);
|
||||
|
@ -163,7 +190,7 @@ namespace MWGui
|
|||
|
||||
if(mEnchanting.getGemCharge()==0)
|
||||
{
|
||||
mWindowManager.messageBox ("#{sNotifyMessage32}");
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage32}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -200,14 +227,14 @@ namespace MWGui
|
|||
{
|
||||
delete mItemSelectionDialog;
|
||||
mItemSelectionDialog = new ItemSelectionDialog("#{sSoulGemsWithSouls}",
|
||||
ContainerBase::Filter_Misc|ContainerBase::Filter_ChargedSoulstones, mWindowManager);
|
||||
ContainerBase::Filter_Misc|ContainerBase::Filter_ChargedSoulstones);
|
||||
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onSoulSelected);
|
||||
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onSoulCancel);
|
||||
mItemSelectionDialog->setVisible(true);
|
||||
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
mItemSelectionDialog->drawItems ();
|
||||
|
||||
//mWindowManager.messageBox("#{sInventorySelectNoSoul}");
|
||||
//MWBase::Environment::get().getWindowManager()->messageBox("#{sInventorySelectNoSoul}");
|
||||
}
|
||||
|
||||
void EnchantingDialog::notifyEffectsChanged ()
|
||||
|
@ -227,45 +254,50 @@ namespace MWGui
|
|||
{
|
||||
if (mEffects.size() <= 0)
|
||||
{
|
||||
mWindowManager.messageBox ("#{sNotifyMessage30}");
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage30}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mName->getCaption ().empty())
|
||||
{
|
||||
mWindowManager.messageBox ("#{sNotifyMessage10}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (boost::lexical_cast<int>(mPrice->getCaption()) > mWindowManager.getInventoryWindow()->getPlayerGold())
|
||||
{
|
||||
mWindowManager.messageBox ("#{sNotifyMessage18}");
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage10}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mEnchanting.soulEmpty())
|
||||
{
|
||||
mWindowManager.messageBox ("#{sNotifyMessage52}");
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage52}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mEnchanting.itemEmpty())
|
||||
{
|
||||
mWindowManager.messageBox ("#{sNotifyMessage11}");
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage11}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mEnchanting.getEnchantCost() > mEnchanting.getMaxEnchantValue())
|
||||
{
|
||||
mWindowManager.messageBox ("#{sNotifyMessage29}");
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage29}");
|
||||
return;
|
||||
}
|
||||
|
||||
mEnchanting.setNewItemName(mName->getCaption());
|
||||
mEnchanting.setEffect(mEffectList);
|
||||
|
||||
mEnchanting.create();
|
||||
mWindowManager.messageBox ("#{sEnchantmentMenu12}");
|
||||
mWindowManager.removeGuiMode (GM_Enchanting);
|
||||
if (mEnchanting.getEnchantPrice() > MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getPlayerGold())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage18}");
|
||||
return;
|
||||
}
|
||||
|
||||
int result = mEnchanting.create();
|
||||
|
||||
if(result==1)
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sEnchantmentMenu12}");
|
||||
else
|
||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage34}");
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef MWGUI_ENCHANTINGDIALOG_H
|
||||
#define MWGUI_ENCHANTINGDIALOG_H
|
||||
|
||||
#include "window_base.hpp"
|
||||
#include "referenceinterface.hpp"
|
||||
#include "spellcreationdialog.hpp"
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
@ -17,7 +15,7 @@ namespace MWGui
|
|||
class EnchantingDialog : public WindowBase, public ReferenceInterface, public EffectEditorBase
|
||||
{
|
||||
public:
|
||||
EnchantingDialog(MWBase::WindowManager& parWindowManager);
|
||||
EnchantingDialog();
|
||||
virtual ~EnchantingDialog();
|
||||
|
||||
virtual void open();
|
||||
|
@ -56,6 +54,7 @@ namespace MWGui
|
|||
MyGUI::TextBox* mCastCost;
|
||||
MyGUI::TextBox* mCharge;
|
||||
MyGUI::TextBox* mPrice;
|
||||
MyGUI::TextBox* mPriceText;
|
||||
|
||||
MWMechanics::Enchanting mEnchanting;
|
||||
ESM::EffectList mEffectList;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#include "map_window.hpp"
|
||||
|
||||
#include <openengine/gui/layout.hpp>
|
||||
#include "mapwindow.hpp"
|
||||
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
|
|
@ -30,13 +30,14 @@
|
|||
namespace MWGui
|
||||
{
|
||||
|
||||
InventoryWindow::InventoryWindow(MWBase::WindowManager& parWindowManager,DragAndDrop* dragAndDrop)
|
||||
InventoryWindow::InventoryWindow(DragAndDrop* dragAndDrop)
|
||||
: ContainerBase(dragAndDrop)
|
||||
, WindowPinnableBase("openmw_inventory_window.layout", parWindowManager)
|
||||
, WindowPinnableBase("openmw_inventory_window.layout")
|
||||
, mTrading(false)
|
||||
, mLastXSize(0)
|
||||
, mLastYSize(0)
|
||||
, mPreview(MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ())
|
||||
, mPreviewDirty(true)
|
||||
{
|
||||
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize);
|
||||
|
||||
|
@ -129,7 +130,7 @@ namespace MWGui
|
|||
|
||||
void InventoryWindow::onPinToggled()
|
||||
{
|
||||
mWindowManager.setWeaponVisibility(!mPinned);
|
||||
MWBase::Environment::get().getWindowManager()->setWeaponVisibility(!mPinned);
|
||||
}
|
||||
|
||||
void InventoryWindow::onAvatarClicked(MyGUI::Widget* _sender)
|
||||
|
@ -149,6 +150,7 @@ namespace MWGui
|
|||
it = invStore.add(ptr);
|
||||
(*it).getRefData().setCount(mDragAndDrop->mDraggedCount);
|
||||
ptr = *it;
|
||||
mDragAndDrop->mDraggedFrom->notifyItemDragged(ptr, -mDragAndDrop->mDraggedCount);
|
||||
}
|
||||
|
||||
/// \todo scripts
|
||||
|
@ -161,13 +163,13 @@ namespace MWGui
|
|||
// the "Take" button should not be visible.
|
||||
// NOTE: the take button is "reset" when the window opens, so we can safely do the following
|
||||
// without screwing up future book windows
|
||||
mWindowManager.getBookWindow()->setTakeButtonShow(false);
|
||||
mWindowManager.getScrollWindow()->setTakeButtonShow(false);
|
||||
MWBase::Environment::get().getWindowManager()->getBookWindow()->setTakeButtonShow(false);
|
||||
MWBase::Environment::get().getWindowManager()->getScrollWindow()->setTakeButtonShow(false);
|
||||
|
||||
mDragAndDrop->mIsOnDragAndDrop = false;
|
||||
MyGUI::Gui::getInstance().destroyWidget(mDragAndDrop->mDraggedWidget);
|
||||
|
||||
mWindowManager.setDragDrop(false);
|
||||
MWBase::Environment::get().getWindowManager()->setDragDrop(false);
|
||||
|
||||
drawItems();
|
||||
|
||||
|
@ -223,11 +225,11 @@ namespace MWGui
|
|||
{
|
||||
invStore.equip(slot, invStore.end());
|
||||
std::string script = MWWorld::Class::get(*it).getScript(*it);
|
||||
|
||||
|
||||
// Unset OnPCEquip Variable on item's script, if it has a script with that variable declared
|
||||
if(script != "")
|
||||
(*it).mRefData->getLocals().setVarByInt(script, "onpcequip", 0);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -268,25 +270,34 @@ namespace MWGui
|
|||
mTrading = true;
|
||||
}
|
||||
|
||||
void InventoryWindow::doRenderUpdate ()
|
||||
{
|
||||
if (mPreviewDirty)
|
||||
{
|
||||
mPreviewDirty = false;
|
||||
MyGUI::IntSize size = mAvatar->getSize();
|
||||
|
||||
mPreview.update (size.width, size.height);
|
||||
mAvatarImage->setSize(MyGUI::IntSize(std::max(mAvatar->getSize().width, 512), std::max(mAvatar->getSize().height, 1024)));
|
||||
mAvatarImage->setImageTexture("CharacterPreview");
|
||||
}
|
||||
}
|
||||
|
||||
void InventoryWindow::notifyContentChanged()
|
||||
{
|
||||
// update the spell window just in case new enchanted items were added to inventory
|
||||
if (mWindowManager.getSpellWindow())
|
||||
mWindowManager.getSpellWindow()->updateSpells();
|
||||
if (MWBase::Environment::get().getWindowManager()->getSpellWindow())
|
||||
MWBase::Environment::get().getWindowManager()->getSpellWindow()->updateSpells();
|
||||
|
||||
// update selected weapon icon
|
||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
|
||||
MWWorld::ContainerStoreIterator weaponSlot = invStore.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||
if (weaponSlot == invStore.end())
|
||||
mWindowManager.unsetSelectedWeapon();
|
||||
MWBase::Environment::get().getWindowManager()->unsetSelectedWeapon();
|
||||
else
|
||||
mWindowManager.setSelectedWeapon(*weaponSlot, 100); /// \todo track weapon durability
|
||||
MWBase::Environment::get().getWindowManager()->setSelectedWeapon(*weaponSlot); /// \todo track weapon durability
|
||||
|
||||
MyGUI::IntSize size = mAvatar->getSize();
|
||||
|
||||
mPreview.update (size.width, size.height);
|
||||
mAvatarImage->setSize(MyGUI::IntSize(std::max(mAvatar->getSize().width, 512), std::max(mAvatar->getSize().height, 1024)));
|
||||
mAvatarImage->setImageTexture("CharacterPreview");
|
||||
mPreviewDirty = true;
|
||||
|
||||
mArmorRating->setCaptionWithReplacing ("#{sArmor}: "
|
||||
+ boost::lexical_cast<std::string>(static_cast<int>(MWWorld::Class::get(mPtr).getArmorRating(mPtr))));
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "../mwrender/characterpreview.hpp"
|
||||
|
||||
#include "container.hpp"
|
||||
#include "window_pinnable_base.hpp"
|
||||
#include "windowpinnablebase.hpp"
|
||||
#include "widgets.hpp"
|
||||
|
||||
namespace MWGui
|
||||
|
@ -12,10 +12,12 @@ namespace MWGui
|
|||
class InventoryWindow : public ContainerBase, public WindowPinnableBase
|
||||
{
|
||||
public:
|
||||
InventoryWindow(MWBase::WindowManager& parWindowManager,DragAndDrop* dragAndDrop);
|
||||
InventoryWindow(DragAndDrop* dragAndDrop);
|
||||
|
||||
virtual void open();
|
||||
|
||||
void doRenderUpdate();
|
||||
|
||||
/// start trading, disables item drag&drop
|
||||
void startTrade();
|
||||
|
||||
|
@ -34,6 +36,8 @@ namespace MWGui
|
|||
}
|
||||
|
||||
protected:
|
||||
bool mPreviewDirty;
|
||||
|
||||
MyGUI::Widget* mAvatar;
|
||||
MyGUI::ImageBox* mAvatarImage;
|
||||
MyGUI::TextBox* mArmorRating;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue