summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-02-01 20:58:10 +0200
committerAndrei Karas <akaras@inbox.ru>2011-02-01 21:42:50 +0200
commit954ceb91ddd94985594996d6d3c50be7b5652626 (patch)
tree95b9a13368a5c561b380f34df95850276ec205ac /src
parentba1c188f7a1850761eb7d63fbaaeece6dfb2a256 (diff)
downloadmv-954ceb91ddd94985594996d6d3c50be7b5652626.tar.gz
mv-954ceb91ddd94985594996d6d3c50be7b5652626.tar.bz2
mv-954ceb91ddd94985594996d6d3c50be7b5652626.tar.xz
mv-954ceb91ddd94985594996d6d3c50be7b5652626.zip
Add ability to enable/disable manaserv with embedded enet.
Set manaserv disabled in automake and cmake by default but enabled in build scripts.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt52
-rw-r--r--src/Makefile.am43
-rw-r--r--src/gui/serverdialog.cpp2
-rw-r--r--src/net/net.cpp5
-rw-r--r--src/net/serverinfo.h3
5 files changed, 60 insertions, 45 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2dfbfcb7c..d807e9a1c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -33,6 +33,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
@@ -111,24 +115,6 @@ MARK_AS_ADVANCED(SDL_INCLUDE_DIR)
MARK_AS_ADVANCED(SDL_LIBRARY)
SET(SRCS
- enet/callbacks.c
- enet/callbacks.h
- enet/compress.c
- enet/enet.h
- enet/host.c
- enet/list.c
- enet/list.h
- enet/packet.c
- enet/peer.c
- enet/protocol.c
- enet/protocol.h
- enet/time.h
- enet/types.h
- enet/unix.c
- enet/unix.h
- enet/utility.h
- enet/win32.c
- enet/win32.h
gui/widgets/avatarlistbox.cpp
gui/widgets/avatarlistbox.h
gui/widgets/battletab.cpp
@@ -635,7 +621,25 @@ SET(SRCS_TMWA
net/tmwa/tradehandler.h
)
-SET(SRCS_MANAPLUS
+SET(SRCS_MANASERV
+ enet/callbacks.c
+ enet/callbacks.h
+ enet/compress.c
+ enet/enet.h
+ enet/host.c
+ enet/list.c
+ enet/list.h
+ enet/packet.c
+ enet/peer.c
+ enet/protocol.c
+ enet/protocol.h
+ enet/time.h
+ enet/types.h
+ enet/unix.c
+ enet/unix.h
+ enet/utility.h
+ enet/win32.c
+ enet/win32.h
net/manaserv/attributes.cpp
net/manaserv/attributes.h
net/manaserv/adminhandler.cpp
@@ -689,8 +693,8 @@ SET(SRCS_MANAPLUS
)
IF (WIN32)
- SET(SRCS_MANAPLUS
- ${SRCS_MANAPLUS}
+ SET(SRCS
+ ${SRCS}
utils/specialfolder.cpp
utils/specialfolder.h
mana.rc
@@ -699,7 +703,11 @@ ENDIF ()
SET (PROGRAMS manaplus)
-ADD_EXECUTABLE(manaplus WIN32 ${SRCS} ${SRCS_MANAPLUS} ${SRCS_TMWA})
+IF (ENABLE_MANASERV)
+ ADD_EXECUTABLE(manaplus WIN32 ${SRCS} ${SRCS_MANASERV} ${SRCS_TMWA})
+ELSE(ENABLE_MANASERV)
+ ADD_EXECUTABLE(manaplus WIN32 ${SRCS} ${SRCS_TMWA})
+ENDIF(ENABLE_MANASERV)
TARGET_LINK_LIBRARIES(manaplus
${SDLGFX_LIBRARIES}
diff --git a/src/Makefile.am b/src/Makefile.am
index 29520258b..4ff75d1a0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,26 +6,7 @@ manaplus_CXXFLAGS = -DPKG_DATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\" \
-Wall
-manaplus_SOURCES = enet/callbacks.c \
- enet/compress.c \
- enet/host.c \
- enet/list.c \
- enet/packet.c \
- enet/peer.c \
- enet/protocol.c \
- enet/unix.c \
- enet/win32.c \
- enet/callbacks.h \
- enet/enet.h \
- enet/list.h \
- enet/protocol.h \
- enet/time.h \
- enet/types.h \
- enet/unix.h \
- enet/utility.h \
- enet/win32.h
-
-manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
+manaplus_SOURCES = gui/widgets/avatarlistbox.cpp \
gui/widgets/avatarlistbox.h \
gui/widgets/battletab.cpp \
gui/widgets/battletab.h \
@@ -482,7 +463,26 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
vector.h \
winver.h
-manaplus_SOURCES += \
+if ENABLE_MANASERV
+manaplus_CXXFLAGS += -DMANASERV_SUPPORT
+manaplus_SOURCES += enet/callbacks.c \
+ enet/compress.c \
+ enet/host.c \
+ enet/list.c \
+ enet/packet.c \
+ enet/peer.c \
+ enet/protocol.c \
+ enet/unix.c \
+ enet/win32.c \
+ enet/callbacks.h \
+ enet/enet.h \
+ enet/list.h \
+ enet/protocol.h \
+ enet/time.h \
+ enet/types.h \
+ enet/unix.h \
+ enet/utility.h \
+ enet/win32.h \
net/manaserv/attributes.cpp \
net/manaserv/attributes.h \
net/manaserv/adminhandler.cpp \
@@ -533,6 +533,7 @@ manaplus_SOURCES += \
net/manaserv/specialhandler.h \
net/manaserv/tradehandler.cpp \
net/manaserv/tradehandler.h
+endif
manaplus_SOURCES += \
net/tmwa/gui/guildtab.cpp \
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index b31bc7ba8..0e6f1d5b8 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -122,8 +122,10 @@ std::string TypeListModel::getElementAt(int elementIndex)
{
if (elementIndex == 0)
return "TmwAthena";
+#ifdef MANASERV_SUPPORT
else if (elementIndex == 1)
return "ManaServ";
+#endif
else
return "Unknown";
}
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 36e414643..862505fdb 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -41,7 +41,9 @@
#include "net/tmwa/generalhandler.h"
+#ifdef MANASERV_SUPPORT
#include "net/manaserv/generalhandler.h"
+#endif
Net::AdminHandler *adminHandler = NULL;
Net::CharHandler *charHandler = NULL;
@@ -157,10 +159,11 @@ void connectToServer(const ServerInfo &server)
switch (server.type)
{
+#ifdef MANASERV_SUPPORT
case ServerInfo::MANASERV:
new ManaServ::GeneralHandler;
break;
-
+#endif
case ServerInfo::TMWATHENA:
new TmwAthena::GeneralHandler;
break;
diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h
index 113d8a9b2..74d537b80 100644
--- a/src/net/serverinfo.h
+++ b/src/net/serverinfo.h
@@ -105,9 +105,10 @@ public:
// Used for backward compatibility
else if (compareStrI(type, "eathena") == 0)
return TMWATHENA;
+#ifdef MANASERV_SUPPORT
else if (compareStrI(type, "manaserv") == 0)
return MANASERV;
-
+#endif
return UNKNOWN;
}
};