1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 12:53:51 +00:00

Merge branch 'master' into spellcreation

Conflicts:
	apps/openmw/mwbase/windowmanager.hpp
This commit is contained in:
scrawl 2012-10-01 17:54:45 +02:00
commit ff2c2d2b96
206 changed files with 5162 additions and 2670 deletions

View file

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

View file

@ -1,20 +1,50 @@
#include <iostream> #include <iostream>
#include <vector>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <boost/program_options.hpp> #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> #include <components/esm/records.hpp>
#define ESMTOOL_VERSION 1.1 #include "record.hpp"
using namespace std; #define ESMTOOL_VERSION 1.1
using namespace ESM;
// Create a local alias for brevity // Create a local alias for brevity
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
void printRaw(ESMReader &esm); struct ESMData
void loadCell(Cell &cell, ESMReader &esm, bool quiet); {
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 // Based on the legacy struct
struct Arguments struct Arguments
@ -22,13 +52,20 @@ struct Arguments
unsigned int raw_given; unsigned int raw_given;
unsigned int quiet_given; unsigned int quiet_given;
unsigned int loadcells_given; unsigned int loadcells_given;
std::string mode;
std::string encoding; std::string encoding;
std::string filename; std::string filename;
std::string outname;
ESMData data;
ESM::ESMReader reader;
ESM::ESMWriter writer;
}; };
bool parseOptions (int argc, char** argv, Arguments &info) 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() desc.add_options()
("help,h", "print help message.") ("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.") ("loadcells,C", "Browse through contents of all cells.")
( "encoding,e", bpo::value<std::string>(&(info.encoding))-> ( "encoding,e", bpo::value<std::string>(&(info.encoding))->
default_value("win1252"), default_value("win1252"),
"Character encoding used in ESMTool:\n" "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\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\twin1251 - Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic and other languages\n"
"\n\twin1252 - Western European (Latin) alphabet, used by default") "\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."; 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"); bpo::options_description hidden("Hidden Options");
hidden.add_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; 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 // there might be a better way to do this
bpo::options_description all; bpo::options_description all;
@ -77,6 +115,20 @@ bool parseOptions (int argc, char** argv, Arguments &info)
std::cout << "ESMTool version " << ESMTOOL_VERSION << std::endl; std::cout << "ESMTool version " << ESMTOOL_VERSION << std::endl;
return false; return false;
} }
if (!variables.count("mode"))
{
std::cout << "No mode specified!" << std::endl << std::endl
<< desc << finalText << std::endl;
return false;
}
info.mode = variables["mode"].as<std::string>();
if (!(info.mode == "dump" || info.mode == "clone" || info.mode == "comp"))
{
std::cout << std::endl << "ERROR: invalid mode \"" << info.mode << "\"" << std::endl << std::endl
<< desc << finalText << std::endl;
return false;
}
if ( !variables.count("input-file") ) if ( !variables.count("input-file") )
{ {
@ -86,14 +138,16 @@ bool parseOptions (int argc, char** argv, Arguments &info)
} }
// handling gracefully the user adding multiple files // handling gracefully the user adding multiple files
if (variables["input-file"].as< vector<std::string> >().size() > 1) /* if (variables["input-file"].as< std::vector<std::string> >().size() > 1)
{ {
std::cout << "\nERROR: more than one ES file specified\n\n"; std::cout << "\nERROR: more than one ES file specified\n\n";
std::cout << desc << finalText << std::endl; std::cout << desc << finalText << std::endl;
return false; return false;
} }*/
info.filename = variables["input-file"].as< vector<std::string> >()[0]; 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.raw_given = variables.count ("raw");
info.quiet_given = variables.count ("quiet"); info.quiet_given = variables.count ("quiet");
@ -122,288 +176,350 @@ bool parseOptions (int argc, char** argv, Arguments &info)
return true; 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) int main(int argc, char**argv)
{ {
Arguments info; Arguments info;
if(!parseOptions (argc, argv, info)) if(!parseOptions (argc, argv, info))
return 1; return 1;
ESMReader esm; if (info.mode == "dump")
esm.setEncoding(info.encoding); return load(info);
else if (info.mode == "clone")
string filename = info.filename; return clone(info);
cout << "\nFile: " << filename << endl; else if (info.mode == "comp")
return comp(info);
try { else
if(info.raw_given)
{ {
cout << "RAW file listing:\n"; std::cout << "Invalid or no mode specified, dying horribly. Have a nice day." << std::endl;
return 1;
esm.openRaw(filename);
printRaw(esm);
return 0;
} }
bool quiet = info.quiet_given; return 0;
bool loadCells = info.loadcells_given; }
esm.open(filename); void loadCell(ESM::Cell &cell, ESM::ESMReader &esm, Arguments& info)
{
bool quiet = (info.quiet_given || info.mode == "clone");
bool save = (info.mode == "clone");
cout << "Author: " << esm.getAuthor() << endl; // Skip back to the beginning of the reference list
cout << "Description: " << esm.getDesc() << endl; cell.restore(esm);
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";
// Loop through all records // Loop through all the references
while(esm.hasMoreRecs()) ESM::CellRef ref;
if(!quiet) std::cout << " References:\n";
while(cell.getNextRef(esm, ref))
{ {
NAME n = esm.getRecName(); if (save) {
esm.getRecHeader(); info.data.mCellRefs[&cell].push_back(ref);
string id = esm.getHNOString("NAME"); }
if(!quiet)
cout << "\nRecord: " << n.toString()
<< " '" << id << "'\n";
switch(n.val) if(quiet) continue;
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;
}
}
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())
{ {
case REC_ACTI: uint64_t offs = esm.getOffset();
{ esm.getSubName();
Activator ac; esm.skipHSub();
ac.load(esm); n = esm.retSubName();
if(quiet) break; std::cout << " " << n.toString() << " - " << esm.getSubSize()
cout << " Name: " << ac.name << endl; << " bytes @ 0x" << std::hex << offs << "\n";
cout << " Mesh: " << ac.model << endl; }
cout << " Script: " << ac.script << endl; }
break; }
}
case REC_ALCH: int load(Arguments& info)
{ {
Potion p; ESM::ESMReader& esm = info.reader;
p.load(esm, id); esm.setEncoding(info.encoding);
if(quiet) break;
cout << " Name: " << p.name << endl; std::string filename = info.filename;
break; std::cout << "Loading file: " << filename << std::endl;
}
case REC_APPA: std::list<int> skipped;
{
Apparatus p; try {
p.load(esm);
if(quiet) break; if(info.raw_given && info.mode == "dump")
cout << " Name: " << p.name << endl; {
break; std::cout << "RAW file listing:\n";
}
case REC_ARMO: esm.openRaw(filename);
{
Armor am; printRaw(esm);
am.load(esm);
if(quiet) break; return 0;
cout << " Name: " << am.name << endl; }
cout << " Mesh: " << am.model << endl;
cout << " Icon: " << am.icon << endl; bool quiet = (info.quiet_given || info.mode == "clone");
cout << " Script: " << am.script << endl; bool loadCells = (info.loadcells_given || info.mode == "clone");
cout << " Enchantment: " << am.enchant << endl; bool save = (info.mode == "clone");
cout << " Type: " << am.data.type << endl;
cout << " Weight: " << am.data.weight << endl; esm.open(filename);
break;
} info.data.author = esm.getAuthor();
case REC_BODY: info.data.description = esm.getDesc();
{ info.data.masters = esm.getMasters();
BodyPart bp; info.data.version = esm.getVer();
bp.load(esm); info.data.type = esm.getType();
if(quiet) break;
cout << " Name: " << bp.name << endl; if (!quiet)
cout << " Mesh: " << bp.model << endl; {
break; std::cout << "Author: " << esm.getAuthor() << std::endl
} << "Description: " << esm.getDesc() << std::endl
case REC_BOOK: << "File format version: " << esm.getFVer() << std::endl
{ << "Special flag: " << esm.getSpecial() << std::endl;
Book b; ESM::ESMReader::MasterList m = esm.getMasters();
b.load(esm, id); if (!m.empty())
if(quiet) break; {
cout << " Name: " << b.name << endl; std::cout << "Masters:" << std::endl;
cout << " Mesh: " << b.model << endl; for(unsigned int i=0;i<m.size();i++)
break; std::cout << " " << m[i].name << ", " << m[i].size << " bytes" << std::endl;
} }
case REC_BSGN: }
{
BirthSign bs; // Loop through all records
bs.load(esm); while(esm.hasMoreRecs())
if(quiet) break; {
cout << " Name: " << bs.name << endl; ESM::NAME n = esm.getRecName();
cout << " Texture: " << bs.texture << endl; uint32_t flags;
cout << " Description: " << bs.description << endl; esm.getRecHeader(flags);
break;
} std::string id = esm.getHNOString("NAME");
case REC_CELL:
{
Cell b;
b.load(esm);
if(!quiet) if(!quiet)
{ std::cout << "\nRecord: " << n.toString()
cout << " Name: " << b.name << endl; << " '" << id << "'\n";
cout << " Region: " << b.region << endl;
} EsmTool::RecordBase *record =
if(loadCells) EsmTool::RecordBase::create(n.val);
loadCell(b, esm, quiet);
break; if (record == 0) {
} if (std::find(skipped.begin(), skipped.end(), n.val) == skipped.end())
case REC_CLAS: {
{ std::cout << "Skipping " << n.toString() << " records." << std::endl;
Class b; skipped.push_back(n.val);
b.load(esm); }
if(quiet) break;
cout << " Name: " << b.name << endl; esm.skipRecord();
cout << " Description: " << b.description << endl; if (quiet) break;
break; std::cout << " Skipping\n";
} } else {
case REC_CLOT: if (record->getType() == ESM::REC_GMST) {
{ // preset id for GameSetting record
Clothing b; record->cast<ESM::GameSetting>()->get().mId = id;
b.load(esm); }
if(quiet) break; record->setId(id);
cout << " Name: " << b.name << endl; record->setFlags((int) flags);
break; record->load(esm);
} if (!quiet) {
case REC_CONT: record->print();
{ }
Container b;
b.load(esm); if (record->getType() == ESM::REC_CELL && loadCells) {
if(quiet) break; loadCell(record->cast<ESM::Cell>()->get(), esm, info);
cout << " Name: " << b.name << endl; }
break;
} if (save) {
case REC_CREA: info.data.mRecords.push_back(record);
{ } else {
Creature b; delete record;
b.load(esm, id); }
if(quiet) break; ++info.data.mRecordStats[n.val];
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";
} }
}
} catch(exception &e) } catch(std::exception &e) {
{ std::cout << "\nERROR:\n\n " << e.what() << std::endl;
cout << "\nERROR:\n\n " << e.what() << endl;
return 1;
}
return 0; typedef std::deque<EsmTool::RecordBase *> RecStore;
} RecStore &store = info.data.mRecords;
for (RecStore::iterator it = store.begin(); it != store.end(); ++it)
void loadCell(Cell &cell, ESMReader &esm, bool quiet)
{
// Skip back to the beginning of the reference list
cell.restore(esm);
// Loop through all the references
CellRef ref;
if(!quiet) cout << " References:\n";
while(cell.getNextRef(esm, ref))
{
if(quiet) continue;
cout << " Refnum: " << ref.refnum << endl;
cout << " ID: '" << ref.refID << "'\n";
cout << " Owner: '" << ref.owner << "'\n";
cout << " INTV: " << ref.intv << " NAM9: " << ref.intv << endl;
}
}
void printRaw(ESMReader &esm)
{
while(esm.hasMoreRecs())
{
NAME n = esm.getRecName();
cout << "Record: " << n.toString() << endl;
esm.getRecHeader();
while(esm.hasMoreSubs())
{ {
uint64_t offs = esm.getOffset(); delete *it;
esm.getSubName(); }
esm.skipHSub(); store.clear();
n = esm.retSubName(); return 1;
cout << " " << n.toString() << " - " << esm.getSubSize() }
<< " bytes @ 0x" << hex << offs << "\n";
return 0;
}
#include <iomanip>
int clone(Arguments& info)
{
if (info.outname.empty())
{
std::cout << "You need to specify an output name" << std::endl;
return 1;
}
if (load(info) != 0)
{
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;
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;
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)
{
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)
{
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;
} }

568
apps/esmtool/record.cpp Normal file
View file

@ -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

127
apps/esmtool/record.hpp Normal file
View file

@ -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

View file

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

View file

@ -372,7 +372,7 @@ void OMW::Engine::go()
if (const ESM::Cell *exterior = MWBase::Environment::get().getWorld()->getExterior (mCellName)) 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); pos.pos[0], pos.pos[1], true);
MWBase::Environment::get().getWorld()->changeToExteriorCell (pos); MWBase::Environment::get().getWorld()->changeToExteriorCell (pos);
} }

