Applying patches by Michi to Enigma
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
# The application settings for Android libSDL port
|
||||
AppSettingVersion=10
|
||||
AppSettingVersion=11
|
||||
LibSdlVersion=1.2
|
||||
AppName="enigma"
|
||||
AppFullName=org.enigmagame.enigma
|
||||
ScreenOrientation=h
|
||||
AppDataDownloadUrl="Enigma Game Data (16 MiB)|https://sites.google.com/site/xpelyax/Home/enigma-data.zip?attredirects=0&d=1"
|
||||
InhibitSuspend=y
|
||||
AppDataDownloadUrl="Enigma Game Data (6.5 MiB)|http://sites.google.com/site/droidsdl/data/enigma-data32.zip?attredirects=0&d=1"
|
||||
SdlVideoResize=y
|
||||
SdlVideoResizeKeepAspect=y
|
||||
NeedDepthBuffer=n
|
||||
AppUsesMouse=y
|
||||
AppNeedsArrowKeys=n
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "PreferenceManager.hh"
|
||||
#include "main.hh"
|
||||
#include "DOMErrorReporter.hh"
|
||||
@@ -60,13 +59,14 @@ namespace enigma {
|
||||
PreferenceManager::PreferenceManager() {
|
||||
std::string prefTemplatePath;
|
||||
bool haveXMLProperties = (ecl::FileExists(app.prefPath)) ? true : false;
|
||||
|
||||
|
||||
if (!app.systemFS->findFile( std::string("schemas/") + PREFFILENAME , prefTemplatePath)) {
|
||||
cerr << "Preferences: no template found\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
app.domParserErrorHandler->resetErrors();
|
||||
app.domParserErrorHandler->reportToErr();
|
||||
app.domParserSchemaResolver->resetResolver();
|
||||
@@ -76,14 +76,14 @@ namespace enigma {
|
||||
// update existing XML prefs from possibly newer template:
|
||||
// use user prefs and copy new properties from template
|
||||
doc = app.domParser->parseURI(app.prefPath.c_str());
|
||||
propertiesElem = dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
propertiesElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("properties").x_str())->item(0));
|
||||
// The following algorithm is not optimized - O(n^2)!
|
||||
DOMDocument * prefTemplate = app.domParser->parseURI(prefTemplatePath.c_str());
|
||||
DOMNodeList * tmplPropList = prefTemplate->getElementsByTagName(
|
||||
Utf8ToXML("property").x_str());
|
||||
for (int i = 0, l = tmplPropList-> getLength(); i < l; i++) {
|
||||
DOMElement *tmplProperty = dynamic_cast<DOMElement *>(tmplPropList->item(i));
|
||||
DOMElement *tmplProperty = reinterpret_cast<DOMElement *>(tmplPropList->item(i));
|
||||
const XMLCh * key = tmplProperty->getAttribute(Utf8ToXML("key").x_str());
|
||||
DOMElement * lastUserProperty;
|
||||
if ((key[0] != chUnderscore) && !hasProperty(key, &lastUserProperty)) {
|
||||
@@ -95,20 +95,21 @@ namespace enigma {
|
||||
Log << "Preferences: copy new Property failed!\n";
|
||||
} else {
|
||||
// insert it at the end of the existing user properties
|
||||
propertiesElem->appendChild(dynamic_cast<DOMElement *>(newProperty));
|
||||
propertiesElem->appendChild(reinterpret_cast<DOMElement *>(newProperty));
|
||||
}
|
||||
}
|
||||
}
|
||||
prefTemplate->release();
|
||||
} else {
|
||||
|
||||
// update from LUA options to XML preferences:
|
||||
// use the template, copy LUA option values and save it later as prefs
|
||||
doc = app.domParser->parseURI(prefTemplatePath.c_str());
|
||||
propertiesElem = dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
propertiesElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("properties").x_str())->item(0));
|
||||
DOMNodeList * propList = propertiesElem->getElementsByTagName(Utf8ToXML("property").x_str());
|
||||
for (int i = 0, l = propList-> getLength(); i < l; i++) {
|
||||
DOMElement * property = dynamic_cast<DOMElement *>(propList->item(i));
|
||||
DOMElement * property = reinterpret_cast<DOMElement *>(propList->item(i));
|
||||
const XMLCh * key = property->getAttribute(Utf8ToXML("key").x_str());
|
||||
std::string optionValue;
|
||||
if (options::HasOption(XMLtoLocal(key).c_str(), optionValue)) {
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace enigma {
|
||||
|
||||
DOMNodeList * propList = propertiesElem->getElementsByTagName(Utf8ToXML("property").x_str());
|
||||
for (int i = 0, l = propList-> getLength(); i < l && !propFound; i++) {
|
||||
property = dynamic_cast<DOMElement *>(propList->item(i));
|
||||
property = reinterpret_cast<DOMElement *>(propList->item(i));
|
||||
if (XMLString::equals(key,
|
||||
property->getAttribute(Utf8ToXML("key").x_str()))) {
|
||||
propFound = true;
|
||||
|
||||
@@ -78,17 +78,17 @@ namespace enigma {
|
||||
|
||||
doc = app.domParser->parseURI(statePath.c_str());
|
||||
if (doc != NULL && !app.domParserErrorHandler->getSawErrors()) {
|
||||
propertiesElem = dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
propertiesElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("properties").x_str())->item(0));
|
||||
groupsElem = dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
groupsElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("groups").x_str())->item(0));
|
||||
groupList = groupsElem->getElementsByTagName(
|
||||
Utf8ToXML("group").x_str());
|
||||
indicesElem = dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
indicesElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("indices").x_str())->item(0));
|
||||
indexList = indicesElem->getElementsByTagName(
|
||||
Utf8ToXML("index").x_str());
|
||||
levelsElem = dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
levelsElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("levels").x_str())->item(0));
|
||||
}
|
||||
if(app.domParserErrorHandler->getSawErrors()) {
|
||||
@@ -192,14 +192,14 @@ namespace enigma {
|
||||
|
||||
void StateManager::getGroupNames(std::vector<std::string> *names) {
|
||||
for (int i = 0, l = groupList-> getLength(); i < l; i++) {
|
||||
DOMElement * group = dynamic_cast<DOMElement *>(groupList->item(i));
|
||||
DOMElement * group = reinterpret_cast<DOMElement *>(groupList->item(i));
|
||||
names->push_back(XMLtoUtf8(group->getAttribute(Utf8ToXML("title").x_str())).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
std::string StateManager::getGroupSelectedIndex(std::string groupName) {
|
||||
for (int i = 0, l = groupList-> getLength(); i < l; i++) {
|
||||
DOMElement * group = dynamic_cast<DOMElement *>(groupList->item(i));
|
||||
DOMElement * group = reinterpret_cast<DOMElement *>(groupList->item(i));
|
||||
if (groupName == XMLtoUtf8(group->getAttribute(Utf8ToXML("title").x_str())).c_str())
|
||||
return XMLtoUtf8(group->getAttribute(Utf8ToXML("curindex").x_str())).c_str();
|
||||
}
|
||||
@@ -208,7 +208,7 @@ namespace enigma {
|
||||
|
||||
std::string StateManager::getGroupSelectedColumn(std::string groupName) {
|
||||
for (int i = 0, l = groupList-> getLength(); i < l; i++) {
|
||||
DOMElement * group = dynamic_cast<DOMElement *>(groupList->item(i));
|
||||
DOMElement * group = reinterpret_cast<DOMElement *>(groupList->item(i));
|
||||
if (groupName == XMLtoUtf8(group->getAttribute(Utf8ToXML("title").x_str())).c_str())
|
||||
return XMLtoUtf8(group->getAttribute(Utf8ToXML("curcolumn").x_str())).c_str();
|
||||
}
|
||||
@@ -217,7 +217,7 @@ namespace enigma {
|
||||
|
||||
void StateManager::setGroupSelectedIndex(std::string groupName, std::string indexName) {
|
||||
for (int i = 0, l = groupList-> getLength(); i < l; i++) {
|
||||
DOMElement * group = dynamic_cast<DOMElement *>(groupList->item(i));
|
||||
DOMElement * group = reinterpret_cast<DOMElement *>(groupList->item(i));
|
||||
if (groupName == XMLtoUtf8(group->getAttribute(Utf8ToXML("title").x_str())).c_str()) {
|
||||
group->setAttribute(Utf8ToXML("curindex").x_str(), Utf8ToXML(indexName).x_str());
|
||||
return;
|
||||
@@ -227,7 +227,7 @@ namespace enigma {
|
||||
|
||||
void StateManager::setGroupSelectedColumn(std::string groupName, std::string column) {
|
||||
for (int i = 0, l = groupList-> getLength(); i < l; i++) {
|
||||
DOMElement * group = dynamic_cast<DOMElement *>(groupList->item(i));
|
||||
DOMElement * group = reinterpret_cast<DOMElement *>(groupList->item(i));
|
||||
if (groupName == XMLtoUtf8(group->getAttribute(Utf8ToXML("title").x_str())).c_str()) {
|
||||
group->setAttribute(Utf8ToXML("curcolumn").x_str(), Utf8ToXML(column).x_str());
|
||||
return;
|
||||
@@ -238,7 +238,7 @@ namespace enigma {
|
||||
void StateManager::addGroup(std::string groupName, std::string indexName, int column) {
|
||||
// check if group exists - update attributes only
|
||||
for (int i = 0, l = groupList->getLength(); i < l; i++) {
|
||||
DOMElement * group = dynamic_cast<DOMElement *>(groupList->item(i));
|
||||
DOMElement * group = reinterpret_cast<DOMElement *>(groupList->item(i));
|
||||
if (groupName == XMLtoUtf8(group->getAttribute(Utf8ToXML("title").x_str())).c_str()) {
|
||||
group->setAttribute(Utf8ToXML("curcolumn").x_str(),
|
||||
Utf8ToXML(ecl::strf("%d",column)).x_str());
|
||||
@@ -264,14 +264,14 @@ namespace enigma {
|
||||
if (pos < 0 || pos >= groupList->getLength())
|
||||
groupsElem->appendChild(group);
|
||||
else {
|
||||
DOMElement * nextGroup = dynamic_cast<DOMElement *>(groupList->item(pos));
|
||||
DOMElement * nextGroup = reinterpret_cast<DOMElement *>(groupList->item(pos));
|
||||
groupsElem->insertBefore(group, nextGroup);
|
||||
}
|
||||
}
|
||||
|
||||
void StateManager::deleteGroup(std::string groupName) {
|
||||
for (int i = 0, l = groupList->getLength(); i < l; i++) {
|
||||
DOMElement * group = dynamic_cast<DOMElement *>(groupList->item(i));
|
||||
DOMElement * group = reinterpret_cast<DOMElement *>(groupList->item(i));
|
||||
if (groupName == XMLtoUtf8(group->getAttribute(Utf8ToXML("title").x_str())).c_str()) {
|
||||
groupsElem->removeChild(group);
|
||||
return;
|
||||
@@ -282,7 +282,7 @@ namespace enigma {
|
||||
void StateManager::renameGroup(std::string oldName, std::string newName) {
|
||||
// rename group element
|
||||
for (int i = 0, l = groupList->getLength(); i < l; i++) {
|
||||
DOMElement * group = dynamic_cast<DOMElement *>(groupList->item(i));
|
||||
DOMElement * group = reinterpret_cast<DOMElement *>(groupList->item(i));
|
||||
if (oldName == XMLtoUtf8(group->getAttribute(Utf8ToXML("title").x_str())).c_str()) {
|
||||
group->setAttribute(Utf8ToXML("title").x_str(), Utf8ToXML(newName).x_str());
|
||||
break;
|
||||
@@ -295,7 +295,7 @@ namespace enigma {
|
||||
double &location, int &curpos, int &curfirst) {
|
||||
// check if index exists - get user attributes
|
||||
for (int i = 0, l = indexList-> getLength(); i < l; i++) {
|
||||
DOMElement * index = dynamic_cast<DOMElement *>(indexList->item(i));
|
||||
DOMElement * index = reinterpret_cast<DOMElement *>(indexList->item(i));
|
||||
if (indexName == XMLtoUtf8(index->getAttribute(Utf8ToXML("title").x_str())).c_str()) {
|
||||
groupName = XMLtoUtf8(index->getAttribute(Utf8ToXML("group").x_str())).c_str();
|
||||
XMLDouble * result = new XMLDouble(index->getAttribute(Utf8ToXML("location").x_str()));
|
||||
@@ -319,7 +319,7 @@ namespace enigma {
|
||||
void StateManager::setIndexName(std::string oldName, std::string newName) {
|
||||
// search index and set attribute
|
||||
for (int i = 0, l = indexList-> getLength(); i < l; i++) {
|
||||
DOMElement * index = dynamic_cast<DOMElement *>(indexList->item(i));
|
||||
DOMElement * index = reinterpret_cast<DOMElement *>(indexList->item(i));
|
||||
if (oldName == XMLtoUtf8(index->getAttribute(Utf8ToXML("title").x_str())).c_str()) {
|
||||
index->setAttribute(Utf8ToXML("title").x_str(), Utf8ToXML(newName).x_str());
|
||||
return;
|
||||
@@ -330,7 +330,7 @@ namespace enigma {
|
||||
void StateManager::setIndexLocation(std::string indexName, double location) {
|
||||
// search index and set attribute
|
||||
for (int i = 0, l = indexList-> getLength(); i < l; i++) {
|
||||
DOMElement * index = dynamic_cast<DOMElement *>(indexList->item(i));
|
||||
DOMElement * index = reinterpret_cast<DOMElement *>(indexList->item(i));
|
||||
if (indexName == XMLtoUtf8(index->getAttribute(Utf8ToXML("title").x_str())).c_str()) {
|
||||
index->setAttribute(Utf8ToXML("location").x_str(), Utf8ToXML(ecl::strf("%.15g",location)).x_str());
|
||||
return;
|
||||
@@ -341,7 +341,7 @@ namespace enigma {
|
||||
void StateManager::setIndexCurpos(std::string indexName, int curpos) {
|
||||
// search index and set attribute
|
||||
for (int i = 0, l = indexList-> getLength(); i < l; i++) {
|
||||
DOMElement * index = dynamic_cast<DOMElement *>(indexList->item(i));
|
||||
DOMElement * index = reinterpret_cast<DOMElement *>(indexList->item(i));
|
||||
if (indexName == XMLtoUtf8(index->getAttribute(Utf8ToXML("title").x_str())).c_str()) {
|
||||
index->setAttribute(Utf8ToXML("curposition").x_str(), Utf8ToXML(ecl::strf("%d",curpos)).x_str());
|
||||
return;
|
||||
@@ -352,7 +352,7 @@ namespace enigma {
|
||||
void StateManager::setIndexCurfirst(std::string indexName, int curfirst) {
|
||||
// search index and set attribute
|
||||
for (int i = 0, l = indexList-> getLength(); i < l; i++) {
|
||||
DOMElement * index = dynamic_cast<DOMElement *>(indexList->item(i));
|
||||
DOMElement * index = reinterpret_cast<DOMElement *>(indexList->item(i));
|
||||
if (indexName == XMLtoUtf8(index->getAttribute(Utf8ToXML("title").x_str())).c_str()) {
|
||||
index->setAttribute(Utf8ToXML("curfirst").x_str(), Utf8ToXML(ecl::strf("%d",curfirst)).x_str());
|
||||
return;
|
||||
@@ -363,7 +363,7 @@ namespace enigma {
|
||||
void StateManager::setIndexGroup(std::string indexName, std::string groupName) {
|
||||
// search index and set attribute
|
||||
for (int i = 0, l = indexList-> getLength(); i < l; i++) {
|
||||
DOMElement * index = dynamic_cast<DOMElement *>(indexList->item(i));
|
||||
DOMElement * index = reinterpret_cast<DOMElement *>(indexList->item(i));
|
||||
if (indexName == XMLtoUtf8(index->getAttribute(Utf8ToXML("title").x_str())).c_str()) {
|
||||
index->setAttribute(Utf8ToXML("group").x_str(), Utf8ToXML(groupName).x_str());
|
||||
return;
|
||||
@@ -396,7 +396,7 @@ namespace enigma {
|
||||
DOMElement * level;
|
||||
DOMNodeList * levelList = levelsElem->getElementsByTagName(Utf8ToXML("level").x_str());
|
||||
for (int i = 0, l = levelList-> getLength(); i < l && !levelFound; i++) {
|
||||
level = dynamic_cast<DOMElement *>(levelList->item(i));
|
||||
level = reinterpret_cast<DOMElement *>(levelList->item(i));
|
||||
if (XMLString::equals(xmlId,
|
||||
level->getAttribute(Utf8ToXML("id").x_str()))) {
|
||||
levelFound = true;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <xercesc/util/XMLString.hpp>
|
||||
#include <xercesc/util/TransService.hpp>
|
||||
|
||||
|
||||
XERCES_CPP_NAMESPACE_USE
|
||||
|
||||
namespace enigma
|
||||
|
||||
@@ -51,6 +51,10 @@ using namespace enigma::client;
|
||||
using namespace ecl;
|
||||
using namespace std;
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
#include "client_internal.hh"
|
||||
|
||||
/* -------------------- Auxiliary functions -------------------- */
|
||||
@@ -197,12 +201,14 @@ void Client::handle_events()
|
||||
on_keydown(e);
|
||||
break;
|
||||
case SDL_MOUSEMOTION:
|
||||
#ifndef ANDROID
|
||||
if (abs(e.motion.xrel) > 300 || abs(e.motion.yrel) > 300) {
|
||||
fprintf(stderr, "mouse event with %i, %i\n", e.motion.xrel, e.motion.yrel);
|
||||
}
|
||||
else
|
||||
server::Msg_MouseForce (options::GetDouble("MouseSpeed") *
|
||||
V2 (e.motion.xrel, e.motion.yrel));
|
||||
#endif
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
@@ -422,7 +428,10 @@ void Client::on_keydown(SDL_Event &e)
|
||||
case SDLK_ESCAPE: show_menu(); break;
|
||||
case SDLK_LEFT: set_mousespeed(options::GetMouseSpeed() - 1); break;
|
||||
case SDLK_RIGHT: set_mousespeed(options::GetMouseSpeed() + 1); break;
|
||||
case SDLK_TAB: rotate_inventory(+1); break;
|
||||
#ifdef ANDROID
|
||||
case SDLK_LCTRL:
|
||||
#endif
|
||||
case SDLK_TAB: rotate_inventory(+1); break;
|
||||
case SDLK_F1: show_help(); break;
|
||||
case SDLK_F2:
|
||||
// display hint
|
||||
@@ -609,12 +618,27 @@ std::string Client::init_hunted_time()
|
||||
void Client::tick (double dtime)
|
||||
{
|
||||
const double timestep = 0.01; // 10ms
|
||||
#ifdef ANDROID
|
||||
Sint16 joy_x, joy_y;
|
||||
SDL_Joystick *joy;
|
||||
#endif
|
||||
|
||||
switch (m_state) {
|
||||
case cls_idle:
|
||||
break;
|
||||
|
||||
case cls_preparing_game: {
|
||||
#ifdef ANDROID
|
||||
// calibrate the orientation sensor, using the current position as zero
|
||||
// TODO: average the values over some period of time?
|
||||
joy = SDL_JoystickOpen(0);
|
||||
SDL_JoystickUpdate();
|
||||
if(joy != NULL) {
|
||||
m_joy_x0 = SDL_JoystickGetAxis(joy,0);
|
||||
m_joy_y0 = SDL_JoystickGetAxis(joy,1);
|
||||
}
|
||||
#endif
|
||||
|
||||
video::TransitionEffect *fx = m_effect.get();
|
||||
if (fx && !fx->finished()) {
|
||||
fx->tick (dtime);
|
||||
@@ -632,7 +656,18 @@ void Client::tick (double dtime)
|
||||
}
|
||||
|
||||
case cls_game:
|
||||
if (app.state->getInt("NextLevelMode") == lev::NEXT_LEVEL_NOT_BEST) {
|
||||
#ifdef ANDROID
|
||||
// joystick/accelerometer control
|
||||
joy = SDL_JoystickOpen(0);
|
||||
SDL_JoystickUpdate();
|
||||
if(joy != NULL) {
|
||||
joy_x = SDL_JoystickGetAxis(joy,0) - m_joy_x0;
|
||||
joy_y = SDL_JoystickGetAxis(joy,1) - m_joy_y0;
|
||||
server::Msg_MouseForce(options::GetDouble("MouseSpeed") * -dtime/3000.0 *
|
||||
V2 (joy_x*sqrt(abs(joy_x)), joy_y*sqrt(abs(joy_y)))); // use joy**1.5 to allow more flexible (non-linear) control
|
||||
}
|
||||
#endif
|
||||
if (app.state->getInt("NextLevelMode") == lev::NEXT_LEVEL_NOT_BEST) {
|
||||
int old_second = round_nearest<int> (m_total_game_time);
|
||||
int second = round_nearest<int> (m_total_game_time + dtime);
|
||||
|
||||
|
||||
@@ -159,6 +159,12 @@ namespace
|
||||
|
||||
string m_user_input;
|
||||
string m_error_message;
|
||||
|
||||
#ifdef ANDROID
|
||||
Sint16 m_joy_x0;
|
||||
Sint16 m_joy_y0;
|
||||
#endif
|
||||
|
||||
|
||||
std::auto_ptr<video::TransitionEffect> m_effect;
|
||||
ENetHost *m_network_host;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* src/config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* android paths */
|
||||
#define SYSTEM_DATA_DIR "."
|
||||
#define SYSTEM_DATA_DIR "./data"
|
||||
#define LOCALEDIR "."
|
||||
|
||||
|
||||
|
||||
@@ -305,11 +305,11 @@ namespace enigma { namespace lev {
|
||||
}
|
||||
|
||||
if (doc != NULL && !app.domParserErrorHandler->getSawErrors()) {
|
||||
infoElem = dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
infoElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("info").x_str())->item(0));
|
||||
updateElem = dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
updateElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("update").x_str())->item(0));
|
||||
levelsElem = dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
levelsElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("levels").x_str())->item(0));
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ namespace enigma { namespace lev {
|
||||
knownAttributes.insert("unit");
|
||||
knownAttributes.insert("target");
|
||||
for (int i = 0, l = levelList->getLength(); i < l; i++) {
|
||||
DOMElement *levelElem = dynamic_cast<DOMElement *>(levelList->item(i));
|
||||
DOMElement *levelElem = reinterpret_cast<DOMElement *>(levelList->item(i));
|
||||
std::string path = XMLtoUtf8(levelElem->getAttribute(
|
||||
Utf8ToXML("_xpath").x_str())).c_str();
|
||||
std::string id = XMLtoUtf8(levelElem->getAttribute(
|
||||
@@ -436,7 +436,7 @@ namespace enigma { namespace lev {
|
||||
Utf8ToXML("target").x_str())).c_str();
|
||||
DOMNamedNodeMap * attrMap = levelElem->getAttributes();
|
||||
for (int j = 0, k = attrMap->getLength(); j < k; j++) {
|
||||
DOMAttr * levelAttr = dynamic_cast<DOMAttr *>(attrMap->item(j));
|
||||
DOMAttr * levelAttr = reinterpret_cast<DOMAttr *>(attrMap->item(j));
|
||||
std::string attrName = XMLtoUtf8(levelAttr->getName()).c_str();
|
||||
if (knownAttributes.find(attrName) == knownAttributes.end()) {
|
||||
Log << "PersistentIndex Load unknown Attribut: " << attrName << "\n";
|
||||
@@ -660,9 +660,9 @@ namespace enigma { namespace lev {
|
||||
app.domParserSchemaResolver->addSchemaId("index.xsd","index.xsd");
|
||||
doc = app.domParser->parseURI(indexTemplatePath.c_str());
|
||||
if (doc != NULL && !app.domParserErrorHandler->getSawErrors()) {
|
||||
infoElem = dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
infoElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("info").x_str())->item(0));
|
||||
levelsElem = dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
levelsElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("levels").x_str())->item(0));
|
||||
}
|
||||
if(app.domParserErrorHandler->getSawErrors()) {
|
||||
@@ -777,7 +777,7 @@ namespace enigma { namespace lev {
|
||||
DOMNodeList *levList = levelsElem->getElementsByTagName(
|
||||
Utf8ToXML("level").x_str());
|
||||
for (int i = 0, l = levList-> getLength(); i < l; i++) {
|
||||
DOMElement *levElem = dynamic_cast<DOMElement *>(levList->item(i));
|
||||
DOMElement *levElem = reinterpret_cast<DOMElement *>(levList->item(i));
|
||||
levElem->setAttribute( Utf8ToXML("_seq").x_str(),
|
||||
Utf8ToXML(ecl::strf("%d",i+1)).x_str());
|
||||
}
|
||||
|
||||
@@ -564,7 +564,7 @@ namespace enigma { namespace lev {
|
||||
#endif
|
||||
}
|
||||
if (doc != NULL && !app.domParserErrorHandler->getSawErrors()) {
|
||||
infoElem = dynamic_cast<DOMElement *>(doc->getElementsByTagNameNS(
|
||||
infoElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("info").x_str())->item(0));
|
||||
stringList = doc->getElementsByTagNameNS(levelNS,
|
||||
Utf8ToXML("string").x_str());
|
||||
@@ -631,7 +631,7 @@ namespace enigma { namespace lev {
|
||||
DOMNodeList *depList = infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("dependency").x_str());
|
||||
for (int i = 0, l = depList->getLength(); i < l; i++) {
|
||||
DOMElement *depElem = dynamic_cast<DOMElement *>(depList->item(i));
|
||||
DOMElement *depElem = reinterpret_cast<DOMElement *>(depList->item(i));
|
||||
std::string depPath;
|
||||
std::string depId;
|
||||
int depRelease;
|
||||
@@ -763,7 +763,7 @@ namespace enigma { namespace lev {
|
||||
lua_State *L = lua::LevelState();
|
||||
DOMNodeList * luamainList = doc->getElementsByTagNameNS(levelNS, Utf8ToXML("luamain").x_str());
|
||||
if (luamainList->getLength() == 1) {
|
||||
DOMElement *luamain = dynamic_cast<DOMElement *>(luamainList->item(0));
|
||||
DOMElement *luamain = reinterpret_cast<DOMElement *>(luamainList->item(0));
|
||||
// add debugging info to lua code
|
||||
std::string luaCode = "--@" + absLevelPath + "\n" +
|
||||
XMLtoUtf8(luamain->getTextContent()).c_str();
|
||||
@@ -793,7 +793,7 @@ namespace enigma { namespace lev {
|
||||
if (key == "title" || key == "subtitle") {
|
||||
// get the english originals from the identity attributes
|
||||
DOMElement *identityElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("identity").x_str())->item(0));
|
||||
english = XMLtoUtf8(identityElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML(&key).x_str())).c_str();
|
||||
@@ -805,7 +805,7 @@ namespace enigma { namespace lev {
|
||||
bool keyFound = false;
|
||||
bool protectedString = true;
|
||||
for (int i = 0, l = stringList-> getLength(); i < l && !translFound; i++) {
|
||||
DOMElement *stringElem = dynamic_cast<DOMElement *>(stringList->item(i));
|
||||
DOMElement *stringElem = reinterpret_cast<DOMElement *>(stringList->item(i));
|
||||
if (key == XMLtoUtf8(stringElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("key").x_str())).c_str()) {
|
||||
keyFound = true;
|
||||
@@ -814,7 +814,7 @@ namespace enigma { namespace lev {
|
||||
if (protectedString) {
|
||||
// resolve english text from string->english subelement
|
||||
DOMElement *englishElem =
|
||||
dynamic_cast<DOMElement *>(stringElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(stringElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("english").x_str())->item(0));
|
||||
std::string tmp = XMLtoUtf8(englishElem->getTextContent()).c_str();
|
||||
if (!tmp.empty()) {
|
||||
@@ -832,7 +832,7 @@ namespace enigma { namespace lev {
|
||||
DOMNodeList *translList = stringElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("translation").x_str());
|
||||
for (int i = 0, l = translList-> getLength(); i < l && !translFound; i++) {
|
||||
DOMElement *translElem = dynamic_cast<DOMElement *>(translList->item(i));
|
||||
DOMElement *translElem = reinterpret_cast<DOMElement *>(translList->item(i));
|
||||
if (lang == XMLtoUtf8(translElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("lang").x_str())).c_str()) {
|
||||
translation = XMLtoUtf8(translElem->getTextContent()).c_str();
|
||||
@@ -873,7 +873,7 @@ namespace enigma { namespace lev {
|
||||
bool Proxy::updateId() {
|
||||
if (doc != NULL) {
|
||||
DOMElement *identityElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("identity").x_str())->item(0));
|
||||
std::string docId = XMLtoUtf8(identityElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("id").x_str())).c_str();
|
||||
@@ -894,7 +894,7 @@ namespace enigma { namespace lev {
|
||||
int Proxy::getScoreVersion() {
|
||||
if (doc != NULL) {
|
||||
DOMElement *versionElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("version").x_str())->item(0));
|
||||
scoreVersion = XMLString::parseInt(versionElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("score").x_str()));
|
||||
@@ -905,7 +905,7 @@ namespace enigma { namespace lev {
|
||||
bool Proxy::updateReleaseVersion() {
|
||||
if (doc != NULL) {
|
||||
DOMElement *versionElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("version").x_str())->item(0));
|
||||
int docRelease = XMLString::parseInt(versionElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("release").x_str()));
|
||||
@@ -927,7 +927,7 @@ namespace enigma { namespace lev {
|
||||
int Proxy::getRevisionNumber() {
|
||||
if (doc != NULL) {
|
||||
DOMElement *versionElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("version").x_str())->item(0));
|
||||
const XMLCh * revision = versionElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("revision").x_str());
|
||||
@@ -959,7 +959,7 @@ namespace enigma { namespace lev {
|
||||
levelStatusType Proxy::getLevelStatus() {
|
||||
if (doc != NULL) {
|
||||
DOMElement *versionElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("version").x_str())->item(0));
|
||||
std::string status = XMLtoUtf8(versionElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("status").x_str())).c_str();
|
||||
@@ -978,7 +978,7 @@ namespace enigma { namespace lev {
|
||||
std::string Proxy::getAuthor() {
|
||||
if (doc != NULL) {
|
||||
DOMElement *authorElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("author").x_str())->item(0));
|
||||
author = XMLtoUtf8(authorElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("name").x_str())).c_str();
|
||||
@@ -989,7 +989,7 @@ namespace enigma { namespace lev {
|
||||
std::string Proxy::getTitle() {
|
||||
if (doc != NULL) {
|
||||
DOMElement *identityElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("identity").x_str())->item(0));
|
||||
title = XMLtoUtf8(identityElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("title").x_str())).c_str();
|
||||
@@ -1000,7 +1000,7 @@ namespace enigma { namespace lev {
|
||||
bool Proxy::hasEasymode() {
|
||||
if (doc != NULL) {
|
||||
DOMElement *modesElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("modes").x_str())->item(0));
|
||||
hasEasymodeFlag = boolValue(modesElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("easy").x_str()));
|
||||
@@ -1012,7 +1012,7 @@ namespace enigma { namespace lev {
|
||||
std::string contact;
|
||||
if (doc != NULL) {
|
||||
DOMElement *authorElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("author").x_str())->item(0));
|
||||
contact = XMLtoUtf8(authorElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("email").x_str())).c_str();
|
||||
@@ -1024,7 +1024,7 @@ namespace enigma { namespace lev {
|
||||
std::string homepage;
|
||||
if (doc != NULL) {
|
||||
DOMElement *authorElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("author").x_str())->item(0));
|
||||
homepage = XMLtoUtf8(authorElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("homepage").x_str())).c_str();
|
||||
@@ -1036,7 +1036,7 @@ namespace enigma { namespace lev {
|
||||
double value = 0.92;
|
||||
if (doc != NULL) {
|
||||
DOMElement *compatibilityElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("compatibility").x_str())->item(0));
|
||||
XMLDouble * result = new XMLDouble(compatibilityElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("enigma").x_str()));
|
||||
@@ -1049,7 +1049,7 @@ namespace enigma { namespace lev {
|
||||
GameType Proxy::getEngineCompatibility() {
|
||||
if (doc != NULL) {
|
||||
DOMElement *authorElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("compatibility").x_str())->item(0));
|
||||
engineCompatibility = GetGameType(XMLtoUtf8(authorElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("engine").x_str())).c_str());
|
||||
@@ -1062,7 +1062,7 @@ namespace enigma { namespace lev {
|
||||
controlType control = force;
|
||||
if (doc != NULL) {
|
||||
DOMElement *authorElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("modes").x_str())->item(0));
|
||||
std::string controlString = XMLtoUtf8(authorElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("control").x_str())).c_str();
|
||||
@@ -1079,7 +1079,7 @@ namespace enigma { namespace lev {
|
||||
scoreUnitType Proxy::getScoreUnit() {
|
||||
if (doc != NULL) {
|
||||
DOMElement *modesElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("modes").x_str())->item(0));
|
||||
std::string txt = XMLtoUtf8(modesElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("scoreunit").x_str())).c_str();
|
||||
@@ -1096,7 +1096,7 @@ namespace enigma { namespace lev {
|
||||
std::string title = "time";
|
||||
if (doc != NULL) {
|
||||
DOMElement *modesElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("modes").x_str())->item(0));
|
||||
title = XMLtoUtf8(modesElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("scoretarget").x_str())).c_str();
|
||||
@@ -1109,7 +1109,7 @@ namespace enigma { namespace lev {
|
||||
std::string attribute = infoUsage ? "showinfo" : "showstart";
|
||||
if (doc != NULL) {
|
||||
DOMElement *creditsElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("credits").x_str())->item(0));
|
||||
if (creditsElem != NULL) // element is optional
|
||||
if (boolValue(creditsElem->getAttributeNS(levelNS,
|
||||
@@ -1124,7 +1124,7 @@ namespace enigma { namespace lev {
|
||||
std::string attribute = infoUsage ? "showinfo" : "showstart";
|
||||
if (doc != NULL) {
|
||||
DOMElement *dedicationElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("dedication").x_str())->item(0));
|
||||
if (dedicationElem != NULL) // element is optional
|
||||
if (boolValue(dedicationElem->getAttributeNS(levelNS,
|
||||
@@ -1137,7 +1137,7 @@ namespace enigma { namespace lev {
|
||||
int score = -1;
|
||||
if (doc != NULL) {
|
||||
DOMElement *versionElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("score").x_str())->item(0));
|
||||
score = scoreText2Int(XMLtoUtf8(versionElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("easy").x_str())).c_str());
|
||||
@@ -1149,7 +1149,7 @@ namespace enigma { namespace lev {
|
||||
int score = -1;
|
||||
if (doc != NULL) {
|
||||
DOMElement *versionElem =
|
||||
dynamic_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
reinterpret_cast<DOMElement *>(infoElem->getElementsByTagNameNS(
|
||||
levelNS, Utf8ToXML("score").x_str())->item(0));
|
||||
score = scoreText2Int(XMLtoUtf8(versionElem->getAttributeNS(levelNS,
|
||||
Utf8ToXML("difficult").x_str())).c_str());
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace enigma { namespace lev {
|
||||
DOMDocument *doc = app.domParser->parseURI(path.c_str());
|
||||
if (doc != NULL && !app.domParserErrorHandler->getSawErrors()) {
|
||||
DOMElement *updateElem =
|
||||
dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("update").x_str())->item(0));
|
||||
std::time_t newVersion = timeValue(updateElem->getAttribute(Utf8ToXML("date").x_str()));
|
||||
bool isUpdate = (std::difftime(newVersion, ratingVersion) > 0) ? true : false;
|
||||
@@ -148,7 +148,7 @@ namespace enigma { namespace lev {
|
||||
DOMNodeList *levelList = doc->getElementsByTagName(
|
||||
Utf8ToXML("level").x_str());
|
||||
for (int i = 0, l = levelList-> getLength(); i < l; i++) {
|
||||
DOMElement *levelElem = dynamic_cast<DOMElement *>(levelList->item(i));
|
||||
DOMElement *levelElem = reinterpret_cast<DOMElement *>(levelList->item(i));
|
||||
const XMLCh * attr = levelElem->getAttribute(Utf8ToXML("id").x_str());
|
||||
std::string id = XMLtoUtf8(attr).c_str();
|
||||
attr = levelElem->getAttribute(Utf8ToXML("sv").x_str());
|
||||
@@ -335,13 +335,13 @@ namespace enigma { namespace lev {
|
||||
app.domParserSchemaResolver->addSchemaId("ratings.xsd","ratings.xsd");
|
||||
saveDoc = app.domParser->parseURI(ratTemplatePath.c_str());
|
||||
if (saveDoc != NULL && !app.domParserErrorHandler->getSawErrors()) {
|
||||
DOMElement * updateElem = dynamic_cast<DOMElement *>(saveDoc->getElementsByTagName(
|
||||
DOMElement * updateElem = reinterpret_cast<DOMElement *>(saveDoc->getElementsByTagName(
|
||||
Utf8ToXML("update").x_str())->item(0));
|
||||
updateElem->setAttribute(Utf8ToXML("date").x_str(), Utf8ToXML(ratingVersionString.c_str()).x_str());
|
||||
updateElem->setAttribute(Utf8ToXML("urlFull").x_str(), Utf8ToXML(urlFullUpdate.c_str()).x_str());
|
||||
updateElem->setAttribute(Utf8ToXML("urlIncremental").x_str(), Utf8ToXML(urlIncrementalUpdate.c_str()).x_str());
|
||||
updateElem->setAttribute(Utf8ToXML("delay").x_str(), Utf8ToXML(ecl::strf("%d",updateMinDelay).c_str()).x_str());
|
||||
levelsElem = dynamic_cast<DOMElement *>(saveDoc->getElementsByTagName(
|
||||
levelsElem = reinterpret_cast<DOMElement *>(saveDoc->getElementsByTagName(
|
||||
Utf8ToXML("levels").x_str())->item(0));
|
||||
std::for_each(cache.begin(), cache.end(), saveLevelRating);
|
||||
std::string writePath = app.userPath + "/" + RATINGSFILENAME;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace {
|
||||
#endif
|
||||
if (node->getNodeType () == DOMNode::ELEMENT_NODE &&
|
||||
std::string(XMLtoUtf8(node->getNodeName()).c_str()) == "level") {
|
||||
const DOMElement *e = dynamic_cast<const DOMElement *>(node);
|
||||
const DOMElement *e = reinterpret_cast<const DOMElement *>(node);
|
||||
std::string id = XMLtoUtf8(e->getAttribute(Utf8ToXML("id").x_str())).c_str();
|
||||
if (id.find("Import ") == 0) {
|
||||
// reject scores for levels imported from dat files
|
||||
@@ -182,9 +182,9 @@ namespace enigma { namespace lev {
|
||||
|
||||
}
|
||||
if (doc != NULL && !app.domParserErrorHandler->getSawErrors()) {
|
||||
propertiesElem = dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
propertiesElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("properties").x_str())->item(0));
|
||||
levelsElem = dynamic_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
levelsElem = reinterpret_cast<DOMElement *>(doc->getElementsByTagName(
|
||||
Utf8ToXML("levels").x_str())->item(0));
|
||||
levelList = levelsElem->getElementsByTagName(Utf8ToXML("level").x_str());
|
||||
|
||||
@@ -192,13 +192,13 @@ namespace enigma { namespace lev {
|
||||
if (hasValidStateUserId && userId == stateUserId) {
|
||||
hasValidUserId = true;
|
||||
for (int i = 0, l = levelList->getLength(); i < l; i++) {
|
||||
DOMElement * levelElem = dynamic_cast<DOMElement *>(levelList->item(i));
|
||||
DOMElement * levelElem = reinterpret_cast<DOMElement *>(levelList->item(i));
|
||||
std::string levelId = XMLtoUtf8(levelElem->getAttribute(Utf8ToXML("id").x_str())).c_str();
|
||||
std::string scoreVersion = XMLtoUtf8(levelElem->getAttribute(Utf8ToXML("version").x_str())).c_str();
|
||||
DOMNamedNodeMap * attrXMap = levelElem->getAttributes();
|
||||
std::map<std::string, std::string> attrMap;
|
||||
for (int j = 0, k = attrXMap->getLength(); j < k; j++) {
|
||||
DOMAttr * levelAttr = dynamic_cast<DOMAttr *>(attrXMap->item(j));
|
||||
DOMAttr * levelAttr = reinterpret_cast<DOMAttr *>(attrXMap->item(j));
|
||||
std::string attrName = XMLtoUtf8(levelAttr->getName()).c_str();
|
||||
if (attrName != "sec" && levelAttr->getSpecified())
|
||||
attrMap[attrName] = XMLtoUtf8(levelAttr->getValue()).c_str();
|
||||
@@ -383,11 +383,11 @@ namespace enigma { namespace lev {
|
||||
}
|
||||
|
||||
for (int i = 0, l = levelList->getLength(); i < l; i++) {
|
||||
DOMElement * levelElem = dynamic_cast<DOMElement *>(levelList->item(i));
|
||||
DOMElement * levelElem = reinterpret_cast<DOMElement *>(levelList->item(i));
|
||||
DOMNamedNodeMap * attrXMap = levelElem->getAttributes();
|
||||
std::map<std::string, std::string> attrMap;
|
||||
for (int j = 0, k = attrXMap->getLength(); j < k; j++) {
|
||||
DOMAttr * levelAttr = dynamic_cast<DOMAttr *>(attrXMap->item(j));
|
||||
DOMAttr * levelAttr = reinterpret_cast<DOMAttr *>(attrXMap->item(j));
|
||||
std::string attrName = XMLtoUtf8(levelAttr->getName()).c_str();
|
||||
if (attrName != "sec" && levelAttr->getSpecified())
|
||||
attrMap[attrName] = XMLtoUtf8(levelAttr->getValue()).c_str();
|
||||
@@ -1007,7 +1007,7 @@ namespace enigma { namespace lev {
|
||||
std::string ScoreManager::upgradeSum() {
|
||||
std::string scores;
|
||||
for (int i = 0, l = levelList->getLength(); i < l; i++) {
|
||||
DOMElement * level = dynamic_cast<DOMElement *>(levelList->item(i));
|
||||
DOMElement * level = reinterpret_cast<DOMElement *>(levelList->item(i));
|
||||
const XMLCh *attr = level->getAttribute(Utf8ToXML("diff1").x_str());
|
||||
int score = (XMLString::stringLen(attr) > 0) ? XMLString::parseInt(attr) : -1;
|
||||
if (score >= 0)
|
||||
|
||||
@@ -230,6 +230,7 @@ Application::Application() : wizard_mode (false), nograb (false), language (""),
|
||||
|
||||
void Application::init(int argc, char **argv)
|
||||
{
|
||||
|
||||
progCallPath = argv[0];
|
||||
copy(argv+1, argv+argc, back_inserter(args));
|
||||
|
||||
@@ -270,6 +271,7 @@ void Application::init(int argc, char **argv)
|
||||
// initialize XML -- needs log, datapaths
|
||||
initXerces();
|
||||
|
||||
|
||||
// initialize LUA - Run initialization scripts
|
||||
lua_State *L = lua::GlobalState();
|
||||
lua::CheckedDoFile(L, app.systemFS, "startup.lua");
|
||||
@@ -290,7 +292,7 @@ void Application::init(int argc, char **argv)
|
||||
|
||||
// initialize user data paths -- needs preferences, system datapaths
|
||||
initUserDatapaths();
|
||||
|
||||
|
||||
// set message language
|
||||
init_i18n();
|
||||
|
||||
@@ -306,6 +308,9 @@ void Application::init(int argc, char **argv)
|
||||
// SDL_putenv("SDL_VIDEODRIVER=directx"); //needed for SDL 1.2.12 that favors GDI which crashes on SetGamma
|
||||
#endif
|
||||
int sdl_flags = SDL_INIT_VIDEO;
|
||||
#ifdef ANDROID
|
||||
sdl_flags |= SDL_INIT_JOYSTICK;
|
||||
#endif
|
||||
if (enigma::WizardMode)
|
||||
sdl_flags |= SDL_INIT_NOPARACHUTE;
|
||||
if (SDL_Init(sdl_flags) < 0) {
|
||||
@@ -483,7 +488,7 @@ void Application::initSysDatapaths(const std::string &prefFilename)
|
||||
if (!systemCmdDataPath.empty())
|
||||
systemFS->prepend_dir(systemCmdDataPath);
|
||||
Log << "systemFS = \"" << systemFS->getDataPath() << "\"\n";
|
||||
|
||||
|
||||
// l10nPath
|
||||
l10nPath = LOCALEDIR; // defined in src/Makefile.am
|
||||
#ifdef __MINGW32__
|
||||
@@ -627,10 +632,11 @@ void Application::initUserDatapaths() {
|
||||
userPath = userStdPath;
|
||||
#endif
|
||||
} else {
|
||||
|
||||
userPath = XMLtoLocal(Utf8ToXML(userPath.c_str()).x_str()).c_str();
|
||||
}
|
||||
Log << "userPath = \"" << userPath << "\"\n";
|
||||
|
||||
|
||||
// userImagePath
|
||||
userImagePath = prefs->getString("UserImagePath");
|
||||
if (userImagePath.empty()) {
|
||||
@@ -657,6 +663,7 @@ void Application::initUserDatapaths() {
|
||||
resourceFS->prepend_dir(std::string(path)+"/Application Support/Enigma");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!systemCmdDataPath.empty())
|
||||
resourceFS->prepend_dir(systemCmdDataPath);
|
||||
resourceFS->prepend_dir(userPath);
|
||||
|
||||
@@ -42,11 +42,11 @@ namespace enigma
|
||||
for (child = elem->getFirstChild(); child != NULL; child = next) {
|
||||
next = child->getNextSibling();
|
||||
if (child->getNodeType() == DOMNode::TEXT_NODE) {
|
||||
if (dynamic_cast<DOMText *>(child)->isIgnorableWhitespace()) {
|
||||
if (reinterpret_cast<DOMText *>(child)->isIgnorableWhitespace()) {
|
||||
elem->removeChild(child);
|
||||
}
|
||||
} else if (child->getNodeType() == DOMNode::ELEMENT_NODE) {
|
||||
DOMElement * childElem = dynamic_cast<DOMElement *>(child);
|
||||
DOMElement * childElem = reinterpret_cast<DOMElement *>(child);
|
||||
if (childElem != NULL)
|
||||
stripIgnorableWhitespace(childElem);
|
||||
}
|
||||
|
||||
@@ -216,6 +216,8 @@ void MouseCursor::set_image (ecl::Surface *s, int hx, int hy) {
|
||||
}
|
||||
|
||||
void MouseCursor::draw () {
|
||||
// we do not need a mouse cursor on a touchscreen device
|
||||
#ifndef ANDROID
|
||||
if (visible > 0) {
|
||||
grab_bg();
|
||||
|
||||
@@ -225,6 +227,7 @@ void MouseCursor::draw () {
|
||||
|
||||
changedp = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void MouseCursor::redraw () {
|
||||
@@ -335,6 +338,7 @@ namespace
|
||||
VM_640x480,
|
||||
false, // 640x512 is deprecated!
|
||||
},
|
||||
#ifndef ANDROID
|
||||
{
|
||||
VM_800x600, 800, 600, 40, "800x600",
|
||||
"models-40.lua", "gfx40/",
|
||||
@@ -361,6 +365,7 @@ namespace
|
||||
Rect (260, 655, 710, 40), // text area
|
||||
VM_640x480, true,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
VideoModes current_video_mode = VM_None;
|
||||
|
||||
Reference in New Issue
Block a user