Merge remote-tracking branch 'upstream/master' into multiple_esm_esp

Conflicts:
	apps/openmw/mwrender/terrain.cpp
	components/esm/loadland.hpp
	components/esm_store/reclists.hpp
actorid
Mark Siewert 12 years ago
commit 1f961d575e

@ -1,5 +1,7 @@
set(ESMTOOL
esmtool.cpp
record.hpp
record.cpp
)
source_group(apps\\esmtool FILES ${ESMTOOL})

@ -1,20 +1,50 @@
#include <iostream>
#include <vector>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <boost/program_options.hpp>
#include <components/esm/esm_reader.hpp>
#include <components/esm/esmreader.hpp>
#include <components/esm/esmwriter.hpp>
#include <components/esm/records.hpp>
#define ESMTOOL_VERSION 1.1
#include "record.hpp"
using namespace std;
using namespace ESM;
#define ESMTOOL_VERSION 1.1
// Create a local alias for brevity
namespace bpo = boost::program_options;
void printRaw(ESMReader &esm);
void loadCell(Cell &cell, ESMReader &esm, bool quiet);
struct ESMData
{
std::string author;
std::string description;
int version;
int type;
ESM::ESMReader::MasterList masters;
std::deque<EsmTool::RecordBase *> mRecords;
std::map<ESM::Cell *, std::deque<ESM::CellRef> > mCellRefs;
std::map<int, int> mRecordStats;
static const std::set<int> sLabeledRec;
};
static const int sLabeledRecIds[] = {
ESM::REC_GLOB, ESM::REC_CLAS, ESM::REC_FACT, ESM::REC_RACE, ESM::REC_SOUN,
ESM::REC_REGN, ESM::REC_BSGN, ESM::REC_LTEX, ESM::REC_STAT, ESM::REC_DOOR,
ESM::REC_MISC, ESM::REC_WEAP, ESM::REC_CONT, ESM::REC_SPEL, ESM::REC_CREA,
ESM::REC_BODY, ESM::REC_LIGH, ESM::REC_ENCH, ESM::REC_NPC_, ESM::REC_ARMO,
ESM::REC_CLOT, ESM::REC_REPA, ESM::REC_ACTI, ESM::REC_APPA, ESM::REC_LOCK,
ESM::REC_PROB, ESM::REC_INGR, ESM::REC_BOOK, ESM::REC_ALCH, ESM::REC_LEVI,
ESM::REC_LEVC, ESM::REC_SNDG, ESM::REC_CELL, ESM::REC_DIAL
};
const std::set<int> ESMData::sLabeledRec =
std::set<int>(sLabeledRecIds, sLabeledRecIds + 34);
// Based on the legacy struct
struct Arguments
@ -22,13 +52,20 @@ struct Arguments
unsigned int raw_given;
unsigned int quiet_given;
unsigned int loadcells_given;
std::string mode;
std::string encoding;
std::string filename;
std::string outname;
ESMData data;
ESM::ESMReader reader;
ESM::ESMWriter writer;
};
bool parseOptions (int argc, char** argv, Arguments &info)
{
bpo::options_description desc("Inspect and extract from Morrowind ES files (ESM, ESP, ESS)\nSyntax: esmtool [options] file \nAllowed options");
bpo::options_description desc("Inspect and extract from Morrowind ES files (ESM, ESP, ESS)\nSyntax: esmtool [options] mode infile [outfile]\nAllowed modes:\n dump\t Dumps all readable data from the input file.\n clone\t Clones the input file to the output file.\n comp\t Compares the given files.\n\nAllowed options");
desc.add_options()
("help,h", "print help message.")
@ -38,11 +75,11 @@ bool parseOptions (int argc, char** argv, Arguments &info)
("loadcells,C", "Browse through contents of all cells.")
( "encoding,e", bpo::value<std::string>(&(info.encoding))->
default_value("win1252"),
"Character encoding used in ESMTool:\n"
"\n\twin1250 - Central and Eastern European such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, Croatian, Serbian (Latin script), Romanian and Albanian languages\n"
"\n\twin1251 - Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic and other languages\n"
"\n\twin1252 - Western European (Latin) alphabet, used by default")
default_value("win1252"),
"Character encoding used in ESMTool:\n"
"\n\twin1250 - Central and Eastern European such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, Croatian, Serbian (Latin script), Romanian and Albanian languages\n"
"\n\twin1251 - Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic and other languages\n"
"\n\twin1252 - Western European (Latin) alphabet, used by default")
;
std::string finalText = "\nIf no option is given, the default action is to parse all records in the archive\nand display diagnostic information.";
@ -51,11 +88,12 @@ bool parseOptions (int argc, char** argv, Arguments &info)
bpo::options_description hidden("Hidden Options");
hidden.add_options()
( "input-file,i", bpo::value< vector<std::string> >(), "input file")
( "mode,m", bpo::value<std::string>(), "esmtool mode")
( "input-file,i", bpo::value< std::vector<std::string> >(), "input file")
;
bpo::positional_options_description p;
p.add("input-file", -1);
p.add("mode", 1).add("input-file", 2);
// there might be a better way to do this
bpo::options_description all;
@ -77,23 +115,39 @@ bool parseOptions (int argc, char** argv, Arguments &info)
std::cout << "ESMTool version " << ESMTOOL_VERSION << std::endl;
return false;
}
if (!variables.count("mode"))
{
std::cout << "No mode specified!" << std::endl << std::endl
<< desc << finalText << std::endl;
return false;
}
if ( !variables.count("input-file") )
info.mode = variables["mode"].as<std::string>();
if (!(info.mode == "dump" || info.mode == "clone" || info.mode == "comp"))
{
std::cout << "\nERROR: missing ES file\n\n";
std::cout << desc << finalText << std::endl;
std::cout << std::endl << "ERROR: invalid mode \"" << info.mode << "\"" << std::endl << std::endl
<< desc << finalText << std::endl;
return false;
}
// handling gracefully the user adding multiple files
if (variables["input-file"].as< vector<std::string> >().size() > 1)
if ( !variables.count("input-file") )
{
std::cout << "\nERROR: more than one ES file specified\n\n";
std::cout << "\nERROR: missing ES file\n\n";
std::cout << desc << finalText << std::endl;
return false;
}
info.filename = variables["input-file"].as< vector<std::string> >()[0];
// handling gracefully the user adding multiple files
/* if (variables["input-file"].as< std::vector<std::string> >().size() > 1)
{
std::cout << "\nERROR: more than one ES file specified\n\n";
std::cout << desc << finalText << std::endl;
return false;
}*/
info.filename = variables["input-file"].as< std::vector<std::string> >()[0];
if (variables["input-file"].as< std::vector<std::string> >().size() > 1)
info.outname = variables["input-file"].as< std::vector<std::string> >()[1];
info.raw_given = variables.count ("raw");
info.quiet_given = variables.count ("quiet");
@ -122,288 +176,350 @@ bool parseOptions (int argc, char** argv, Arguments &info)
return true;
}
void printRaw(ESM::ESMReader &esm);
void loadCell(ESM::Cell &cell, ESM::ESMReader &esm, Arguments& info);
int load(Arguments& info);
int clone(Arguments& info);
int comp(Arguments& info);
int main(int argc, char**argv)
{
Arguments info;
if(!parseOptions (argc, argv, info))
return 1;
Arguments info;
if(!parseOptions (argc, argv, info))
return 1;
if (info.mode == "dump")
return load(info);
else if (info.mode == "clone")
return clone(info);
else if (info.mode == "comp")
return comp(info);
else
{
std::cout << "Invalid or no mode specified, dying horribly. Have a nice day." << std::endl;
return 1;
}
ESMReader esm;
esm.setEncoding(info.encoding);
return 0;
}
string filename = info.filename;
cout << "\nFile: " << filename << endl;
void loadCell(ESM::Cell &cell, ESM::ESMReader &esm, Arguments& info)
{
bool quiet = (info.quiet_given || info.mode == "clone");
bool save = (info.mode == "clone");
try {
// Skip back to the beginning of the reference list
cell.restore(esm);
if(info.raw_given)
// Loop through all the references
ESM::CellRef ref;
if(!quiet) std::cout << " References:\n";
while(cell.getNextRef(esm, ref))
{
cout << "RAW file listing:\n";
if (save) {
info.data.mCellRefs[&cell].push_back(ref);
}
esm.openRaw(filename);
if(quiet) continue;
printRaw(esm);
std::cout << " Refnum: " << ref.mRefnum << std::endl;
std::cout << " ID: '" << ref.mRefID << "'\n";
std::cout << " Owner: '" << ref.mOwner << "'\n";
std::cout << " INTV: " << ref.mIntv << " NAM9: " << ref.mIntv << std::endl;
}
}
return 0;
void printRaw(ESM::ESMReader &esm)
{
while(esm.hasMoreRecs())
{
ESM::NAME n = esm.getRecName();
std::cout << "Record: " << n.toString() << std::endl;
esm.getRecHeader();
while(esm.hasMoreSubs())
{
uint64_t offs = esm.getOffset();
esm.getSubName();
esm.skipHSub();
n = esm.retSubName();
std::cout << " " << n.toString() << " - " << esm.getSubSize()
<< " bytes @ 0x" << std::hex << offs << "\n";
}
}
}
int load(Arguments& info)
{
ESM::ESMReader& esm = info.reader;
esm.setEncoding(info.encoding);
bool quiet = info.quiet_given;
bool loadCells = info.loadcells_given;
std::string filename = info.filename;
std::cout << "Loading file: " << filename << std::endl;
esm.open(filename);
std::list<int> skipped;
cout << "Author: " << esm.getAuthor() << endl;
cout << "Description: " << esm.getDesc() << endl;
cout << "File format version: " << esm.getFVer() << endl;
cout << "Special flag: " << esm.getSpecial() << endl;
cout << "Masters:\n";
ESMReader::MasterList m = esm.getMasters();
for(unsigned int i=0;i<m.size();i++)
cout << " " << m[i].name << ", " << m[i].size << " bytes\n";
try {
// Loop through all records
while(esm.hasMoreRecs())
{
NAME n = esm.getRecName();
esm.getRecHeader();
string id = esm.getHNOString("NAME");
if(!quiet)
cout << "\nRecord: " << n.toString()
<< " '" << id << "'\n";
switch(n.val)
if(info.raw_given && info.mode == "dump")
{
case REC_ACTI:
{
Activator ac;
ac.load(esm);
if(quiet) break;
cout << " Name: " << ac.name << endl;
cout << " Mesh: " << ac.model << endl;
cout << " Script: " << ac.script << endl;
break;
}
case REC_ALCH:
{
Potion p;
p.load(esm, id);
if(quiet) break;
cout << " Name: " << p.name << endl;
break;
}
case REC_APPA:
{
Apparatus p;
p.load(esm);
if(quiet) break;
cout << " Name: " << p.name << endl;
break;
}
case REC_ARMO:
{
Armor am;
am.load(esm);
if(quiet) break;
cout << " Name: " << am.name << endl;
cout << " Mesh: " << am.model << endl;
cout << " Icon: " << am.icon << endl;
cout << " Script: " << am.script << endl;
cout << " Enchantment: " << am.enchant << endl;
cout << " Type: " << am.data.type << endl;
cout << " Weight: " << am.data.weight << endl;
break;
}
case REC_BODY:
{
BodyPart bp;
bp.load(esm);
if(quiet) break;
cout << " Name: " << bp.name << endl;
cout << " Mesh: " << bp.model << endl;
break;
}
case REC_BOOK:
{
Book b;
b.load(esm, id);
if(quiet) break;
cout << " Name: " << b.name << endl;
cout << " Mesh: " << b.model << endl;
break;
}
case REC_BSGN:
{
BirthSign bs;
bs.load(esm);
if(quiet) break;
cout << " Name: " << bs.name << endl;
cout << " Texture: " << bs.texture << endl;
cout << " Description: " << bs.description << endl;
break;
}
case REC_CELL:
{
Cell b;
b.load(esm);
std::cout << "RAW file listing:\n";
esm.openRaw(filename);
printRaw(esm);
return 0;
}
bool quiet = (info.quiet_given || info.mode == "clone");
bool loadCells = (info.loadcells_given || info.mode == "clone");
bool save = (info.mode == "clone");
esm.open(filename);
info.data.author = esm.getAuthor();
info.data.description = esm.getDesc();
info.data.masters = esm.getMasters();
info.data.version = esm.getVer();
info.data.type = esm.getType();
if (!quiet)
{
std::cout << "Author: " << esm.getAuthor() << std::endl
<< "Description: " << esm.getDesc() << std::endl
<< "File format version: " << esm.getFVer() << std::endl
<< "Special flag: " << esm.getSpecial() << std::endl;
ESM::ESMReader::MasterList m = esm.getMasters();
if (!m.empty())
{
std::cout << "Masters:" << std::endl;
for(unsigned int i=0;i<m.size();i++)
std::cout << " " << m[i].name << ", " << m[i].size << " bytes" << std::endl;
}
}
// Loop through all records
while(esm.hasMoreRecs())
{
ESM::NAME n = esm.getRecName();
uint32_t flags;
esm.getRecHeader(flags);
std::string id = esm.getHNOString("NAME");
if(!quiet)
{
cout << " Name: " << b.name << endl;
cout << " Region: " << b.region << endl;
}
if(loadCells)
loadCell(b, esm, quiet);
break;
}
case REC_CLAS:
{
Class b;
b.load(esm);
if(quiet) break;
cout << " Name: " << b.name << endl;
cout << " Description: " << b.description << endl;
break;
}
case REC_CLOT:
{
Clothing b;
b.load(esm);
if(quiet) break;
cout << " Name: " << b.name << endl;
break;
}
case REC_CONT:
{
Container b;
b.load(esm);
if(quiet) break;
cout << " Name: " << b.name << endl;
break;
}
case REC_CREA:
{
Creature b;
b.load(esm, id);
if(quiet) break;
cout << " Name: " << b.name << endl;
break;
}
case REC_DIAL:
{
Dialogue b;
b.load(esm);
break;
}
case REC_DOOR:
{
Door d;
d.load(esm);
if(quiet) break;
cout << " Name: " << d.name << endl;
cout << " Mesh: " << d.model << endl;
cout << " Script: " << d.script << endl;
cout << " OpenSound: " << d.openSound << endl;
cout << " CloseSound: " << d.closeSound << endl;
break;
}
case REC_ENCH:
{
Enchantment b;
b.load(esm);
break;
}
case REC_GMST:
{
GameSetting b;
b.id = id;
b.load(esm);
if(quiet) break;
cout << " Value: ";
if(b.type == VT_String)
cout << "'" << b.str << "' (string)";
else if(b.type == VT_Float)
cout << b.f << " (float)";
else if(b.type == VT_Int)
cout << b.i << " (int)";
cout << "\n Dirty: " << b.dirty << endl;
break;
}
case REC_INFO:
{
DialInfo p;
p.load(esm);
if(quiet) break;
cout << " Id: " << p.id << endl;
cout << " Text: " << p.response << endl;
break;
}
case REC_SOUN:
{
Sound d;
d.load(esm);
if(quiet) break;
cout << " Sound: " << d.sound << endl;
cout << " Volume: " << (int)d.data.volume << endl;
break;
}
case REC_SPEL:
{
Spell s;
s.load(esm);
if(quiet) break;
cout << " Name: " << s.name << endl;
break;
}
default:
esm.skipRecord();
if(quiet) break;
cout << " Skipping\n";
std::cout << "\nRecord: " << n.toString()
<< " '" << id << "'\n";
EsmTool::RecordBase *record =
EsmTool::RecordBase::create(n.val);
if (record == 0) {
if (std::find(skipped.begin(), skipped.end(), n.val) == skipped.end())
{
std::cout << "Skipping " << n.toString() << " records." << std::endl;
skipped.push_back(n.val);
}
esm.skipRecord();
if (quiet) break;
std::cout << " Skipping\n";
} else {
if (record->getType() == ESM::REC_GMST) {
// preset id for GameSetting record
record->cast<ESM::GameSetting>()->get().mId = id;
}
record->setId(id);
record->setFlags((int) flags);
record->load(esm);
if (!quiet) {
record->print();
}
if (record->getType() == ESM::REC_CELL && loadCells) {
loadCell(record->cast<ESM::Cell>()->get(), esm, info);
}
if (save) {
info.data.mRecords.push_back(record);
} else {
delete record;
}
++info.data.mRecordStats[n.val];
}
}
}
} catch(exception &e)
{
cout << "\nERROR:\n\n " << e.what() << endl;
return 1;
} catch(std::exception &e) {
std::cout << "\nERROR:\n\n " << e.what() << std::endl;
typedef std::deque<EsmTool::RecordBase *> RecStore;
RecStore &store = info.data.mRecords;
for (RecStore::iterator it = store.begin(); it != store.end(); ++it)
{
delete *it;
}
store.clear();
return 1;
}
return 0;
return 0;
}
void loadCell(Cell &cell, ESMReader &esm, bool quiet)
#include <iomanip>
int clone(Arguments& info)
{
// Skip back to the beginning of the reference list
cell.restore(esm);
if (info.outname.empty())
{
std::cout << "You need to specify an output name" << std::endl;
return 1;
}
// Loop through all the references
CellRef ref;
if(!quiet) cout << " References:\n";
while(cell.getNextRef(esm, ref))
if (load(info) != 0)
{
if(quiet) continue;
std::cout << "Failed to load, aborting." << std::endl;
return 1;
}
int recordCount = info.data.mRecords.size();
int digitCount = 1; // For a nicer output
if (recordCount > 9) ++digitCount;
if (recordCount > 99) ++digitCount;
if (recordCount > 999) ++digitCount;
if (recordCount > 9999) ++digitCount;
if (recordCount > 99999) ++digitCount;
if (recordCount > 999999) ++digitCount;
std::cout << "Loaded " << recordCount << " records:" << std::endl << std::endl;
cout << " Refnum: " << ref.refnum << endl;
cout << " ID: '" << ref.refID << "'\n";
cout << " Owner: '" << ref.owner << "'\n";
cout << " INTV: " << ref.intv << " NAM9: " << ref.intv << endl;
ESM::NAME name;
int i = 0;
typedef std::map<int, int> Stats;
Stats &stats = info.data.mRecordStats;
for (Stats::iterator it = stats.begin(); it != stats.end(); ++it)
{
name.val = it->first;
float amount = it->second;
std::cout << std::setw(digitCount) << amount << " " << name.toString() << " ";
if (++i % 3 == 0)
std::cout << std::endl;
}
}
if (i % 3 != 0)
std::cout << std::endl;
void printRaw(ESMReader &esm)
{
while(esm.hasMoreRecs())
std::cout << std::endl << "Saving records to: " << info.outname << "..." << std::endl;
ESM::ESMWriter& esm = info.writer;
esm.setEncoding(info.encoding);
esm.setAuthor(info.data.author);
esm.setDescription(info.data.description);
esm.setVersion(info.data.version);
esm.setType(info.data.type);
for (ESM::ESMReader::MasterList::iterator it = info.data.masters.begin(); it != info.data.masters.end(); ++it)
esm.addMaster(it->name, it->size);
std::fstream save(info.outname.c_str(), std::fstream::out | std::fstream::binary);
esm.save(save);
int saved = 0;
typedef std::deque<EsmTool::RecordBase *> Records;
Records &records = info.data.mRecords;
for (Records::iterator it = records.begin(); it != records.end() && i > 0; ++it)
{
NAME n = esm.getRecName();
cout << "Record: " << n.toString() << endl;
esm.getRecHeader();
while(esm.hasMoreSubs())
EsmTool::RecordBase *record = *it;
name.val = record->getType();
esm.startRecord(name.toString(), record->getFlags());
// TODO wrap this with std::set
if (ESMData::sLabeledRec.count(name.val) > 0) {
esm.writeHNCString("NAME", record->getId());
} else {
esm.writeHNOString("NAME", record->getId());
}
record->save(esm);
if (name.val == ESM::REC_CELL) {
ESM::Cell *ptr = &record->cast<ESM::Cell>()->get();
if (!info.data.mCellRefs[ptr].empty()) {
typedef std::deque<ESM::CellRef> RefList;
RefList &refs = info.data.mCellRefs[ptr];
for (RefList::iterator it = refs.begin(); it != refs.end(); ++it)
{
it->save(esm);
}
}
}
esm.endRecord(name.toString());
saved++;
int perc = (saved / (float)recordCount)*100;
if (perc % 10 == 0)
{
uint64_t offs = esm.getOffset();
esm.getSubName();
esm.skipHSub();
n = esm.retSubName();
cout << " " << n.toString() << " - " << esm.getSubSize()
<< " bytes @ 0x" << hex << offs << "\n";
std::cerr << "\r" << perc << "%";
}
}
std::cout << "\rDone!" << std::endl;
esm.close();
save.close();
return 0;
}
int comp(Arguments& info)
{
if (info.filename.empty() || info.outname.empty())
{
std::cout << "You need to specify two input files" << std::endl;
return 1;
}
Arguments fileOne;
Arguments fileTwo;
fileOne.raw_given = 0;
fileTwo.raw_given = 0;
fileOne.mode = "clone";
fileTwo.mode = "clone";
fileOne.encoding = info.encoding;
fileTwo.encoding = info.encoding;
fileOne.filename = info.filename;
fileTwo.filename = info.outname;
if (load(fileOne) != 0)
{
std::cout << "Failed to load " << info.filename << ", aborting comparison." << std::endl;
return 1;
}
if (load(fileTwo) != 0)
{
std::cout << "Failed to load " << info.outname << ", aborting comparison." << std::endl;
return 1;
}
if (fileOne.data.mRecords.size() != fileTwo.data.mRecords.size())
{
std::cout << "Not equal, different amount of records." << std::endl;
return 1;
}
return 0;
}

@ -0,0 +1,568 @@
#include "record.hpp"
#include <iostream>
namespace EsmTool {
RecordBase *
RecordBase::create(int type)
{
RecordBase *record = 0;
switch (type) {
case ESM::REC_ACTI:
{
record = new EsmTool::Record<ESM::Activator>;
break;
}
case ESM::REC_ALCH:
{
record = new EsmTool::Record<ESM::Potion>;
break;
}
case ESM::REC_APPA:
{
record = new EsmTool::Record<ESM::Apparatus>;
break;
}
case ESM::REC_ARMO:
{
record = new EsmTool::Record<ESM::Armor>;
break;
}
case ESM::REC_BODY:
{
record = new EsmTool::Record<ESM::BodyPart>;
break;
}
case ESM::REC_BOOK:
{
record = new EsmTool::Record<ESM::Book>;
break;
}
case ESM::REC_BSGN:
{
record = new EsmTool::Record<ESM::BirthSign>;
break;
}
case ESM::REC_CELL:
{
record = new EsmTool::Record<ESM::Cell>;
break;
}
case ESM::REC_CLAS:
{
record = new EsmTool::Record<ESM::Class>;
break;
}
case ESM::REC_CLOT:
{
record = new EsmTool::Record<ESM::Clothing>;
break;
}
case ESM::REC_CONT:
{
record = new EsmTool::Record<ESM::Container>;
break;
}
case ESM::REC_CREA:
{
record = new EsmTool::Record<ESM::Creature>;
break;
}
case ESM::REC_DIAL:
{
record = new EsmTool::Record<ESM::Dialogue>;
break;
}
case ESM::REC_DOOR:
{
record = new EsmTool::Record<ESM::Door>;
break;
}
case ESM::REC_ENCH:
{
record = new EsmTool::Record<ESM::Enchantment>;
break;
}
case ESM::REC_FACT:
{
record = new EsmTool::Record<ESM::Faction>;
break;
}
case ESM::REC_GLOB:
{
record = new EsmTool::Record<ESM::Global>;
break;
}
case ESM::REC_GMST:
{
record = new EsmTool::Record<ESM::GameSetting>;
break;
}
case ESM::REC_INFO:
{
record = new EsmTool::Record<ESM::DialInfo>;
break;
}
case ESM::REC_INGR:
{
record = new EsmTool::Record<ESM::Ingredient>;
break;
}
case ESM::REC_LAND:
{
record = new EsmTool::Record<ESM::Land>;
break;
}
case ESM::REC_LEVI:
{
record = new EsmTool::Record<ESM::ItemLevList>;
break;
}
case ESM::REC_LEVC:
{
record = new EsmTool::Record<ESM::CreatureLevList>;
break;
}
case ESM::REC_LIGH:
{
record = new EsmTool::Record<ESM::Light>;
break;
}
case ESM::REC_LOCK:
{
record = new EsmTool::Record<ESM::Tool>;
break;
}
case ESM::REC_LTEX:
{
record = new EsmTool::Record<ESM::LandTexture>;
break;
}
case ESM::REC_MISC:
{
record = new EsmTool::Record<ESM::Miscellaneous>;
break;
}
case ESM::REC_MGEF:
{
record = new EsmTool::Record<ESM::MagicEffect>;
break;
}
case ESM::REC_NPC_:
{
record = new EsmTool::Record<ESM::NPC>;
break;
}
case ESM::REC_PGRD:
{
record = new EsmTool::Record<ESM::Pathgrid>;
break;
}
case ESM::REC_PROB:
{
record = new EsmTool::Record<ESM::Probe>;
break;
}
case ESM::REC_RACE:
{
record = new EsmTool::Record<ESM::Race>;
break;
}
case ESM::REC_REGN:
{
record = new EsmTool::Record<ESM::Region>;
break;
}
case ESM::REC_REPA:
{
record = new EsmTool::Record<ESM::Repair>;
break;
}
case ESM::REC_SCPT:
{
record = new EsmTool::Record<ESM::Script>;
break;
}
case ESM::REC_SKIL:
{
record = new EsmTool::Record<ESM::Skill>;
break;
}
case ESM::REC_SNDG:
{
record = new EsmTool::Record<ESM::SoundGenerator>;
break;
}
case ESM::REC_SOUN:
{
record = new EsmTool::Record<ESM::Sound>;
break;
}
case ESM::REC_SPEL:
{
record = new EsmTool::Record<ESM::Spell>;
break;
}
case ESM::REC_STAT:
{
record = new EsmTool::Record<ESM::Static>;
break;
}
case ESM::REC_WEAP:
{
record = new EsmTool::Record<ESM::Weapon>;
break;
}
case ESM::REC_SSCR:
{
record = new EsmTool::Record<ESM::StartScript>;
break;
}
default:
record = 0;
}
if (record) {
record->mType = type;
}
return record;
}
template<>
void Record<ESM::Activator>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Mesh: " << mData.mModel << std::endl;
std::cout << " Script: " << mData.mScript << std::endl;
}
template<>
void Record<ESM::Potion>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::Armor>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Mesh: " << mData.mModel << std::endl;
std::cout << " Icon: " << mData.mIcon << std::endl;
std::cout << " Script: " << mData.mScript << std::endl;
std::cout << " Enchantment: " << mData.mEnchant << std::endl;
std::cout << " Type: " << mData.mData.mType << std::endl;
std::cout << " Weight: " << mData.mData.mWeight << std::endl;
}
template<>
void Record<ESM::Apparatus>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::BodyPart>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Mesh: " << mData.mModel << std::endl;
}
template<>
void Record<ESM::Book>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Mesh: " << mData.mModel << std::endl;
}
template<>
void Record<ESM::BirthSign>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Texture: " << mData.mTexture << std::endl;
std::cout << " Description: " << mData.mDescription << std::endl;
}
template<>
void Record<ESM::Cell>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Region: " << mData.mRegion << std::endl;
}
template<>
void Record<ESM::Class>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Description: " << mData.mDescription << std::endl;
}
template<>
void Record<ESM::Clothing>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::Container>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::Creature>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::Dialogue>::print()
{
// nothing to print
}
template<>
void Record<ESM::Door>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Mesh: " << mData.mModel << std::endl;
std::cout << " Script: " << mData.mScript << std::endl;
std::cout << " OpenSound: " << mData.mOpenSound << std::endl;
std::cout << " CloseSound: " << mData.mCloseSound << std::endl;
}
template<>
void Record<ESM::Enchantment>::print()
{
// nothing to print
}
template<>
void Record<ESM::Faction>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Attr1: " << mData.mData.mAttribute1 << std::endl;
std::cout << " Attr2: " << mData.mData.mAttribute2 << std::endl;
std::cout << " Hidden: " << mData.mData.mIsHidden << std::endl;
}
template<>
void Record<ESM::Global>::print()
{
// nothing to print
}
template<>
void Record<ESM::GameSetting>::print()
{
std::cout << " Value: ";
switch (mData.mType) {
case ESM::VT_String:
std::cout << "'" << mData.mStr << "' (std::string)";
break;
case ESM::VT_Float:
std::cout << mData.mF << " (float)";
break;
case ESM::VT_Int:
std::cout << mData.mI << " (int)";
break;
default:
std::cout << "unknown type";
}
std::cout << "\n Dirty: " << mData.mDirty << std::endl;
}
template<>
void Record<ESM::DialInfo>::print()
{
std::cout << " Id: " << mData.mId << std::endl;
std::cout << " Text: " << mData.mResponse << std::endl;
}
template<>
void Record<ESM::Ingredient>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Weight: " << mData.mData.mWeight << std::endl;
std::cout << " Value: " << mData.mData.mValue << std::endl;
}
template<>
void Record<ESM::Land>::print()
{
std::cout << " Coords: [" << mData.mX << "," << mData.mY << "]" << std::endl;
}
template<>
void Record<ESM::CreatureLevList>::print()
{
std::cout << " Number of items: " << mData.mList.size() << std::endl;
}
template<>
void Record<ESM::ItemLevList>::print()
{
std::cout << " Number of items: " << mData.mList.size() << std::endl;
}
template<>
void Record<ESM::Light>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Weight: " << mData.mData.mWeight << std::endl;
std::cout << " Value: " << mData.mData.mValue << std::endl;
}
template<>
void Record<ESM::Tool>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Quality: " << mData.mData.mQuality << std::endl;
}
template<>
void Record<ESM::Probe>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Quality: " << mData.mData.mQuality << std::endl;
}
template<>
void Record<ESM::Repair>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Quality: " << mData.mData.mQuality << std::endl;
}
template<>
void Record<ESM::LandTexture>::print()
{
std::cout << " Id: " << mData.mId << std::endl;
std::cout << " Texture: " << mData.mTexture << std::endl;
}
template<>
void Record<ESM::MagicEffect>::print()
{
std::cout << " Index: " << mData.mIndex << std::endl;
const char *text = "Positive";
if (mData.mData.mFlags & ESM::MagicEffect::Negative) {
text = "Negative";
}
std::cout << " " << text << std::endl;
}
template<>
void Record<ESM::Miscellaneous>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Value: " << mData.mData.mValue << std::endl;
}
template<>
void Record<ESM::NPC>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Race: " << mData.mRace << std::endl;
}
template<>
void Record<ESM::Pathgrid>::print()
{
std::cout << " Cell: " << mData.mCell << std::endl;
std::cout << " Point count: " << mData.mPoints.size() << std::endl;
std::cout << " Edge count: " << mData.mEdges.size() << std::endl;
}
template<>
void Record<ESM::Race>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Length: " << mData.mData.mHeight.mMale << "m " << mData.mData.mHeight.mFemale << "f" << std::endl;
}
template<>
void Record<ESM::Region>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::Script>::print()
{
std::cout << " Name: " << mData.mData.mName.toString() << std::endl;
}
template<>
void Record<ESM::Skill>::print()
{
std::cout << " ID: " << mData.mIndex << std::endl;
const char *spec = 0;
int specId = mData.mData.mSpecialization;
if (specId == 0) {
spec = "Combat";
} else if (specId == 1) {
spec = "Magic";
} else {
spec = "Stealth";
}
std::cout << " Type: " << spec << std::endl;
}
template<>
void Record<ESM::SoundGenerator>::print()
{
std::cout << " Creature: " << mData.mCreature << std::endl;
std::cout << " Sound: " << mData.mSound << std::endl;
}
template<>
void Record<ESM::Sound>::print()
{
std::cout << " Sound: " << mData.mSound << std::endl;
std::cout << " Volume: " << mData.mData.mVolume << std::endl;
}
template<>
void Record<ESM::Spell>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::StartScript>::print()
{
std::cout << "Start script: " << mData.mScript << std::endl;
}
template<>
void Record<ESM::Static>::print()
{
std::cout << " Model: " << mData.mModel << std::endl;
}
template<>
void Record<ESM::Weapon>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Chop: " << mData.mData.mChop[0] << "-" << mData.mData.mChop[1] << std::endl;
std::cout << " Slash: " << mData.mData.mSlash[0] << "-" << mData.mData.mSlash[1] << std::endl;
std::cout << " Thrust: " << mData.mData.mThrust[0] << "-" << mData.mData.mThrust[1] << std::endl;
std::cout << " Value: " << mData.mData.mValue << std::endl;
}
template<>
void Record<ESM::CellRef>::print()
{
std::cout << " Refnum: " << mData.mRefnum << std::endl;
std::cout << " ID: '" << mData.mRefID << "'\n";
std::cout << " Owner: '" << mData.mOwner << "'\n";
std::cout << " INTV: " << mData.mIntv << " NAM9: " << mData.mIntv << std::endl;
}
} // end namespace