View file

@ -112,12 +112,9 @@ namespace MWBase
virtual bool getSoundPlaying(MWWorld::Ptr reference, const std::string& soundId) const = 0; virtual bool getSoundPlaying(MWWorld::Ptr reference, const std::string& soundId) const = 0;
///< Is the given sound currently playing on the given object? ///< 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 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) inline int operator|(SoundManager::PlayMode a, SoundManager::PlayMode b)

View file

@ -213,7 +213,7 @@ namespace MWBase
* @param id Identifier for the GMST setting, e.g. "aName" * @param id Identifier for the GMST setting, e.g. "aName"
* @param default Default value if the GMST setting cannot be used. * @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; virtual void processChangedSettings(const Settings::CategorySettingVector& changed) = 0;
@ -226,6 +226,7 @@ namespace MWBase
virtual bool getRestEnabled() = 0; virtual bool getRestEnabled() = 0;
virtual bool getPlayerSleeping() = 0; virtual bool getPlayerSleeping() = 0;
virtual void wakeUpPlayer() = 0;
virtual void startSpellMaking(MWWorld::Ptr actor) = 0; virtual void startSpellMaking(MWWorld::Ptr actor) = 0;
virtual void startEnchanting(MWWorld::Ptr actor) = 0; virtual void startEnchanting(MWWorld::Ptr actor) = 0;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -95,24 +95,24 @@ namespace
int i = 0; int i = 0;
for (; i<static_cast<int> (script->varNames.size()); ++i) for (; i<static_cast<int> (script->mVarNames.size()); ++i)
if (script->varNames[i]==name) if (script->mVarNames[i]==name)
break; 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 return false; // script does not have a variable of this name
const MWScript::Locals& locals = actor.getRefData().getLocals(); const MWScript::Locals& locals = actor.getRefData().getLocals();
if (i<script->data.numShorts) if (i<script->mData.mNumShorts)
return selectCompare (comp, locals.mShorts[i], value); return selectCompare (comp, locals.mShorts[i], value);
else 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); return selectCompare (comp, locals.mLongs[i], value);
else else
i -= script->data.numShorts; i -= script->mData.mNumShorts;
return selectCompare (comp, locals.mFloats.at (i), value); return selectCompare (comp, locals.mFloats.at (i), value);
} }
@ -161,16 +161,16 @@ namespace MWDialogue
{ {
bool isCreature = (actor.getTypeName() != typeid(ESM::NPC).name()); bool isCreature = (actor.getTypeName() != typeid(ESM::NPC).name());
for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.selects.begin()); for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.mSelects.begin());
iter != info.selects.end(); ++iter) iter != info.mSelects.end(); ++iter)
{ {
ESM::DialInfo::SelectStruct select = *iter; ESM::DialInfo::SelectStruct select = *iter;
char type = select.selectRule[1]; char type = select.mSelectRule[1];
if(type == '1') if(type == '1')
{ {
char comp = select.selectRule[4]; char comp = select.mSelectRule[4];
std::string name = select.selectRule.substr (5); std::string name = select.mSelectRule.substr (5);
std::string function = select.selectRule.substr(2,2); std::string function = select.mSelectRule.substr(2,2);
int ifunction; int ifunction;
std::istringstream iss(function); std::istringstream iss(function);
@ -178,19 +178,19 @@ namespace MWDialogue
switch(ifunction) switch(ifunction)
{ {
case 39://PC Expelled 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; break;
case 40://PC Common Disease 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; break;
case 41://PC Blight Disease 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; break;
case 43://PC Crime level 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; break;
case 46://Same faction case 46://Same faction
@ -206,71 +206,71 @@ namespace MWDialogue
std::string NPCFaction = NPCstats.getFactionRanks().begin()->first; std::string NPCFaction = NPCstats.getFactionRanks().begin()->first;
if(PCstats.getFactionRanks().find(toLower(NPCFaction)) != PCstats.getFactionRanks().end()) sameFaction = 1; 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; break;
case 48://Detected case 48://Detected
if(!selectCompare<int,int>(comp,1,select.i)) return false; if(!selectCompare<int,int>(comp,1,select.mI)) return false;
break; break;
case 49://Alarmed case 49://Alarmed
if(!selectCompare<int,int>(comp,0,select.i)) return false; if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break; break;
case 50://choice case 50://choice
if(choice) if(choice)
{ {
if(!selectCompare<int,int>(comp,mChoice,select.i)) return false; if(!selectCompare<int,int>(comp,mChoice,select.mI)) return false;
} }
break; break;
case 60://PC Vampire 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; break;
case 61://Level case 61://Level
if(!selectCompare<int,int>(comp,1,select.i)) return false; if(!selectCompare<int,int>(comp,1,select.mI)) return false;
break; break;
case 62://Attacked case 62://Attacked
if(!selectCompare<int,int>(comp,0,select.i)) return false; if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break; break;
case 63://Talked to PC 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; break;
case 64://PC Health 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; break;
case 65://Creature target 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; break;
case 66://Friend hit 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; break;
case 67://Fight case 67://Fight
if(!selectCompare<int,int>(comp,0,select.i)) return false; if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break; break;
case 68://Hello???? case 68://Hello????
if(!selectCompare<int,int>(comp,0,select.i)) return false; if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break; break;
case 69://Alarm case 69://Alarm
if(!selectCompare<int,int>(comp,0,select.i)) return false; if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break; break;
case 70://Flee case 70://Flee
if(!selectCompare<int,int>(comp,0,select.i)) return false; if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break; break;
case 71://Should Attack 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; break;
default: default:
@ -288,13 +288,13 @@ namespace MWDialogue
{ {
bool isCreature = (actor.getTypeName() != typeid(ESM::NPC).name()); bool isCreature = (actor.getTypeName() != typeid(ESM::NPC).name());
char type = select.selectRule[1]; char type = select.mSelectRule[1];
if (type!='0') if (type!='0')
{ {
char comp = select.selectRule[4]; char comp = select.mSelectRule[4];
std::string name = select.selectRule.substr (5); std::string name = select.mSelectRule.substr (5);
std::string function = select.selectRule.substr(1,2); std::string function = select.mSelectRule.substr(1,2);
switch (type) switch (type)
{ {
@ -304,15 +304,15 @@ namespace MWDialogue
case '2': // global case '2': // global
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int || if (select.mType==ESM::VT_Short || select.mType==ESM::VT_Int ||
select.type==ESM::VT_Long) select.mType==ESM::VT_Long)
{ {
if (!checkGlobal (comp, toLower (name), select.i)) if (!checkGlobal (comp, toLower (name), select.mI))
return false; 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; return false;
} }
else else
@ -323,16 +323,16 @@ namespace MWDialogue
case '3': // local case '3': // local
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int || if (select.mType==ESM::VT_Short || select.mType==ESM::VT_Int ||
select.type==ESM::VT_Long) 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())) MWBase::Environment::get().getWorld()->getStore()))
return false; 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())) MWBase::Environment::get().getWorld()->getStore()))
return false; return false;
} }
@ -343,9 +343,9 @@ namespace MWDialogue
return true; return true;
case '4'://journal 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 else
throw std::runtime_error ( throw std::runtime_error (
@ -361,22 +361,22 @@ namespace MWDialogue
int sum = 0; int sum = 0;
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end(); ++iter) 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(); 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; return true;
case '6'://dead 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 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))); 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 else
throw std::runtime_error ( throw std::runtime_error (
@ -388,11 +388,11 @@ namespace MWDialogue
if (isCreature) if (isCreature)
return false; return false;
if(select.type==ESM::VT_Int) if(select.mType==ESM::VT_Int)
{ {
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>(); MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
int isFaction = int(toLower(npc->base->faction) == toLower(name)); int isFaction = int(toLower(npc->base->mFaction) == toLower(name));
if(selectCompare<int,int>(comp,!isFaction,select.i)) if(selectCompare<int,int>(comp,!isFaction,select.mI))
return false; return false;
} }
else else
@ -405,11 +405,11 @@ namespace MWDialogue
if (isCreature) if (isCreature)
return false; return false;
if(select.type==ESM::VT_Int) if(select.mType==ESM::VT_Int)
{ {
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>(); MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
int isClass = int(toLower(npc->base->cls) == toLower(name)); int isClass = int(toLower(npc->base->mClass) == toLower(name));
if(selectCompare<int,int>(comp,!isClass,select.i)) if(selectCompare<int,int>(comp,!isClass,select.mI))
return false; return false;
} }
else else
@ -422,11 +422,11 @@ namespace MWDialogue
if (isCreature) if (isCreature)
return false; return false;
if(select.type==ESM::VT_Int) if(select.mType==ESM::VT_Int)
{ {
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>(); MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
int isRace = int(toLower(npc->base->race) == toLower(name)); int isRace = int(toLower(npc->base->mRace) == toLower(name));
if(selectCompare<int,int>(comp,!isRace,select.i)) if(selectCompare<int,int>(comp,!isRace,select.mI))
return false; return false;
} }
else else
@ -436,10 +436,10 @@ namespace MWDialogue
return true; return true;
case 'B'://not Cell 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)); int isCell = int(toLower(actor.getCell()->cell->mName) == toLower(name));
if(selectCompare<int,int>(comp,!isCell,select.i)) if(selectCompare<int,int>(comp,!isCell,select.mI))
return false; return false;
} }
else else
@ -448,16 +448,16 @@ namespace MWDialogue
return true; return true;
case 'C'://not local case 'C'://not local
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int || if (select.mType==ESM::VT_Short || select.mType==ESM::VT_Int ||
select.type==ESM::VT_Long) 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())) MWBase::Environment::get().getWorld()->getStore()))
return false; 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())) MWBase::Environment::get().getWorld()->getStore()))
return false; return false;
} }
@ -481,12 +481,12 @@ namespace MWDialogue
bool isCreature = (actor.getTypeName() != typeid(ESM::NPC).name()); bool isCreature = (actor.getTypeName() != typeid(ESM::NPC).name());
// actor id // actor id
if (!info.actor.empty()) if (!info.mActor.empty())
if (toLower (info.actor)!=MWWorld::Class::get (actor).getId (actor)) if (toLower (info.mActor)!=MWWorld::Class::get (actor).getId (actor))
return false; return false;
//NPC race //NPC race
if (!info.race.empty()) if (!info.mRace.empty())
{ {
if (isCreature) if (isCreature)
return false; return false;
@ -496,12 +496,12 @@ namespace MWDialogue
if (!cellRef) if (!cellRef)
return false; return false;
if (toLower (info.race)!=toLower (cellRef->base->race)) if (toLower (info.mRace)!=toLower (cellRef->base->mRace))
return false; return false;
} }
//NPC class //NPC class
if (!info.clas.empty()) if (!info.mClass.empty())
{ {
if (isCreature) if (isCreature)
return false; return false;
@ -511,23 +511,23 @@ namespace MWDialogue
if (!cellRef) if (!cellRef)
return false; return false;
if (toLower (info.clas)!=toLower (cellRef->base->cls)) if (toLower (info.mClass)!=toLower (cellRef->base->mClass))
return false; return false;
} }
//NPC faction //NPC faction
if (!info.npcFaction.empty()) if (!info.mNpcFaction.empty())
{ {
if (isCreature) if (isCreature)
return false; return false;
//MWWorld::Class npcClass = MWWorld::Class::get(actor); //MWWorld::Class npcClass = MWWorld::Class::get(actor);
MWMechanics::NpcStats stats = MWWorld::Class::get(actor).getNpcStats(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()) if(it!=stats.getFactionRanks().end())
{ {
//check rank //check rank
if(it->second < (int)info.data.rank) return false; if(it->second < (int)info.mData.mRank) return false;
} }
else else
{ {
@ -537,14 +537,14 @@ namespace MWDialogue
} }
// TODO check player faction // 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()); 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()) if(it!=stats.getFactionRanks().end())
{ {
//check rank //check rank
if(it->second < (int)info.data.PCrank) return false; if(it->second < (int)info.mData.mPCrank) return false;
} }
else else
{ {
@ -557,24 +557,24 @@ namespace MWDialogue
if (!isCreature) if (!isCreature)
{ {
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>(); 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 else
{ {
if(static_cast<int> (info.data.gender)==1) return false; if(static_cast<int> (info.mData.mGender)==1) return false;
} }
} }
// check cell // check cell
if (!info.cell.empty()) if (!info.mCell.empty())
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->name != info.cell) if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->mName != info.mCell)
return false; return false;
// TODO check DATAstruct // TODO check DATAstruct
for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.selects.begin()); for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.mSelects.begin());
iter != info.selects.end(); ++iter) iter != info.mSelects.end(); ++iter)
if (!isMatching (actor, *iter)) if (!isMatching (actor, *iter))
return false; return false;
@ -647,7 +647,7 @@ namespace MWDialogue
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++) for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
{ {
ESM::Dialogue ndialogue = it->second; ESM::Dialogue ndialogue = it->second;
if(ndialogue.type == ESM::Dialogue::Greeting) if(ndialogue.mType == ESM::Dialogue::Greeting)
{ {
if (greetingFound) break; if (greetingFound) break;
for (std::vector<ESM::DialInfo>::const_iterator iter (it->second.mInfo.begin()); for (std::vector<ESM::DialInfo>::const_iterator iter (it->second.mInfo.begin());
@ -655,15 +655,15 @@ namespace MWDialogue
{ {
if (isMatching (actor, *iter) && functionFilter(mActor,*iter,true)) if (isMatching (actor, *iter) && functionFilter(mActor,*iter,true))
{ {
if (!iter->sound.empty()) if (!iter->mSound.empty())
{ {
// TODO play sound // TODO play sound
} }
std::string text = iter->response; std::string text = iter->mResponse;
parseText(text); parseText(text);
win->addText(iter->response); win->addText(iter->mResponse);
executeScript(iter->resultScript); executeScript(iter->mResultScript);
greetingFound = true; greetingFound = true;
mLastTopic = it->first; mLastTopic = it->first;
mLastDialogue = *iter; mLastDialogue = *iter;
@ -746,7 +746,7 @@ namespace MWDialogue
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++) for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
{ {
ESM::Dialogue ndialogue = it->second; 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()); for (std::vector<ESM::DialInfo>::const_iterator iter (it->second.mInfo.begin());
iter!=it->second.mInfo.end(); ++iter) iter!=it->second.mInfo.end(); ++iter)
@ -820,21 +820,21 @@ namespace MWDialogue
if(mDialogueMap.find(keyword) != mDialogueMap.end()) if(mDialogueMap.find(keyword) != mDialogueMap.end())
{ {
ESM::Dialogue ndialogue = mDialogueMap[keyword]; 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(); for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
iter!=ndialogue.mInfo.end(); ++iter) iter!=ndialogue.mInfo.end(); ++iter)
{ {
if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,true)) if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,true))
{ {
std::string text = iter->response; std::string text = iter->mResponse;
std::string script = iter->resultScript; std::string script = iter->mResultScript;
parseText(text); parseText(text);
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
win->addTitle(keyword); win->addTitle(keyword);
win->addText(iter->response); win->addText(iter->mResponse);
executeScript(script); executeScript(script);
@ -865,7 +865,7 @@ namespace MWDialogue
if(mDialogueMap.find(mLastTopic) != mDialogueMap.end()) if(mDialogueMap.find(mLastTopic) != mDialogueMap.end())
{ {
ESM::Dialogue ndialogue = mDialogueMap[mLastTopic]; 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(); for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
iter!=ndialogue.mInfo.end(); ++iter) iter!=ndialogue.mInfo.end(); ++iter)
@ -876,10 +876,10 @@ namespace MWDialogue
mChoice = -1; mChoice = -1;
mIsInChoice = false; mIsInChoice = false;
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
std::string text = iter->response; std::string text = iter->mResponse;
parseText(text); parseText(text);
win->addText(text); win->addText(text);
executeScript(iter->resultScript); executeScript(iter->mResultScript);
mLastTopic = mLastTopic; mLastTopic = mLastTopic;
mLastDialogue = *iter; mLastDialogue = *iter;
break; break;

View file

@ -22,8 +22,8 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin()); for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter) iter!=dialogue->mInfo.end(); ++iter)
if (iter->id==mInfoId) if (iter->mId == mInfoId)
return iter->response; return iter->mResponse;
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic); 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()); for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter) 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); throw std::runtime_error ("unknown journal index for topic " + topic);

View file

@ -22,8 +22,8 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin()); for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter) iter!=dialogue->mInfo.end(); ++iter)
if (iter->questStatus==ESM::DialInfo::QS_Name) if (iter->mQuestStatus==ESM::DialInfo::QS_Name)
return iter->response; return iter->mResponse;
return ""; return "";
} }
@ -39,13 +39,13 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin()); for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter) 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; mIndex = index;
if (iter->questStatus==ESM::DialInfo::QS_Finished) if (iter->mQuestStatus==ESM::DialInfo::QS_Finished)
mFinished = true; mFinished = true;
else if (iter->questStatus==ESM::DialInfo::QS_Restart) else if (iter->mQuestStatus==ESM::DialInfo::QS_Restart)
mFinished = false; mFinished = false;
return; return;
@ -67,9 +67,9 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin()); for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter) 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; break;
} }

