- ported bugfixes to trunk from 3.6.0.3

This commit is contained in:
Mark Vejvoda
2012-01-24 21:28:05 +00:00
11 changed files with 55 additions and 26 deletions

View File

@@ -293,6 +293,30 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${IRCCLIENT_LIBRARY})
endif()
set(CMAKE_REQUIRED_INCLUDES "${IRCCLIENT_INCLUDE_DIR}")
set(CMAKE_REQUIRED_LIBRARIES "${IRCCLIENT_LIBRARY}")
check_cxx_source_runs("
#include <stdio.h>
#include <stdlib.h>
#include <libircclient.h>
int main()
{
unsigned int high = 0;
unsigned int low = 0;
irc_get_version(&high,&low);
if( (high == 1 && low >= 6) || (high > 1)) {
return 0;
}
throw 1;
}"
HAS_LIBIRCCLIENT_1_6)
IF(HAS_LIBIRCCLIENT_1_6)
message(STATUS "Found HAS_LIBIRCCLIENT_1_6: ${HAS_LIBIRCCLIENT_1_6}")
ELSE()
ADD_DEFINITIONS(-DLIBIRCCLIENT_PRE1_6)
ENDIF()
IF(WIN32)
SET(MG_SOURCE_FILES ${MG_SOURCE_FILES} ${PROJECT_SOURCE_DIR}/source/shared_lib/sources/platform/posix/socket.cpp)
SET(MG_SOURCE_FILES ${MG_SOURCE_FILES} ${PROJECT_SOURCE_DIR}/source/shared_lib/sources/platform/posix/ircclient.cpp)

View File

@@ -211,6 +211,7 @@ bool EndsWith(const string &str, const string& key);
void endPathWithSlash(string &path, bool requireOSSlash=false);
void trimPathWithStartingSlash(string &path);
void updatePathClimbingParts(string &path);
string formatPath(string path);
string replaceAll(string& context, const string& from, const string& to);
bool removeFile(string file);

View File

@@ -500,6 +500,13 @@ void endPathWithSlash(string &path,bool requireOSSlash) {
}
}
string formatPath(string path) {
replaceAll(path, "\"", "");
replaceAll(path, "//", "/");
return path;
}
void trimPathWithStartingSlash(string &path) {
if(StartsWith(path, "/") == true || StartsWith(path, "\\") == true) {
path.erase(path.begin(),path.begin()+1);

View File

@@ -15,6 +15,11 @@
#include "platform_common.h"
#include "libircclient.h"
// upstream moved some defines into new headers as of 1.6
#ifndef LIBIRCCLIENT_PRE1_6
#include "libirc_rfcnumeric.h"
#endif
#include <stdio.h>
#include <stdarg.h>
#include <string.h>

View File

@@ -79,11 +79,11 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,
#ifndef WIN32
string mg_icon_file = "";
#if defined(CUSTOM_DATA_INSTALL_PATH_VALUE)
if(fileExists(CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.png")) {
mg_icon_file = CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.png";
if(fileExists(formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.png")) {
mg_icon_file = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.png";
}
else if(fileExists(CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.bmp")) {
mg_icon_file = CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.bmp";
else if(fileExists(formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.bmp")) {
mg_icon_file = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.bmp";
}
#endif

View File

@@ -215,20 +215,15 @@ std::map<string,string> Properties::getTagReplacementValues(std::map<string,stri
mapTagReplacementValues["{APPLICATIONPATH}"] = Properties::applicationPath;
#if defined(CUSTOM_DATA_INSTALL_PATH)
mapTagReplacementValues["$APPLICATIONDATAPATH"] = TOSTRING(CUSTOM_DATA_INSTALL_PATH);
mapTagReplacementValues["%%APPLICATIONDATAPATH%%"] = TOSTRING(CUSTOM_DATA_INSTALL_PATH);
mapTagReplacementValues["{APPLICATIONDATAPATH}"] = TOSTRING(CUSTOM_DATA_INSTALL_PATH);
//mapTagReplacementValues["$COMMONDATAPATH", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/");
//mapTagReplacementValues["%%COMMONDATAPATH%%", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/");
mapTagReplacementValues["$APPLICATIONDATAPATH"] = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH));
mapTagReplacementValues["%%APPLICATIONDATAPATH%%"] = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH));
mapTagReplacementValues["{APPLICATIONDATAPATH}"] = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH));
#else
mapTagReplacementValues["$APPLICATIONDATAPATH"] = Properties::applicationPath;
mapTagReplacementValues["%%APPLICATIONDATAPATH%%"] = Properties::applicationPath;
mapTagReplacementValues["{APPLICATIONDATAPATH}"] = Properties::applicationPath;
//mapTagReplacementValues["$COMMONDATAPATH", Properties::applicationPath + "/commondata/");
//mapTagReplacementValues["%%COMMONDATAPATH%%", Properties::applicationPath + "/commondata/");
#endif
mapTagReplacementValues["$GAMEVERSION"] = Properties::gameVersion;
@@ -308,20 +303,15 @@ bool Properties::applyTagsToValue(string &value, std::map<string,string> *mapTag
replaceAll(value, "{APPLICATIONPATH}", Properties::applicationPath);
#if defined(CUSTOM_DATA_INSTALL_PATH)
replaceAll(value, "$APPLICATIONDATAPATH", TOSTRING(CUSTOM_DATA_INSTALL_PATH));
replaceAll(value, "%%APPLICATIONDATAPATH%%", TOSTRING(CUSTOM_DATA_INSTALL_PATH));
replaceAll(value, "{APPLICATIONDATAPATH}", TOSTRING(CUSTOM_DATA_INSTALL_PATH));
//replaceAll(value, "$COMMONDATAPATH", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/");
//replaceAll(value, "%%COMMONDATAPATH%%", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/");
replaceAll(value, "$APPLICATIONDATAPATH", formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH)));
replaceAll(value, "%%APPLICATIONDATAPATH%%", formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH)));
replaceAll(value, "{APPLICATIONDATAPATH}", formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH)));
#else
replaceAll(value, "$APPLICATIONDATAPATH", Properties::applicationPath);
replaceAll(value, "%%APPLICATIONDATAPATH%%", Properties::applicationPath);
replaceAll(value, "{APPLICATIONDATAPATH}", Properties::applicationPath);
//replaceAll(value, "$COMMONDATAPATH", Properties::applicationPath + "/commondata/");
//replaceAll(value, "%%COMMONDATAPATH%%", Properties::applicationPath + "/commondata/");
#endif
replaceAll(value, "$GAMEVERSION", Properties::gameVersion);