@ -0,0 +1,127 @@
#ifndef OPENMW_ESMTOOL_RECORD_H
#define OPENMW_ESMTOOL_RECORD_H
#include <string>
#include <components/esm/records.hpp>
namespace ESM
{
class ESMReader;
class ESMWriter;
}
namespace EsmTool
{
template <class T> class Record;
class RecordBase
{
protected:
std::string mId;
int mFlags;
int mType;
public:
RecordBase () {}
virtual ~RecordBase() {}
const std::string &getId() const {
return mId;
}
void setId(const std::string &id) {
mId = id;
}
int getFlags() const {
return mFlags;
}
void setFlags(int flags) {
mFlags = flags;
}
int getType() const {
return mType;
}
virtual void load(ESM::ESMReader &esm) = 0;
virtual void save(ESM::ESMWriter &esm) = 0;
virtual void print() = 0;
static RecordBase *create(int type);
// just make it a bit shorter
template <class T>
Record<T> *cast() {
return static_cast<Record<T> *>(this);
}
};
template <class T>
class Record : public RecordBase
{
T mData;
public:
T &get() {
return mData;
}
void save(ESM::ESMWriter &esm) {
mData.save(esm);
}
void load(ESM::ESMReader &esm) {
mData.load(esm);
}
void print();
};
template<> void Record<ESM::Activator>::print();
template<> void Record<ESM::Potion>::print();
template<> void Record<ESM::Armor>::print();
template<> void Record<ESM::Apparatus>::print();
template<> void Record<ESM::BodyPart>::print();
template<> void Record<ESM::Book>::print();
template<> void Record<ESM::BirthSign>::print();
template<> void Record<ESM::Cell>::print();
template<> void Record<ESM::Class>::print();
template<> void Record<ESM::Clothing>::print();
template<> void Record<ESM::Container>::print();
template<> void Record<ESM::Creature>::print();
template<> void Record<ESM::Dialogue>::print();
template<> void Record<ESM::Door>::print();
template<> void Record<ESM::Enchantment>::print();
template<> void Record<ESM::Faction>::print();
template<> void Record<ESM::Global>::print();
template<> void Record<ESM::GameSetting>::print();
template<> void Record<ESM::DialInfo>::print();
template<> void Record<ESM::Ingredient>::print();
template<> void Record<ESM::Land>::print();
template<> void Record<ESM::CreatureLevList>::print();
template<> void Record<ESM::ItemLevList>::print();
template<> void Record<ESM::Light>::print();
template<> void Record<ESM::Tool>::print();
template<> void Record<ESM::Probe>::print();
template<> void Record<ESM::Repair>::print();
template<> void Record<ESM::LandTexture>::print();
template<> void Record<ESM::MagicEffect>::print();
template<> void Record<ESM::Miscellaneous>::print();
template<> void Record<ESM::NPC>::print();
template<> void Record<ESM::Pathgrid>::print();
template<> void Record<ESM::Race>::print();
template<> void Record<ESM::Region>::print();
template<> void Record<ESM::Script>::print();
template<> void Record<ESM::Skill>::print();
template<> void Record<ESM::SoundGenerator>::print();
template<> void Record<ESM::Sound>::print();
template<> void Record<ESM::Spell>::print();
template<> void Record<ESM::StartScript>::print();
template<> void Record<ESM::Static>::print();
template<> void Record<ESM::Weapon>::print();
}
#endif

@ -1,6 +1,6 @@
#include <QtGui>
#include <components/esm/esm_reader.hpp>
#include <components/esm/esmreader.hpp>
#include <components/files/configurationmanager.hpp>
#include "datafilespage.hpp"

@ -385,7 +385,7 @@ void OMW::Engine::go()
if (const ESM::Cell *exterior = MWBase::Environment::get().getWorld()->getExterior (mCellName))
{
MWBase::Environment::get().getWorld()->indexToPosition (exterior->data.gridX, exterior->data.gridY,
MWBase::Environment::get().getWorld()->indexToPosition (exterior->mData.mX, exterior->mData.mY,
pos.pos[0], pos.pos[1], true);
MWBase::Environment::get().getWorld()->changeToExteriorCell (pos);
}

@ -112,12 +112,9 @@ namespace MWBase
virtual bool getSoundPlaying(MWWorld::Ptr reference, const std::string& soundId) const = 0;
///< Is the given sound currently playing on the given object?
virtual void updateObject(MWWorld::Ptr reference) = 0;
///< Update the position of all sounds connected to the given object.
virtual void update(float duration) = 0;
virtual void setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir) = 0;
virtual void setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir, const Ogre::Vector3 &up) = 0;
};
inline int operator|(SoundManager::PlayMode a, SoundManager::PlayMode b)

@ -213,7 +213,7 @@ namespace MWBase
* @param id Identifier for the GMST setting, e.g. "aName"
* @param default Default value if the GMST setting cannot be used.
*/
virtual const std::string &getGameSettingString(const std::string &id, const std::string &default_) = 0;
virtual std::string getGameSettingString(const std::string &id, const std::string &default_) = 0;
virtual void processChangedSettings(const Settings::CategorySettingVector& changed) = 0;
@ -226,6 +226,7 @@ namespace MWBase
virtual bool getRestEnabled() = 0;
virtual bool getPlayerSleeping() = 0;
virtual void wakeUpPlayer() = 0;
};
}

@ -41,7 +41,7 @@ namespace MWClass
ptr.get<ESM::Activator>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -53,7 +53,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
return ref->base->name;
return ref->base->mName;
}
std::string Activator::getScript (const MWWorld::Ptr& ptr) const
@ -61,7 +61,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
return ref->base->script;
return ref->base->mScript;
}
void Activator::registerSelf()
@ -76,7 +76,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Activator::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -85,11 +85,11 @@ namespace MWClass
ptr.get<ESM::Activator>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
std::string text;
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
info.text = text;
return info;

@ -44,7 +44,7 @@ namespace MWClass
ptr.get<ESM::Apparatus>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -56,7 +56,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
@ -75,7 +75,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return ref->base->script;
return ref->base->mScript;
}
int Apparatus::getValue (const MWWorld::Ptr& ptr) const
@ -83,7 +83,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Apparatus::registerSelf()
@ -108,7 +108,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Apparatus::hasToolTip (const MWWorld::Ptr& ptr) const
@ -116,7 +116,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Apparatus::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -125,17 +125,17 @@ namespace MWClass
ptr.get<ESM::Apparatus>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
std::string text;
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->data.quality);
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}");
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->mData.mQuality);
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;

@ -47,7 +47,7 @@ namespace MWClass
ptr.get<ESM::Armor>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -59,7 +59,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
@ -82,7 +82,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->data.health;
return ref->base->mData.mHealth;
}
std::string Armor::getScript (const MWWorld::Ptr& ptr) const
@ -90,7 +90,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->script;
return ref->base->mScript;
}
std::pair<std::vector<int>, bool> Armor::getEquipmentSlots (const MWWorld::Ptr& ptr) const
@ -118,7 +118,7 @@ namespace MWClass
};
for (int i=0; i<size; ++i)
if (sMapping[i][0]==ref->base->data.type)
if (sMapping[i][0]==ref->base->mData.mType)
{
slots.push_back (int (sMapping[i][1]));
break;
@ -134,7 +134,7 @@ namespace MWClass
std::string typeGmst;
switch (ref->base->data.type)
switch (ref->base->mData.mType)
{
case ESM::Armor::Helmet: typeGmst = "iHelmWeight"; break;
case ESM::Armor::Cuirass: typeGmst = "iCuirassWeight"; break;
@ -155,11 +155,11 @@ namespace MWClass
float iWeight = MWBase::Environment::get().getWorld()->getStore().gameSettings.find (typeGmst)->getInt();
if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fLightMaxMod")->getFloat()>=
ref->base->data.weight)
ref->base->mData.mWeight)
return ESM::Skill::LightArmor;
if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMedMaxMod")->getFloat()>=
ref->base->data.weight)
ref->base->mData.mWeight)
return ESM::Skill::MediumArmor;
return ESM::Skill::HeavyArmor;
@ -170,7 +170,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Armor::registerSelf()
@ -207,7 +207,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Armor::hasToolTip (const MWWorld::Ptr& ptr) const
@ -215,7 +215,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Armor::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -224,8 +224,8 @@ namespace MWClass
ptr.get<ESM::Armor>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
std::string text;
@ -239,20 +239,20 @@ namespace MWClass
else
typeText = "#{sHeavy}";
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(ref->base->data.armor);
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(ref->base->mData.mArmor);
/// \todo store the current armor health somewhere
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(ref->base->data.health);
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(ref->base->mData.mHealth);
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight) + " (" + typeText + ")";
text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}");
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight) + " (" + typeText + ")";
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.enchant = ref->base->enchant;
info.enchant = ref->base->mEnchant;
info.text = text;
@ -264,7 +264,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->enchant;
return ref->base->mEnchant;
}
boost::shared_ptr<MWWorld::Action> Armor::use (const MWWorld::Ptr& ptr) const

@ -1,4 +1,3 @@
#include "book.hpp"
#include <components/esm/loadbook.hpp>
@ -44,7 +43,7 @@ namespace MWClass
ptr.get<ESM::Book>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -56,7 +55,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Book::activate (const MWWorld::Ptr& ptr,
@ -71,7 +70,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->script;
return ref->base->mScript;
}
int Book::getValue (const MWWorld::Ptr& ptr) const
@ -79,7 +78,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Book::registerSelf()
@ -104,7 +103,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Book::hasToolTip (const MWWorld::Ptr& ptr) const
@ -112,7 +111,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Book::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -121,20 +120,20 @@ namespace MWClass
ptr.get<ESM::Book>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
std::string text;
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}");
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.enchant = ref->base->enchant;
info.enchant = ref->base->mEnchant;
info.text = text;
@ -146,7 +145,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->enchant;
return ref->base->mEnchant;
}
boost::shared_ptr<MWWorld::Action> Book::use (const MWWorld::Ptr& ptr) const

@ -45,7 +45,7 @@ namespace MWClass
ptr.get<ESM::Clothing>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -57,7 +57,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
@ -75,7 +75,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->script;
return ref->base->mScript;
}
std::pair<std::vector<int>, bool> Clothing::getEquipmentSlots (const MWWorld::Ptr& ptr) const
@ -85,7 +85,7 @@ namespace MWClass
std::vector<int> slots;
if (ref->base->data.type==ESM::Clothing::Ring)
if (ref->base->mData.mType==ESM::Clothing::Ring)
{
slots.push_back (int (MWWorld::InventoryStore::Slot_LeftRing));
slots.push_back (int (MWWorld::InventoryStore::Slot_RightRing));
@ -108,7 +108,7 @@ namespace MWClass
};
for (int i=0; i<size; ++i)
if (sMapping[i][0]==ref->base->data.type)
if (sMapping[i][0]==ref->base->mData.mType)
{
slots.push_back (int (sMapping[i][1]));
break;
@ -123,7 +123,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
if (ref->base->data.type==ESM::Clothing::Shoes)
if (ref->base->mData.mType==ESM::Clothing::Shoes)
return ESM::Skill::Unarmored;
return -1;
@ -134,7 +134,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Clothing::registerSelf()
@ -149,7 +149,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
if (ref->base->data.type == 8)
if (ref->base->mData.mType == 8)
{
return std::string("Item Ring Up");
}
@ -161,7 +161,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
if (ref->base->data.type == 8)
if (ref->base->mData.mType == 8)
{
return std::string("Item Ring Down");
}
@ -173,7 +173,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Clothing::hasToolTip (const MWWorld::Ptr& ptr) const
@ -181,7 +181,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Clothing::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -190,20 +190,20 @@ namespace MWClass
ptr.get<ESM::Clothing>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
std::string text;
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}");
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.enchant = ref->base->enchant;
info.enchant = ref->base->mEnchant;
info.text = text;
@ -215,7 +215,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->enchant;
return ref->base->mEnchant;
}
boost::shared_ptr<MWWorld::Action> Clothing::use (const MWWorld::Ptr& ptr) const

@ -76,7 +76,7 @@ namespace MWClass
ptr.get<ESM::Container>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -92,12 +92,12 @@ namespace MWClass
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player);
bool needKey = ptr.getCellRef().lockLevel>0;
bool needKey = ptr.getCellRef().mLockLevel>0;
bool hasKey = false;
std::string keyName;
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
{
if (it->getCellRef ().refID == ptr.getCellRef().key)
if (it->getCellRef ().mRefID == ptr.getCellRef().mKey)
{
hasKey = true;
keyName = MWWorld::Class::get(*it).getName(*it);
@ -107,15 +107,15 @@ namespace MWClass
if (needKey && hasKey)
{
MWBase::Environment::get().getWindowManager ()->messageBox (keyName + " #{sKeyUsed}", std::vector<std::string>());
ptr.getCellRef().lockLevel = 0;
ptr.getCellRef().mLockLevel = 0;
// using a key disarms the trap
ptr.getCellRef().trap = "";
ptr.getCellRef().mTrap = "";
}
if (!needKey || hasKey)
{
if(ptr.getCellRef().trap.empty())
if(ptr.getCellRef().mTrap.empty())
{
boost::shared_ptr<MWWorld::Action> action (new MWWorld::ActionOpen(ptr));
return action;
@ -123,10 +123,10 @@ namespace MWClass
else
{
// Trap activation goes here
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
action->setSound(trapActivationSound);
ptr.getCellRef().trap = "";
ptr.getCellRef().mTrap = "";
return action;
}
}
@ -143,7 +143,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
return ref->base->name;
return ref->base->mName;
}
MWWorld::ContainerStore& Container::getContainerStore (const MWWorld::Ptr& ptr)
@ -159,7 +159,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
return ref->base->script;
return ref->base->mScript;
}
void Container::registerSelf()
@ -174,7 +174,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Container::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -183,17 +183,17 @@ namespace MWClass
ptr.get<ESM::Container>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name;
info.caption = ref->base->mName;
std::string text;
if (ref->ref.lockLevel > 0)
text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ref->ref.lockLevel);
if (ref->ref.trap != "")
if (ref->ref.mLockLevel > 0)
text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ref->ref.mLockLevel);
if (ref->ref.mTrap != "")
text += "\n#{sTrapped}";
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;
@ -206,7 +206,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
return ref->base->weight;
return ref->base->mWeight;
}
float Container::getEncumbrance (const MWWorld::Ptr& ptr) const
@ -219,12 +219,12 @@ namespace MWClass
if (lockLevel<0)
lockLevel = 0;
ptr.getCellRef().lockLevel = lockLevel;
ptr.getCellRef().mLockLevel = lockLevel;
}
void Container::unlock (const MWWorld::Ptr& ptr) const
{
ptr.getCellRef().lockLevel = 0;
ptr.getCellRef().mLockLevel = 0;
}
MWWorld::Ptr

@ -47,19 +47,19 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
// creature stats
data->mCreatureStats.getAttribute(0).set (ref->base->data.strength);
data->mCreatureStats.getAttribute(1).set (ref->base->data.intelligence);
data->mCreatureStats.getAttribute(2).set (ref->base->data.willpower);
data->mCreatureStats.getAttribute(3).set (ref->base->data.agility);
data->mCreatureStats.getAttribute(4).set (ref->base->data.speed);
data->mCreatureStats.getAttribute(5).set (ref->base->data.endurance);
data->mCreatureStats.getAttribute(6).set (ref->base->data.personality);
data->mCreatureStats.getAttribute(7).set (ref->base->data.luck);
data->mCreatureStats.getHealth().set (ref->base->data.health);
data->mCreatureStats.getMagicka().set (ref->base->data.mana);
data->mCreatureStats.getFatigue().set (ref->base->data.fatigue);
data->mCreatureStats.setLevel(ref->base->data.level);
data->mCreatureStats.getAttribute(0).set (ref->base->mData.mStrength);
data->mCreatureStats.getAttribute(1).set (ref->base->mData.mIntelligence);
data->mCreatureStats.getAttribute(2).set (ref->base->mData.mWillpower);
data->mCreatureStats.getAttribute(3).set (ref->base->mData.mAgility);
data->mCreatureStats.getAttribute(4).set (ref->base->mData.mSpeed);
data->mCreatureStats.getAttribute(5).set (ref->base->mData.mEndurance);
data->mCreatureStats.getAttribute(6).set (ref->base->mData.mPersonality);
data->mCreatureStats.getAttribute(7).set (ref->base->mData.mLuck);
data->mCreatureStats.getHealth().set (ref->base->mData.mHealth);
data->mCreatureStats.getMagicka().set (ref->base->mData.mMana);
data->mCreatureStats.getFatigue().set (ref->base->mData.mFatigue);
data->mCreatureStats.setLevel(ref->base->mData.mLevel);
data->mCreatureStats.setHello(ref->base->mAiData.mHello);
data->mCreatureStats.setFight(ref->base->mAiData.mFight);
@ -67,8 +67,8 @@ namespace MWClass
data->mCreatureStats.setAlarm(ref->base->mAiData.mAlarm);
// spells
for (std::vector<std::string>::const_iterator iter (ref->base->mSpells.list.begin());
iter!=ref->base->mSpells.list.end(); ++iter)
for (std::vector<std::string>::const_iterator iter (ref->base->mSpells.mList.begin());
iter!=ref->base->mSpells.mList.end(); ++iter)
data->mCreatureStats.getSpells().add (*iter);
// store
@ -105,7 +105,7 @@ namespace MWClass
ptr.get<ESM::Creature>();
assert (ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -117,7 +117,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
return ref->base->name;
return ref->base->mName;
}
MWMechanics::CreatureStats& Creature::getCreatureStats (const MWWorld::Ptr& ptr) const
@ -146,7 +146,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
return ref->base->script;
return ref->base->mScript;
}
void Creature::registerSelf()
@ -169,11 +169,11 @@ namespace MWClass
ptr.get<ESM::Creature>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name;
info.caption = ref->base->mName;
std::string text;
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
info.text = text;
return info;

@ -46,7 +46,7 @@ namespace MWClass
ptr.get<ESM::Door>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -58,10 +58,10 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
if (ref->ref.teleport && !ref->ref.destCell.empty()) // TODO doors that lead to exteriors
return ref->ref.destCell;
if (ref->ref.mTeleport && !ref->ref.mDestCell.empty()) // TODO doors that lead to exteriors
return ref->ref.mDestCell;
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Door::activate (const MWWorld::Ptr& ptr,
@ -70,7 +70,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
const std::string &openSound = ref->base->openSound;
const std::string &openSound = ref->base->mOpenSound;
//const std::string &closeSound = ref->base->closeSound;
const std::string lockedSound = "LockedDoor";
const std::string trapActivationSound = "Disarm Trap Fail";
@ -78,12 +78,12 @@ namespace MWClass
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player);
bool needKey = ptr.getCellRef().lockLevel>0;
bool needKey = ptr.getCellRef().mLockLevel>0;
bool hasKey = false;
std::string keyName;
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
{
if (it->getCellRef ().refID == ptr.getCellRef().key)
if (it->getCellRef ().mRefID == ptr.getCellRef().mKey)
{
hasKey = true;
keyName = MWWorld::Class::get(*it).getName(*it);
@ -93,33 +93,33 @@ namespace MWClass
if (needKey && hasKey)
{
MWBase::Environment::get().getWindowManager ()->messageBox (keyName + " #{sKeyUsed}", std::vector<std::string>());
ptr.getCellRef().lockLevel = 0;
ptr.getCellRef().mLockLevel = 0;
// using a key disarms the trap
ptr.getCellRef().trap = "";
ptr.getCellRef().mTrap = "";
}
if (!needKey || hasKey)
{
if(!ptr.getCellRef().trap.empty())
if(!ptr.getCellRef().mTrap.empty())
{
// Trap activation
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
action->setSound(trapActivationSound);
ptr.getCellRef().trap = "";
ptr.getCellRef().mTrap = "";
return action;
}
if (ref->ref.teleport)
if (ref->ref.mTeleport)
{
// teleport door
/// \todo remove this if clause once ActionTeleport can also support other actors
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()==actor)
{
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->ref.destCell, ref->ref.doorDest));
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->ref.mDestCell, ref->ref.mDoorDest));
action->setSound(openSound);
@ -158,12 +158,12 @@ namespace MWClass
if (lockLevel<0)
lockLevel = 0;
ptr.getCellRef().lockLevel = lockLevel;
ptr.getCellRef().mLockLevel = lockLevel;
}
void Door::unlock (const MWWorld::Ptr& ptr) const
{
ptr.getCellRef().lockLevel = 0;
ptr.getCellRef().mLockLevel = 0;
}
std::string Door::getScript (const MWWorld::Ptr& ptr) const
@ -171,7 +171,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
return ref->base->script;
return ref->base->mScript;
}
void Door::registerSelf()
@ -186,7 +186,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Door::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -195,45 +195,45 @@ namespace MWClass
ptr.get<ESM::Door>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name;
info.caption = ref->base->mName;
std::string text;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
if (ref->ref.teleport)
if (ref->ref.mTeleport)
{
std::string dest;
if (ref->ref.destCell != "")
if (ref->ref.mDestCell != "")
{
// door leads to an interior, use interior name as tooltip
dest = ref->ref.destCell;
dest = ref->ref.mDestCell;
}
else
{
// door leads to exterior, use cell name (if any), otherwise translated region name
int x,y;
MWBase::Environment::get().getWorld()->positionToIndex (ref->ref.doorDest.pos[0], ref->ref.doorDest.pos[1], x, y);
MWBase::Environment::get().getWorld()->positionToIndex (ref->ref.mDoorDest.pos[0], ref->ref.mDoorDest.pos[1], x, y);
const ESM::Cell* cell = store.cells.findExt(x,y);
if (cell->name != "")
dest = cell->name;
if (cell->mName != "")
dest = cell->mName;
else
{
const ESM::Region* region = store.regions.search(cell->region);
dest = region->name;
const ESM::Region* region = store.regions.search(cell->mRegion);
dest = region->mName;
}
}
text += "\n#{sTo}";
text += "\n"+dest;
}
if (ref->ref.lockLevel > 0)
text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ref->ref.lockLevel);
if (ref->ref.trap != "")
if (ref->ref.mLockLevel > 0)
text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ref->ref.mLockLevel);
if (ref->ref.mTrap != "")
text += "\n#{sTrapped}";
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
info.text = text;

@ -52,7 +52,7 @@ namespace MWClass
ptr.get<ESM::Ingredient>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -64,7 +64,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
@ -82,7 +82,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->script;
return ref->base->mScript;
}
int Ingredient::getValue (const MWWorld::Ptr& ptr) const
@ -90,7 +90,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
@ -125,7 +125,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Ingredient::hasToolTip (const MWWorld::Ptr& ptr) const
@ -133,7 +133,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Ingredient::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -142,28 +142,28 @@ namespace MWClass
ptr.get<ESM::Ingredient>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
std::string text;
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}");
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
MWGui::Widgets::SpellEffectList list;
for (int i=0; i<4; ++i)
{
if (ref->base->data.effectID[i] < 0)
if (ref->base->mData.mEffectID[i] < 0)
continue;
MWGui::Widgets::SpellEffectParams params;
params.mEffectID = ref->base->data.effectID[i];
params.mAttribute = ref->base->data.attributes[i];
params.mSkill = ref->base->data.skills[i];
params.mEffectID = ref->base->mData.mEffectID[i];
params.mAttribute = ref->base->mData.mAttributes[i];
params.mSkill = ref->base->mData.mSkills[i];
list.push_back(params);
}
info.effects = list;