View file

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

View file

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

View file

@ -60,7 +60,7 @@ void BookWindow::open (MWWorld::Ptr book)
MWWorld::LiveCellRef<ESM::Book> *ref = mBook.get<ESM::Book>(); MWWorld::LiveCellRef<ESM::Book> *ref = mBook.get<ESM::Book>();
BookTextParser parser; 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; int i=0;
for (std::vector<std::string>::iterator it=results.begin(); for (std::vector<std::string>::iterator it=results.begin();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -128,7 +128,7 @@ namespace MWGui
std::map<std::string, ESM::Class> list = MWBase::Environment::get().getWorld()->getStore ().classes.list; 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) 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; classId = it->first;
} }
mClassImage->setImageTexture ("textures\\levelup\\" + classId + ".dds"); mClassImage->setImageTexture ("textures\\levelup\\" + classId + ".dds");

View file

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

View file

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

View file

@ -223,11 +223,11 @@ void RaceDialog::updateRaces()
for (; it != end; ++it) for (; it != end; ++it)
{ {
const ESM::Race &race = it->second; 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 if (!playable) // Only display playable races
continue; continue;
mRaceList->addItem(race.name, it->first); mRaceList->addItem(race.mName, it->first);
if (boost::iequals(it->first, mCurrentRaceId)) if (boost::iequals(it->first, mCurrentRaceId))
mRaceList->setIndexSelected(index); mRaceList->setIndexSelected(index);
++index; ++index;
@ -251,10 +251,10 @@ void RaceDialog::updateSkills()
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(mCurrentRaceId); 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) 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 if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
continue; continue;
@ -262,7 +262,7 @@ void RaceDialog::updateSkills()
std::string("Skill") + boost::lexical_cast<std::string>(i)); std::string("Skill") + boost::lexical_cast<std::string>(i));
skillWidget->setWindowManager(&mWindowManager); skillWidget->setWindowManager(&mWindowManager);
skillWidget->setSkillNumber(skillId); 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); ToolTips::createSkillToolTip(skillWidget, skillId);
@ -290,8 +290,8 @@ void RaceDialog::updateSpellPowers()
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(mCurrentRaceId); 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 it = race->mPowers.mList.begin();
std::vector<std::string>::const_iterator end = race->powers.list.end(); std::vector<std::string>::const_iterator end = race->mPowers.mList.end();
for (int i = 0; it != end; ++it) for (int i = 0; it != end; ++it)
{ {
const std::string &spellpower = *it; const std::string &spellpower = *it;

View file

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

View file

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

View file

@ -50,12 +50,23 @@ namespace MWGui
void SpellBuyingWindow::addSpell(const std::string& spellId) void SpellBuyingWindow::addSpell(const std::string& spellId)
{ {
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(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(); 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);
MyGUI::Button* toAdd =
mSpellsView->createWidget<MyGUI::Button>(
(price>mWindowManager.getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SpellText",
0,
mCurrentY,
200,
sLineHeight,
MyGUI::Align::Default
);
mCurrentY += sLineHeight; mCurrentY += sLineHeight;
/// \todo price adjustment depending on merchantile skill /// \todo price adjustment depending on merchantile skill
toAdd->setUserData(price); 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->setSize(toAdd->getTextSize().width,sLineHeight);
toAdd->eventMouseWheel += MyGUI::newDelegate(this, &SpellBuyingWindow::onMouseWheel); toAdd->eventMouseWheel += MyGUI::newDelegate(this, &SpellBuyingWindow::onMouseWheel);
toAdd->setUserString("ToolTipType", "Spell"); toAdd->setUserString("ToolTipType", "Spell");
@ -88,7 +99,7 @@ namespace MWGui
{ {
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find (*iter); 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 continue; // don't try to sell diseases, curses or powers
if (std::find (playerSpells.begin(), playerSpells.end(), *iter)!=playerSpells.end()) if (std::find (playerSpells.begin(), playerSpells.end(), *iter)!=playerSpells.end())

View file

@ -59,14 +59,14 @@ namespace MWGui
WindowModal::open(); WindowModal::open();
center(); center();
mEffect.range = ESM::RT_Self; mEffect.mRange = ESM::RT_Self;
onRangeButtonClicked(mRangeButton); onRangeButtonClicked(mRangeButton);
} }
void EditEffectDialog::setEffect (const ESM::MagicEffect *effect) void EditEffectDialog::setEffect (const ESM::MagicEffect *effect)
{ {
std::string icon = effect->icon; std::string icon = effect->mIcon;
icon[icon.size()-3] = 'd'; icon[icon.size()-3] = 'd';
icon[icon.size()-2] = 'd'; icon[icon.size()-2] = 'd';
icon[icon.size()-1] = 's'; icon[icon.size()-1] = 's';
@ -74,22 +74,22 @@ namespace MWGui
mEffectImage->setImageTexture (icon); mEffectImage->setImageTexture (icon);
mEffectName->setCaptionWithReplacing("#{"+Widgets::MWSpellEffect::effectIDToString (effect->index)+"}"); mEffectName->setCaptionWithReplacing("#{"+Widgets::MWSpellEffect::effectIDToString (effect->mIndex)+"}");
} }
void EditEffectDialog::onRangeButtonClicked (MyGUI::Widget* sender) void EditEffectDialog::onRangeButtonClicked (MyGUI::Widget* sender)
{ {
mEffect.range = (mEffect.range+1)%3; mEffect.mRange = (mEffect.mRange+1)%3;
if (mEffect.range == ESM::RT_Self) if (mEffect.mRange == ESM::RT_Self)
mRangeButton->setCaptionWithReplacing ("#{sRangeSelf}"); mRangeButton->setCaptionWithReplacing ("#{sRangeSelf}");
else if (mEffect.range == ESM::RT_Target) else if (mEffect.mRange == ESM::RT_Target)
mRangeButton->setCaptionWithReplacing ("#{sRangeTarget}"); mRangeButton->setCaptionWithReplacing ("#{sRangeTarget}");
else if (mEffect.range == ESM::RT_Touch) else if (mEffect.mRange == ESM::RT_Touch)
mRangeButton->setCaptionWithReplacing ("#{sRangeTouch}"); mRangeButton->setCaptionWithReplacing ("#{sRangeTouch}");
mAreaSlider->setVisible (mEffect.range != ESM::RT_Self); mAreaSlider->setVisible (mEffect.mRange != ESM::RT_Self);
mAreaText->setVisible (mEffect.range != ESM::RT_Self); mAreaText->setVisible (mEffect.mRange != ESM::RT_Self);
} }
void EditEffectDialog::onDeleteButtonClicked (MyGUI::Widget* sender) void EditEffectDialog::onDeleteButtonClicked (MyGUI::Widget* sender)
@ -161,14 +161,14 @@ namespace MWGui
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it); const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
// only normal spells count // only normal spells count
if (spell->data.type != ESM::Spell::ST_Spell) if (spell->mData.mType != ESM::Spell::ST_Spell)
continue; continue;
const std::vector<ESM::ENAMstruct>& list = spell->effects.list; const std::vector<ESM::ENAMstruct>& list = spell->mEffects.mList;
for (std::vector<ESM::ENAMstruct>::const_iterator it2 = list.begin(); it2 != list.end(); ++it2) for (std::vector<ESM::ENAMstruct>::const_iterator it2 = list.begin(); it2 != list.end(); ++it2)
{ {
if (std::find(knownEffects.begin(), knownEffects.end(), it2->effectID) == knownEffects.end()) if (std::find(knownEffects.begin(), knownEffects.end(), it2->mEffectID) == knownEffects.end())
knownEffects.push_back(it2->effectID); knownEffects.push_back(it2->mEffectID);
} }
} }

View file

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

View file

@ -222,9 +222,9 @@ void StatsWindow::configureSkills (const std::vector<int>& major, const std::vec
std::set<int> skillSet; std::set<int> skillSet;
std::copy(major.begin(), major.end(), std::inserter(skillSet, skillSet.begin())); std::copy(major.begin(), major.end(), std::inserter(skillSet, skillSet.begin()));
std::copy(minor.begin(), minor.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(); 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; int skill = *it;
if (skillSet.find(skill) == skillSet.end()) 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]; 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); assert(attr);
std::string state = "normal"; 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("ToolTipType", "Layout");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("ToolTipLayout", "SkillToolTip"); mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("ToolTipLayout", "SkillToolTip");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillName", "#{"+skillNameId+"}"); 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_SkillDescription", skill->mDescription);
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillAttribute", "#{sGoverningAttribute}: #{" + attr->name + "}"); 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("ImageTexture_SkillImage", icon);
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillProgressText", boost::lexical_cast<std::string>(progressPercent)+"/100"); mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillProgressText", boost::lexical_cast<std::string>(progressPercent)+"/100");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Range_SkillProgress", "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) for (FactionList::const_iterator it = mFactions.begin(); it != end; ++it)
{ {
const ESM::Faction *faction = store.factions.find(it->first); 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; std::string text;
text += std::string("#DDC79E") + faction->name; text += std::string("#DDC79E") + faction->mName;
text += std::string("\n#BF9959") + faction->ranks[it->second]; text += std::string("\n#BF9959") + faction->mRanks[it->second];
if (it->second < 9) if (it->second < 9)
{ {
// player doesn't have max rank yet // 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]; ESM::RankData rankData = faction->mData.mRankData[it->second+1];
const ESM::Attribute* attr1 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->data.attribute1); 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->data.attribute2); const ESM::Attribute* attr2 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->mData.mAttribute2);
assert(attr1 && attr2); assert(attr1 && attr2);
text += "\n#BF9959#{" + attr1->name + "}: " + boost::lexical_cast<std::string>(rankData.attribute1) text += "\n#BF9959#{" + attr1->mName + "}: " + boost::lexical_cast<std::string>(rankData.mAttribute1)
+ ", #{" + attr2->name + "}: " + boost::lexical_cast<std::string>(rankData.attribute2); + ", #{" + attr2->mName + "}: " + boost::lexical_cast<std::string>(rankData.mAttribute2);
text += "\n\n#DDC79E#{sFavoriteSkills}"; text += "\n\n#DDC79E#{sFavoriteSkills}";
text += "\n#BF9959"; text += "\n#BF9959";
for (int i=0; i<6; ++i) 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) if (i<5)
text += ", "; text += ", ";
} }
text += "\n"; text += "\n";
if (rankData.skill1 > 0) if (rankData.mSkill1 > 0)
text += "\n#{sNeedOneSkill} " + boost::lexical_cast<std::string>(rankData.skill1); text += "\n#{sNeedOneSkill} " + boost::lexical_cast<std::string>(rankData.mSkill1);
if (rankData.skill2 > 0) if (rankData.mSkill2 > 0)
text += "\n#{sNeedTwoSkills} " + boost::lexical_cast<std::string>(rankData.skill2); text += "\n#{sNeedTwoSkills} " + boost::lexical_cast<std::string>(rankData.mSkill2);
} }
w->setUserString("ToolTipType", "Layout"); w->setUserString("ToolTipType", "Layout");
@ -502,7 +502,7 @@ void StatsWindow::updateSkillArea()
addGroup(mWindowManager.getGameSettingString("sBirthSign", "Sign"), coord1, coord2); addGroup(mWindowManager.getGameSettingString("sBirthSign", "Sign"), coord1, coord2);
const ESM::BirthSign *sign = store.birthSigns.find(mBirthSignId); 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); ToolTips::createBirthsignToolTip(w, mBirthSignId);
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -175,12 +175,12 @@ WindowManager::WindowManager(
// Setup player stats // Setup player stats
for (int i = 0; i < ESM::Attribute::Length; ++i) 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) 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(); unsetSelectedSpell();
@ -484,7 +484,7 @@ void WindowManager::setValue (const std::string& id, int value)
void WindowManager::setPlayerClass (const ESM::Class &class_) void WindowManager::setPlayerClass (const ESM::Class &class_)
{ {
mPlayerClass = class_; mPlayerClass = class_;
mStatsWindow->setValue("class", mPlayerClass.name); mStatsWindow->setValue("class", mPlayerClass.mName);
} }
void WindowManager::configureSkills (const SkillList& major, const SkillList& minor) void WindowManager::configureSkills (const SkillList& major, const SkillList& minor)
@ -536,11 +536,11 @@ int WindowManager::readPressedButton ()
return mMessageBoxManager->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); const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.search(id);
if (setting && setting->type == ESM::VT_String) if (setting && setting->mType == ESM::VT_String)
return setting->str; return setting->getString();
return default_; return default_;
} }
@ -584,19 +584,19 @@ void WindowManager::onFrame (float frameDuration)
void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell) 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; 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 ()); mMap->addVisitedLocation (name, cell->cell->getGridX (), cell->cell->getGridY ());
} }
else 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) if (region)
name = region->name; name = region->mName;
else else
name = getGameSettingString("sDefaultCellname", "Wilderness"); name = getGameSettingString("sDefaultCellname", "Wilderness");
} }
@ -606,15 +606,15 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
mMap->setCellPrefix("Cell"); mMap->setCellPrefix("Cell");
mHud->setCellPrefix("Cell"); mHud->setCellPrefix("Cell");
mMap->setActiveCell( cell->cell->data.gridX, cell->cell->data.gridY ); mMap->setActiveCell( cell->cell->mData.mX, cell->cell->mData.mY );
mHud->setActiveCell( cell->cell->data.gridX, cell->cell->data.gridY ); mHud->setActiveCell( cell->cell->mData.mX, cell->cell->mData.mY );
} }
else else
{ {
mMap->setCellName( cell->cell->name ); mMap->setCellName( cell->cell->mName );
mHud->setCellName( cell->cell->name ); mHud->setCellName( cell->cell->mName );
mMap->setCellPrefix( cell->cell->name ); mMap->setCellPrefix( cell->cell->mName );
mHud->setCellPrefix( cell->cell->name ); mHud->setCellPrefix( cell->cell->mName );
} }
} }
@ -698,8 +698,8 @@ void WindowManager::setDragDrop(bool dragDrop)
void WindowManager::onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result) void WindowManager::onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result)
{ {
const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.find(_tag); const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.find(_tag);
if (setting && setting->type == ESM::VT_String) if (setting && setting->mType == ESM::VT_String)
_result = setting->str; _result = setting->getString();
else else
_result = _tag; _result = _tag;
} }
@ -789,7 +789,7 @@ void WindowManager::setSelectedSpell(const std::string& spellId, int successChan
{ {
mHud->setSelectedSpell(spellId, successChancePercent); mHud->setSelectedSpell(spellId, successChancePercent);
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId); 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) void WindowManager::setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent)
@ -973,6 +973,11 @@ bool WindowManager::getPlayerSleeping ()
return mWaitDialog->getSleeping(); return mWaitDialog->getSleeping();
} }
void WindowManager::wakeUpPlayer()
{
mWaitDialog->wakeUp();
}
void WindowManager::addVisitedLocation(const std::string& name, int x, int y) void WindowManager::addVisitedLocation(const std::string& name, int x, int y)
{ {
mMap->addVisitedLocation (name, x, y); mMap->addVisitedLocation (name, x, y);

View file

@ -198,7 +198,7 @@ namespace MWGui
* @param id Identifier for the GMST setting, e.g. "aName" * @param id Identifier for the GMST setting, e.g. "aName"
* @param default Default value if the GMST setting cannot be used. * @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); virtual void processChangedSettings(const Settings::CategorySettingVector& changed);
@ -211,6 +211,7 @@ namespace MWGui
virtual bool getRestEnabled() { return mRestAllowed; } virtual bool getRestEnabled() { return mRestAllowed; }
virtual bool getPlayerSleeping(); virtual bool getPlayerSleeping();
virtual void wakeUpPlayer();
virtual void startSpellMaking(MWWorld::Ptr actor); virtual void startSpellMaking(MWWorld::Ptr actor);
virtual void startEnchanting(MWWorld::Ptr actor); virtual void startEnchanting(MWWorld::Ptr actor);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -22,9 +22,9 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr): Animation()
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>(); MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
assert (ref->base != NULL); 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); mEntityList = NifOgre::NIFLoader::createEntities(mInsert, &mTextKeys, mesh);
for(size_t i = 0;i < mEntityList.mEntities.size();i++) for(size_t i = 0;i < mEntityList.mEntities.size();i++)

