XML saving and minor fixes + code refactoring.

Signed-off-by: otfallen <f.fallen45@gmail.com>
This commit is contained in:
otfallen
2012-09-14 21:38:21 +00:00
parent 1ecaca82b7
commit eb7a11158a
14 changed files with 437 additions and 170 deletions

View File

@@ -66,6 +66,7 @@ void Application::registerLuaFunctions()
g_lua.bindGlobalFunction("iptostring", [](int v) { return stdext::ip_to_string(v); });
g_lua.bindGlobalFunction("stringtoip", [](const std::string& v) { return stdext::string_to_ip(v); });
g_lua.bindGlobalFunction("listSubnetAddresses", [](uint32 a, uint8 b) { return stdext::listSubnetAddresses(a, b); });
g_lua.bindGlobalFunction("ucwords", [](std::string s) { return stdext::ucwords(s); });
// Application
g_lua.registerSingletonClass("g_app");
@@ -154,6 +155,7 @@ void Application::registerLuaFunctions()
g_lua.bindSingletonFunction("g_resources", "searchAndAddPackages", &ResourceManager::searchAndAddPackages, &g_resources);
g_lua.bindSingletonFunction("g_resources", "removeSearchPath", &ResourceManager::removeSearchPath, &g_resources);
g_lua.bindSingletonFunction("g_resources", "fileExists", &ResourceManager::fileExists, &g_resources);
g_lua.bindSingletonFunction("g_resources", "directoryExists", &ResourceManager::directoryExists, &g_resources);
g_lua.bindSingletonFunction("g_resources", "getRealDir", &ResourceManager::getRealDir, &g_resources);
g_lua.bindSingletonFunction("g_resources", "getWorkDir", &ResourceManager::getWorkDir, &g_resources);
g_lua.bindSingletonFunction("g_resources", "getSearchPaths", &ResourceManager::getSearchPaths, &g_resources);

View File

@@ -43,6 +43,7 @@ distribution.
#include <framework/const.h>
#include <otclient/position.h>
#include <framework/stdext/cast.h>
#include <framework/stdext/string.h>
// Help out windows:
#if defined( _DEBUG ) && !defined( DEBUG )
@@ -51,7 +52,7 @@ distribution.
#ifdef TIXML_USE_STL
#include <string>
#include <iostream>
#include <iostream>
#include <sstream>
#define TIXML_STRING std::string
#else
@@ -1005,6 +1006,7 @@ public:
std::string Attribute( const std::string& name, double* d ) const;
void SetAttribute( const std::string& name, const std::string& _value );
void SetAttribute( const std::string& name, int _value) { SetAttribute(name, stdext::to_string(_value)); }
void RemoveAttribute( const std::string& name );