@ -29,7 +29,7 @@ namespace MWClass
ptr.get<ESM::Light>();
assert (ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
MWRender::Objects& objects = renderingInterface.getObjects();
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
@ -37,11 +37,11 @@ namespace MWClass
if (!model.empty())
objects.insertMesh(ptr, "meshes\\" + model);
const int color = ref->base->data.color;
const int color = ref->base->mData.mColor;
const float r = ((color >> 0) & 0xFF) / 255.0f;
const float g = ((color >> 8) & 0xFF) / 255.0f;
const float b = ((color >> 16) & 0xFF) / 255.0f;
const float radius = float (ref->base->data.radius);
const float radius = float (ref->base->mData.mRadius);
objects.insertLight (ptr, r, g, b, radius);
}
@ -51,13 +51,13 @@ namespace MWClass
ptr.get<ESM::Light>();
assert (ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if(!model.empty()) {
physics.insertObjectPhysics(ptr, "meshes\\" + model);
}
if (!ref->base->sound.empty()) {
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->base->sound, 1.0, 1.0, MWBase::SoundManager::Play_Loop);
if (!ref->base->mSound.empty()) {
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->base->mSound, 1.0, 1.0, MWBase::SoundManager::Play_Loop);
}
}
@ -67,7 +67,7 @@ namespace MWClass
ptr.get<ESM::Light>();
assert (ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -79,10 +79,10 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
if (ref->base->model.empty())
if (ref->base->mModel.empty())
return "";
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr,
@ -91,7 +91,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
if (!(ref->base->data.flags & ESM::Light::Carry))
if (!(ref->base->mData.mFlags & ESM::Light::Carry))
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
@ -106,7 +106,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
return ref->base->script;
return ref->base->mScript;
}
std::pair<std::vector<int>, bool> Light::getEquipmentSlots (const MWWorld::Ptr& ptr) const
@ -116,7 +116,7 @@ namespace MWClass
std::vector<int> slots;
if (ref->base->data.flags & ESM::Light::Carry)
if (ref->base->mData.mFlags & ESM::Light::Carry)
slots.push_back (int (MWWorld::InventoryStore::Slot_CarriedLeft));
return std::make_pair (slots, false);
@ -127,7 +127,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Light::registerSelf()
@ -153,7 +153,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Light::hasToolTip (const MWWorld::Ptr& ptr) const
@ -161,7 +161,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Light::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -170,17 +170,17 @@ namespace MWClass
ptr.get<ESM::Light>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
std::string text;
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}");
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;

@ -45,7 +45,7 @@ namespace MWClass
ptr.get<ESM::Tool>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -57,7 +57,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
@ -75,7 +75,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return ref->base->script;
return ref->base->mScript;
}
std::pair<std::vector<int>, bool> Lockpick::getEquipmentSlots (const MWWorld::Ptr& ptr) const
@ -92,7 +92,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Lockpick::registerSelf()
@ -117,7 +117,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Lockpick::hasToolTip (const MWWorld::Ptr& ptr) const
@ -125,7 +125,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Lockpick::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -134,21 +134,21 @@ namespace MWClass
ptr.get<ESM::Tool>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
std::string text;
/// \todo store remaining uses somewhere
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->base->data.uses);
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->data.quality);
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}");
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->base->mData.mUses);
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->mData.mQuality);
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;

@ -48,7 +48,7 @@ namespace MWClass
ptr.get<ESM::Miscellaneous>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -60,7 +60,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Miscellaneous::activate (const MWWorld::Ptr& ptr,
@ -78,7 +78,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->base->script;
return ref->base->mScript;
}
int Miscellaneous::getValue (const MWWorld::Ptr& ptr) const
@ -86,7 +86,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Miscellaneous::registerSelf()
@ -101,7 +101,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString())
if (ref->base->mName == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString())
{
return std::string("Item Gold Up");
}
@ -113,7 +113,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString())
if (ref->base->mName == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString())
{
return std::string("Item Gold Down");
}
@ -125,7 +125,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Miscellaneous::hasToolTip (const MWWorld::Ptr& ptr) const
@ -133,7 +133,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Miscellaneous::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -147,9 +147,9 @@ namespace MWClass
int count = ptr.getRefData().getCount();
bool isGold = (ref->base->name == store.gameSettings.find("sGold")->getString());
bool isGold = (ref->base->mName == store.gameSettings.find("sGold")->getString());
if (isGold && count == 1)
count = ref->base->data.value;
count = ref->base->mData.mValue;
std::string countString;
if (!isGold)
@ -157,26 +157,26 @@ namespace MWClass
else // gold displays its count also if it's 1.
countString = " (" + boost::lexical_cast<std::string>(count) + ")";
info.caption = ref->base->name + countString;
info.icon = ref->base->icon;
info.caption = ref->base->mName + countString;
info.icon = ref->base->mIcon;
if (ref->ref.soul != "")
if (ref->ref.mSoul != "")
{
const ESM::Creature *creature = store.creatures.search(ref->ref.soul);
info.caption += " (" + creature->name + ")";
const ESM::Creature *creature = store.creatures.search(ref->ref.mSoul);
info.caption += " (" + creature->mName + ")";
}
std::string text;
if (!isGold)
{
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}");
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
}
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;

@ -61,43 +61,43 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
// NPC stats
if (!ref->base->faction.empty())
if (!ref->base->mFaction.empty())
{
std::string faction = ref->base->faction;
std::string faction = ref->base->mFaction;
boost::algorithm::to_lower(faction);
if(ref->base->npdt52.gold != -10)
if(ref->base->mNpdt52.mGold != -10)
{
data->mNpcStats.getFactionRanks()[faction] = (int)ref->base->npdt52.rank;
data->mNpcStats.getFactionRanks()[faction] = (int)ref->base->mNpdt52.mRank;
}
else
{
data->mNpcStats.getFactionRanks()[faction] = (int)ref->base->npdt12.rank;
data->mNpcStats.getFactionRanks()[faction] = (int)ref->base->mNpdt12.mRank;
}
}
// creature stats
if(ref->base->npdt52.gold != -10)
if(ref->base->mNpdt52.mGold != -10)
{
for (int i=0; i<27; ++i)
data->mNpcStats.getSkill (i).setBase (ref->base->npdt52.skills[i]);
data->mCreatureStats.getAttribute(0).set (ref->base->npdt52.strength);
data->mCreatureStats.getAttribute(1).set (ref->base->npdt52.intelligence);
data->mCreatureStats.getAttribute(2).set (ref->base->npdt52.willpower);
data->mCreatureStats.getAttribute(3).set (ref->base->npdt52.agility);
data->mCreatureStats.getAttribute(4).set (ref->base->npdt52.speed);
data->mCreatureStats.getAttribute(5).set (ref->base->npdt52.endurance);
data->mCreatureStats.getAttribute(6).set (ref->base->npdt52.personality);
data->mCreatureStats.getAttribute(7).set (ref->base->npdt52.luck);
data->mCreatureStats.getHealth().set (ref->base->npdt52.health);
data->mCreatureStats.getMagicka().set (ref->base->npdt52.mana);
data->mCreatureStats.getFatigue().set (ref->base->npdt52.fatigue);
data->mCreatureStats.setLevel(ref->base->npdt52.level);
data->mNpcStats.getSkill (i).setBase (ref->base->mNpdt52.mSkills[i]);
data->mCreatureStats.getAttribute(0).set (ref->base->mNpdt52.mStrength);
data->mCreatureStats.getAttribute(1).set (ref->base->mNpdt52.mIntelligence);
data->mCreatureStats.getAttribute(2).set (ref->base->mNpdt52.mWillpower);
data->mCreatureStats.getAttribute(3).set (ref->base->mNpdt52.mAgility);
data->mCreatureStats.getAttribute(4).set (ref->base->mNpdt52.mSpeed);
data->mCreatureStats.getAttribute(5).set (ref->base->mNpdt52.mEndurance);
data->mCreatureStats.getAttribute(6).set (ref->base->mNpdt52.mPersonality);
data->mCreatureStats.getAttribute(7).set (ref->base->mNpdt52.mLuck);
data->mCreatureStats.getHealth().set (ref->base->mNpdt52.mHealth);
data->mCreatureStats.getMagicka().set (ref->base->mNpdt52.mMana);
data->mCreatureStats.getFatigue().set (ref->base->mNpdt52.mFatigue);
data->mCreatureStats.setLevel(ref->base->mNpdt52.mLevel);
}
else
{
/// \todo do something with npdt12 maybe:p
/// \todo do something with mNpdt12 maybe:p
}
data->mCreatureStats.setHello(ref->base->mAiData.mHello);
@ -106,8 +106,8 @@ namespace MWClass
data->mCreatureStats.setAlarm(ref->base->mAiData.mAlarm);
// spells
for (std::vector<std::string>::const_iterator iter (ref->base->spells.list.begin());
iter!=ref->base->spells.list.end(); ++iter)
for (std::vector<std::string>::const_iterator iter (ref->base->mSpells.mList.begin());
iter!=ref->base->mSpells.mList.end(); ++iter)
data->mCreatureStats.getSpells().add (*iter);
// store
@ -140,7 +140,7 @@ namespace MWClass
ptr.get<ESM::NPC>();
assert(ref->base != NULL);
std::string headID = ref->base->head;
std::string headID = ref->base->mHead;
int end = headID.find_last_of("head_") - 4;
std::string bodyRaceID = headID.substr(0, end);
@ -162,7 +162,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
return ref->base->name;
return ref->base->mName;
}
MWMechanics::CreatureStats& Npc::getCreatureStats (const MWWorld::Ptr& ptr) const
@ -206,7 +206,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
return ref->base->script;
return ref->base->mScript;
}
void Npc::setForceStance (const MWWorld::Ptr& ptr, Stance stance, bool force) const
@ -301,7 +301,7 @@ namespace MWClass
vector.x = getMovementSettings (ptr).mLeftRight * 127;
vector.y = getMovementSettings (ptr).mForwardBackward * 127;
vector.z = getMovementSettings(ptr).mUpDown * 127;
vector.z = getMovementSettings(ptr).mUpDown * 127;
//if (getStance (ptr, Run, false))
// vector *= 2;
@ -328,11 +328,11 @@ namespace MWClass
ptr.get<ESM::NPC>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name;
info.caption = ref->base->mName;
std::string text;
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
info.text = text;
return info;
@ -377,7 +377,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
const ESM::Class *class_ = MWBase::Environment::get().getWorld()->getStore().classes.find (
ref->base->cls);
ref->base->mClass);
stats.useSkill (skill, *class_, usageType);
}

@ -45,7 +45,7 @@ namespace MWClass
ptr.get<ESM::Potion>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -57,7 +57,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
@ -76,7 +76,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return ref->base->script;
return ref->base->mScript;
}
int Potion::getValue (const MWWorld::Ptr& ptr) const
@ -84,7 +84,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Potion::registerSelf()
@ -109,7 +109,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Potion::hasToolTip (const MWWorld::Ptr& ptr) const
@ -117,7 +117,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Potion::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -126,20 +126,20 @@ namespace MWClass
ptr.get<ESM::Potion>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
std::string text;
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}");
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
info.effects = MWGui::Widgets::MWEffectList::effectListFromESM(&ref->base->effects);
info.effects = MWGui::Widgets::MWEffectList::effectListFromESM(&ref->base->mEffects);
info.isPotion = true;
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;

@ -45,7 +45,7 @@ namespace MWClass
ptr.get<ESM::Probe>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -57,7 +57,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const
@ -74,7 +74,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return ref->base->script;
return ref->base->mScript;
}
std::pair<std::vector<int>, bool> Probe::getEquipmentSlots (const MWWorld::Ptr& ptr) const
@ -91,7 +91,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Probe::registerSelf()
@ -116,7 +116,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Probe::hasToolTip (const MWWorld::Ptr& ptr) const
@ -124,7 +124,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Probe::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -133,21 +133,21 @@ namespace MWClass
ptr.get<ESM::Probe>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
std::string text;
/// \todo store remaining uses somewhere
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->base->data.uses);
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->data.quality);
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}");
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->base->mData.mUses);
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->mData.mQuality);
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;

@ -43,7 +43,7 @@ namespace MWClass
ptr.get<ESM::Repair>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -55,7 +55,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
@ -73,7 +73,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return ref->base->script;
return ref->base->mScript;
}
int Repair::getValue (const MWWorld::Ptr& ptr) const
@ -81,7 +81,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Repair::registerSelf()
@ -106,7 +106,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Repair::hasToolTip (const MWWorld::Ptr& ptr) const
@ -114,7 +114,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Repair::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -123,21 +123,21 @@ namespace MWClass
ptr.get<ESM::Repair>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
std::string text;
/// \todo store remaining uses somewhere
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->base->data.uses);
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->data.quality);
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}");
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->base->mData.mUses);
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->mData.mQuality);
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;

@ -35,7 +35,7 @@ namespace MWClass
ptr.get<ESM::Static>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}

@ -45,7 +45,7 @@ namespace MWClass
ptr.get<ESM::Weapon>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -57,7 +57,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
@ -80,7 +80,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->data.health;
return ref->base->mData.mHealth;
}
std::string Weapon::getScript (const MWWorld::Ptr& ptr) const
@ -88,7 +88,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->script;
return ref->base->mScript;
}
std::pair<std::vector<int>, bool> Weapon::getEquipmentSlots (const MWWorld::Ptr& ptr) const
@ -99,12 +99,12 @@ namespace MWClass
std::vector<int> slots;
bool stack = false;
if (ref->base->data.type==ESM::Weapon::Arrow || ref->base->data.type==ESM::Weapon::Bolt)
if (ref->base->mData.mType==ESM::Weapon::Arrow || ref->base->mData.mType==ESM::Weapon::Bolt)
{
slots.push_back (int (MWWorld::InventoryStore::Slot_Ammunition));
stack = true;
}
else if (ref->base->data.type==ESM::Weapon::MarksmanThrown)
else if (ref->base->mData.mType==ESM::Weapon::MarksmanThrown)
{
slots.push_back (int (MWWorld::InventoryStore::Slot_CarriedRight));
stack = true;
@ -139,7 +139,7 @@ namespace MWClass
};
for (int i=0; i<size; ++i)
if (sMapping[i][0]==ref->base->data.type)
if (sMapping[i][0]==ref->base->mData.mType)
return sMapping[i][1];
return -1;
@ -150,7 +150,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Weapon::registerSelf()
@ -165,7 +165,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
int type = ref->base->data.type;
int type = ref->base->mData.mType;
// Ammo
if (type == 12 || type == 13)
{
@ -211,7 +211,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
int type = ref->base->data.type;
int type = ref->base->mData.mType;
// Ammo
if (type == 12 || type == 13)
{
@ -257,7 +257,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Weapon::hasToolTip (const MWWorld::Ptr& ptr) const
@ -265,7 +265,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Weapon::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -274,15 +274,15 @@ namespace MWClass
ptr.get<ESM::Weapon>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
std::string text;
// weapon type & damage. arrows / bolts don't have his info.
if (ref->base->data.type < 12)
if (ref->base->mData.mType < 12)
{
text += "\n#{sType} ";
@ -300,49 +300,49 @@ namespace MWClass
mapping[ESM::Weapon::MarksmanCrossbow] = std::make_pair("sSkillMarksman", "");
mapping[ESM::Weapon::MarksmanThrown] = std::make_pair("sSkillMarksman", "");
std::string type = mapping[ref->base->data.type].first;
std::string oneOrTwoHanded = mapping[ref->base->data.type].second;
std::string type = mapping[ref->base->mData.mType].first;
std::string oneOrTwoHanded = mapping[ref->base->mData.mType].second;
text += store.gameSettings.find(type)->getString() +
((oneOrTwoHanded != "") ? ", " + store.gameSettings.find(oneOrTwoHanded)->getString() : "");
// weapon damage
if (ref->base->data.type >= 9)
if (ref->base->mData.mType >= 9)
{
// marksman
text += "\n#{sAttack}: "
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[1]));
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mChop[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mChop[1]));
}
else
{
// Chop
text += "\n#{sChop}: "
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[1]));
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mChop[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mChop[1]));
// Slash
text += "\n#{sSlash}: "
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.slash[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.slash[1]));
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mSlash[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mSlash[1]));
// Thrust
text += "\n#{sThrust}: "
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.thrust[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.thrust[1]));
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mThrust[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mThrust[1]));
}
}
/// \todo store the current weapon health somewhere
if (ref->base->data.type < 11) // thrown weapons and arrows/bolts don't have health, only quantity
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(ref->base->data.health);
if (ref->base->mData.mType < 11) // thrown weapons and arrows/bolts don't have health, only quantity
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(ref->base->mData.mHealth);
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, "#{sValue}");
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
info.enchant = ref->base->enchant;
info.enchant = ref->base->mEnchant;
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;
@ -355,7 +355,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->enchant;
return ref->base->mEnchant;
}
boost::shared_ptr<MWWorld::Action> Weapon::use (const MWWorld::Ptr& ptr) const