View file

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

View file

@ -63,9 +63,9 @@ namespace MWRender
if (land) 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) 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) if (landHeight >= 0)

View file

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

View file

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

View file

@ -64,11 +64,11 @@ void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_)
const float *f = ptr.getRefData().getPosition().pos; const float *f = ptr.getRefData().getPosition().pos;
insert->setPosition(f[0], f[1], f[2]); 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: // Convert MW rotation to a quaternion:
f = ptr.getCellRef().pos.rot; f = ptr.getCellRef().mPos.rot;
// Rotate around X axis // Rotate around X axis
Ogre::Quaternion xr(Ogre::Radian(-f[0]), Ogre::Vector3::UNIT_X); 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.radius = radius;
info.colour = Ogre::ColourValue(r, g, b); 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.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; 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; 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; 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; info.type = LT_PulseSlow;
else else
info.type = LT_Normal; info.type = LT_Normal;

View file

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

View file

@ -56,9 +56,9 @@ enum VisibilityFlags
RV_PlayerPreview = 512, 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
}; };
} }

View file

@ -372,9 +372,9 @@ void RenderingManager::update (float duration)
} }
void RenderingManager::waterAdded (MWWorld::Ptr::CellStore *store){ void RenderingManager::waterAdded (MWWorld::Ptr::CellStore *store){
if(store->cell->data.flags & store->cell->HasWater if(store->cell->mData.mFlags & store->cell->HasWater
|| ((!(store->cell->data.flags & ESM::Cell::Interior)) || ((!(store->cell->mData.mFlags & 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. && !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) if(mWater == 0)
mWater = new MWRender::Water(mRendering.getCamera(), this, store->cell); 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) void RenderingManager::configureFog(MWWorld::Ptr::CellStore &mCell)
{ {
Ogre::ColourValue color; 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) if (mWater)
mWater->setViewportBackground (Ogre::ColourValue(0.8f, 0.9f, 1.0f)); mWater->setViewportBackground (Ogre::ColourValue(0.8f, 0.9f, 1.0f));
@ -517,7 +517,7 @@ void RenderingManager::setAmbientMode()
void RenderingManager::configureAmbient(MWWorld::Ptr::CellStore &mCell) void RenderingManager::configureAmbient(MWWorld::Ptr::CellStore &mCell)
{ {
mAmbientColor.setAsABGR (mCell.cell->ambi.ambient); mAmbientColor.setAsABGR (mCell.cell->mAmbi.mAmbient);
setAmbientMode(); setAmbientMode();
// Create a "sun" that shines light downwards. It doesn't look // 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(); mSun = mRendering.getScene()->createLight();
} }
Ogre::ColourValue colour; Ogre::ColourValue colour;
colour.setAsABGR (mCell.cell->ambi.sunlight); colour.setAsABGR (mCell.cell->mAmbi.mSunlight);
mSun->setDiffuseColour (colour); mSun->setDiffuseColour (colour);
mSun->setType(Ogre::Light::LT_DIRECTIONAL); mSun->setType(Ogre::Light::LT_DIRECTIONAL);
mSun->setDirection(0,-1,0); mSun->setDirection(0,-1,0);
@ -611,7 +611,7 @@ void RenderingManager::setGlare(bool glare)
void RenderingManager::requestMap(MWWorld::Ptr::CellStore* cell) 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); mLocalMap->requestMap(cell);
else else
mLocalMap->requestMap(cell, mObjects.getDimensions(cell)); mLocalMap->requestMap(cell, mObjects.getDimensions(cell));

View file

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

View file

@ -38,7 +38,7 @@ Water::Water (Ogre::Camera *camera, RenderingManager* rend, const ESM::Cell* cel
mMaterial = MaterialManager::getSingleton().getByName("Water"); mMaterial = MaterialManager::getSingleton().getByName("Water");
mTop = cell->water; mTop = cell->mWater;
mIsUnderwater = false; mIsUnderwater = false;
@ -55,9 +55,9 @@ Water::Water (Ogre::Camera *camera, RenderingManager* rend, const ESM::Cell* cel
mReflectionCamera = mSceneManager->createCamera("ReflectionCamera"); 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); mWaterNode->attachObject(mWater);
@ -156,12 +156,12 @@ Water::~Water()
void Water::changeCell(const ESM::Cell* cell) void Water::changeCell(const ESM::Cell* cell)
{ {
mTop = cell->water; mTop = cell->mWater;
setHeight(mTop); setHeight(mTop);
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));
} }
void Water::setHeight(const float height) void Water::setHeight(const float height)

View file

@ -45,7 +45,7 @@ namespace MWScript
if (const ESM::Cell *exterior = MWBase::Environment::get().getWorld()->getExterior (cell)) 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); pos.pos[0], pos.pos[1], true);
MWBase::Environment::get().getWorld()->changeToExteriorCell (pos); MWBase::Environment::get().getWorld()->changeToExteriorCell (pos);
} }
@ -87,7 +87,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime) virtual void execute (Interpreter::Runtime& runtime)
{ {
bool interior = 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; ESM::Cell::Interior;
runtime.push (interior ? 1 : 0); runtime.push (interior ? 1 : 0);
@ -105,14 +105,14 @@ namespace MWScript
const ESM::Cell *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell; 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 = 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() && bool match = current.length()>=name.length() &&
@ -143,7 +143,7 @@ namespace MWScript
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell(); 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"); throw std::runtime_error("Can't set water level in exterior cell");
cell->mWaterLevel = level; cell->mWaterLevel = level;
@ -161,7 +161,7 @@ namespace MWScript
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell(); 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"); throw std::runtime_error("Can't set water level in exterior cell");
cell->mWaterLevel +=level; cell->mWaterLevel +=level;

View file

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

View file

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

View file

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

View file

@ -112,10 +112,10 @@ namespace MWScript
const ESMS::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells; 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) 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); boost::algorithm::to_lower(name);
if (name.find(cell) != std::string::npos) 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; 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) 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 != "") if (name != "")
MWBase::Environment::get().getWindowManager()->addVisitedLocation (name, it->first.first, it->first.second); MWBase::Environment::get().getWindowManager()->addVisitedLocation (name, it->first.first, it->first.second);
} }

