summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2011-01-27 14:55:56 -0600
committerDavid Athay <ko2fan@gmail.com>2011-01-27 14:55:56 -0600
commite5ecfdfd67b806c76cbcc57f0df8e2ddda75ac2e (patch)
treea147807888b1c3d9b1fcf3c178143d9572ce6c41
parent0c4cc6b924d953459198aaae4710296ffb47bfa4 (diff)
parentfe7a543ce0495b55122afbf11d0488289613cff5 (diff)
downloadmana-e5ecfdfd67b806c76cbcc57f0df8e2ddda75ac2e.tar.gz
mana-e5ecfdfd67b806c76cbcc57f0df8e2ddda75ac2e.tar.bz2
mana-e5ecfdfd67b806c76cbcc57f0df8e2ddda75ac2e.tar.xz
mana-e5ecfdfd67b806c76cbcc57f0df8e2ddda75ac2e.zip
Merge branch '0.5' of git://gitorious.org/mana/mana into 0.5
-rw-r--r--CMakeLists.txt7
-rw-r--r--src/CMakeLists.txt21
-rw-r--r--src/client.cpp22
-rw-r--r--src/net/net.cpp3
4 files changed, 41 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1418e938..00139b55 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,6 +30,7 @@ FIND_PACKAGE(Gettext)
OPTION(WITH_OPENGL "Enable OpenGL support" ON)
OPTION(ENABLE_NLS "Enable building of tranlations" ON)
+OPTION(ENABLE_MANASERV "Enable Manaserv support" OFF)
IF (WIN32)
SET(PKG_DATADIR ".")
@@ -46,7 +47,11 @@ ELSE (WIN32)
ENDIF (WIN32)
ADD_SUBDIRECTORY(data)
-ADD_SUBDIRECTORY(libs/enet)
+
+IF (ENABLE_MANASERV)
+ ADD_SUBDIRECTORY(libs/enet)
+ENDIF()
+
ADD_SUBDIRECTORY(src)
IF (GETTEXT_FOUND AND ENABLE_NLS)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c9f23cc1..0fd32f59 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,11 +22,14 @@ IF (CMAKE_COMPILER_IS_GNUCXX)
ENDIF()
IF (POLICY CMP0015)
- CMAKE_POLICY(SET CMP0015 OLD)
+ CMAKE_POLICY(SET CMP0015 OLD)
+ENDIF()
+
+IF (ENABLE_MANASERV)
+ INCLUDE_DIRECTORIES("../libs/enet/include")
+ LINK_DIRECTORIES("../libs/enet")
+ SET(INTERNAL_LIBRARIES enet)
ENDIF()
-INCLUDE_DIRECTORIES("../libs/enet/include")
-LINK_DIRECTORIES("../libs/enet")
-SET(INTERNAL_LIBRARIES enet)
SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"")
@@ -36,6 +39,10 @@ IF (ENABLE_NLS)
SET(FLAGS "${FLAGS} -DENABLE_NLS=1")
ENDIF()
+IF (ENABLE_MANASERV)
+ SET(FLAGS "${FLAGS} -DMANASERV_SUPPORT=1")
+ENDIF()
+
IF (CMAKE_BUILD_TYPE)
STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug OR
@@ -623,7 +630,11 @@ ENDIF ()
SET (PROGRAMS mana)
-ADD_EXECUTABLE(mana WIN32 ${SRCS} ${SRCS_MANA} ${SRCS_TMWA})
+IF (ENABLE_MANASERV)
+ ADD_EXECUTABLE(mana WIN32 ${SRCS} ${SRCS_MANA} ${SRCS_TMWA})
+ELSE(ENABLE_MANASERV)
+ ADD_EXECUTABLE(mana WIN32 ${SRCS} ${SRCS_TMWA})
+ENDIF(ENABLE_MANASERV)
TARGET_LINK_LIBRARIES(mana
${INTERNAL_LIBRARIES}
diff --git a/src/client.cpp b/src/client.cpp
index 110420d5..b57c3ae8 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -299,17 +299,29 @@ Client::Client(const Options &options):
// Add the local data directory to PhysicsFS search path
resman->addToSearchPath(mLocalDataDir, false);
+ std::string iconFile = branding.getValue("appIcon", "icons/mana");
+#ifdef WIN32
+ iconFile += ".ico";
+#else
+ iconFile += ".png";
+#endif
+ iconFile = resman->getPath(iconFile);
+ logger->log("Loading icon from file: %s", iconFile.c_str());
#ifdef WIN32
static SDL_SysWMinfo pInfo;
SDL_GetWMInfo(&pInfo);
- HICON icon = LoadIcon(GetModuleHandle(NULL), "A");
+ // Attempt to load icon from .ico file
+ HICON icon = (HICON) LoadImage(NULL,
+ iconFile.c_str(),
+ IMAGE_ICON, 64, 64, LR_LOADFROMFILE);
+ // If it's failing, we load the default resource file.
+ if (!icon)
+ icon = LoadIcon(GetModuleHandle(NULL), "A");
+
if (icon)
- {
SetClassLong(pInfo.window, GCL_HICON, (LONG) icon);
- }
#else
- mIcon = IMG_Load(resman->getPath(
- branding.getValue("appIcon", "icons/mana.png")).c_str());
+ mIcon = IMG_Load(iconFile.c_str());
if (mIcon)
{
SDL_SetAlpha(mIcon, SDL_SRCALPHA, SDL_ALPHA_OPAQUE);
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 25dcd981..1b4bbf36 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -159,10 +159,11 @@ void connectToServer(ServerInfo &server)
switch (server.type)
{
+#ifdef MANASERV_SUPPORT
case ServerInfo::MANASERV:
new ManaServ::GeneralHandler;
break;
-
+#endif
case ServerInfo::TMWATHENA:
new TmwAthena::GeneralHandler;
break;