@ -95,24 +95,24 @@ namespace
int i = 0;
for (; i<static_cast<int> (script->varNames.size()); ++i)
if (script->varNames[i]==name)
for (; i<static_cast<int> (script->mVarNames.size()); ++i)
if (script->mVarNames[i]==name)
break;
if (i>=static_cast<int> (script->varNames.size()))
if (i>=static_cast<int> (script->mVarNames.size()))
return false; // script does not have a variable of this name
const MWScript::Locals& locals = actor.getRefData().getLocals();
if (i<script->data.numShorts)
if (i<script->mData.mNumShorts)
return selectCompare (comp, locals.mShorts[i], value);
else
i -= script->data.numShorts;
i -= script->mData.mNumShorts;
if (i<script->data.numLongs)
if (i<script->mData.mNumLongs)
return selectCompare (comp, locals.mLongs[i], value);
else
i -= script->data.numShorts;
i -= script->mData.mNumShorts;
return selectCompare (comp, locals.mFloats.at (i), value);
}
@ -160,16 +160,16 @@ namespace MWDialogue
{
bool isCreature = (actor.getTypeName() != typeid(ESM::NPC).name());
for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.selects.begin());
iter != info.selects.end(); ++iter)
for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.mSelects.begin());
iter != info.mSelects.end(); ++iter)
{
ESM::DialInfo::SelectStruct select = *iter;
char type = select.selectRule[1];
char type = select.mSelectRule[1];
if(type == '1')
{
char comp = select.selectRule[4];
std::string name = select.selectRule.substr (5);
std::string function = select.selectRule.substr(2,2);
char comp = select.mSelectRule[4];
std::string name = select.mSelectRule.substr (5);
std::string function = select.mSelectRule.substr(2,2);
int ifunction;
std::istringstream iss(function);
@ -177,19 +177,19 @@ namespace MWDialogue
switch(ifunction)
{
case 39://PC Expelled
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 40://PC Common Disease
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 41://PC Blight Disease
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 43://PC Crime level
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 46://Same faction
@ -205,71 +205,71 @@ namespace MWDialogue
std::string NPCFaction = NPCstats.getFactionRanks().begin()->first;
if(PCstats.getFactionRanks().find(toLower(NPCFaction)) != PCstats.getFactionRanks().end()) sameFaction = 1;
}
if(!selectCompare<int,int>(comp,sameFaction,select.i)) return false;
if(!selectCompare<int,int>(comp,sameFaction,select.mI)) return false;
}
break;
case 48://Detected
if(!selectCompare<int,int>(comp,1,select.i)) return false;
if(!selectCompare<int,int>(comp,1,select.mI)) return false;
break;
case 49://Alarmed
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 50://choice
if(choice)
{
if(!selectCompare<int,int>(comp,mChoice,select.i)) return false;
if(!selectCompare<int,int>(comp,mChoice,select.mI)) return false;
}
break;
case 60://PC Vampire
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 61://Level
if(!selectCompare<int,int>(comp,1,select.i)) return false;
if(!selectCompare<int,int>(comp,1,select.mI)) return false;
break;
case 62://Attacked
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 63://Talked to PC
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 64://PC Health
if(!selectCompare<int,int>(comp,50,select.i)) return false;
if(!selectCompare<int,int>(comp,50,select.mI)) return false;
break;
case 65://Creature target
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 66://Friend hit
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 67://Fight
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 68://Hello????
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 69://Alarm
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 70://Flee
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 71://Should Attack
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
default:
@ -287,13 +287,13 @@ namespace MWDialogue
{
bool isCreature = (actor.getTypeName() != typeid(ESM::NPC).name());
char type = select.selectRule[1];
char type = select.mSelectRule[1];
if (type!='0')
{
char comp = select.selectRule[4];
std::string name = select.selectRule.substr (5);
std::string function = select.selectRule.substr(1,2);
char comp = select.mSelectRule[4];
std::string name = select.mSelectRule.substr (5);
std::string function = select.mSelectRule.substr(1,2);
switch (type)
{
@ -303,15 +303,15 @@ namespace MWDialogue
case '2': // global
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
select.type==ESM::VT_Long)
if (select.mType==ESM::VT_Short || select.mType==ESM::VT_Int ||
select.mType==ESM::VT_Long)
{
if (!checkGlobal (comp, toLower (name), select.i))
if (!checkGlobal (comp, toLower (name), select.mI))
return false;
}
else if (select.type==ESM::VT_Float)
else if (select.mType==ESM::VT_Float)
{
if (!checkGlobal (comp, toLower (name), select.f))
if (!checkGlobal (comp, toLower (name), select.mF))
return false;
}
else
@ -322,16 +322,16 @@ namespace MWDialogue
case '3': // local
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
select.type==ESM::VT_Long)
if (select.mType==ESM::VT_Short || select.mType==ESM::VT_Int ||
select.mType==ESM::VT_Long)
{
if (!checkLocal (comp, toLower (name), select.i, actor,
if (!checkLocal (comp, toLower (name), select.mI, actor,
MWBase::Environment::get().getWorld()->getStore()))
return false;
}
else if (select.type==ESM::VT_Float)
else if (select.mType==ESM::VT_Float)
{
if (!checkLocal (comp, toLower (name), select.f, actor,
if (!checkLocal (comp, toLower (name), select.mF, actor,
MWBase::Environment::get().getWorld()->getStore()))
return false;
}
@ -342,9 +342,9 @@ namespace MWDialogue
return true;
case '4'://journal
if(select.type==ESM::VT_Int)
if(select.mType==ESM::VT_Int)
{
if(!selectCompare<int,int>(comp,MWBase::Environment::get().getJournal()->getJournalIndex(toLower(name)),select.i)) return false;
if(!selectCompare<int,int>(comp,MWBase::Environment::get().getJournal()->getJournalIndex(toLower(name)),select.mI)) return false;
}
else
throw std::runtime_error (
@ -360,22 +360,22 @@ namespace MWDialogue
int sum = 0;
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end(); ++iter)
if (toLower(iter->getCellRef().refID) == toLower(name))
if (toLower(iter->getCellRef().mRefID) == toLower(name))
sum += iter->getRefData().getCount();
if(!selectCompare<int,int>(comp,sum,select.i)) return false;
if(!selectCompare<int,int>(comp,sum,select.mI)) return false;
}
return true;
case '6'://dead
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
case '7':// not ID
if(select.type==ESM::VT_String ||select.type==ESM::VT_Int)//bug in morrowind here? it's not a short, it's a string
if(select.mType==ESM::VT_String ||select.mType==ESM::VT_Int)//bug in morrowind here? it's not a short, it's a string
{
int isID = int(toLower(name)==toLower(MWWorld::Class::get (actor).getId (actor)));
if (selectCompare<int,int>(comp,!isID,select.i)) return false;
if (selectCompare<int,int>(comp,!isID,select.mI)) return false;
}
else
throw std::runtime_error (
@ -387,11 +387,11 @@ namespace MWDialogue
if (isCreature)
return false;
if(select.type==ESM::VT_Int)
if(select.mType==ESM::VT_Int)
{
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
int isFaction = int(toLower(npc->base->faction) == toLower(name));
if(selectCompare<int,int>(comp,!isFaction,select.i))
int isFaction = int(toLower(npc->base->mFaction) == toLower(name));
if(selectCompare<int,int>(comp,!isFaction,select.mI))
return false;
}
else
@ -404,11 +404,11 @@ namespace MWDialogue
if (isCreature)
return false;
if(select.type==ESM::VT_Int)
if(select.mType==ESM::VT_Int)
{
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
int isClass = int(toLower(npc->base->cls) == toLower(name));
if(selectCompare<int,int>(comp,!isClass,select.i))
int isClass = int(toLower(npc->base->mClass) == toLower(name));
if(selectCompare<int,int>(comp,!isClass,select.mI))
return false;
}
else
@ -421,11 +421,11 @@ namespace MWDialogue
if (isCreature)
return false;
if(select.type==ESM::VT_Int)
if(select.mType==ESM::VT_Int)
{
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
int isRace = int(toLower(npc->base->race) == toLower(name));
if(selectCompare<int,int>(comp,!isRace,select.i))
int isRace = int(toLower(npc->base->mRace) == toLower(name));
if(selectCompare<int,int>(comp,!isRace,select.mI))
return false;
}
else
@ -435,10 +435,10 @@ namespace MWDialogue
return true;
case 'B'://not Cell
if(select.type==ESM::VT_Int)
if(select.mType==ESM::VT_Int)
{
int isCell = int(toLower(actor.getCell()->cell->name) == toLower(name));
if(selectCompare<int,int>(comp,!isCell,select.i))
int isCell = int(toLower(actor.getCell()->cell->mName) == toLower(name));
if(selectCompare<int,int>(comp,!isCell,select.mI))
return false;
}
else
@ -447,16 +447,16 @@ namespace MWDialogue
return true;
case 'C'://not local
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
select.type==ESM::VT_Long)
if (select.mType==ESM::VT_Short || select.mType==ESM::VT_Int ||
select.mType==ESM::VT_Long)
{
if (checkLocal (comp, toLower (name), select.i, actor,
if (checkLocal (comp, toLower (name), select.mI, actor,
MWBase::Environment::get().getWorld()->getStore()))
return false;
}
else if (select.type==ESM::VT_Float)
else if (select.mType==ESM::VT_Float)
{
if (checkLocal (comp, toLower (name), select.f, actor,
if (checkLocal (comp, toLower (name), select.mF, actor,
MWBase::Environment::get().getWorld()->getStore()))
return false;
}
@ -480,12 +480,12 @@ namespace MWDialogue
bool isCreature = (actor.getTypeName() != typeid(ESM::NPC).name());
// actor id
if (!info.actor.empty())
if (toLower (info.actor)!=MWWorld::Class::get (actor).getId (actor))
if (!info.mActor.empty())
if (toLower (info.mActor)!=MWWorld::Class::get (actor).getId (actor))
return false;
//NPC race
if (!info.race.empty())
if (!info.mRace.empty())
{
if (isCreature)
return false;
@ -495,12 +495,12 @@ namespace MWDialogue
if (!cellRef)
return false;
if (toLower (info.race)!=toLower (cellRef->base->race))
if (toLower (info.mRace)!=toLower (cellRef->base->mRace))
return false;
}
//NPC class
if (!info.clas.empty())
if (!info.mClass.empty())
{
if (isCreature)
return false;
@ -510,23 +510,23 @@ namespace MWDialogue
if (!cellRef)
return false;
if (toLower (info.clas)!=toLower (cellRef->base->cls))
if (toLower (info.mClass)!=toLower (cellRef->base->mClass))
return false;
}
//NPC faction
if (!info.npcFaction.empty())
if (!info.mNpcFaction.empty())
{
if (isCreature)
return false;
//MWWorld::Class npcClass = MWWorld::Class::get(actor);
MWMechanics::NpcStats stats = MWWorld::Class::get(actor).getNpcStats(actor);
std::map<std::string,int>::iterator it = stats.getFactionRanks().find(toLower(info.npcFaction));
std::map<std::string,int>::iterator it = stats.getFactionRanks().find(toLower(info.mNpcFaction));
if(it!=stats.getFactionRanks().end())
{
//check rank
if(it->second < (int)info.data.rank) return false;
if(it->second < (int)info.mData.mRank) return false;
}
else
{
@ -536,14 +536,14 @@ namespace MWDialogue
}
// TODO check player faction
if(!info.pcFaction.empty())
if(!info.mPcFaction.empty())
{
MWMechanics::NpcStats stats = MWWorld::Class::get(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()).getNpcStats(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
std::map<std::string,int>::iterator it = stats.getFactionRanks().find(toLower(info.pcFaction));
std::map<std::string,int>::iterator it = stats.getFactionRanks().find(toLower(info.mPcFaction));
if(it!=stats.getFactionRanks().end())
{
//check rank
if(it->second < (int)info.data.PCrank) return false;
if(it->second < (int)info.mData.mPCrank) return false;
}
else
{
@ -556,24 +556,24 @@ namespace MWDialogue
if (!isCreature)
{
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
if(npc->base->flags&npc->base->Female)
if(npc->base->mFlags & npc->base->Female)
{
if(static_cast<int> (info.data.gender)==0) return false;
if(static_cast<int> (info.mData.mGender)==0) return false;
}
else
{
if(static_cast<int> (info.data.gender)==1) return false;
if(static_cast<int> (info.mData.mGender)==1) return false;
}
}
// check cell
if (!info.cell.empty())
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->name != info.cell)
if (!info.mCell.empty())
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->mName != info.mCell)
return false;
// TODO check DATAstruct
for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.selects.begin());
iter != info.selects.end(); ++iter)
for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.mSelects.begin());
iter != info.mSelects.end(); ++iter)
if (!isMatching (actor, *iter))
return false;
@ -646,7 +646,7 @@ namespace MWDialogue
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
{
ESM::Dialogue ndialogue = it->second;
if(ndialogue.type == ESM::Dialogue::Greeting)
if(ndialogue.mType == ESM::Dialogue::Greeting)
{
if (greetingFound) break;
for (std::vector<ESM::DialInfo>::const_iterator iter (it->second.mInfo.begin());
@ -654,15 +654,15 @@ namespace MWDialogue
{
if (isMatching (actor, *iter) && functionFilter(mActor,*iter,true))
{
if (!iter->sound.empty())
if (!iter->mSound.empty())
{
// TODO play sound
}
std::string text = iter->response;
std::string text = iter->mResponse;
parseText(text);
win->addText(iter->response);
executeScript(iter->resultScript);
win->addText(iter->mResponse);
executeScript(iter->mResultScript);
greetingFound = true;
mLastTopic = it->first;
mLastDialogue = *iter;
@ -745,7 +745,7 @@ namespace MWDialogue
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
{
ESM::Dialogue ndialogue = it->second;
if(ndialogue.type == ESM::Dialogue::Topic)
if(ndialogue.mType == ESM::Dialogue::Topic)
{
for (std::vector<ESM::DialInfo>::const_iterator iter (it->second.mInfo.begin());
iter!=it->second.mInfo.end(); ++iter)
@ -813,21 +813,21 @@ namespace MWDialogue
if(mDialogueMap.find(keyword) != mDialogueMap.end())
{
ESM::Dialogue ndialogue = mDialogueMap[keyword];
if(ndialogue.type == ESM::Dialogue::Topic)
if(ndialogue.mType == ESM::Dialogue::Topic)
{
for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
iter!=ndialogue.mInfo.end(); ++iter)
{
if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,true))
{
std::string text = iter->response;
std::string script = iter->resultScript;
std::string text = iter->mResponse;
std::string script = iter->mResultScript;
parseText(text);
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
win->addTitle(keyword);
win->addText(iter->response);
win->addText(iter->mResponse);
executeScript(script);
@ -858,7 +858,7 @@ namespace MWDialogue
if(mDialogueMap.find(mLastTopic) != mDialogueMap.end())
{
ESM::Dialogue ndialogue = mDialogueMap[mLastTopic];
if(ndialogue.type == ESM::Dialogue::Topic)
if(ndialogue.mType == ESM::Dialogue::Topic)
{
for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
iter!=ndialogue.mInfo.end(); ++iter)
@ -869,10 +869,10 @@ namespace MWDialogue
mChoice = -1;
mIsInChoice = false;
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
std::string text = iter->response;
std::string text = iter->mResponse;
parseText(text);
win->addText(text);
executeScript(iter->resultScript);
executeScript(iter->mResultScript);
mLastTopic = mLastTopic;
mLastDialogue = *iter;
break;

@ -22,8 +22,8 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->id==mInfoId)
return iter->response;
if (iter->mId == mInfoId)
return iter->mResponse;
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic);
}
@ -39,9 +39,9 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->data.disposition==index) /// \todo cleanup info structure
if (iter->mData.mDisposition==index) /// \todo cleanup info structure
{
return iter->id;
return iter->mId;
}
throw std::runtime_error ("unknown journal index for topic " + topic);

@ -22,8 +22,8 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->questStatus==ESM::DialInfo::QS_Name)
return iter->response;
if (iter->mQuestStatus==ESM::DialInfo::QS_Name)
return iter->mResponse;
return "";
}
@ -39,13 +39,13 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->data.disposition==index && iter->questStatus!=ESM::DialInfo::QS_Name)
if (iter->mData.mDisposition==index && iter->mQuestStatus!=ESM::DialInfo::QS_Name)
{
mIndex = index;
if (iter->questStatus==ESM::DialInfo::QS_Finished)
if (iter->mQuestStatus==ESM::DialInfo::QS_Finished)
mFinished = true;
else if (iter->questStatus==ESM::DialInfo::QS_Restart)
else if (iter->mQuestStatus==ESM::DialInfo::QS_Restart)
mFinished = false;
return;
@ -67,9 +67,9 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->id==entry.mInfoId)
if (iter->mId == entry.mInfoId)
{
index = iter->data.disposition; /// \todo cleanup info structure
index = iter->mData.mDisposition; /// \todo cleanup info structure
break;
}

@ -112,22 +112,22 @@ namespace MWGui
if (rand() % 2 == 0) /// \todo
{
ESM::Potion newPotion;
newPotion.name = mNameEdit->getCaption();
newPotion.mName = mNameEdit->getCaption();
ESM::EffectList effects;
for (unsigned int i=0; i<4; ++i)
{
if (mEffects.size() >= i+1)
{
ESM::ENAMstruct effect;
effect.effectID = mEffects[i].mEffectID;
effect.area = 0;
effect.range = ESM::RT_Self;
effect.skill = mEffects[i].mSkill;
effect.attribute = mEffects[i].mAttribute;
effect.magnMin = 1; /// \todo
effect.magnMax = 10; /// \todo
effect.duration = 60; /// \todo
effects.list.push_back(effect);
effect.mEffectID = mEffects[i].mEffectID;
effect.mArea = 0;
effect.mRange = ESM::RT_Self;
effect.mSkill = mEffects[i].mSkill;
effect.mAttribute = mEffects[i].mAttribute;
effect.mMagnMin = 1; /// \todo
effect.mMagnMax = 10; /// \todo
effect.mDuration = 60; /// \todo
effects.mList.push_back(effect);
}
}
@ -137,17 +137,17 @@ namespace MWGui
// have 0 weight when using ingredients with 0.1 weight respectively
float weight = 0;
if (mIngredient1->isUserString("ToolTipType"))
weight += mIngredient1->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->data.weight;
weight += mIngredient1->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->mData.mWeight;
if (mIngredient2->isUserString("ToolTipType"))
weight += mIngredient2->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->data.weight;
weight += mIngredient2->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->mData.mWeight;
if (mIngredient3->isUserString("ToolTipType"))
weight += mIngredient3->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->data.weight;
weight += mIngredient3->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->mData.mWeight;
if (mIngredient4->isUserString("ToolTipType"))
weight += mIngredient4->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->data.weight;
newPotion.data.weight = weight / float(numIngreds);
weight += mIngredient4->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->mData.mWeight;
newPotion.mData.mWeight = weight / float(numIngreds);
newPotion.data.value = 100; /// \todo
newPotion.effects = effects;
newPotion.mData.mValue = 100; /// \todo
newPotion.mEffects = effects;
// pick a random mesh and icon
std::vector<std::string> names;
/// \todo is the mesh/icon dependent on alchemy skill?
@ -158,8 +158,8 @@ namespace MWGui
names.push_back("exclusive");
names.push_back("quality");
int random = rand() % names.size();
newPotion.model = "m\\misc_potion_" + names[random ] + "_01.nif";
newPotion.icon = "m\\tx_potion_" + names[random ] + "_01.dds";
newPotion.mModel = "m\\misc_potion_" + names[random ] + "_01.nif";
newPotion.mIcon = "m\\tx_potion_" + names[random ] + "_01.dds";
// check if a similiar potion record exists already
bool found = false;
@ -170,24 +170,24 @@ namespace MWGui
{
if (found) break;
if (it->second.data.value == newPotion.data.value
&& it->second.data.weight == newPotion.data.weight
&& it->second.name == newPotion.name
&& it->second.effects.list.size() == newPotion.effects.list.size())
if (it->second.mData.mValue == newPotion.mData.mValue
&& it->second.mData.mWeight == newPotion.mData.mWeight
&& it->second.mName == newPotion.mName
&& it->second.mEffects.mList.size() == newPotion.mEffects.mList.size())
{
// check effects
for (unsigned int i=0; i < it->second.effects.list.size(); ++i)
for (unsigned int i=0; i < it->second.mEffects.mList.size(); ++i)
{
const ESM::ENAMstruct& a = it->second.effects.list[i];
const ESM::ENAMstruct& b = newPotion.effects.list[i];
if (a.effectID == b.effectID
&& a.area == b.area
&& a.range == b.range
&& a.skill == b.skill
&& a.attribute == b.attribute
&& a.magnMin == b.magnMin
&& a.magnMax == b.magnMax
&& a.duration == b.duration)
const ESM::ENAMstruct& a = it->second.mEffects.mList[i];
const ESM::ENAMstruct& b = newPotion.mEffects.mList[i];
if (a.mEffectID == b.mEffectID
&& a.mArea == b.mArea
&& a.mRange == b.mRange
&& a.mSkill == b.mSkill
&& a.mAttribute == b.mAttribute
&& a.mMagnMin == b.mMagnMin
&& a.mMagnMax == b.mMagnMax
&& a.mDuration == b.mDuration)
{
found = true;
objectId = it->first;
@ -268,17 +268,17 @@ namespace MWGui
it != store.end(); ++it)
{
MWWorld::LiveCellRef<ESM::Apparatus>* ref = it->get<ESM::Apparatus>();
if (ref->base->data.type == ESM::Apparatus::Albemic
&& (bestAlbemic.isEmpty() || ref->base->data.quality > bestAlbemic.get<ESM::Apparatus>()->base->data.quality))
if (ref->base->mData.mType == ESM::Apparatus::Albemic
&& (bestAlbemic.isEmpty() || ref->base->mData.mQuality > bestAlbemic.get<ESM::Apparatus>()->base->mData.mQuality))
bestAlbemic = *it;
else if (ref->base->data.type == ESM::Apparatus::MortarPestle
&& (bestMortarPestle.isEmpty() || ref->base->data.quality > bestMortarPestle.get<ESM::Apparatus>()->base->data.quality))
else if (ref->base->mData.mType == ESM::Apparatus::MortarPestle
&& (bestMortarPestle.isEmpty() || ref->base->mData.mQuality > bestMortarPestle.get<ESM::Apparatus>()->base->mData.mQuality))
bestMortarPestle = *it;
else if (ref->base->data.type == ESM::Apparatus::Calcinator
&& (bestCalcinator.isEmpty() || ref->base->data.quality > bestCalcinator.get<ESM::Apparatus>()->base->data.quality))
else if (ref->base->mData.mType == ESM::Apparatus::Calcinator
&& (bestCalcinator.isEmpty() || ref->base->mData.mQuality > bestCalcinator.get<ESM::Apparatus>()->base->mData.mQuality))
bestCalcinator = *it;
else if (ref->base->data.type == ESM::Apparatus::Retort
&& (bestRetort.isEmpty() || ref->base->data.quality > bestRetort.get<ESM::Apparatus>()->base->data.quality))
else if (ref->base->mData.mType == ESM::Apparatus::Retort
&& (bestRetort.isEmpty() || ref->base->mData.mQuality > bestRetort.get<ESM::Apparatus>()->base->mData.mQuality))
bestRetort = *it;
}
@ -415,12 +415,12 @@ namespace MWGui
MWWorld::LiveCellRef<ESM::Ingredient>* ref = ingredient->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>();
for (int i=0; i<4; ++i)
{
if (ref->base->data.effectID[i] < 0)
if (ref->base->mData.mEffectID[i] < 0)
continue;
MWGui::Widgets::SpellEffectParams params;
params.mEffectID = ref->base->data.effectID[i];
params.mAttribute = ref->base->data.attributes[i];
params.mSkill = ref->base->data.skills[i];
params.mEffectID = ref->base->mData.mEffectID[i];
params.mAttribute = ref->base->mData.mAttributes[i];
params.mSkill = ref->base->mData.mSkills[i];
effects.push_back(params);
}

@ -118,7 +118,7 @@ void BirthDialog::updateBirths()
for (; it != end; ++it)
{
const ESM::BirthSign &birth = it->second;
mBirthList->addItem(birth.name, it->first);
mBirthList->addItem(birth.mName, it->first);
if (boost::iequals(it->first, mCurrentBirthId))
mBirthList->setIndexSelected(index);
++index;
@ -143,21 +143,21 @@ void BirthDialog::updateSpells()
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::BirthSign *birth = store.birthSigns.find(mCurrentBirthId);
std::string texturePath = std::string("textures\\") + birth->texture;
std::string texturePath = std::string("textures\\") + birth->mTexture;
fixTexturePath(texturePath);
mBirthImage->setImageTexture(texturePath);
std::vector<std::string> abilities, powers, spells;
std::vector<std::string>::const_iterator it = birth->powers.list.begin();
std::vector<std::string>::const_iterator end = birth->powers.list.end();
std::vector<std::string>::const_iterator it = birth->mPowers.mList.begin();
std::vector<std::string>::const_iterator end = birth->mPowers.mList.end();
for (; it != end; ++it)
{
const std::string &spellId = *it;
const ESM::Spell *spell = store.spells.search(spellId);
if (!spell)
continue; // Skip spells which cannot be found
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->data.type);
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->mData.mType);
if (type != ESM::Spell::ST_Spell && type != ESM::Spell::ST_Ability && type != ESM::Spell::ST_Power)
continue; // We only want spell, ability and powers.

@ -60,7 +60,7 @@ void BookWindow::open (MWWorld::Ptr book)
MWWorld::LiveCellRef<ESM::Book> *ref = mBook.get<ESM::Book>();
BookTextParser parser;
std::vector<std::string> results = parser.split(ref->base->text, mLeftPage->getSize().width, mLeftPage->getSize().height);
std::vector<std::string> results = parser.split(ref->base->mText, mLeftPage->getSize().width, mLeftPage->getSize().height);
int i=0;
for (std::vector<std::string>::iterator it=results.begin();

@ -221,7 +221,7 @@ void CharacterCreation::spawnDialog(const char id)
mPickClassDialog = 0;
mPickClassDialog = new PickClassDialog(*mWM);
mPickClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
mPickClassDialog->setClassId(mPlayerClass.name);
mPickClassDialog->setClassId(mPlayerClass.mName);
mPickClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogDone);
mPickClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogBack);
mPickClassDialog->setVisible(true);
@ -537,24 +537,24 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
if (mCreateClassDialog)
{
ESM::Class klass;
klass.name = mCreateClassDialog->getName();
klass.description = mCreateClassDialog->getDescription();
klass.data.specialization = mCreateClassDialog->getSpecializationId();
klass.data.isPlayable = 0x1;
klass.mName = mCreateClassDialog->getName();
klass.mDescription = mCreateClassDialog->getDescription();
klass.mData.mSpecialization = mCreateClassDialog->getSpecializationId();
klass.mData.mIsPlayable = 0x1;
std::vector<int> attributes = mCreateClassDialog->getFavoriteAttributes();
assert(attributes.size() == 2);
klass.data.attribute[0] = attributes[0];
klass.data.attribute[1] = attributes[1];
klass.mData.mAttribute[0] = attributes[0];
klass.mData.mAttribute[1] = attributes[1];
std::vector<ESM::Skill::SkillEnum> majorSkills = mCreateClassDialog->getMajorSkills();
std::vector<ESM::Skill::SkillEnum> minorSkills = mCreateClassDialog->getMinorSkills();
assert(majorSkills.size() >= sizeof(klass.data.skills)/sizeof(klass.data.skills[0]));
assert(minorSkills.size() >= sizeof(klass.data.skills)/sizeof(klass.data.skills[0]));
for (size_t i = 0; i < sizeof(klass.data.skills)/sizeof(klass.data.skills[0]); ++i)
assert(majorSkills.size() >= sizeof(klass.mData.mSkills)/sizeof(klass.mData.mSkills[0]));
assert(minorSkills.size() >= sizeof(klass.mData.mSkills)/sizeof(klass.mData.mSkills[0]));
for (size_t i = 0; i < sizeof(klass.mData.mSkills)/sizeof(klass.mData.mSkills[0]); ++i)
{
klass.data.skills[i][1] = majorSkills[i];
klass.data.skills[i][0] = minorSkills[i];
klass.mData.mSkills[i][1] = majorSkills[i];
klass.mData.mSkills[i][0] = minorSkills[i];
}
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(klass);
mPlayerClass = klass;

@ -50,7 +50,7 @@ void GenerateClassResultDialog::setClassId(const std::string &classId)
{
mCurrentClassId = classId;
mClassImage->setImageTexture(std::string("textures\\levelup\\") + mCurrentClassId + ".dds");
mClassName->setCaption(MWBase::Environment::get().getWorld()->getStore().classes.find(mCurrentClassId)->name);
mClassName->setCaption(MWBase::Environment::get().getWorld()->getStore().classes.find(mCurrentClassId)->mName);
}
// widget controls
@ -183,12 +183,12 @@ void PickClassDialog::updateClasses()
for (; it != end; ++it)
{
const ESM::Class &klass = it->second;
bool playable = (klass.data.isPlayable != 0);
bool playable = (klass.mData.mIsPlayable != 0);
if (!playable) // Only display playable classes
continue;
const std::string &id = it->first;
mClassList->addItem(klass.name, id);
mClassList->addItem(klass.mName, id);
if (boost::iequals(id, mCurrentClassId))
mClassList->setIndexSelected(index);
++index;
@ -204,7 +204,7 @@ void PickClassDialog::updateStats()
if (!klass)
return;
ESM::Class::Specialization specialization = static_cast<ESM::Class::Specialization>(klass->data.specialization);
ESM::Class::Specialization specialization = static_cast<ESM::Class::Specialization>(klass->mData.mSpecialization);
static const char *specIds[3] = {
"sSpecializationCombat",
@ -215,17 +215,17 @@ void PickClassDialog::updateStats()
mSpecializationName->setCaption(specName);
ToolTips::createSpecializationToolTip(mSpecializationName, specName, specialization);
mFavoriteAttribute[0]->setAttributeId(klass->data.attribute[0]);
mFavoriteAttribute[1]->setAttributeId(klass->data.attribute[1]);
mFavoriteAttribute[0]->setAttributeId(klass->mData.mAttribute[0]);
mFavoriteAttribute[1]->setAttributeId(klass->mData.mAttribute[1]);
ToolTips::createAttributeToolTip(mFavoriteAttribute[0], mFavoriteAttribute[0]->getAttributeId());
ToolTips::createAttributeToolTip(mFavoriteAttribute[1], mFavoriteAttribute[1]->getAttributeId());
for (int i = 0; i < 5; ++i)
{
mMinorSkill[i]->setSkillNumber(klass->data.skills[i][0]);
mMajorSkill[i]->setSkillNumber(klass->data.skills[i][1]);
ToolTips::createSkillToolTip(mMinorSkill[i], klass->data.skills[i][0]);
ToolTips::createSkillToolTip(mMajorSkill[i], klass->data.skills[i][1]);
mMinorSkill[i]->setSkillNumber(klass->mData.mSkills[i][0]);
mMajorSkill[i]->setSkillNumber(klass->mData.mSkills[i][1]);
ToolTips::createSkillToolTip(mMinorSkill[i], klass->mData.mSkills[i][0]);
ToolTips::createSkillToolTip(mMajorSkill[i], klass->mData.mSkills[i][1]);
}
mClassImage->setImageTexture(std::string("textures\\levelup\\") + mCurrentClassId + ".dds");
@ -664,9 +664,9 @@ SelectSpecializationDialog::SelectSpecializationDialog(MWBase::WindowManager& pa
getWidget(mSpecialization0, "Specialization0");
getWidget(mSpecialization1, "Specialization1");
getWidget(mSpecialization2, "Specialization2");
std::string combat = mWindowManager.getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Combat], "");
std::string magic = mWindowManager.getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Magic], "");
std::string stealth = mWindowManager.getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Stealth], "");
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], "");
mSpecialization0->setCaption(combat);
mSpecialization0->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
@ -728,7 +728,7 @@ SelectAttributeDialog::SelectAttributeDialog(MWBase::WindowManager& parWindowMan
getWidget(attribute, std::string("Attribute").append(1, theIndex));
attribute->setWindowManager(&parWindowManager);
attribute->setAttributeId(ESM::Attribute::attributeIds[i]);
attribute->setAttributeId(ESM::Attribute::sAttributeIds[i]);
attribute->eventClicked += MyGUI::newDelegate(this, &SelectAttributeDialog::onAttributeClicked);
ToolTips::createAttributeToolTip(attribute, attribute->getAttributeId());
}

@ -407,7 +407,7 @@ namespace MWGui
{
mPtr = object;
if (!mPtr.isEmpty())
setTitle("#{sConsoleTitle} (" + mPtr.getCellRef().refID + ")");
setTitle("#{sConsoleTitle} (" + mPtr.getCellRef().mRefID + ")");
else
setTitle("#{sConsoleTitle}");
MyGUI::InputManager::getInstance().setKeyFocusWidget(command);

@ -129,8 +129,8 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender)
{
// the player is trying to sell an item, check if the merchant accepts it
// also, don't allow selling gold (let's be better than Morrowind at this, can we?)
if (!MWBase::Environment::get().getWindowManager()->getTradeWindow()->npcAcceptsItem(object)
|| MWWorld::Class::get(object).getName(object) == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString())
if (!MWBase::Environment::get().getWindowManager()->getTradeWindow()->npcAcceptsItem(object) ||
MWWorld::Class::get(object).getName(object) == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString())
{
// user notification "i don't buy this item"
MWBase::Environment::get().getWindowManager()->
@ -274,11 +274,12 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender)
if (mPtr.getTypeName() == typeid(ESM::Container).name())
{
MWWorld::LiveCellRef<ESM::Container>* ref = mPtr.get<ESM::Container>();
if (ref->base->flags & ESM::Container::Organic)
if (ref->base->mFlags & ESM::Container::Organic)
{
// user notification
MWBase::Environment::get().getWindowManager()->
messageBox("#{sContentsMessage2}", std::vector<std::string>());
return;
}
}
@ -302,6 +303,7 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender)
// user notification
MWBase::Environment::get().getWindowManager()->
messageBox("#{sContentsMessage3}", std::vector<std::string>());
return;
}
else

@ -350,7 +350,7 @@ void HUD::onResChange(int width, int height)
void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
std::string spellName = spell->name;
std::string spellName = spell->mName;
if (spellName != mSpellName && mSpellVisible)
{
mWeaponSpellTimer = 5.0f;
@ -369,8 +369,8 @@ void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent)
mSpellBox->setUserString("Spell", spellId);
// use the icon of the first effect
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->effects.list.front().effectID);
std::string icon = effect->icon;
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->mEffects.mList.front().mEffectID);
std::string icon = effect->mIcon;
int slashPos = icon.find("\\");
icon.insert(slashPos+1, "b_");
icon = std::string("icons\\") + icon;

@ -284,7 +284,7 @@ namespace MWGui
for (MWWorld::ContainerStoreIterator it = invStore.begin();
it != invStore.end(); ++it)
{
if (toLower(it->getCellRef().refID) == "gold_001")
if (toLower(it->getCellRef().mRefID) == "gold_001")
return it->getRefData().getCount();
}
return 0;

@ -128,7 +128,7 @@ namespace MWGui
std::map<std::string, ESM::Class> list = MWBase::Environment::get().getWorld()->getStore ().classes.list;
for (std::map<std::string, ESM::Class>::iterator it = list.begin(); it != list.end(); ++it)
{
if (playerClass.name == it->second.name)
if (playerClass.mName == it->second.mName)
classId = it->first;
}
mClassImage->setImageTexture ("textures\\levelup\\" + classId + ".dds");

@ -406,16 +406,15 @@ void MapWindow::globalMapUpdatePlayer ()
rotatingSubskin->setCenter(MyGUI::IntPoint(16,16));
float angle = std::atan2(dir.x, dir.y);
rotatingSubskin->setAngle(angle);
}
// set the view offset so that player is in the center
MyGUI::IntSize viewsize = mGlobalMap->getSize();
MyGUI::IntPoint viewoffs(0.5*viewsize.width - worldX, 0.5*viewsize.height - worldY);
mGlobalMap->setViewOffset(viewoffs);
// set the view offset so that player is in the center
MyGUI::IntSize viewsize = mGlobalMap->getSize();
MyGUI::IntPoint viewoffs(0.5*viewsize.width - worldX, 0.5*viewsize.height - worldY);
mGlobalMap->setViewOffset(viewoffs);
}
}
void MapWindow::notifyPlayerUpdate ()
{
if (mGlobal)
globalMapUpdatePlayer ();
globalMapUpdatePlayer ();
}

@ -32,7 +32,7 @@ namespace
const ESM::Spell* a = MWBase::Environment::get().getWorld()->getStore().spells.find(left);
const ESM::Spell* b = MWBase::Environment::get().getWorld()->getStore().spells.find(right);
int cmp = a->name.compare(b->name);
int cmp = a->mName.compare(b->mName);
return cmp < 0;
}
}
@ -236,8 +236,8 @@ namespace MWGui
// use the icon of the first effect
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->effects.list.front().effectID);
std::string path = effect->icon;
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->mEffects.mList.front().mEffectID);
std::string path = effect->mIcon;
int slashPos = path.find("\\");
path.insert(slashPos+1, "b_");
path = std::string("icons\\") + path;
@ -439,15 +439,15 @@ namespace MWGui
while (it != spellList.end())
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
if (spell->data.type == ESM::Spell::ST_Power)
if (spell->mData.mType == ESM::Spell::ST_Power)
{
powers.push_back(*it);
it = spellList.erase(it);
}
else if (spell->data.type == ESM::Spell::ST_Ability
|| spell->data.type == ESM::Spell::ST_Blight
|| spell->data.type == ESM::Spell::ST_Curse
|| spell->data.type == ESM::Spell::ST_Disease)
else if (spell->mData.mType == ESM::Spell::ST_Ability
|| spell->mData.mType == ESM::Spell::ST_Blight
|| spell->mData.mType == ESM::Spell::ST_Curse
|| spell->mData.mType == ESM::Spell::ST_Disease)
{
it = spellList.erase(it);
}
@ -466,7 +466,7 @@ namespace MWGui
{
// only add items with "Cast once" or "Cast on use"
const ESM::Enchantment* enchant = MWBase::Environment::get().getWorld()->getStore().enchants.find(enchantId);
int type = enchant->data.type;
int type = enchant->mData.mType;
if (type != ESM::Enchantment::CastOnce
&& type != ESM::Enchantment::WhenUsed)
continue;
@ -490,7 +490,7 @@ namespace MWGui
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(spell->name);
t->setCaption(spell->mName);
t->setTextAlign(MyGUI::Align::Left);
t->setUserString("ToolTipType", "Spell");
t->setUserString("Spell", *it);
@ -507,7 +507,7 @@ namespace MWGui
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(spell->name);
t->setCaption(spell->mName);
t->setTextAlign(MyGUI::Align::Left);
t->setUserString("ToolTipType", "Spell");
t->setUserString("Spell", *it);

@ -223,11 +223,11 @@ void RaceDialog::updateRaces()
for (; it != end; ++it)
{
const ESM::Race &race = it->second;
bool playable = race.data.flags & ESM::Race::Playable;
bool playable = race.mData.mFlags & ESM::Race::Playable;
if (!playable) // Only display playable races
continue;
mRaceList->addItem(race.name, it->first);
mRaceList->addItem(race.mName, it->first);
if (boost::iequals(it->first, mCurrentRaceId))
mRaceList->setIndexSelected(index);
++index;
@ -251,10 +251,10 @@ void RaceDialog::updateSkills()
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(mCurrentRaceId);
int count = sizeof(race->data.bonus)/sizeof(race->data.bonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
int count = sizeof(race->mData.mBonus)/sizeof(race->mData.mBonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
for (int i = 0; i < count; ++i)
{
int skillId = race->data.bonus[i].skill;
int skillId = race->mData.mBonus[i].mSkill;
if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
continue;
@ -262,7 +262,7 @@ void RaceDialog::updateSkills()
std::string("Skill") + boost::lexical_cast<std::string>(i));
skillWidget->setWindowManager(&mWindowManager);
skillWidget->setSkillNumber(skillId);
skillWidget->setSkillValue(MWSkill::SkillValue(race->data.bonus[i].bonus));
skillWidget->setSkillValue(MWSkill::SkillValue(race->mData.mBonus[i].mBonus));
ToolTips::createSkillToolTip(skillWidget, skillId);
@ -290,8 +290,8 @@ void RaceDialog::updateSpellPowers()
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(mCurrentRaceId);
std::vector<std::string>::const_iterator it = race->powers.list.begin();
std::vector<std::string>::const_iterator end = race->powers.list.end();
std::vector<std::string>::const_iterator it = race->mPowers.mList.begin();
std::vector<std::string>::const_iterator end = race->mPowers.mList.end();
for (int i = 0; it != end; ++it)
{
const std::string &spellpower = *it;

@ -70,9 +70,9 @@ ReviewDialog::ReviewDialog(MWBase::WindowManager& parWindowManager)
for (int idx = 0; idx < ESM::Attribute::Length; ++idx)
{
getWidget(attribute, std::string("Attribute") + boost::lexical_cast<std::string>(idx));
mAttributeWidgets.insert(std::make_pair(static_cast<int>(ESM::Attribute::attributeIds[idx]), attribute));
mAttributeWidgets.insert(std::make_pair(static_cast<int>(ESM::Attribute::sAttributeIds[idx]), attribute));
attribute->setWindowManager(&mWindowManager);
attribute->setAttributeId(ESM::Attribute::attributeIds[idx]);
attribute->setAttributeId(ESM::Attribute::sAttributeIds[idx]);
attribute->setAttributeValue(MWAttribute::AttributeValue(0, 0));
}
@ -112,14 +112,14 @@ void ReviewDialog::setRace(const std::string &raceId)
if (race)
{
ToolTips::createRaceToolTip(mRaceWidget, race);
mRaceWidget->setCaption(race->name);
mRaceWidget->setCaption(race->mName);
}
}
void ReviewDialog::setClass(const ESM::Class& class_)
{
mKlass = class_;
mClassWidget->setCaption(mKlass.name);
mClassWidget->setCaption(mKlass.mName);
ToolTips::createClassToolTip(mClassWidget, mKlass);
}
@ -129,7 +129,7 @@ void ReviewDialog::setBirthSign(const std::string& signId)
const ESM::BirthSign *sign = MWBase::Environment::get().getWorld()->getStore().birthSigns.search(mBirthSignId);
if (sign)
{
mBirthSignWidget->setCaption(sign->name);
mBirthSignWidget->setCaption(sign->mName);
ToolTips::createBirthsignToolTip(mBirthSignWidget, mBirthSignId);
}
}
@ -193,9 +193,9 @@ void ReviewDialog::configureSkills(const std::vector<int>& major, const std::vec
std::set<int> skillSet;
std::copy(major.begin(), major.end(), std::inserter(skillSet, skillSet.begin()));
std::copy(minor.begin(), minor.end(), std::inserter(skillSet, skillSet.begin()));
boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator end = ESM::Skill::skillIds.end();
boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator end = ESM::Skill::sSkillIds.end();
mMiscSkills.clear();
for (boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator it = ESM::Skill::skillIds.begin(); it != end; ++it)
for (boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator it = ESM::Skill::sSkillIds.begin(); it != end; ++it)
{
int skill = *it;
if (skillSet.find(skill) == skillSet.end())

@ -36,7 +36,7 @@ void ScrollWindow::open (MWWorld::Ptr scroll)
MWWorld::LiveCellRef<ESM::Book> *ref = mScroll.get<ESM::Book>();
BookTextParser parser;
MyGUI::IntSize size = parser.parse(ref->base->text, mTextView, 390);
MyGUI::IntSize size = parser.parse(ref->base->mText, mTextView, 390);
if (size.height > mTextView->getSize().height)
mTextView->setCanvasSize(MyGUI::IntSize(410, size.height));

@ -51,12 +51,23 @@ namespace MWGui
void SpellBuyingWindow::addSpell(const std::string& spellId)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
int price = spell->data.cost*MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fSpellValueMult")->getFloat();
MyGUI::Button* toAdd = mSpellsView->createWidget<MyGUI::Button>((price>mWindowManager.getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SpellText", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default);
int price = spell->mData.mCost*MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fSpellValueMult")->getFloat();
MyGUI::Button* toAdd =
mSpellsView->createWidget<MyGUI::Button>(
(price>mWindowManager.getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SpellText",
0,
mCurrentY,
200,
sLineHeight,
MyGUI::Align::Default
);
mCurrentY += sLineHeight;
/// \todo price adjustment depending on merchantile skill
toAdd->setUserData(price);
toAdd->setCaptionWithReplacing(spell->name+" - "+boost::lexical_cast<std::string>(price)+"#{sgp}");
toAdd->setCaptionWithReplacing(spell->mName+" - "+boost::lexical_cast<std::string>(price)+"#{sgp}");
toAdd->setSize(toAdd->getTextSize().width,sLineHeight);
toAdd->eventMouseWheel += MyGUI::newDelegate(this, &SpellBuyingWindow::onMouseWheel);
toAdd->setUserString("ToolTipType", "Spell");
@ -89,7 +100,7 @@ namespace MWGui
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find (*iter);
if (spell->data.type!=ESM::Spell::ST_Spell)
if (spell->mData.mType!=ESM::Spell::ST_Spell)
continue; // don't try to sell diseases, curses or powers
if (std::find (playerSpells.begin(), playerSpells.end(), *iter)!=playerSpells.end())

@ -29,7 +29,7 @@ namespace
const ESM::Spell* a = MWBase::Environment::get().getWorld()->getStore().spells.find(left);
const ESM::Spell* b = MWBase::Environment::get().getWorld()->getStore().spells.find(right);
int cmp = a->name.compare(b->name);
int cmp = a->mName.compare(b->mName);
return cmp < 0;
}
@ -144,15 +144,15 @@ namespace MWGui
while (it != spellList.end())
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
if (spell->data.type == ESM::Spell::ST_Power)
if (spell->mData.mType == ESM::Spell::ST_Power)
{
powers.push_back(*it);
it = spellList.erase(it);
}
else if (spell->data.type == ESM::Spell::ST_Ability
|| spell->data.type == ESM::Spell::ST_Blight
|| spell->data.type == ESM::Spell::ST_Curse
|| spell->data.type == ESM::Spell::ST_Disease)
else if (spell->mData.mType == ESM::Spell::ST_Ability
|| spell->mData.mType == ESM::Spell::ST_Blight
|| spell->mData.mType == ESM::Spell::ST_Curse
|| spell->mData.mType == ESM::Spell::ST_Disease)
{
it = spellList.erase(it);
}
@ -171,7 +171,7 @@ namespace MWGui
{
// only add items with "Cast once" or "Cast on use"
const ESM::Enchantment* enchant = MWBase::Environment::get().getWorld()->getStore().enchants.find(enchantId);
int type = enchant->data.type;
int type = enchant->mData.mType;
if (type != ESM::Enchantment::CastOnce
&& type != ESM::Enchantment::WhenUsed)
continue;
@ -194,7 +194,7 @@ namespace MWGui
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
MyGUI::Button* t = mSpellView->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(spell->name);
t->setCaption(spell->mName);
t->setTextAlign(MyGUI::Align::Left);
t->setUserString("ToolTipType", "Spell");
t->setUserString("Spell", *it);
@ -214,7 +214,7 @@ namespace MWGui
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
MyGUI::Button* t = mSpellView->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(spell->name);
t->setCaption(spell->mName);
t->setTextAlign(MyGUI::Align::Left);
t->setUserString("ToolTipType", "Spell");
t->setUserString("Spell", *it);
@ -225,7 +225,7 @@ namespace MWGui
// cost / success chance
MyGUI::Button* costChance = mSpellView->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
std::string cost = boost::lexical_cast<std::string>(spell->data.cost);
std::string cost = boost::lexical_cast<std::string>(spell->mData.mCost);
std::string chance = boost::lexical_cast<std::string>(int(MWMechanics::getSpellSuccessChance(*it, player)));
costChance->setCaption(cost + "/" + chance);
costChance->setTextAlign(MyGUI::Align::Right);
@ -272,9 +272,9 @@ namespace MWGui
MyGUI::Button* costCharge = mSpellView->createWidget<MyGUI::Button>(equipped ? "SpellText" : "SpellTextUnequipped",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
std::string cost = boost::lexical_cast<std::string>(enchant->data.cost);
std::string charge = boost::lexical_cast<std::string>(enchant->data.charge); /// \todo track current charge
if (enchant->data.type == ESM::Enchantment::CastOnce)
std::string cost = boost::lexical_cast<std::string>(enchant->mData.mCost);
std::string charge = boost::lexical_cast<std::string>(enchant->mData.mCharge); /// \todo track current charge
if (enchant->mData.mType == ESM::Enchantment::CastOnce)
{
// this is Morrowind behaviour
cost = "100";
@ -379,8 +379,8 @@ namespace MWGui
{
// delete spell, if allowed
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
if (spell->data.flags & ESM::Spell::F_Always
|| spell->data.type == ESM::Spell::ST_Power)
if (spell->mData.mFlags & ESM::Spell::F_Always
|| spell->mData.mType == ESM::Spell::ST_Power)
{
mWindowManager.messageBox("#{sDeleteSpellError}", std::vector<std::string>());
}
@ -390,7 +390,7 @@ namespace MWGui
mSpellToDelete = spellId;
ConfirmationDialog* dialog = mWindowManager.getConfirmationDialog();
std::string question = mWindowManager.getGameSettingString("sQuestionDeleteSpell", "Delete %s?");
question = boost::str(boost::format(question) % spell->name);
question = boost::str(boost::format(question) % spell->mName);
dialog->open(question);
dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &SpellWindow::onDeleteSpellAccept);

@ -222,9 +222,9 @@ void StatsWindow::configureSkills (const std::vector<int>& major, const std::vec
std::set<int> skillSet;
std::copy(major.begin(), major.end(), std::inserter(skillSet, skillSet.begin()));
std::copy(minor.begin(), minor.end(), std::inserter(skillSet, skillSet.begin()));
boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator end = ESM::Skill::skillIds.end();
boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator end = ESM::Skill::sSkillIds.end();
mMiscSkills.clear();
for (boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator it = ESM::Skill::skillIds.begin(); it != end; ++it)
for (boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator it = ESM::Skill::sSkillIds.begin(); it != end; ++it)
{
int skill = *it;
if (skillSet.find(skill) == skillSet.end())
@ -368,7 +368,7 @@ void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId,
std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->data.attribute);
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->mData.mAttribute);
assert(attr);
std::string state = "normal";
@ -384,8 +384,8 @@ void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId,
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("ToolTipType", "Layout");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("ToolTipLayout", "SkillToolTip");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillName", "#{"+skillNameId+"}");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillDescription", skill->description);
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillAttribute", "#{sGoverningAttribute}: #{" + attr->name + "}");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillDescription", skill->mDescription);
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillAttribute", "#{sGoverningAttribute}: #{" + attr->mName + "}");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("ImageTexture_SkillImage", icon);
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillProgressText", boost::lexical_cast<std::string>(progressPercent)+"/100");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Range_SkillProgress", "100");
@ -451,41 +451,41 @@ void StatsWindow::updateSkillArea()
for (FactionList::const_iterator it = mFactions.begin(); it != end; ++it)
{
const ESM::Faction *faction = store.factions.find(it->first);
MyGUI::Widget* w = addItem(faction->name, coord1, coord2);
MyGUI::Widget* w = addItem(faction->mName, coord1, coord2);
std::string text;
text += std::string("#DDC79E") + faction->name;
text += std::string("\n#BF9959") + faction->ranks[it->second];
text += std::string("#DDC79E") + faction->mName;
text += std::string("\n#BF9959") + faction->mRanks[it->second];
if (it->second < 9)
{
// player doesn't have max rank yet
text += std::string("\n\n#DDC79E#{sNextRank} ") + faction->ranks[it->second+1];
text += std::string("\n\n#DDC79E#{sNextRank} ") + faction->mRanks[it->second+1];
ESM::RankData rankData = faction->data.rankData[it->second+1];
const ESM::Attribute* attr1 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->data.attribute1);
const ESM::Attribute* attr2 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->data.attribute2);
ESM::RankData rankData = faction->mData.mRankData[it->second+1];
const ESM::Attribute* attr1 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->mData.mAttribute1);
const ESM::Attribute* attr2 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->mData.mAttribute2);
assert(attr1 && attr2);
text += "\n#BF9959#{" + attr1->name + "}: " + boost::lexical_cast<std::string>(rankData.attribute1)
+ ", #{" + attr2->name + "}: " + boost::lexical_cast<std::string>(rankData.attribute2);
text += "\n#BF9959#{" + attr1->mName + "}: " + boost::lexical_cast<std::string>(rankData.mAttribute1)
+ ", #{" + attr2->mName + "}: " + boost::lexical_cast<std::string>(rankData.mAttribute2);
text += "\n\n#DDC79E#{sFavoriteSkills}";
text += "\n#BF9959";
for (int i=0; i<6; ++i)
{
text += "#{"+ESM::Skill::sSkillNameIds[faction->data.skillID[i]]+"}";
text += "#{"+ESM::Skill::sSkillNameIds[faction->mData.mSkillID[i]]+"}";
if (i<5)
text += ", ";
}
text += "\n";
if (rankData.skill1 > 0)
text += "\n#{sNeedOneSkill} " + boost::lexical_cast<std::string>(rankData.skill1);
if (rankData.skill2 > 0)
text += "\n#{sNeedTwoSkills} " + boost::lexical_cast<std::string>(rankData.skill2);
if (rankData.mSkill1 > 0)
text += "\n#{sNeedOneSkill} " + boost::lexical_cast<std::string>(rankData.mSkill1);
if (rankData.mSkill2 > 0)
text += "\n#{sNeedTwoSkills} " + boost::lexical_cast<std::string>(rankData.mSkill2);
}
w->setUserString("ToolTipType", "Layout");
@ -502,7 +502,7 @@ void StatsWindow::updateSkillArea()
addGroup(mWindowManager.getGameSettingString("sBirthSign", "Sign"), coord1, coord2);
const ESM::BirthSign *sign = store.birthSigns.find(mBirthSignId);
MyGUI::Widget* w = addItem(sign->name, coord1, coord2);
MyGUI::Widget* w = addItem(sign->mName, coord1, coord2);
ToolTips::createBirthsignToolTip(w, mBirthSignId);
}

@ -184,20 +184,20 @@ void ToolTips::onFrame(float frameDuration)
{
ToolTipInfo info;
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.find(focus->getUserString("Spell"));
info.caption = spell->name;
info.caption = spell->mName;
Widgets::SpellEffectList effects;
std::vector<ESM::ENAMstruct>::const_iterator end = spell->effects.list.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->effects.list.begin(); it != end; ++it)
std::vector<ESM::ENAMstruct>::const_iterator end = spell->mEffects.mList.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->mEffects.mList.begin(); it != end; ++it)
{
Widgets::SpellEffectParams params;
params.mEffectID = it->effectID;
params.mSkill = it->skill;
params.mAttribute = it->attribute;
params.mDuration = it->duration;
params.mMagnMin = it->magnMin;
params.mMagnMax = it->magnMax;
params.mRange = it->range;
params.mIsConstant = (spell->data.type == ESM::Spell::ST_Ability);
params.mEffectID = it->mEffectID;
params.mSkill = it->mSkill;
params.mAttribute = it->mAttribute;
params.mDuration = it->mDuration;
params.mMagnMin = it->mMagnMin;
params.mMagnMax = it->mMagnMax;
params.mRange = it->mRange;
params.mIsConstant = (spell->mData.mType == ESM::Spell::ST_Ability);
params.mNoTarget = false;
effects.push_back(params);
}
@ -373,13 +373,13 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
if (info.enchant != "")
{
enchant = store.enchants.search(info.enchant);
if (enchant->data.type == ESM::Enchantment::CastOnce)
if (enchant->mData.mType == ESM::Enchantment::CastOnce)
text += "\n#{sItemCastOnce}";
else if (enchant->data.type == ESM::Enchantment::WhenStrikes)
else if (enchant->mData.mType == ESM::Enchantment::WhenStrikes)
text += "\n#{sItemCastWhenStrikes}";
else if (enchant->data.type == ESM::Enchantment::WhenUsed)
else if (enchant->mData.mType == ESM::Enchantment::WhenUsed)
text += "\n#{sItemCastWhenUsed}";
else if (enchant->data.type == ESM::Enchantment::ConstantEffect)
else if (enchant->mData.mType == ESM::Enchantment::ConstantEffect)
text += "\n#{sItemCastConstant}";
}
@ -450,24 +450,25 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
Widgets::MWEffectListPtr enchantWidget = enchantArea->createWidget<Widgets::MWEffectList>
("MW_StatName", coord, Align::Default, "ToolTipEnchantWidget");
enchantWidget->setWindowManager(mWindowManager);
enchantWidget->setEffectList(Widgets::MWEffectList::effectListFromESM(&enchant->effects));
enchantWidget->setEffectList(Widgets::MWEffectList::effectListFromESM(&enchant->mEffects));
std::vector<MyGUI::WidgetPtr> enchantEffectItems;
int flag = (enchant->data.type == ESM::Enchantment::ConstantEffect) ? Widgets::MWEffectList::EF_Constant : 0;
int flag = (enchant->mData.mType == ESM::Enchantment::ConstantEffect) ? Widgets::MWEffectList::EF_Constant : 0;
enchantWidget->createEffectWidgets(enchantEffectItems, enchantArea, coord, true, flag);
totalSize.height += coord.top-6;
totalSize.width = std::max(totalSize.width, coord.width);
if (enchant->data.type == ESM::Enchantment::WhenStrikes
|| enchant->data.type == ESM::Enchantment::WhenUsed)
if (enchant->mData.mType == ESM::Enchantment::WhenStrikes
|| enchant->mData.mType == ESM::Enchantment::WhenUsed)
{
/// \todo store the current enchantment charge somewhere
int charge = enchant->data.charge;
int charge = enchant->mData.mCharge;
const int chargeWidth = 204;
TextBox* chargeText = enchantArea->createWidget<TextBox>("SandText", IntCoord(0, 0, 10, 18), Align::Default, "ToolTipEnchantChargeText");
chargeText->setCaptionWithReplacing("#{sCharges}");
const int chargeTextWidth = chargeText->getTextSize().width + 5;
const int chargeAndTextWidth = chargeWidth + chargeTextWidth;
@ -577,15 +578,15 @@ void ToolTips::createSkillToolTip(MyGUI::Widget* widget, int skillId)
const std::string &skillNameId = ESMS::Skill::sSkillNameIds[skillId];
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(skillId);
assert(skill);
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->data.attribute);
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->mData.mAttribute);
assert(attr);
std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
widget->setUserString("ToolTipType", "Layout");
widget->setUserString("ToolTipLayout", "SkillNoProgressToolTip");
widget->setUserString("Caption_SkillNoProgressName", "#{"+skillNameId+"}");
widget->setUserString("Caption_SkillNoProgressDescription", skill->description);
widget->setUserString("Caption_SkillNoProgressAttribute", "#{sGoverningAttribute}: #{" + attr->name + "}");
widget->setUserString("Caption_SkillNoProgressDescription", skill->mDescription);
widget->setUserString("Caption_SkillNoProgressAttribute", "#{sGoverningAttribute}: #{" + attr->mName + "}");
widget->setUserString("ImageTexture_SkillNoProgressImage", icon);
widget->setUserString("ToolTipLayout", "SkillNoProgressToolTip");
widget->setUserString("ToolTipLayout", "SkillNoProgressToolTip");
@ -596,9 +597,9 @@ void ToolTips::createAttributeToolTip(MyGUI::Widget* widget, int attributeId)
if (attributeId == -1)
return;
std::string icon = ESM::Attribute::attributeIcons[attributeId];
std::string name = ESM::Attribute::gmstAttributeIds[attributeId];
std::string desc = ESM::Attribute::gmstAttributeDescIds[attributeId];
std::string icon = ESM::Attribute::sAttributeIcons[attributeId];
std::string name = ESM::Attribute::sGmstAttributeIds[attributeId];
std::string desc = ESM::Attribute::sGmstAttributeDescIds[attributeId];
widget->setUserString("ToolTipType", "Layout");
widget->setUserString("ToolTipLayout", "AttributeToolTip");
@ -616,8 +617,8 @@ void ToolTips::createSpecializationToolTip(MyGUI::Widget* widget, const std::str
for (std::map<int, ESM::Skill>::const_iterator it = skills.begin();
it != skills.end(); ++it)
{
if (it->second.data.specialization == specId)
specText += std::string("\n#{") + ESM::Skill::sSkillNameIds[it->second.index] + "}";
if (it->second.mData.mSpecialization == specId)
specText += std::string("\n#{") + ESM::Skill::sSkillNameIds[it->second.mIndex] + "}";
}
widget->setUserString("Caption_CenteredCaptionText", specText);
widget->setUserString("ToolTipLayout", "TextWithCenteredCaptionToolTip");
@ -630,25 +631,25 @@ void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string&
widget->setUserString("ToolTipType", "Layout");
widget->setUserString("ToolTipLayout", "BirthSignToolTip");
std::string image = sign->texture;
std::string image = sign->mTexture;
image.replace(image.size()-3, 3, "dds");
widget->setUserString("ImageTexture_BirthSignImage", "textures\\" + image);
std::string text;
text += sign->name;
text += "\n#BF9959" + sign->description;
text += sign->mName;
text += "\n#BF9959" + sign->mDescription;
std::vector<std::string> abilities, powers, spells;
std::vector<std::string>::const_iterator it = sign->powers.list.begin();
std::vector<std::string>::const_iterator end = sign->powers.list.end();
std::vector<std::string>::const_iterator it = sign->mPowers.mList.begin();
std::vector<std::string>::const_iterator end = sign->mPowers.mList.end();
for (; it != end; ++it)
{
const std::string &spellId = *it;
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.search(spellId);
if (!spell)
continue; // Skip spells which cannot be found
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->data.type);
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->mData.mType);
if (type != ESM::Spell::ST_Spell && type != ESM::Spell::ST_Ability && type != ESM::Spell::ST_Power)
continue; // We only want spell, ability and powers.
@ -678,7 +679,7 @@ void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string&
const std::string &spellId = *it;
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.search(spellId);
text += "\n#BF9959" + spell->name;
text += "\n#BF9959" + spell->mName;
}
}
@ -687,18 +688,18 @@ void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string&
void ToolTips::createRaceToolTip(MyGUI::Widget* widget, const ESM::Race* playerRace)
{
widget->setUserString("Caption_CenteredCaption", playerRace->name);
widget->setUserString("Caption_CenteredCaptionText", playerRace->description);
widget->setUserString("Caption_CenteredCaption", playerRace->mName);
widget->setUserString("Caption_CenteredCaptionText", playerRace->mDescription);
widget->setUserString("ToolTipType", "Layout");
widget->setUserString("ToolTipLayout", "TextWithCenteredCaptionToolTip");
}
void ToolTips::createClassToolTip(MyGUI::Widget* widget, const ESM::Class& playerClass)
{
if (playerClass.name == "")
if (playerClass.mName == "")
return;
int spec = playerClass.data.specialization;
int spec = playerClass.mData.mSpecialization;
std::string specStr;
if (spec == 0)
specStr = "#{sSpecializationCombat}";
@ -707,8 +708,8 @@ void ToolTips::createClassToolTip(MyGUI::Widget* widget, const ESM::Class& playe
else if (spec == 2)
specStr = "#{sSpecializationStealth}";
widget->setUserString("Caption_ClassName", playerClass.name);
widget->setUserString("Caption_ClassDescription", playerClass.description);
widget->setUserString("Caption_ClassName", playerClass.mName);
widget->setUserString("Caption_ClassDescription", playerClass.mDescription);
widget->setUserString("Caption_ClassSpecialisation", "#{sSpecialization}: " + specStr);
widget->setUserString("ToolTipType", "Layout");
widget->setUserString("ToolTipLayout", "ClassToolTip");

@ -156,15 +156,15 @@ namespace MWGui
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
{
MWWorld::LiveCellRef<ESM::NPC>* ref = mPtr.get<ESM::NPC>();
if (ref->base->npdt52.gold == -10)
merchantgold = ref->base->npdt12.gold;
if (ref->base->mNpdt52.mGold == -10)
merchantgold = ref->base->mNpdt12.mGold;
else
merchantgold = ref->base->npdt52.gold;
merchantgold = ref->base->mNpdt52.mGold;
}
else // ESM::Creature
{
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
merchantgold = ref->base->data.gold;
merchantgold = ref->base->mData.mGold;
}
if (mCurrentBalance > 0 && merchantgold < mCurrentBalance)
{
@ -217,15 +217,15 @@ namespace MWGui
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
{
MWWorld::LiveCellRef<ESM::NPC>* ref = mPtr.get<ESM::NPC>();
if (ref->base->npdt52.gold == -10)
merchantgold = ref->base->npdt12.gold;
if (ref->base->mNpdt52.mGold == -10)
merchantgold = ref->base->mNpdt12.mGold;
else
merchantgold = ref->base->npdt52.gold;
merchantgold = ref->base->mNpdt52.mGold;
}
else // ESM::Creature
{
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
merchantgold = ref->base->data.gold;
merchantgold = ref->base->mData.mGold;
}
mMerchantGold->setCaptionWithReplacing("#{sSellerGold} " + boost::lexical_cast<std::string>(merchantgold));

@ -202,7 +202,7 @@ namespace MWGui
{
MWBase::Environment::get().getWorld ()->getFader ()->fadeIn(0.2);
mProgressBar.setVisible (false);
mWindowManager.popGuiMode ();
mWindowManager.removeGuiMode (GM_Rest);
mWaiting = false;
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
@ -215,4 +215,11 @@ namespace MWGui
}
}
void WaitDialog::wakeUp ()
{
mSleeping = false;
mWaiting = false;
stopWaiting();
}
}

@ -32,6 +32,7 @@ namespace MWGui
void bedActivated() { setCanRest(true); }
bool getSleeping() { return mWaiting && mSleeping; }
void wakeUp();
protected:
MyGUI::TextBox* mDateTimeText;

@ -233,19 +233,19 @@ void MWSpell::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI:
MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found");
MWSpellEffectPtr effect = nullptr;
std::vector<ESM::ENAMstruct>::const_iterator end = spell->effects.list.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->effects.list.begin(); it != end; ++it)
std::vector<ESM::ENAMstruct>::const_iterator end = spell->mEffects.mList.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->mEffects.mList.begin(); it != end; ++it)
{
effect = creator->createWidget<MWSpellEffect>("MW_EffectImage", coord, MyGUI::Align::Default);
effect->setWindowManager(mWindowManager);
SpellEffectParams params;
params.mEffectID = it->effectID;
params.mSkill = it->skill;
params.mAttribute = it->attribute;
params.mDuration = it->duration;
params.mMagnMin = it->magnMin;
params.mMagnMax = it->magnMax;
params.mRange = it->range;
params.mEffectID = it->mEffectID;
params.mSkill = it->mSkill;
params.mAttribute = it->mAttribute;
params.mDuration = it->mDuration;
params.mMagnMin = it->mMagnMin;
params.mMagnMax = it->mMagnMax;
params.mRange = it->mRange;
params.mIsConstant = (flags & MWEffectList::EF_Constant);
params.mNoTarget = (flags & MWEffectList::EF_NoTarget);
effect->setSpellEffect(params);
@ -262,7 +262,7 @@ void MWSpell::updateWidgets()
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Spell *spell = store.spells.search(mId);
if (spell)
static_cast<MyGUI::TextBox*>(mSpellNameWidget)->setCaption(spell->name);
static_cast<MyGUI::TextBox*>(mSpellNameWidget)->setCaption(spell->mName);
else
static_cast<MyGUI::TextBox*>(mSpellNameWidget)->setCaption("");
}
@ -351,17 +351,17 @@ MWEffectList::~MWEffectList()
SpellEffectList MWEffectList::effectListFromESM(const ESM::EffectList* effects)
{
SpellEffectList result;
std::vector<ESM::ENAMstruct>::const_iterator end = effects->list.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = effects->list.begin(); it != end; ++it)
std::vector<ESM::ENAMstruct>::const_iterator end = effects->mList.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = effects->mList.begin(); it != end; ++it)
{
SpellEffectParams params;
params.mEffectID = it->effectID;
params.mSkill = it->skill;
params.mAttribute = it->attribute;
params.mDuration = it->duration;
params.mMagnMin = it->magnMin;
params.mMagnMax = it->magnMax;
params.mRange = it->range;
params.mEffectID = it->mEffectID;
params.mSkill = it->mSkill;
params.mAttribute = it->mAttribute;
params.mDuration = it->mDuration;
params.mMagnMin = it->mMagnMin;
params.mMagnMax = it->mMagnMax;
params.mRange = it->mRange;
result.push_back(params);
}
return result;
@ -457,7 +457,7 @@ void MWSpellEffect::updateWidgets()
}
if (mImageWidget)
{
std::string path = std::string("icons\\") + magicEffect->icon;
std::string path = std::string("icons\\") + magicEffect->mIcon;
fixTexturePath(path);
mImageWidget->setImageTexture(path);
}