View file

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

View file

@ -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 class OpXBox : public Interpreter::Opcode0
{ {
public: public:
@ -261,6 +271,7 @@ namespace MWScript
const int opcodeDontSaveObject = 0x2000153; const int opcodeDontSaveObject = 0x2000153;
const int opcodeToggleVanityMode = 0x2000174; const int opcodeToggleVanityMode = 0x2000174;
const int opcodeGetPcSleep = 0x200019f; const int opcodeGetPcSleep = 0x200019f;
const int opcodeWakeUpPc = 0x20001a2;
void registerExtensions (Compiler::Extensions& extensions) void registerExtensions (Compiler::Extensions& extensions)
{ {
@ -286,6 +297,7 @@ namespace MWScript
extensions.registerInstruction ("togglevanitymode", "", opcodeToggleVanityMode); extensions.registerInstruction ("togglevanitymode", "", opcodeToggleVanityMode);
extensions.registerInstruction ("tvm", "", opcodeToggleVanityMode); extensions.registerInstruction ("tvm", "", opcodeToggleVanityMode);
extensions.registerFunction ("getpcsleep", 'l', "", opcodeGetPcSleep); extensions.registerFunction ("getpcsleep", 'l', "", opcodeGetPcSleep);
extensions.registerInstruction ("wakeuppc", "", opcodeWakeUpPc);
} }
void installOpcodes (Interpreter::Interpreter& interpreter) void installOpcodes (Interpreter::Interpreter& interpreter)
@ -307,6 +319,7 @@ namespace MWScript
interpreter.installSegment5 (opcodeDontSaveObject, new OpDontSaveObject); interpreter.installSegment5 (opcodeDontSaveObject, new OpDontSaveObject);
interpreter.installSegment5 (opcodeToggleVanityMode, new OpToggleVanityMode); interpreter.installSegment5 (opcodeToggleVanityMode, new OpToggleVanityMode);
interpreter.installSegment5 (opcodeGetPcSleep, new OpGetPcSleep); interpreter.installSegment5 (opcodeGetPcSleep, new OpGetPcSleep);
interpreter.installSegment5 (opcodeWakeUpPc, new OpWakeUpPc);
} }
} }
} }