@ -169,12 +169,12 @@ WindowManager::WindowManager(
// Setup player stats
for (int i = 0; i < ESM::Attribute::Length; ++i)
{
mPlayerAttributes.insert(std::make_pair(ESM::Attribute::attributeIds[i], MWMechanics::Stat<int>()));
mPlayerAttributes.insert(std::make_pair(ESM::Attribute::sAttributeIds[i], MWMechanics::Stat<int>()));
}
for (int i = 0; i < ESM::Skill::Length; ++i)
{
mPlayerSkillValues.insert(std::make_pair(ESM::Skill::skillIds[i], MWMechanics::Stat<float>()));
mPlayerSkillValues.insert(std::make_pair(ESM::Skill::sSkillIds[i], MWMechanics::Stat<float>()));
}
unsetSelectedSpell();
@ -468,7 +468,7 @@ void WindowManager::setValue (const std::string& id, int value)
void WindowManager::setPlayerClass (const ESM::Class &class_)
{
mPlayerClass = class_;
mStatsWindow->setValue("class", mPlayerClass.name);
mStatsWindow->setValue("class", mPlayerClass.mName);
}
void WindowManager::configureSkills (const SkillList& major, const SkillList& minor)
@ -520,11 +520,11 @@ int WindowManager::readPressedButton ()
return mMessageBoxManager->readPressedButton();
}
const std::string &WindowManager::getGameSettingString(const std::string &id, const std::string &default_)
std::string WindowManager::getGameSettingString(const std::string &id, const std::string &default_)
{
const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.find(id);
if (setting && setting->type == ESM::VT_String)
return setting->str;
const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.search(id);
if (setting && setting->mType == ESM::VT_String)
return setting->getString();
return default_;
}
@ -567,19 +567,19 @@ void WindowManager::onFrame (float frameDuration)
void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
{
if (!(cell->cell->data.flags & ESM::Cell::Interior))
if (!(cell->cell->mData.mFlags & ESM::Cell::Interior))
{
std::string name;
if (cell->cell->name != "")
if (cell->cell->mName != "")
{
name = cell->cell->name;
name = cell->cell->mName;
mMap->addVisitedLocation (name, cell->cell->getGridX (), cell->cell->getGridY ());
}
else
{
const ESM::Region* region = MWBase::Environment::get().getWorld()->getStore().regions.search(cell->cell->region);
const ESM::Region* region = MWBase::Environment::get().getWorld()->getStore().regions.search(cell->cell->mRegion);
if (region)
name = region->name;
name = region->mName;
else
name = getGameSettingString("sDefaultCellname", "Wilderness");
}
@ -589,15 +589,15 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
mMap->setCellPrefix("Cell");
mHud->setCellPrefix("Cell");
mMap->setActiveCell( cell->cell->data.gridX, cell->cell->data.gridY );
mHud->setActiveCell( cell->cell->data.gridX, cell->cell->data.gridY );
mMap->setActiveCell( cell->cell->mData.mX, cell->cell->mData.mY );
mHud->setActiveCell( cell->cell->mData.mX, cell->cell->mData.mY );
}
else
{
mMap->setCellName( cell->cell->name );
mHud->setCellName( cell->cell->name );
mMap->setCellPrefix( cell->cell->name );
mHud->setCellPrefix( cell->cell->name );
mMap->setCellName( cell->cell->mName );
mHud->setCellName( cell->cell->mName );
mMap->setCellPrefix( cell->cell->mName );
mHud->setCellPrefix( cell->cell->mName );
}
}
@ -681,8 +681,8 @@ void WindowManager::setDragDrop(bool dragDrop)
void WindowManager::onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result)
{
const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.find(_tag);
if (setting && setting->type == ESM::VT_String)
_result = setting->str;
if (setting && setting->mType == ESM::VT_String)
_result = setting->getString();
else
_result = _tag;
}
@ -772,7 +772,7 @@ void WindowManager::setSelectedSpell(const std::string& spellId, int successChan
{
mHud->setSelectedSpell(spellId, successChancePercent);
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
mSpellWindow->setTitle(spell->name);
mSpellWindow->setTitle(spell->mName);
}
void WindowManager::setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent)
@ -956,6 +956,11 @@ bool WindowManager::getPlayerSleeping ()
return mWaitDialog->getSleeping();
}
void WindowManager::wakeUpPlayer()
{
mWaitDialog->wakeUp();
}
void WindowManager::addVisitedLocation(const std::string& name, int x, int y)
{
mMap->addVisitedLocation (name, x, y);

@ -196,7 +196,7 @@ namespace MWGui
* @param id Identifier for the GMST setting, e.g. "aName"
* @param default Default value if the GMST setting cannot be used.
*/
virtual const std::string &getGameSettingString(const std::string &id, const std::string &default_);
virtual std::string getGameSettingString(const std::string &id, const std::string &default_);
virtual void processChangedSettings(const Settings::CategorySettingVector& changed);
@ -209,6 +209,7 @@ namespace MWGui
virtual bool getRestEnabled() { return mRestAllowed; }
virtual bool getPlayerSleeping();
virtual void wakeUpPlayer();
private:
OEngine::GUI::MyGUIManager *mGuiManager;

@ -65,12 +65,12 @@ namespace MWMechanics
const MWWorld::TimeStamp& start = iter->second.first;
float magnitude = iter->second.second;
for (std::vector<ESM::ENAMstruct>::const_iterator iter (effects.first.list.begin());
iter!=effects.first.list.end(); ++iter)
for (std::vector<ESM::ENAMstruct>::const_iterator iter (effects.first.mList.begin());
iter!=effects.first.mList.end(); ++iter)
{
if (iter->duration)
if (iter->mDuration)
{
int duration = iter->duration;
int duration = iter->mDuration;
if (effects.second)
duration *= magnitude;
@ -87,22 +87,22 @@ namespace MWMechanics
{
const ESM::MagicEffect *magicEffect =
MWBase::Environment::get().getWorld()->getStore().magicEffects.find (
iter->effectID);
iter->mEffectID);
if (iter->duration==0)
if (iter->mDuration==0)
{
param.mMagnitude =
static_cast<int> (magnitude / (0.1 * magicEffect->data.baseCost));
static_cast<int> (magnitude / (0.1 * magicEffect->mData.mBaseCost));
}
else
{
param.mMagnitude =
static_cast<int> (0.05*magnitude / (0.1 * magicEffect->data.baseCost));
static_cast<int> (0.05*magnitude / (0.1 * magicEffect->mData.mBaseCost));
}
}
else
param.mMagnitude = static_cast<int> (
(iter->magnMax-iter->magnMin)*magnitude + iter->magnMin);
(iter->mMagnMax-iter->mMagnMin)*magnitude + iter->mMagnMin);
mEffects.add (*iter, param);
}
@ -115,32 +115,32 @@ namespace MWMechanics
{
if (const ESM::Spell *spell =
MWBase::Environment::get().getWorld()->getStore().spells.search (id))
return std::make_pair (spell->effects, false);
return std::make_pair (spell->mEffects, false);
if (const ESM::Potion *potion =
MWBase::Environment::get().getWorld()->getStore().potions.search (id))
return std::make_pair (potion->effects, false);
return std::make_pair (potion->mEffects, false);
if (const ESM::Ingredient *ingredient =
MWBase::Environment::get().getWorld()->getStore().ingreds.search (id))
{
const ESM::MagicEffect *magicEffect =
MWBase::Environment::get().getWorld()->getStore().magicEffects.find (
ingredient->data.effectID[0]);
ingredient->mData.mEffectID[0]);
ESM::ENAMstruct effect;
effect.effectID = ingredient->data.effectID[0];
effect.skill = ingredient->data.skills[0];
effect.attribute = ingredient->data.attributes[0];
effect.range = 0;
effect.area = 0;
effect.duration = magicEffect->data.flags & ESM::MagicEffect::NoDuration ? 0 : 1;
effect.magnMin = 1;
effect.magnMax = 1;
effect.mEffectID = ingredient->mData.mEffectID[0];
effect.mSkill = ingredient->mData.mSkills[0];
effect.mAttribute = ingredient->mData.mAttributes[0];
effect.mRange = 0;
effect.mArea = 0;
effect.mDuration = magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration ? 0 : 1;
effect.mMagnMin = 1;
effect.mMagnMax = 1;
std::pair<ESM::EffectList, bool> result;
result.first.list.push_back (effect);
result.first.mList.push_back (effect);
result.second = true;
return result;
@ -159,10 +159,10 @@ namespace MWMechanics
bool found = false;
for (std::vector<ESM::ENAMstruct>::const_iterator iter (effects.first.list.begin());
iter!=effects.first.list.end(); ++iter)
for (std::vector<ESM::ENAMstruct>::const_iterator iter (effects.first.mList.begin());
iter!=effects.first.mList.end(); ++iter)
{
if (iter->duration)
if (iter->mDuration)
{
found = true;
break;
@ -238,11 +238,11 @@ namespace MWMechanics
int duration = 0;
for (std::vector<ESM::ENAMstruct>::const_iterator iter (effects.first.list.begin());
iter!=effects.first.list.end(); ++iter)
for (std::vector<ESM::ENAMstruct>::const_iterator iter (effects.first.mList.begin());
iter!=effects.first.mList.end(); ++iter)
{
if (iter->duration>duration)
duration = iter->duration;
if (iter->mDuration > duration)
duration = iter->mDuration;
}
if (effects.second)

@ -5,7 +5,7 @@
#include <stdexcept>
#include <components/esm/defs.hpp>
#include <components/esm/effectlist.hpp>
namespace MWMechanics
{
@ -13,19 +13,19 @@ namespace MWMechanics
EffectKey::EffectKey (const ESM::ENAMstruct& effect)
{
mId = effect.effectID;
mId = effect.mEffectID;
mArg = -1;
if (effect.skill!=-1)
mArg = effect.skill;
if (effect.mSkill!=-1)
mArg = effect.mSkill;
if (effect.attribute!=-1)
if (effect.mAttribute!=-1)
{
if (mArg!=-1)
throw std::runtime_error (
"magic effect can't have both a skill and an attribute argument");
mArg = effect.attribute;
mArg = effect.mAttribute;
}
}
@ -70,17 +70,17 @@ namespace MWMechanics
void MagicEffects::add (const ESM::EffectList& list)
{
for (std::vector<ESM::ENAMstruct>::const_iterator iter (list.list.begin()); iter!=list.list.end();
for (std::vector<ESM::ENAMstruct>::const_iterator iter (list.mList.begin()); iter!=list.mList.end();
++iter)
{
EffectParam param;
if (iter->magnMin>=iter->magnMax)
param.mMagnitude = iter->magnMin;
if (iter->mMagnMin>=iter->mMagnMax)
param.mMagnitude = iter->mMagnMin;
else
param.mMagnitude = static_cast<int> (
(iter->magnMax-iter->magnMin+1)*
(static_cast<float> (std::rand()) / RAND_MAX) + iter->magnMin);
(iter->mMagnMax-iter->mMagnMin+1)*
(static_cast<float> (std::rand()) / RAND_MAX) + iter->mMagnMin);
add (*iter, param);
}

@ -22,21 +22,21 @@ namespace MWMechanics
const ESM::NPC *player = ptr.get<ESM::NPC>()->base;
// reset
creatureStats.setLevel(player->npdt52.level);
creatureStats.setLevel(player->mNpdt52.mLevel);
creatureStats.getSpells().clear();
creatureStats.setMagicEffects(MagicEffects());
for (int i=0; i<27; ++i)
npcStats.getSkill (i).setBase (player->npdt52.skills[i]);
npcStats.getSkill (i).setBase (player->mNpdt52.mSkills[i]);
creatureStats.getAttribute(0).setBase (player->npdt52.strength);
creatureStats.getAttribute(1).setBase (player->npdt52.intelligence);
creatureStats.getAttribute(2).setBase (player->npdt52.willpower);
creatureStats.getAttribute(3).setBase (player->npdt52.agility);
creatureStats.getAttribute(4).setBase (player->npdt52.speed);
creatureStats.getAttribute(5).setBase (player->npdt52.endurance);
creatureStats.getAttribute(6).setBase (player->npdt52.personality);
creatureStats.getAttribute(7).setBase (player->npdt52.luck);
creatureStats.getAttribute(0).setBase (player->mNpdt52.mStrength);
creatureStats.getAttribute(1).setBase (player->mNpdt52.mIntelligence);
creatureStats.getAttribute(2).setBase (player->mNpdt52.mWillpower);
creatureStats.getAttribute(3).setBase (player->mNpdt52.mAgility);
creatureStats.getAttribute(4).setBase (player->mNpdt52.mSpeed);
creatureStats.getAttribute(5).setBase (player->mNpdt52.mEndurance);
creatureStats.getAttribute(6).setBase (player->mNpdt52.mPersonality);
creatureStats.getAttribute(7).setBase (player->mNpdt52.mLuck);
// race
if (mRaceSelected)
@ -52,18 +52,18 @@ namespace MWMechanics
const ESM::Race::MaleFemale *attribute = 0;
switch (i)
{
case 0: attribute = &race->data.strength; break;
case 1: attribute = &race->data.intelligence; break;
case 2: attribute = &race->data.willpower; break;
case 3: attribute = &race->data.agility; break;
case 4: attribute = &race->data.speed; break;
case 5: attribute = &race->data.endurance; break;
case 6: attribute = &race->data.personality; break;
case 7: attribute = &race->data.luck; break;
case 0: attribute = &race->mData.mStrength; break;
case 1: attribute = &race->mData.mIntelligence; break;
case 2: attribute = &race->mData.mWillpower; break;
case 3: attribute = &race->mData.mAgility; break;
case 4: attribute = &race->mData.mSpeed; break;
case 5: attribute = &race->mData.mEndurance; break;
case 6: attribute = &race->mData.mPersonality; break;
case 7: attribute = &race->mData.mLuck; break;
}
creatureStats.getAttribute(i).setBase (
static_cast<int> (male ? attribute->male : attribute->female));
static_cast<int> (male ? attribute->mMale : attribute->mFemale));
}
for (int i=0; i<27; ++i)
@ -71,17 +71,17 @@ namespace MWMechanics
int bonus = 0;
for (int i2=0; i2<7; ++i2)
if (race->data.bonus[i2].skill==i)
if (race->mData.mBonus[i2].mSkill==i)
{
bonus = race->data.bonus[i2].bonus;
bonus = race->mData.mBonus[i2].mBonus;
break;
}
npcStats.getSkill (i).setBase (5 + bonus);
}
for (std::vector<std::string>::const_iterator iter (race->powers.list.begin());
iter!=race->powers.list.end(); ++iter)
for (std::vector<std::string>::const_iterator iter (race->mPowers.mList.begin());
iter!=race->mPowers.mList.end(); ++iter)
{
creatureStats.getSpells().add (*iter);
}
@ -94,8 +94,8 @@ namespace MWMechanics
MWBase::Environment::get().getWorld()->getStore().birthSigns.find (
MWBase::Environment::get().getWorld()->getPlayer().getBirthsign());
for (std::vector<std::string>::const_iterator iter (sign->powers.list.begin());
iter!=sign->powers.list.end(); ++iter)
for (std::vector<std::string>::const_iterator iter (sign->mPowers.mList.begin());
iter!=sign->mPowers.mList.end(); ++iter)
{
creatureStats.getSpells().add (*iter);
}
@ -108,7 +108,7 @@ namespace MWMechanics
for (int i=0; i<2; ++i)
{
int attribute = class_.data.attribute[i];
int attribute = class_.mData.mAttribute[i];
if (attribute>=0 && attribute<8)
{
creatureStats.getAttribute(attribute).setBase (
@ -122,7 +122,7 @@ namespace MWMechanics
for (int i2=0; i2<5; ++i2)
{
int index = class_.data.skills[i2][i];
int index = class_.mData.mSkills[i2][i];
if (index>=0 && index<27)
{
@ -137,7 +137,7 @@ namespace MWMechanics
for (ContainerType::const_iterator iter (skills.begin()); iter!=skills.end(); ++iter)
{
if (iter->second.data.specialization==class_.data.specialization)
if (iter->second.mData.mSpecialization==class_.mData.mSpecialization)
{
int index = iter->first;
@ -262,9 +262,9 @@ namespace MWMechanics
MWBase::Environment::get().getWindowManager()->setValue ("name", MWBase::Environment::get().getWorld()->getPlayer().getName());
MWBase::Environment::get().getWindowManager()->setValue ("race",
MWBase::Environment::get().getWorld()->getStore().races.find (MWBase::Environment::get().getWorld()->getPlayer().
getRace())->name);
getRace())->mName);
MWBase::Environment::get().getWindowManager()->setValue ("class",
MWBase::Environment::get().getWorld()->getPlayer().getClass().name);
MWBase::Environment::get().getWorld()->getPlayer().getClass().mName);
mUpdatePlayer = false;
MWBase::WindowManager::SkillList majorSkills (5);
@ -272,8 +272,8 @@ namespace MWMechanics
for (int i=0; i<5; ++i)
{
minorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().data.skills[i][0];
majorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().data.skills[i][1];
minorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().mData.mSkills[i][0];
majorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().mData.mSkills[i][1];
}
MWBase::Environment::get().getWindowManager()->configureSkills (majorSkills, minorSkills);

@ -90,7 +90,7 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
if (usageType>0)
{
skillFactor = skill->data.useValue[usageType];
skillFactor = skill->mData.mUseValue[usageType];
if (skillFactor<=0)
throw std::runtime_error ("invalid skill gain factor");
@ -100,7 +100,7 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMiscSkillBonus")->getFloat();
for (int i=0; i<5; ++i)
if (class_.data.skills[i][0]==skillIndex)
if (class_.mData.mSkills[i][0]==skillIndex)
{
typeFactor =
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMinorSkillBonus")->getFloat();
@ -109,7 +109,7 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
}
for (int i=0; i<5; ++i)
if (class_.data.skills[i][1]==skillIndex)
if (class_.mData.mSkills[i][1]==skillIndex)
{
typeFactor =
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMajorSkillBonus")->getFloat();
@ -122,7 +122,7 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
float specialisationFactor = 1;
if (skill->data.specialization==class_.data.specialization)
if (skill->mData.mSpecialization==class_.mData.mSpecialization)
{
specialisationFactor =
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fSpecialSkillBonus")->getFloat();
@ -170,7 +170,7 @@ void MWMechanics::NpcStats::increaseSkill(int skillIndex, const ESM::Class &clas
for (int i=0; i<2; ++i)
for (int j=0; j<5; ++j)
{
int skill = class_.data.skills[j][i];
int skill = class_.mData.mSkills[j][i];
if (skill == skillIndex)
levelProgress = true;
}
@ -179,7 +179,7 @@ void MWMechanics::NpcStats::increaseSkill(int skillIndex, const ESM::Class &clas
// check the attribute this skill belongs to
const ESM::Skill* skill = MWBase::Environment::get().getWorld ()->getStore ().skills.find(skillIndex);
++mSkillIncreases[skill->data.attribute];
++mSkillIncreases[skill->mData.mAttribute];
// Play sound & skill progress notification
/// \todo check if character is the player, if levelling is ever implemented for NPCs

@ -14,7 +14,7 @@ namespace MWMechanics
{
void Spells::addSpell (const ESM::Spell *spell, MagicEffects& effects) const
{
effects.add (spell->effects);
effects.add (spell->mEffects);
}
Spells::TIterator Spells::begin() const
@ -52,8 +52,8 @@ namespace MWMechanics
{
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.find (*iter);
if (spell->data.type==ESM::Spell::ST_Ability || spell->data.type==ESM::Spell::ST_Blight ||
spell->data.type==ESM::Spell::ST_Disease || spell->data.type==ESM::Spell::ST_Curse)
if (spell->mData.mType==ESM::Spell::ST_Ability || spell->mData.mType==ESM::Spell::ST_Blight ||
spell->mData.mType==ESM::Spell::ST_Disease || spell->mData.mType==ESM::Spell::ST_Curse)
addSpell (spell, effects);
}

@ -35,14 +35,14 @@ namespace MWMechanics
// determine the spell's school
// this is always the school where the player's respective skill is the least advanced
// out of all the magic effects' schools
const std::vector<ESM::ENAMstruct>& effects = spell->effects.list;
const std::vector<ESM::ENAMstruct>& effects = spell->mEffects.mList;
int school = -1;
int skillLevel = -1;
for (std::vector<ESM::ENAMstruct>::const_iterator it = effects.begin();
it != effects.end(); ++it)
{
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(it->effectID);
int _school = effect->data.school;
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(it->mEffectID);
int _school = effect->mData.mSchool;
int _skillLevel = stats.getSkill (spellSchoolToSkill(_school)).getModified();
if (school == -1)
@ -73,8 +73,8 @@ namespace MWMechanics
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
if (spell->data.flags & ESM::Spell::F_Always // spells with this flag always succeed (usually birthsign spells)
|| spell->data.type == ESM::Spell::ST_Power) // powers always succeed, but can be cast only once per day
if (spell->mData.mFlags & ESM::Spell::F_Always // spells with this flag always succeed (usually birthsign spells)
|| spell->mData.mType == ESM::Spell::ST_Power) // powers always succeed, but can be cast only once per day
return 100.0;
NpcStats& stats = MWWorld::Class::get(actor).getNpcStats(actor);
@ -89,7 +89,7 @@ namespace MWMechanics
int luck = creatureStats.getAttribute(ESM::Attribute::Luck).getModified();
int currentFatigue = creatureStats.getFatigue().getCurrent();
int maxFatigue = creatureStats.getFatigue().getModified();
int spellCost = spell->data.cost;
int spellCost = spell->mData.mCost;
// There we go, all needed variables are there, lets go
float chance = (float(skillLevel * 2) + float(willpower)/5.0 + float(luck)/ 10.0 - spellCost - soundMagnitude) * (float(currentFatigue + maxFatigue * 1.5)) / float(maxFatigue * 2.0);

@ -45,10 +45,10 @@ void Actors::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){
Ogre::SceneNode* insert = cellnode->createChildSceneNode();
const float *f = ptr.getRefData().getPosition().pos;
insert->setPosition(f[0], f[1], f[2]);
insert->setScale(ptr.getCellRef().scale, ptr.getCellRef().scale, ptr.getCellRef().scale);
insert->setScale(ptr.getCellRef().mScale, ptr.getCellRef().mScale, ptr.getCellRef().mScale);
// Convert MW rotation to a quaternion:
f = ptr.getCellRef().pos.rot;
f = ptr.getCellRef().mPos.rot;
// Rotate around X axis
Quaternion xr(Radian(-f[0]), Vector3::UNIT_X);

@ -49,44 +49,27 @@ bool Animation::findGroupTimes(const std::string &groupname, Animation::GroupTim
std::string::const_iterator strpos = iter->second.begin();
std::string::const_iterator strend = iter->second.end();
size_t strlen = strend-strpos;
while(strpos != strend)
if(start.size() <= strlen && std::mismatch(strpos, strend, start.begin(), checklow()).first == strend)
{
size_t strlen = strend-strpos;
std::string::const_iterator striter;
if(start.size() <= strlen &&
((striter=std::mismatch(strpos, strend, start.begin(), checklow()).first) == strend ||
*striter == '\r' || *striter == '\n'))
{
times->mStart = iter->first;
times->mLoopStart = iter->first;
}
else if(startloop.size() <= strlen &&
((striter=std::mismatch(strpos, strend, startloop.begin(), checklow()).first) == strend ||
*striter == '\r' || *striter == '\n'))
{
times->mLoopStart = iter->first;
}
else if(stoploop.size() <= strlen &&
((striter=std::mismatch(strpos, strend, stoploop.begin(), checklow()).first) == strend ||
*striter == '\r' || *striter == '\n'))
{
times->mStart = iter->first;
times->mLoopStart = iter->first;
}
else if(startloop.size() <= strlen && std::mismatch(strpos, strend, startloop.begin(), checklow()).first == strend)
{
times->mLoopStart = iter->first;
}
else if(stoploop.size() <= strlen && std::mismatch(strpos, strend, stoploop.begin(), checklow()).first == strend)
{
times->mLoopStop = iter->first;
}
else if(stop.size() <= strlen && std::mismatch(strpos, strend, stop.begin(), checklow()).first == strend)
{
times->mStop = iter->first;
if(times->mLoopStop < 0.0f)
times->mLoopStop = iter->first;
}
else if(stop.size() <= strlen &&
((striter=std::mismatch(strpos, strend, stop.begin(), checklow()).first) == strend ||
*striter == '\r' || *striter == '\n'))
{
times->mStop = iter->first;
if(times->mLoopStop < 0.0f)
times->mLoopStop = iter->first;
break;
}
strpos = std::find(strpos+1, strend, '\n');
while(strpos != strend && *strpos == '\n')
strpos++;
break;
}
}
@ -104,17 +87,9 @@ void Animation::playGroup(std::string groupname, int mode, int loops)
times.mStart = times.mLoopStart = 0.0f;
times.mLoopStop = times.mStop = 0.0f;
if(mEntityList.mSkelBase)
{
Ogre::AnimationStateSet *aset = mEntityList.mSkelBase->getAllAnimationStates();
Ogre::AnimationStateIterator as = aset->getAnimationStateIterator();
while(as.hasMoreElements())
{
Ogre::AnimationState *state = as.getNext();
times.mLoopStop = times.mStop = state->getLength();
break;
}
}
NifOgre::TextKeyMap::const_reverse_iterator iter = mTextKeys.rbegin();
if(iter != mTextKeys.rend())
times.mLoopStop = times.mStop = iter->first;
}
else if(!findGroupTimes(groupname, &times))
throw std::runtime_error("Failed to find animation group "+groupname);

@ -118,6 +118,9 @@ namespace MWRender
void InventoryPreview::onSetup ()
{
mSelectionBuffer = new OEngine::Render::SelectionBuffer(mCamera, 512, 1024, RV_PlayerPreview);
mAnimation->playGroup ("inventoryhandtohand", 0, 1);
mAnimation->runAnimation (0);
}
// --------------------------------------------------------------------------------------------------

@ -22,9 +22,9 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr): Animation()
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
assert (ref->base != NULL);
if(!ref->base->model.empty())
if(!ref->base->mModel.empty())
{
std::string mesh = "meshes\\" + ref->base->model;
std::string mesh = "meshes\\" + ref->base->mModel;
mEntityList = NifOgre::NIFLoader::createEntities(mInsert, &mTextKeys, mesh);
for(size_t i = 0;i < mEntityList.mEntities.size();i++)

@ -19,6 +19,7 @@
#include "../mwworld/ptr.hpp"
#include "player.hpp"
#include "renderconst.hpp"
using namespace Ogre;
@ -71,21 +72,23 @@ ManualObject *Debugging::createPathgridLines(const ESM::Pathgrid *pathgrid)
ManualObject *result = mSceneMgr->createManualObject();
result->begin(PATHGRID_LINE_MATERIAL, RenderOperation::OT_LINE_LIST);
for(ESM::Pathgrid::EdgeList::const_iterator it = pathgrid->edges.begin();
it != pathgrid->edges.end();
for(ESM::Pathgrid::EdgeList::const_iterator it = pathgrid->mEdges.begin();
it != pathgrid->mEdges.end();
++it)
{
const ESM::Pathgrid::Edge &edge = *it;
const ESM::Pathgrid::Point &p1 = pathgrid->points[edge.v0], &p2 = pathgrid->points[edge.v1];
Vector3 direction = (Vector3(p2.x, p2.y, p2.z) - Vector3(p1.x, p1.y, p1.z));
const ESM::Pathgrid::Point &p1 = pathgrid->mPoints[edge.mV0], &p2 = pathgrid->mPoints[edge.mV1];
Vector3 direction = (Vector3(p2.mX, p2.mY, p2.mZ) - Vector3(p1.mX, p1.mY, p1.mZ));
Vector3 lineDisplacement = direction.crossProduct(Vector3::UNIT_Z).normalisedCopy();
lineDisplacement = lineDisplacement * POINT_MESH_BASE +
Vector3(0, 0, 10); // move lines up a little, so they will be less covered by meshes/landscape
result->position(Vector3(p1.x, p1.y, p1.z) + lineDisplacement);
result->position(Vector3(p2.x, p2.y, p2.z) + lineDisplacement);
result->position(Vector3(p1.mX, p1.mY, p1.mZ) + lineDisplacement);
result->position(Vector3(p2.mX, p2.mY, p2.mZ) + lineDisplacement);
}
result->end();
result->setVisibilityFlags (RV_Debug);
return result;
}
@ -98,11 +101,11 @@ ManualObject *Debugging::createPathgridPoints(const ESM::Pathgrid *pathgrid)
bool first = true;
uint32 startIndex = 0;
for(ESM::Pathgrid::PointList::const_iterator it = pathgrid->points.begin();
it != pathgrid->points.end();
for(ESM::Pathgrid::PointList::const_iterator it = pathgrid->mPoints.begin();
it != pathgrid->mPoints.end();
it++, startIndex += 6)
{
Vector3 pointPos(it->x, it->y, it->z);
Vector3 pointPos(it->mX, it->mY, it->mZ);
if (!first)
{
@ -140,6 +143,8 @@ ManualObject *Debugging::createPathgridPoints(const ESM::Pathgrid *pathgrid)
result->end();
result->setVisibilityFlags (RV_Debug);
return result;
}
@ -229,8 +234,8 @@ void Debugging::enableCellPathgrid(MWWorld::Ptr::CellStore *store)
Vector3 cellPathGridPos(0, 0, 0);
if (store->cell->isExterior())
{
cellPathGridPos.x = store->cell->data.gridX * ESM::Land::REAL_SIZE;
cellPathGridPos.y = store->cell->data.gridY * ESM::Land::REAL_SIZE;
cellPathGridPos.x = store->cell->mData.mX * ESM::Land::REAL_SIZE;
cellPathGridPos.y = store->cell->mData.mY * ESM::Land::REAL_SIZE;
}
SceneNode *cellPathGrid = mPathGridRoot->createChildSceneNode(cellPathGridPos);
cellPathGrid->attachObject(createPathgridLines(pathgrid));
@ -238,7 +243,7 @@ void Debugging::enableCellPathgrid(MWWorld::Ptr::CellStore *store)
if (store->cell->isExterior())
{
mExteriorPathgridNodes[std::make_pair(store->cell->data.gridX, store->cell->data.gridY)] = cellPathGrid;
mExteriorPathgridNodes[std::make_pair(store->cell->mData.mX, store->cell->mData.mY)] = cellPathGrid;
}
else
{
@ -252,7 +257,7 @@ void Debugging::disableCellPathgrid(MWWorld::Ptr::CellStore *store)
if (store->cell->isExterior())
{
ExteriorPathgridNodes::iterator it =
mExteriorPathgridNodes.find(std::make_pair(store->cell->data.gridX, store->cell->data.gridY));
mExteriorPathgridNodes.find(std::make_pair(store->cell->mData.mX, store->cell->mData.mY));
if (it != mExteriorPathgridNodes.end())
{
destroyCellPathgridNode(it->second);

@ -63,9 +63,9 @@ namespace MWRender
if (land)
{
if (!land->dataLoaded)
if (!land->isDataLoaded(ESM::Land::DATA_VHGT))
{
land->loadData();
land->loadData(ESM::Land::DATA_VHGT);
}
}
@ -93,7 +93,7 @@ namespace MWRender
if (land)
{
float landHeight = land->landData->heights[vertexY * ESM::Land::LAND_SIZE + vertexX];
float landHeight = land->mLandData->mHeights[vertexY * ESM::Land::LAND_SIZE + vertexX];
if (landHeight >= 0)

@ -108,10 +108,10 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell)
mCameraRotNode->setOrientation(Quaternion::IDENTITY);
std::string name = "Cell_"+coordStr(cell->cell->data.gridX, cell->cell->data.gridY);
std::string name = "Cell_"+coordStr(cell->cell->mData.mX, cell->cell->mData.mY);
int x = cell->cell->data.gridX;
int y = cell->cell->data.gridY;
int x = cell->cell->mData.mX;
int y = cell->cell->mData.mY;
mCameraPosNode->setPosition(Vector3(0,0,0));
@ -163,7 +163,7 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell,
const int segsX = std::ceil( length.x / sSize );
const int segsY = std::ceil( length.y / sSize );
mInteriorName = cell->cell->name;
mInteriorName = cell->cell->mName;
for (int x=0; x<segsX; ++x)
{
@ -173,7 +173,7 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell,
Vector2 newcenter = start + 4096;
render(newcenter.x - center.x, newcenter.y - center.y, z.y, z.x, sSize, sSize,
cell->cell->name + "_" + coordStr(x,y));
cell->cell->mName + "_" + coordStr(x,y));
}
}
}

@ -63,18 +63,18 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
}
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(ref->base->race);
const ESM::Race *race = store.races.find(ref->base->mRace);
std::string hairID = ref->base->hair;
std::string headID = ref->base->head;
headModel = "meshes\\" + store.bodyParts.find(headID)->model;
hairModel = "meshes\\" + store.bodyParts.find(hairID)->model;
npcName = ref->base->name;
std::string hairID = ref->base->mHair;
std::string headID = ref->base->mHead;
headModel = "meshes\\" + store.bodyParts.find(headID)->mModel;
hairModel = "meshes\\" + store.bodyParts.find(hairID)->mModel;
npcName = ref->base->mName;
isFemale = !!(ref->base->flags&ESM::NPC::Female);
isBeast = !!(race->data.flags&ESM::Race::Beast);
isFemale = !!(ref->base->mFlags&ESM::NPC::Female);
isBeast = !!(race->mData.mFlags&ESM::Race::Beast);
bodyRaceID = "b_n_"+ref->base->race;
bodyRaceID = "b_n_"+ref->base->mRace;
std::transform(bodyRaceID.begin(), bodyRaceID.end(), bodyRaceID.begin(), ::tolower);
@ -123,12 +123,12 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
}
}
float scale = race->mData.mHeight.mMale;
if (isFemale) {
scale = race->mData.mHeight.mFemale;
}
mInsert->scale(scale, scale, scale);
if(isFemale)
mInsert->scale(race->data.height.female, race->data.height.female, race->data.height.female);
else
mInsert->scale(race->data.height.male, race->data.height.male, race->data.height.male);
updateParts();
}
@ -171,7 +171,7 @@ void NpcAnimation::updateParts()
MWWorld::Ptr ptr = *robe;
const ESM::Clothing *clothes = (ptr.get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Robe, 5, parts);
reserveIndividualPart(ESM::PRT_Groin, MWWorld::InventoryStore::Slot_Robe, 5);
reserveIndividualPart(ESM::PRT_Skirt, MWWorld::InventoryStore::Slot_Robe, 5);
@ -191,7 +191,7 @@ void NpcAnimation::updateParts()
MWWorld::Ptr ptr = *skirtiter;
const ESM::Clothing *clothes = (ptr.get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Skirt, 4, parts);
reserveIndividualPart(ESM::PRT_Groin, MWWorld::InventoryStore::Slot_Skirt, 4);
reserveIndividualPart(ESM::PRT_RLeg, MWWorld::InventoryStore::Slot_Skirt, 4);
@ -202,32 +202,32 @@ void NpcAnimation::updateParts()
{
removeIndividualPart(ESM::PRT_Hair);
const ESM::Armor *armor = (helmet->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Helmet, 3, parts);
}
if(cuirass != mInv.end())
{
const ESM::Armor *armor = (cuirass->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Cuirass, 3, parts);
}
if(greaves != mInv.end())
{
const ESM::Armor *armor = (greaves->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Greaves, 3, parts);
}
if(leftpauldron != mInv.end())
{
const ESM::Armor *armor = (leftpauldron->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_LeftPauldron, 3, parts);
}
if(rightpauldron != mInv.end())
{
const ESM::Armor *armor = (rightpauldron->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_RightPauldron, 3, parts);
}
if(boots != mInv.end())
@ -235,13 +235,13 @@ void NpcAnimation::updateParts()
if(boots->getTypeName() == typeid(ESM::Clothing).name())
{
const ESM::Clothing *clothes = (boots->get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Boots, 2, parts);
}
else if(boots->getTypeName() == typeid(ESM::Armor).name())
{
const ESM::Armor *armor = (boots->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Boots, 3, parts);
}
}
@ -250,13 +250,13 @@ void NpcAnimation::updateParts()
if(leftglove->getTypeName() == typeid(ESM::Clothing).name())
{
const ESM::Clothing *clothes = (leftglove->get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_LeftGauntlet, 2, parts);
}
else
{
const ESM::Armor *armor = (leftglove->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_LeftGauntlet, 3, parts);
}
}
@ -265,13 +265,13 @@ void NpcAnimation::updateParts()
if(rightglove->getTypeName() == typeid(ESM::Clothing).name())
{
const ESM::Clothing *clothes = (rightglove->get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_RightGauntlet, 2, parts);
}
else
{
const ESM::Armor *armor = (rightglove->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_RightGauntlet, 3, parts);
}
@ -280,13 +280,13 @@ void NpcAnimation::updateParts()
if(shirt != mInv.end())
{
const ESM::Clothing *clothes = (shirt->get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Shirt, 2, parts);
}
if(pants != mInv.end())
{
const ESM::Clothing *clothes = (pants->get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Pants, 2, parts);
}
}
@ -344,7 +344,7 @@ void NpcAnimation::updateParts()
} while(1);
if(part)
addOrReplaceIndividualPart(PartTypeList[i].type, -1,1, "meshes\\"+part->model);
addOrReplaceIndividualPart(PartTypeList[i].type, -1,1, "meshes\\"+part->mModel);
}
}
}
@ -571,14 +571,14 @@ void NpcAnimation::addPartGroup(int group, int priority, std::vector<ESM::PartRe
const ESM::BodyPart *bodypart = 0;
if(isFemale)
bodypart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search(part.female);
bodypart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search(part.mFemale);
if(!bodypart)
bodypart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search(part.male);
bodypart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search(part.mMale);
if(bodypart)
addOrReplaceIndividualPart(part.part, group, priority,"meshes\\" + bodypart->model);
addOrReplaceIndividualPart(part.mPart, group, priority,"meshes\\" + bodypart->mModel);
else
reserveIndividualPart(part.part, group, priority);
reserveIndividualPart(part.mPart, group, priority);
}
}

@ -64,11 +64,11 @@ void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_)
const float *f = ptr.getRefData().getPosition().pos;
insert->setPosition(f[0], f[1], f[2]);
insert->setScale(ptr.getCellRef().scale, ptr.getCellRef().scale, ptr.getCellRef().scale);
insert->setScale(ptr.getCellRef().mScale, ptr.getCellRef().mScale, ptr.getCellRef().mScale);
// Convert MW rotation to a quaternion:
f = ptr.getCellRef().pos.rot;
f = ptr.getCellRef().mPos.rot;
// Rotate around X axis
Ogre::Quaternion xr(Ogre::Radian(-f[0]), Ogre::Vector3::UNIT_X);
@ -219,18 +219,18 @@ void Objects::insertLight (const MWWorld::Ptr& ptr, float r, float g, float b, f
info.radius = radius;
info.colour = Ogre::ColourValue(r, g, b);
if (ref->base->data.flags & ESM::Light::Negative)
if (ref->base->mData.mFlags & ESM::Light::Negative)
info.colour *= -1;
info.interior = (ptr.getCell()->cell->data.flags & ESM::Cell::Interior);
info.interior = (ptr.getCell()->cell->mData.mFlags & ESM::Cell::Interior);
if (ref->base->data.flags & ESM::Light::Flicker)
if (ref->base->mData.mFlags & ESM::Light::Flicker)
info.type = LT_Flicker;
else if (ref->base->data.flags & ESM::Light::FlickerSlow)
else if (ref->base->mData.mFlags & ESM::Light::FlickerSlow)
info.type = LT_FlickerSlow;
else if (ref->base->data.flags & ESM::Light::Pulse)
else if (ref->base->mData.mFlags & ESM::Light::Pulse)
info.type = LT_Pulse;
else if (ref->base->data.flags & ESM::Light::PulseSlow)
else if (ref->base->mData.mFlags & ESM::Light::PulseSlow)
info.type = LT_PulseSlow;
else
info.type = LT_Normal;

@ -94,7 +94,6 @@ namespace MWRender
} else {
mCameraNode->setOrientation(zr * xr);
}
updateListener();
}
std::string Player::getHandle() const
@ -111,16 +110,20 @@ namespace MWRender
{
Ogre::Vector3 pos = mCamera->getRealPosition();
Ogre::Vector3 dir = mCamera->getRealDirection();
Ogre::Vector3 up = mCamera->getRealUp();
Ogre::Real xch;
xch = pos.y, pos.y = -pos.z, pos.z = xch;
xch = dir.y, dir.y = -dir.z, dir.z = xch;
xch = up.y, up.y = -up.z, up.z = xch;
MWBase::Environment::get().getSoundManager()->setListenerPosDir(pos, dir);
MWBase::Environment::get().getSoundManager()->setListenerPosDir(pos, dir, up);
}
void Player::update(float duration)
{
updateListener();
// only show the crosshair in game mode and in first person mode.
MWBase::Environment::get().getWindowManager ()->showCrosshair
(!MWBase::Environment::get().getWindowManager ()->isGuiMode () && (mFirstPersonView && !mVanity.enabled && !mPreviewMode));

@ -56,9 +56,9 @@ enum VisibilityFlags
RV_PlayerPreview = 512,
RV_Map = RV_Terrain + RV_Statics + RV_StaticsSmall + RV_Misc + RV_Water
RV_Debug = 1024,
/// \todo markers (normally hidden)
RV_Map = RV_Terrain + RV_Statics + RV_StaticsSmall + RV_Misc + RV_Water
};
}

@ -372,9 +372,9 @@ void RenderingManager::update (float duration)
}
void RenderingManager::waterAdded (MWWorld::Ptr::CellStore *store){
if(store->cell->data.flags & store->cell->HasWater
|| ((!(store->cell->data.flags & ESM::Cell::Interior))
&& !MWBase::Environment::get().getWorld()->getStore().lands.search(store->cell->data.gridX,store->cell->data.gridY) )) // always use water, if the cell does not have land.
if(store->cell->mData.mFlags & store->cell->HasWater
|| ((!(store->cell->mData.mFlags & ESM::Cell::Interior))
&& !MWBase::Environment::get().getWorld()->getStore().lands.search(store->cell->mData.mX,store->cell->mData.mY) )) // always use water, if the cell does not have land.
{
if(mWater == 0)
mWater = new MWRender::Water(mRendering.getCamera(), this, store->cell);
@ -465,9 +465,9 @@ bool RenderingManager::toggleRenderMode(int mode)
void RenderingManager::configureFog(MWWorld::Ptr::CellStore &mCell)
{
Ogre::ColourValue color;
color.setAsABGR (mCell.cell->ambi.fog);
color.setAsABGR (mCell.cell->mAmbi.mFog);
configureFog(mCell.cell->ambi.fogDensity, color);
configureFog(mCell.cell->mAmbi.mFogDensity, color);
if (mWater)
mWater->setViewportBackground (Ogre::ColourValue(0.8f, 0.9f, 1.0f));
@ -517,7 +517,7 @@ void RenderingManager::setAmbientMode()
void RenderingManager::configureAmbient(MWWorld::Ptr::CellStore &mCell)
{
mAmbientColor.setAsABGR (mCell.cell->ambi.ambient);
mAmbientColor.setAsABGR (mCell.cell->mAmbi.mAmbient);
setAmbientMode();
// Create a "sun" that shines light downwards. It doesn't look
@ -527,7 +527,7 @@ void RenderingManager::configureAmbient(MWWorld::Ptr::CellStore &mCell)
mSun = mRendering.getScene()->createLight();
}
Ogre::ColourValue colour;
colour.setAsABGR (mCell.cell->ambi.sunlight);
colour.setAsABGR (mCell.cell->mAmbi.mSunlight);
mSun->setDiffuseColour (colour);
mSun->setType(Ogre::Light::LT_DIRECTIONAL);
mSun->setDirection(0,-1,0);
@ -611,7 +611,7 @@ void RenderingManager::setGlare(bool glare)
void RenderingManager::requestMap(MWWorld::Ptr::CellStore* cell)
{
if (!(cell->cell->data.flags & ESM::Cell::Interior))
if (!(cell->cell->mData.mFlags & ESM::Cell::Interior))
mLocalMap->requestMap(cell);
else
mLocalMap->requestMap(cell, mObjects.getDimensions(cell));

@ -99,9 +99,10 @@ namespace MWRender
if (land == NULL) // no land data means we're not going to create any terrain.
return;
if (!land->dataLoaded)
int dataRequired = ESM::Land::DATA_VHGT | ESM::Land::DATA_VCLR;
if (!land->isDataLoaded(dataRequired))
{
land->loadData();
land->loadData(dataRequired);
}
//split the cell terrain into four segments
@ -134,7 +135,7 @@ namespace MWRender
const size_t xOffset = x * (mLandSize-1);
memcpy(&terrainData.inputFloat[terrainCopyY*mLandSize],
&land->landData->heights[yOffset + xOffset],
&land->mLandData->mHeights[yOffset + xOffset],
mLandSize*sizeof(float));
}
@ -159,7 +160,7 @@ namespace MWRender
terrain->setRenderQueueGroup(RQG_Main);
// disable or enable global colour map (depends on available vertex colours)
if ( land->landData->usingColours )
if ( land->mLandData->mUsingColours )
{
TexturePtr vertex = getVertexColours(land,
cellX, cellY,
@ -271,7 +272,7 @@ namespace MWRender
}
else
{
texture = MWBase::Environment::get().getWorld()->getStore().landTexts.search(ltexIndex-1, plugin)->texture;
texture = MWBase::Environment::get().getWorld()->getStore().landTexts.search(ltexIndex-1, plugin)->mTexture;
//TODO this is needed due to MWs messed up texture handling
texture = texture.substr(0, texture.rfind(".")) + ".dds";
}
@ -430,13 +431,13 @@ namespace MWRender
ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search(cellX, cellY);
if ( land != NULL )
{
if (!land->dataLoaded)
if (!land->isDataLoaded(ESM::Land::DATA_VTEX))
{
land->loadData();
land->loadData(ESM::Land::DATA_VTEX);
}
return land->landData
->textures[y * ESM::Land::LAND_TEXTURE_SIZE + x];
return land->mLandData
->mTextures[y * ESM::Land::LAND_TEXTURE_SIZE + x];
}
else
{
@ -480,7 +481,7 @@ namespace MWRender
if ( land != NULL )
{
const char* const colours = land->landData->colours;
const char* const colours = land->mLandData->mColours;
for ( int y = 0; y < size; y++ )
{
for ( int x = 0; x < size; x++ )

@ -38,7 +38,7 @@ Water::Water (Ogre::Camera *camera, RenderingManager* rend, const ESM::Cell* cel
mMaterial = MaterialManager::getSingleton().getByName("Water");
mTop = cell->water;
mTop = cell->mWater;
mIsUnderwater = false;
@ -55,9 +55,9 @@ Water::Water (Ogre::Camera *camera, RenderingManager* rend, const ESM::Cell* cel
mReflectionCamera = mSceneManager->createCamera("ReflectionCamera");
if(!(cell->data.flags & cell->Interior))
if(!(cell->mData.mFlags & cell->Interior))
{
mWaterNode->setPosition(getSceneNodeCoordinates(cell->data.gridX, cell->data.gridY));
mWaterNode->setPosition(getSceneNodeCoordinates(cell->mData.mX, cell->mData.mY));
}
mWaterNode->attachObject(mWater);
@ -156,12 +156,12 @@ Water::~Water()
void Water::changeCell(const ESM::Cell* cell)
{
mTop = cell->water;
mTop = cell->mWater;
setHeight(mTop);
if(!(cell->data.flags & cell->Interior))
mWaterNode->setPosition(getSceneNodeCoordinates(cell->data.gridX, cell->data.gridY));
if(!(cell->mData.mFlags & cell->Interior))
mWaterNode->setPosition(getSceneNodeCoordinates(cell->mData.mX, cell->mData.mY));
}
void Water::setHeight(const float height)

@ -45,7 +45,7 @@ namespace MWScript
if (const ESM::Cell *exterior = MWBase::Environment::get().getWorld()->getExterior (cell))
{
MWBase::Environment::get().getWorld()->indexToPosition (exterior->data.gridX, exterior->data.gridY,
MWBase::Environment::get().getWorld()->indexToPosition (exterior->mData.mX, exterior->mData.mY,
pos.pos[0], pos.pos[1], true);
MWBase::Environment::get().getWorld()->changeToExteriorCell (pos);
}
@ -87,7 +87,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime)
{
bool interior =
MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->data.flags &
MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->mData.mFlags &
ESM::Cell::Interior;
runtime.push (interior ? 1 : 0);
@ -105,14 +105,14 @@ namespace MWScript
const ESM::Cell *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell;
std::string current = cell->name;
std::string current = cell->mName;
if (!(cell->data.flags & ESM::Cell::Interior) && current.empty())
if (!(cell->mData.mFlags & ESM::Cell::Interior) && current.empty())
{
const ESM::Region *region =
MWBase::Environment::get().getWorld()->getStore().regions.find (cell->region);
MWBase::Environment::get().getWorld()->getStore().regions.find (cell->mRegion);
current = region->name;
current = region->mName;
}
bool match = current.length()>=name.length() &&
@ -143,7 +143,7 @@ namespace MWScript
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell();
if (!(cell->cell->data.flags & ESM::Cell::Interior))
if (!(cell->cell->mData.mFlags & ESM::Cell::Interior))
throw std::runtime_error("Can't set water level in exterior cell");
cell->mWaterLevel = level;
@ -161,7 +161,7 @@ namespace MWScript
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell();
if (!(cell->cell->data.flags & ESM::Cell::Interior))
if (!(cell->cell->mData.mFlags & ESM::Cell::Interior))
throw std::runtime_error("Can't set water level in exterior cell");
cell->mWaterLevel +=level;

@ -78,7 +78,7 @@ namespace MWScript
Interpreter::Type_Integer sum = 0;
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end(); ++iter)
if (toLower(iter->getCellRef().refID) == toLower(item))
if (toLower(iter->getCellRef().mRefID) == toLower(item))
sum += iter->getRefData().getCount();
runtime.push (sum);
@ -108,7 +108,7 @@ namespace MWScript
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end() && count;
++iter)
{
if (toLower(iter->getCellRef().refID) == toLower(item))
if (toLower(iter->getCellRef().mRefID) == toLower(item))
{
if (iter->getRefData().getCount()<=count)
{

@ -205,5 +205,6 @@ op 0x200019e: PlaceAtMe Explicit
op 0x200019f: GetPcSleep
op 0x20001a0: ShowMap
op 0x20001a1: FillMap
opcodes 0x20001a2-0x3ffffff unused
op 0x20001a2: WakeUpPc
opcodes 0x20001a3-0x3ffffff unused

@ -21,7 +21,7 @@ namespace MWScript
for (ESMS::RecListT<ESM::StartScript>::MapType::const_iterator iter
(store.startScripts.list.begin());
iter != store.startScripts.list.end(); ++iter)
addScript (iter->second.script);
addScript (iter->second.mScript);
}
void GlobalScripts::addScript (const std::string& name)

@ -112,10 +112,10 @@ namespace MWScript
const ESMS::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells;
for (ESMS::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it)
{
std::string name = it->second->name;
std::string name = it->second->mName;
boost::algorithm::to_lower(name);
if (name.find(cell) != std::string::npos)
MWBase::Environment::get().getWindowManager()->addVisitedLocation (it->second->name, it->first.first, it->first.second);
MWBase::Environment::get().getWindowManager()->addVisitedLocation (it->second->mName, it->first.first, it->first.second);
}
}
};
@ -129,7 +129,7 @@ namespace MWScript
const ESMS::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells;
for (ESMS::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it)
{
std::string name = it->second->name;
std::string name = it->second->mName;
if (name != "")
MWBase::Environment::get().getWindowManager()->addVisitedLocation (name, it->first.first, it->first.second);
}

@ -17,11 +17,11 @@ namespace MWScript
void configure (const ESM::Script& script)
{
mShorts.clear();
mShorts.resize (script.data.numShorts, 0);
mShorts.resize (script.mData.mNumShorts, 0);
mLongs.clear();
mLongs.resize (script.data.numLongs, 0);
mLongs.resize (script.mData.mNumLongs, 0);
mFloats.clear();
mFloats.resize (script.data.numFloats, 0);
mFloats.resize (script.mData.mNumFloats, 0);
}
};
}

@ -31,6 +31,16 @@ namespace MWScript
}
};
class OpWakeUpPc : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
MWBase::Environment::get().getWindowManager ()->wakeUpPlayer();
}
};
class OpXBox : public Interpreter::Opcode0
{
public:
@ -261,6 +271,7 @@ namespace MWScript
const int opcodeDontSaveObject = 0x2000153;
const int opcodeToggleVanityMode = 0x2000174;
const int opcodeGetPcSleep = 0x200019f;
const int opcodeWakeUpPc = 0x20001a2;
void registerExtensions (Compiler::Extensions& extensions)
{
@ -286,6 +297,7 @@ namespace MWScript
extensions.registerInstruction ("togglevanitymode", "", opcodeToggleVanityMode);
extensions.registerInstruction ("tvm", "", opcodeToggleVanityMode);
extensions.registerFunction ("getpcsleep", 'l', "", opcodeGetPcSleep);
extensions.registerInstruction ("wakeuppc", "", opcodeWakeUpPc);
}
void installOpcodes (Interpreter::Interpreter& interpreter)
@ -307,6 +319,7 @@ namespace MWScript
interpreter.installSegment5 (opcodeDontSaveObject, new OpDontSaveObject);
interpreter.installSegment5 (opcodeToggleVanityMode, new OpToggleVanityMode);
interpreter.installSegment5 (opcodeGetPcSleep, new OpGetPcSleep);
interpreter.installSegment5 (opcodeWakeUpPc, new OpWakeUpPc);
}
}
}