View file

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

View file

@ -316,7 +316,7 @@ namespace MWScript
assert (ref); assert (ref);
const ESM::Class& class_ = 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 level = 0;
float progress = std::modf (stats.getSkill (mIndex).getBase(), &level); float progress = std::modf (stats.getSkill (mIndex).getBase(), &level);

View file

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

View file

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

View file

@ -52,6 +52,7 @@ namespace MWSound
Ogre::Vector3 mListenerPos; Ogre::Vector3 mListenerPos;
Ogre::Vector3 mListenerDir; Ogre::Vector3 mListenerDir;
Ogre::Vector3 mListenerUp;
std::string lookup(const std::string &soundId, std::string lookup(const std::string &soundId,
float &volume, float &min, float &max); float &volume, float &min, float &max);
@ -126,12 +127,9 @@ namespace MWSound
virtual bool getSoundPlaying(MWWorld::Ptr reference, const std::string& soundId) const; virtual bool getSoundPlaying(MWWorld::Ptr reference, const std::string& soundId) const;
///< Is the given sound currently playing on the given object? ///< 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 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);
}; };
} }

View file

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

View file

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

View file

@ -13,7 +13,7 @@ namespace MWWorld
{ {
CellStore::CellStore (const ESM::Cell *cell_) : cell (cell_), mState (State_Unloaded) 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) void CellStore::load (const ESMS::ESMStore &store, ESM::ESMReader &esm)
@ -45,7 +45,7 @@ namespace MWWorld
{ {
assert (cell); assert (cell);
if (cell->context.filename.empty()) if (cell->mContext.filename.empty())
return; // this is a dynamically generated cell -> skipping. return; // this is a dynamically generated cell -> skipping.
// Reopen the ESM reader and seek to the right position. // Reopen the ESM reader and seek to the right position.
@ -58,7 +58,7 @@ namespace MWWorld
{ {
std::string lowerCase; 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(*)(int)) std::tolower);
mIds.push_back (lowerCase); mIds.push_back (lowerCase);
@ -71,7 +71,7 @@ namespace MWWorld
{ {
assert (cell); assert (cell);
if (cell->context.filename.empty()) if (cell->mContext.filename.empty())
return; // this is a dynamically generated cell -> skipping. return; // this is a dynamically generated cell -> skipping.
// Reopen the ESM reader and seek to the right position. // Reopen the ESM reader and seek to the right position.
@ -84,12 +84,12 @@ namespace MWWorld
{ {
std::string lowerCase; 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(*)(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 /* 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 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_STAT: statics.find(ref, store.statics); break;
case ESM::REC_WEAP: weapons.find(ref, store.weapons); 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: default:
std::cout << "WARNING: Ignoring reference '" << ref.refID << "' of unhandled type\n"; std::cout << "WARNING: Ignoring reference '" << ref.mRefID << "' of unhandled type\n";
} }
} }
} }

View file

@ -58,9 +58,9 @@ namespace MWWorld
template <typename Y> template <typename Y>
void find(ESM::CellRef &ref, const Y& recList) 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) 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)); 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) 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; return &*iter;
} }
@ -156,9 +156,9 @@ namespace MWWorld
} }
bool operator==(const CellStore &cell) { bool operator==(const CellStore &cell) {
return this->cell->name == cell.cell->name && return this->cell->mName == cell.cell->mName &&
this->cell->data.gridX == cell.cell->data.gridX && this->cell->mData.mX == cell.cell->mData.mX &&
this->cell->data.gridY == cell.cell->data.gridY; this->cell->mData.mY == cell.cell->mData.mY;
} }
bool operator!=(const CellStore &cell) { bool operator!=(const CellStore &cell) {

View file

@ -29,7 +29,7 @@ namespace
++iter) ++iter)
{ {
if (iter->mData.getCount()>0) if (iter->mData.getCount()>0)
sum += iter->mData.getCount()*iter->base->data.weight; sum += iter->mData.getCount()*iter->base->mData.mWeight;
} }
return sum; return sum;
@ -59,12 +59,12 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::end()
bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2) 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 /// \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).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) && 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->mOwner == ptr2.mCellRef->mOwner
&& ptr1.mCellRef->soul == ptr2.mCellRef->soul && ptr1.mCellRef->mSoul == ptr2.mCellRef->mSoul
&& ptr1.mCellRef->charge == ptr2.mCellRef->charge) && ptr1.mCellRef->mCharge == ptr2.mCellRef->mCharge)
return true; return true;
return false; return false;
@ -81,19 +81,19 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr)
MWWorld::LiveCellRef<ESM::Miscellaneous> *gold = MWWorld::LiveCellRef<ESM::Miscellaneous> *gold =
ptr.get<ESM::Miscellaneous>(); ptr.get<ESM::Miscellaneous>();
if (compare_string_ci(gold->ref.refID, "gold_001") if (compare_string_ci(gold->ref.mRefID, "gold_001")
|| compare_string_ci(gold->ref.refID, "gold_005") || compare_string_ci(gold->ref.mRefID, "gold_005")
|| compare_string_ci(gold->ref.refID, "gold_010") || compare_string_ci(gold->ref.mRefID, "gold_010")
|| compare_string_ci(gold->ref.refID, "gold_025") || compare_string_ci(gold->ref.mRefID, "gold_025")
|| compare_string_ci(gold->ref.refID, "gold_100")) || compare_string_ci(gold->ref.mRefID, "gold_100"))
{ {
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), "Gold_001"); 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); ref.getPtr().getRefData().setCount(count);
for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter) 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); (*iter).getRefData().setCount( (*iter).getRefData().getCount() + count);
flagAsModified(); flagAsModified();
@ -117,7 +117,6 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr)
return iter; return iter;
} }
} }
// if we got here, this means no stacking // if we got here, this means no stacking
return addImpl(ptr); 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) 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) ++iter)
{ {
ManualRef ref (store, iter->item.toString()); ManualRef ref (store, iter->mItem.toString());
if (ref.getPtr().getTypeName()==typeid (ESM::ItemLevList).name()) if (ref.getPtr().getTypeName()==typeid (ESM::ItemLevList).name())
{ {
@ -159,7 +158,7 @@ void MWWorld::ContainerStore::fill (const ESM::InventoryList& items, const ESMS:
continue; 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()); add (ref.getPtr());
} }

View file

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

View file

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

View file

@ -15,9 +15,9 @@ namespace
cellRefList.list.begin()); cellRefList.list.begin());
iter!=cellRefList.list.end(); ++iter) 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));
} }
} }
} }

View file

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

View file

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

View file

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

View file

@ -29,7 +29,7 @@ namespace MWWorld
} }
RefData::RefData (const ESM::CellRef& cellRef) 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) mCustomData (0)
{} {}

View file

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

View file

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