@ -38,7 +38,7 @@ namespace MWScript
try
{
std::istringstream input (script->scriptText);
std::istringstream input (script->mScriptText);
Compiler::Scanner scanner (mErrorHandler, input, mCompilerContext.getExtensions());
@ -62,7 +62,7 @@ namespace MWScript
{
std::cerr
<< "compiling failed: " << name << std::endl
<< script->scriptText
<< script->mScriptText
<< std::endl << std::endl;
}
@ -180,19 +180,19 @@ namespace MWScript
case 's':
offset = 0;
size = script->data.numShorts;
size = script->mData.mNumShorts;
break;
case 'l':
offset = script->data.numShorts;
size = script->data.numLongs;
offset = script->mData.mNumShorts;
size = script->mData.mNumLongs;
break;
case 'f':
offset = script->data.numShorts+script->data.numLongs;
size = script->data.numFloats;
offset = script->mData.mNumShorts+script->mData.mNumLongs;
size = script->mData.mNumFloats;
default:
@ -200,7 +200,7 @@ namespace MWScript
}
for (int i=0; i<size; ++i)
if (script->varNames.at (i+offset)==variable)
if (script->mVarNames.at (i+offset)==variable)
return i;
throw std::runtime_error ("unable to access local variable " + variable + " of " + scriptId);

@ -316,7 +316,7 @@ namespace MWScript
assert (ref);
const ESM::Class& class_ =
*MWBase::Environment::get().getWorld()->getStore().classes.find (ref->base->cls);
*MWBase::Environment::get().getWorld()->getStore().classes.find (ref->base->mClass);
float level = 0;
float progress = std::modf (stats.getSkill (mIndex).getBase(), &level);

@ -49,7 +49,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);
runtime.push(ptr.getCellRef().scale);
runtime.push(ptr.getCellRef().mScale);
}
};
@ -131,15 +131,15 @@ namespace MWScript
if (axis=="x")
{
runtime.push(Ogre::Radian(ptr.getCellRef().pos.rot[0]).valueDegrees());
runtime.push(Ogre::Radian(ptr.getCellRef().mPos.rot[0]).valueDegrees());
}
else if (axis=="y")
{
runtime.push(Ogre::Radian(ptr.getCellRef().pos.rot[1]).valueDegrees());
runtime.push(Ogre::Radian(ptr.getCellRef().mPos.rot[1]).valueDegrees());
}
else if (axis=="z")
{
runtime.push(Ogre::Radian(ptr.getCellRef().pos.rot[2]).valueDegrees());
runtime.push(Ogre::Radian(ptr.getCellRef().mPos.rot[2]).valueDegrees());
}
else
throw std::runtime_error ("invalid ration axis: " + axis);
@ -224,15 +224,15 @@ namespace MWScript
if(axis == "x")
{
runtime.push(ptr.getCellRef().pos.pos[0]);
runtime.push(ptr.getCellRef().mPos.pos[0]);
}
else if(axis == "y")
{
runtime.push(ptr.getCellRef().pos.pos[1]);
runtime.push(ptr.getCellRef().mPos.pos[1]);
}
else if(axis == "z")
{
runtime.push(ptr.getCellRef().pos.pos[2]);
runtime.push(ptr.getCellRef().mPos.pos[2]);
}
else
throw std::runtime_error ("invalid axis: " + axis);
@ -372,7 +372,7 @@ namespace MWScript
pos.rot[0] = pos.rot[1] = 0;
pos.rot[2] = zRot;
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(),itemID);
ref.getPtr().getCellRef().pos = pos;
ref.getPtr().getCellRef().mPos = pos;
MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),*store,pos);
}
else
@ -413,7 +413,7 @@ namespace MWScript
pos.rot[0] = pos.rot[1] = 0;
pos.rot[2] = zRot;
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(),itemID);
ref.getPtr().getCellRef().pos = pos;
ref.getPtr().getCellRef().mPos = pos;
MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),*store,pos);
}
else
@ -458,7 +458,7 @@ namespace MWScript
MWWorld::CellStore* store = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell();
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(),itemID);
ref.getPtr().getCellRef().pos = ipos;
ref.getPtr().getCellRef().mPos = ipos;
ref.getPtr().getRefData().setCount(count);
MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),*store,ipos);
}
@ -501,7 +501,7 @@ namespace MWScript
MWWorld::CellStore* store = me.getCell();
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(),itemID);
ref.getPtr().getCellRef().pos = ipos;
ref.getPtr().getCellRef().mPos = ipos;
ref.getPtr().getRefData().setCount(count);
MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),*store,ipos);

@ -120,22 +120,22 @@ namespace MWSound
if(snd == NULL)
throw std::runtime_error(std::string("Failed to lookup sound ")+soundId);
volume *= pow(10.0, (snd->data.volume/255.0*3348.0 - 3348.0) / 2000.0);
volume *= pow(10.0, (snd->mData.mVolume/255.0*3348.0 - 3348.0) / 2000.0);
if(snd->data.minRange == 0 && snd->data.maxRange == 0)
if(snd->mData.mMinRange == 0 && snd->mData.mMaxRange == 0)
{
min = 100.0f;
max = 2000.0f;
}
else
{
min = snd->data.minRange * 20.0f;
max = snd->data.maxRange * 50.0f;
min = snd->mData.mMinRange * 20.0f;
max = snd->mData.mMaxRange * 50.0f;
min = std::max(min, 1.0f);
max = std::max(min, max);
}
return "Sound/"+snd->sound;
return "Sound/"+snd->mSound;
}
@ -296,7 +296,7 @@ namespace MWSound
}
catch(std::exception &e)
{
std::cout <<"Sound Error: "<<e.what()<< std::endl;
//std::cout <<"Sound Error: "<<e.what()<< std::endl;
}
return sound;
}
@ -332,7 +332,7 @@ namespace MWSound
}
catch(std::exception &e)
{
std::cout <<"Sound Error: "<<e.what()<< std::endl;
//std::cout <<"Sound Error: "<<e.what()<< std::endl;
}
return sound;
}
@ -404,18 +404,6 @@ namespace MWSound
return isPlaying(ptr, soundId);
}
void SoundManager::updateObject(MWWorld::Ptr ptr)
{
const ESM::Position &pos = ptr.getRefData().getPosition();;
const Ogre::Vector3 objpos(pos.pos[0], pos.pos[1], pos.pos[2]);
SoundMap::iterator snditer = mActiveSounds.begin();
while(snditer != mActiveSounds.end())
{
if(snditer->second.first == ptr)
snditer->first->setPosition(objpos);
snditer++;
}
}
void SoundManager::updateRegionSound(float duration)
{
@ -426,13 +414,13 @@ namespace MWSound
//If the region has changed
timePassed += duration;
if((current->cell->data.flags & current->cell->Interior) || timePassed < 10)
if((current->cell->mData.mFlags & current->cell->Interior) || timePassed < 10)
return;
timePassed = 0;
if(regionName != current->cell->region)
if(regionName != current->cell->mRegion)
{
regionName = current->cell->region;
regionName = current->cell->mRegion;
total = 0;
}
@ -443,10 +431,10 @@ namespace MWSound
std::vector<ESM::Region::SoundRef>::const_iterator soundIter;
if(total == 0)
{
soundIter = regn->soundList.begin();
while(soundIter != regn->soundList.end())
soundIter = regn->mSoundList.begin();
while(soundIter != regn->mSoundList.end())
{
total += (int)soundIter->chance;
total += (int)soundIter->mChance;
soundIter++;
}
if(total == 0)
@ -456,11 +444,11 @@ namespace MWSound
int r = (int)(rand()/((double)RAND_MAX+1) * total);
int pos = 0;
soundIter = regn->soundList.begin();
while(soundIter != regn->soundList.end())
soundIter = regn->mSoundList.begin();
while(soundIter != regn->mSoundList.end())
{
const std::string go = soundIter->sound.toString();
int chance = (int) soundIter->chance;
const std::string go = soundIter->mSound.toString();
int chance = (int) soundIter->mChance;
//std::cout << "Sound: " << go.name <<" Chance:" << chance << "\n";
soundIter++;
if(r - pos < chance)
@ -492,13 +480,13 @@ namespace MWSound
const ESM::Cell *cell = player.getCell()->cell;
Environment env = Env_Normal;
if((cell->data.flags&cell->HasWater) && mListenerPos.z < cell->water)
if((cell->mData.mFlags&cell->HasWater) && mListenerPos.z < cell->mWater)
env = Env_Underwater;
mOutput->updateListener(
mListenerPos,
mListenerDir,
Ogre::Vector3::UNIT_Z,
mListenerUp,
env
);
@ -558,10 +546,11 @@ namespace MWSound
}
}
void SoundManager::setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir)
void SoundManager::setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir, const Ogre::Vector3 &up)
{
mListenerPos = pos;
mListenerDir = dir;
mListenerUp = up;
}
// Default readAll implementation, for decoders that can't do anything

@ -52,6 +52,7 @@ namespace MWSound
Ogre::Vector3 mListenerPos;
Ogre::Vector3 mListenerDir;
Ogre::Vector3 mListenerUp;
std::string lookup(const std::string &soundId,
float &volume, float &min, float &max);
@ -126,12 +127,9 @@ namespace MWSound
virtual bool getSoundPlaying(MWWorld::Ptr reference, const std::string& soundId) const;
///< Is the given sound currently playing on the given object?
virtual void updateObject(MWWorld::Ptr reference);
///< Update the position of all sounds connected to the given object.
virtual void update(float duration);
virtual void setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir);
virtual void setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir, const Ogre::Vector3 &up);
};
}

@ -24,7 +24,7 @@ namespace MWWorld
{
LiveCellRef<ESM::Book> *ref = getTarget().get<ESM::Book>();
if (ref->base->data.isScroll)
if (ref->base->mData.mIsScroll)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Scroll);
MWBase::Environment::get().getWindowManager()->getScrollWindow()->open(getTarget());
@ -39,16 +39,16 @@ namespace MWWorld
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player);
// Skill gain from books
if (ref->base->data.skillID >= 0 && ref->base->data.skillID < ESM::Skill::Length
&& !npcStats.hasBeenUsed (ref->base->id))
if (ref->base->mData.mSkillID >= 0 && ref->base->mData.mSkillID < ESM::Skill::Length
&& !npcStats.hasBeenUsed (ref->base->mId))
{
MWWorld::LiveCellRef<ESM::NPC> *playerRef = player.get<ESM::NPC>();
const ESM::Class *class_ = MWBase::Environment::get().getWorld()->getStore().classes.find (
playerRef->base->cls);
playerRef->base->mClass);
npcStats.increaseSkill (ref->base->data.skillID, *class_, true);
npcStats.increaseSkill (ref->base->mData.mSkillID, *class_, true);
npcStats.flagAsUsed (ref->base->id);
npcStats.flagAsUsed (ref->base->mId);
}
}

@ -10,13 +10,13 @@
MWWorld::Ptr::CellStore *MWWorld::Cells::getCellStore (const ESM::Cell *cell)
{
if (cell->data.flags & ESM::Cell::Interior)
if (cell->mData.mFlags & ESM::Cell::Interior)
{
std::map<std::string, Ptr::CellStore>::iterator result = mInteriors.find (cell->name);
std::map<std::string, Ptr::CellStore>::iterator result = mInteriors.find (cell->mName);
if (result==mInteriors.end())
{
result = mInteriors.insert (std::make_pair (cell->name, Ptr::CellStore (cell))).first;
result = mInteriors.insert (std::make_pair (cell->mName, Ptr::CellStore (cell))).first;
}
return &result->second;
@ -24,12 +24,12 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getCellStore (const ESM::Cell *cell)
else
{
std::map<std::pair<int, int>, Ptr::CellStore>::iterator result =
mExteriors.find (std::make_pair (cell->data.gridX, cell->data.gridY));
mExteriors.find (std::make_pair (cell->mData.mX, cell->mData.mY));
if (result==mExteriors.end())
{
result = mExteriors.insert (std::make_pair (
std::make_pair (cell->data.gridX, cell->data.gridY), Ptr::CellStore (cell))).first;
std::make_pair (cell->mData.mX, cell->mData.mY), Ptr::CellStore (cell))).first;
}
@ -46,7 +46,7 @@ void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore)
Ptr container (&*iter, &cellStore);
Class::get (container).getContainerStore (container).fill (
iter->base->inventory, mStore);
iter->base->mInventory, mStore);
}
for (CellRefList<ESM::Creature>::List::iterator iter (
@ -56,7 +56,7 @@ void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore)
Ptr container (&*iter, &cellStore);
Class::get (container).getContainerStore (container).fill (
iter->base->inventory, mStore);
iter->base->mInventory, mStore);
}
for (CellRefList<ESM::NPC>::List::iterator iter (
@ -66,7 +66,7 @@ void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore)
Ptr container (&*iter, &cellStore);
Class::get (container).getContainerStore (container).fill (
iter->base->inventory, mStore);
iter->base->mInventory, mStore);
}
}
@ -105,11 +105,11 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y)
// Cell isn't predefined. Make one on the fly.
ESM::Cell record;
record.data.flags = 0;
record.data.gridX = x;
record.data.gridY = y;
record.water = 0;
record.mapColor = 0;
record.mData.mFlags = 0;
record.mData.mX = x;
record.mData.mY = y;
record.mWater = 0;
record.mMapColor = 0;
cell = MWBase::Environment::get().getWorld()->createRecord (record);
}

@ -13,7 +13,7 @@ namespace MWWorld
{
CellStore::CellStore (const ESM::Cell *cell_) : cell (cell_), mState (State_Unloaded)
{
mWaterLevel = cell->water;
mWaterLevel = cell->mWater;
}
void CellStore::load (const ESMS::ESMStore &store, ESM::ESMReader &esm)
@ -45,7 +45,7 @@ namespace MWWorld
{
assert (cell);
if (cell->context.filename.empty())
if (cell->mContext.filename.empty())
return; // this is a dynamically generated cell -> skipping.
// Reopen the ESM reader and seek to the right position.
@ -58,7 +58,7 @@ namespace MWWorld
{
std::string lowerCase;
std::transform (ref.refID.begin(), ref.refID.end(), std::back_inserter (lowerCase),
std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase),
(int(*)(int)) std::tolower);
mIds.push_back (lowerCase);
@ -71,7 +71,7 @@ namespace MWWorld
{
assert (cell);
if (cell->context.filename.empty())
if (cell->mContext.filename.empty())
return; // this is a dynamically generated cell -> skipping.
// Reopen the ESM reader and seek to the right position.
@ -84,12 +84,12 @@ namespace MWWorld
{
std::string lowerCase;
std::transform (ref.refID.begin(), ref.refID.end(), std::back_inserter (lowerCase),
std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase),
(int(*)(int)) std::tolower);
int rec = store.find(ref.refID);
int rec = store.find(ref.mRefID);
ref.refID = lowerCase;
ref.mRefID = lowerCase;
/* We can optimize this further by storing the pointer to the
record itself in store.all, so that we don't need to look it
@ -119,9 +119,9 @@ namespace MWWorld
case ESM::REC_STAT: statics.find(ref, store.statics); break;
case ESM::REC_WEAP: weapons.find(ref, store.weapons); break;
case 0: std::cout << "Cell reference " + ref.refID + " not found!\n"; break;
case 0: std::cout << "Cell reference " + ref.mRefID + " not found!\n"; break;
default:
std::cout << "WARNING: Ignoring reference '" << ref.refID << "' of unhandled type\n";
std::cout << "WARNING: Ignoring reference '" << ref.mRefID << "' of unhandled type\n";
}
}
}

@ -58,9 +58,9 @@ namespace MWWorld
template <typename Y>
void find(ESM::CellRef &ref, const Y& recList)
{
const X* obj = recList.find(ref.refID);
const X* obj = recList.find(ref.mRefID);
if(obj == NULL)
throw std::runtime_error("Error resolving cell reference " + ref.refID);
throw std::runtime_error("Error resolving cell reference " + ref.mRefID);
list.push_back(LiveRef(ref, obj));
}
@ -69,7 +69,7 @@ namespace MWWorld
{
for (typename std::list<LiveRef>::iterator iter (list.begin()); iter!=list.end(); ++iter)
{
if (iter->mData.getCount() > 0 && iter->ref.refID == name)
if (iter->mData.getCount() > 0 && iter->ref.mRefID == name)
return &*iter;
}
@ -156,9 +156,9 @@ namespace MWWorld
}
bool operator==(const CellStore &cell) {
return this->cell->name == cell.cell->name &&
this->cell->data.gridX == cell.cell->data.gridX &&
this->cell->data.gridY == cell.cell->data.gridY;
return this->cell->mName == cell.cell->mName &&
this->cell->mData.mX == cell.cell->mData.mX &&
this->cell->mData.mY == cell.cell->mData.mY;
}
bool operator!=(const CellStore &cell) {

@ -29,7 +29,7 @@ namespace
++iter)
{
if (iter->mData.getCount()>0)
sum += iter->mData.getCount()*iter->base->data.weight;
sum += iter->mData.getCount()*iter->base->mData.mWeight;
}
return sum;
@ -59,12 +59,12 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::end()
bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2)
{
/// \todo add current weapon/armor health, remaining lockpick/repair uses, current enchantment charge here as soon as they are implemented
if ( ptr1.mCellRef->refID == ptr2.mCellRef->refID
if ( ptr1.mCellRef->mRefID == ptr2.mCellRef->mRefID
&& MWWorld::Class::get(ptr1).getScript(ptr1) == "" // item with a script never stacks
&& MWWorld::Class::get(ptr1).getEnchantment(ptr1) == "" // item with enchantment never stacks (we could revisit this later, but for now it makes selecting items in the spell window much easier)
&& ptr1.mCellRef->owner == ptr2.mCellRef->owner
&& ptr1.mCellRef->soul == ptr2.mCellRef->soul
&& ptr1.mCellRef->charge == ptr2.mCellRef->charge)
&& ptr1.mCellRef->mOwner == ptr2.mCellRef->mOwner
&& ptr1.mCellRef->mSoul == ptr2.mCellRef->mSoul
&& ptr1.mCellRef->mCharge == ptr2.mCellRef->mCharge)
return true;
return false;
@ -81,19 +81,19 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr)
MWWorld::LiveCellRef<ESM::Miscellaneous> *gold =
ptr.get<ESM::Miscellaneous>();
if (compare_string_ci(gold->ref.refID, "gold_001")
|| compare_string_ci(gold->ref.refID, "gold_005")
|| compare_string_ci(gold->ref.refID, "gold_010")
|| compare_string_ci(gold->ref.refID, "gold_025")
|| compare_string_ci(gold->ref.refID, "gold_100"))
if (compare_string_ci(gold->ref.mRefID, "gold_001")
|| compare_string_ci(gold->ref.mRefID, "gold_005")
|| compare_string_ci(gold->ref.mRefID, "gold_010")
|| compare_string_ci(gold->ref.mRefID, "gold_025")
|| compare_string_ci(gold->ref.mRefID, "gold_100"))
{
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), "Gold_001");
int count = (ptr.getRefData().getCount() == 1) ? gold->base->data.value : ptr.getRefData().getCount();
int count = (ptr.getRefData().getCount() == 1) ? gold->base->mData.mValue : ptr.getRefData().getCount();
ref.getPtr().getRefData().setCount(count);
for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter)
{
if (compare_string_ci((*iter).get<ESM::Miscellaneous>()->ref.refID, "gold_001"))
if (compare_string_ci((*iter).get<ESM::Miscellaneous>()->ref.mRefID, "gold_001"))
{
(*iter).getRefData().setCount( (*iter).getRefData().getCount() + count);
flagAsModified();
@ -117,7 +117,6 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr)
return iter;
}
}
// if we got here, this means no stacking
return addImpl(ptr);
}
@ -148,10 +147,10 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImpl (const Ptr& ptr
void MWWorld::ContainerStore::fill (const ESM::InventoryList& items, const ESMS::ESMStore& store)
{
for (std::vector<ESM::ContItem>::const_iterator iter (items.list.begin()); iter!=items.list.end();
for (std::vector<ESM::ContItem>::const_iterator iter (items.mList.begin()); iter!=items.mList.end();
++iter)
{
ManualRef ref (store, iter->item.toString());
ManualRef ref (store, iter->mItem.toString());
if (ref.getPtr().getTypeName()==typeid (ESM::ItemLevList).name())
{
@ -159,7 +158,7 @@ void MWWorld::ContainerStore::fill (const ESM::InventoryList& items, const ESMS:
continue;
}
ref.getPtr().getRefData().setCount (std::abs(iter->count)); /// \todo implement item restocking (indicated by negative count)
ref.getPtr().getRefData().setCount (std::abs(iter->mCount)); /// \todo implement item restocking (indicated by negative count)
add (ref.getPtr());
}

@ -35,27 +35,27 @@ namespace MWWorld
char type = ' ';
Data value;
switch (iter->second.type)
switch (iter->second.mType)
{
case ESM::VT_Short:
type = 's';
value.mShort = *reinterpret_cast<const Interpreter::Type_Float *> (
&iter->second.value);
&iter->second.mValue);
break;
case ESM::VT_Int:
type = 'l';
value.mLong = *reinterpret_cast<const Interpreter::Type_Float *> (
&iter->second.value);
&iter->second.mValue);
break;
case ESM::VT_Float:
type = 'f';
value.mFloat = *reinterpret_cast<const Interpreter::Type_Float *> (
&iter->second.value);
&iter->second.mValue);
break;
default:

@ -233,8 +233,8 @@ const MWMechanics::MagicEffects& MWWorld::InventoryStore::getMagicEffects()
const ESM::Enchantment& enchantment =
*MWBase::Environment::get().getWorld()->getStore().enchants.find (enchantmentId);
if (enchantment.data.type==ESM::Enchantment::ConstantEffect)
mMagicEffects.add (enchantment.effects);
if (enchantment.mData.mType==ESM::Enchantment::ConstantEffect)
mMagicEffects.add (enchantment.mEffects);
}
}

@ -15,9 +15,9 @@ namespace
cellRefList.list.begin());
iter!=cellRefList.list.end(); ++iter)
{
if (!iter->base->script.empty() && iter->mData.getCount())
if (!iter->base->mScript.empty() && iter->mData.getCount())
{
localScripts.add (iter->base->script, MWWorld::Ptr (&*iter, cell));
localScripts.add (iter->base->mScript, MWWorld::Ptr (&*iter, cell));
}
}
}

@ -82,16 +82,16 @@ namespace MWWorld
// initialise
ESM::CellRef& cellRef = mPtr.getCellRef();
cellRef.refID = name;
cellRef.refnum = -1;
cellRef.scale = 1;
cellRef.factIndex = 0;
cellRef.charge = 0;
cellRef.intv = 0;
cellRef.nam9 = 0;
cellRef.teleport = false;
cellRef.lockLevel = 0;
cellRef.unam = 0;
cellRef.mRefID = name;
cellRef.mRefnum = -1;
cellRef.mScale = 1;
cellRef.mFactIndex = 0;
cellRef.mCharge = 0;
cellRef.mIntv = 0;
cellRef.mNam9 = 0;
cellRef.mTeleport = false;
cellRef.mLockLevel = 0;
cellRef.mUnam = 0;
}
const Ptr& getPtr() const

@ -399,7 +399,7 @@ namespace MWWorld
return false;
}
btVector3 btMin, btMax;
float scale = ptr.getCellRef().scale;
float scale = ptr.getCellRef().mScale;
mEngine->getObjectAABB(model, scale, btMin, btMax);
min.x = btMin.x();

@ -18,16 +18,16 @@ namespace MWWorld
mAutoMove (false), mForwardBackward (0)
{
mPlayer.base = player;
mPlayer.ref.refID = "player";
mName = player->name;
mMale = !(player->flags & ESM::NPC::Female);
mRace = player->race;
mPlayer.ref.mRefID = "player";
mName = player->mName;
mMale = !(player->mFlags & ESM::NPC::Female);
mRace = player->mRace;
float* playerPos = mPlayer.mData.getPosition().pos;
playerPos[0] = playerPos[1] = playerPos[2] = 0;
/// \todo Do not make a copy of classes defined in esm/p records.
mClass = new ESM::Class (*world.getStore().classes.find (player->cls));
mClass = new ESM::Class (*world.getStore().classes.find (player->mClass));
}
Player::~Player()

@ -29,7 +29,7 @@ namespace MWWorld
}
RefData::RefData (const ESM::CellRef& cellRef)
: mBaseNode(0), mHasLocals (false), mEnabled (true), mCount (1), mPosition (cellRef.pos),
: mBaseNode(0), mHasLocals (false), mEnabled (true), mCount (1), mPosition (cellRef.mPos),
mCustomData (0)
{}

@ -88,11 +88,11 @@ namespace MWWorld
mPhysics->removeObject (node->getName());
}
if (!((*iter)->cell->data.flags & ESM::Cell::Interior))
if (!((*iter)->cell->mData.mFlags & ESM::Cell::Interior))
{
ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search((*iter)->cell->data.gridX,(*iter)->cell->data.gridY);
ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search((*iter)->cell->mData.mX,(*iter)->cell->mData.mY);
if (land)
mPhysics->removeHeightField( (*iter)->cell->data.gridX, (*iter)->cell->data.gridY );
mPhysics->removeHeightField( (*iter)->cell->mData.mX, (*iter)->cell->mData.mY );
}
}
@ -126,12 +126,12 @@ namespace MWWorld
float verts = ESM::Land::LAND_SIZE;
float worldsize = ESM::Land::REAL_SIZE;
if (!(cell->cell->data.flags & ESM::Cell::Interior))
if (!(cell->cell->mData.mFlags & ESM::Cell::Interior))
{
ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search(cell->cell->data.gridX,cell->cell->data.gridY);
ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search(cell->cell->mData.mX,cell->cell->mData.mY);
if (land)
mPhysics->addHeightField (land->landData->heights,
cell->cell->data.gridX, cell->cell->data.gridY,
mPhysics->addHeightField (land->mLandData->mHeights,
cell->cell->mData.mX, cell->cell->mData.mY,
0, ( worldsize/(verts-1) ), verts);
}
@ -149,8 +149,8 @@ namespace MWWorld
const ESM::Position& pos,
bool adjustPlayerPos)
{
bool hasWater = cell->cell->data.flags & cell->cell->HasWater;
mPhysics->setCurrentWater(hasWater, cell->cell->water);
bool hasWater = cell->cell->mData.mFlags & cell->cell->HasWater;
mPhysics->setCurrentWater(hasWater, cell->cell->mWater);
MWBase::World *world = MWBase::Environment::get().getWorld();
world->getPlayer().setCell(cell);
@ -188,10 +188,10 @@ namespace MWWorld
int numUnload = 0;
while (active!=mActiveCells.end())
{
if (!((*active)->cell->data.flags & ESM::Cell::Interior))
if (!((*active)->cell->mData.mFlags & ESM::Cell::Interior))
{
if (std::abs (X-(*active)->cell->data.gridX)<=1 &&
std::abs (Y-(*active)->cell->data.gridY)<=1)
if (std::abs (X-(*active)->cell->mData.mX)<=1 &&
std::abs (Y-(*active)->cell->mData.mY)<=1)
{
// keep cells within the new 3x3 grid
++active;
@ -206,10 +206,10 @@ namespace MWWorld
active = mActiveCells.begin();
while (active!=mActiveCells.end())
{
if (!((*active)->cell->data.flags & ESM::Cell::Interior))
if (!((*active)->cell->mData.mFlags & ESM::Cell::Interior))
{
if (std::abs (X-(*active)->cell->data.gridX)<=1 &&
std::abs (Y-(*active)->cell->data.gridY)<=1)
if (std::abs (X-(*active)->cell->mData.mX)<=1 &&
std::abs (Y-(*active)->cell->mData.mY)<=1)
{
// keep cells within the new 3x3 grid
++active;
@ -231,10 +231,10 @@ namespace MWWorld
while (iter!=mActiveCells.end())
{
assert (!((*iter)->cell->data.flags & ESM::Cell::Interior));
assert (!((*iter)->cell->mData.mFlags & ESM::Cell::Interior));
if (x==(*iter)->cell->data.gridX &&
y==(*iter)->cell->data.gridY)
if (x==(*iter)->cell->mData.mX &&
y==(*iter)->cell->mData.mY)
break;
++iter;
@ -253,10 +253,10 @@ namespace MWWorld
while (iter!=mActiveCells.end())
{
assert (!((*iter)->cell->data.flags & ESM::Cell::Interior));
assert (!((*iter)->cell->mData.mFlags & ESM::Cell::Interior));
if (x==(*iter)->cell->data.gridX &&
y==(*iter)->cell->data.gridY)
if (x==(*iter)->cell->mData.mX &&
y==(*iter)->cell->mData.mY)
break;
++iter;
@ -277,10 +277,10 @@ namespace MWWorld
while (iter!=mActiveCells.end())
{
assert (!((*iter)->cell->data.flags & ESM::Cell::Interior));
assert (!((*iter)->cell->mData.mFlags & ESM::Cell::Interior));
if (X==(*iter)->cell->data.gridX &&
Y==(*iter)->cell->data.gridY)
if (X==(*iter)->cell->mData.mX &&
Y==(*iter)->cell->mData.mY)
break;
++iter;

@ -497,7 +497,7 @@ void WeatherManager::update(float duration)
if (exterior)
{
std::string regionstr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->region;
std::string regionstr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->mRegion;
boost::algorithm::to_lower(regionstr);
if (mWeatherUpdateTime <= 0 || regionstr != mCurrentRegion)
@ -516,16 +516,16 @@ void WeatherManager::update(float duration)
if (region != 0)
{
float clear = region->data.clear/255.f;
float cloudy = region->data.cloudy/255.f;
float foggy = region->data.foggy/255.f;
float overcast = region->data.overcast/255.f;
float rain = region->data.rain/255.f;
float thunder = region->data.thunder/255.f;
float ash = region->data.ash/255.f;
float blight = region->data.blight/255.f;
//float snow = region->data.a/255.f;
//float blizzard = region->data.b/255.f;
float clear = region->mData.mClear/255.f;
float cloudy = region->mData.mCloudy/255.f;
float foggy = region->mData.mFoggy/255.f;
float overcast = region->mData.mOvercast/255.f;
float rain = region->mData.mRain/255.f;
float thunder = region->mData.mThunder/255.f;
float ash = region->mData.mAsh/255.f;
float blight = region->mData.mBlight/255.f;
//float snow = region->mData.a/255.f;
//float blizzard = region->mData.b/255.f;
// re-scale to 100 percent
const float total = clear+cloudy+foggy+overcast+rain+thunder+ash+blight;//+snow+blizzard;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save