diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-14 16:51:36 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-14 16:51:36 +0300 |
commit | da98d12637db106b87341560cc72ca6207b2d12f (patch) | |
tree | c79f1c3389f38ec878fc2dfc4729839242e2e81c | |
parent | 8a616021cbefff5f62b0ca55cf535130c8c1b5f0 (diff) | |
download | manaplus-da98d12637db106b87341560cc72ca6207b2d12f.tar.gz manaplus-da98d12637db106b87341560cc72ca6207b2d12f.tar.bz2 manaplus-da98d12637db106b87341560cc72ca6207b2d12f.tar.xz manaplus-da98d12637db106b87341560cc72ca6207b2d12f.zip |
Add configure and cmake option to enable/disable compilation for tmwa/evol.
Tmwa/evol by default enabled.
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rwxr-xr-x | configure.ac | 11 | ||||
-rw-r--r-- | src/CMakeLists.txt | 11 | ||||
-rw-r--r-- | src/Makefile.am | 11 | ||||
-rw-r--r-- | src/gui/models/typelistmodel.h | 13 | ||||
-rw-r--r-- | src/gui/windows/editserverdialog.cpp | 25 | ||||
-rw-r--r-- | src/gui/windows/serverdialog.cpp | 8 | ||||
-rw-r--r-- | src/net/net.cpp | 10 | ||||
-rw-r--r-- | src/net/netconsts.h | 4 | ||||
-rw-r--r-- | src/net/serverinfo.h | 10 |
10 files changed, 87 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b0dbab863..50ac51fb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ FIND_PACKAGE(Gettext) OPTION(WITH_OPENGL "Enable OpenGL support" ON) OPTION(ENABLE_NLS "Enable building of tranlations" ON) OPTION(ENABLE_EATHENA "Enable eAthena support" ON) +OPTION(ENABLE_TMWA "Enable tmwA support" ON) IF (WIN32) SET(PKG_DATADIR ".") diff --git a/configure.ac b/configure.ac index 9f3e21731..dfbba60cf 100755 --- a/configure.ac +++ b/configure.ac @@ -287,6 +287,17 @@ esac],[with_eathena=false]) AM_CONDITIONAL(ENABLE_EATHENA, test x$with_eathena = xtrue) +# Enable tmwA +AC_ARG_ENABLE(tmwa, +[ --enable-tmwa Turn on tmwA support], +[case "${enableval}" in + yes) with_tmwa=true ;; + no) with_tmwa=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-tmwa) ;; +esac],[with_tmwa=true]) + +AM_CONDITIONAL(ENABLE_TMWA, test x$with_tmwa = xtrue) + # Enable checks AC_ARG_ENABLE(checks, [ --enable-checks Turn on internal checks (can be slow)], diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a6cbcb69f..171ee9245 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,6 +29,9 @@ ENDIF() IF (ENABLE_EATHENA) SET(FLAGS "${FLAGS} -DEATHENA_SUPPORT=1") ENDIF() +IF (ENABLE_TMWA) + SET(FLAGS "${FLAGS} -DTMWA_SUPPORT=1") +ENDIF() IF (CMAKE_BUILD_TYPE) STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) @@ -1396,11 +1399,13 @@ ENDIF () SET (PROGRAMS manaplus dyecmd) IF (ENABLE_EATHENA) - ADD_EXECUTABLE(manaplus WIN32 ${SRCS} ${SRCS_EATHENA} ${SRCS_TMWA} ${SRCS_EVOL}) -ELSE(ENABLE_EATHENA) - ADD_EXECUTABLE(manaplus WIN32 ${SRCS} ${SRCS_TMWA} ${SRCS_EVOL}) + SET(SRCS ${SRCS} ${SRCS_EATHENA}) ENDIF(ENABLE_EATHENA) +IF (ENABLE_TMWA) + SET(SRCS ${SRCS} ${SRCS_TMWA}) +ENDIF(ENABLE_TMWA) +ADD_EXECUTABLE(manaplus WIN32 ${SRCS} ${SRCS_EVOL}) ADD_EXECUTABLE(dyecmd WIN32 ${DYE_CMD_SRCS}) TARGET_LINK_LIBRARIES(manaplus diff --git a/src/Makefile.am b/src/Makefile.am index 993d1ab63..38cf3310a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1156,9 +1156,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ vector.h \ resources/map/walklayer.cpp \ resources/map/walklayer.h \ - winver.h - -manaplus_SOURCES += \ + winver.h \ net/ea/gui/guildtab.cpp \ net/ea/gui/guildtab.h \ net/ea/gui/partytab.cpp \ @@ -1197,7 +1195,11 @@ manaplus_SOURCES += \ net/ea/skillhandler.h \ net/ea/token.h \ net/ea/tradehandler.cpp \ - net/ea/tradehandler.h \ + net/ea/tradehandler.h + +if ENABLE_TMWA +manaplus_CXXFLAGS += -DTMWA_SUPPORT +manaplus_SOURCES += \ net/tmwa/adminhandler.cpp \ net/tmwa/adminhandler.h \ net/tmwa/attrs.h \ @@ -1250,6 +1252,7 @@ manaplus_SOURCES += \ net/tmwa/sprite.h \ net/tmwa/tradehandler.cpp \ net/tmwa/tradehandler.h +endif if ENABLE_EATHENA manaplus_CXXFLAGS += -DEATHENA_SUPPORT diff --git a/src/gui/models/typelistmodel.h b/src/gui/models/typelistmodel.h index 2db290e70..bd27fce39 100644 --- a/src/gui/models/typelistmodel.h +++ b/src/gui/models/typelistmodel.h @@ -37,8 +37,10 @@ class TypeListModel final : public ListModel * Used to get number of line in the list */ int getNumberOfElements() override final A_WARN_UNUSED -#ifdef EATHENA_SUPPORT +#if defined(EATHENA_SUPPORT) && defined(TMWA_SUPPORT) { return 3; } +#elif defined(EATHENA_SUPPORT) + { return 1; } #else { return 2; } #endif @@ -49,6 +51,7 @@ class TypeListModel final : public ListModel std::string getElementAt(int elementIndex) override final A_WARN_UNUSED { +#ifdef TMWA_SUPPORT if (elementIndex == 0) return "TmwAthena"; else if (elementIndex == 1) @@ -56,7 +59,13 @@ class TypeListModel final : public ListModel #ifdef EATHENA_SUPPORT else if (elementIndex == 2) return "eAthena"; -#endif +#endif // EATHENA_SUPPORT +#else // TMWA_SUPPORT +#ifdef EATHENA_SUPPORT + if (elementIndex == 0) + return "eAthena"; +#endif // EATHENA_SUPPORT +#endif // TMWA_SUPPORT else return "Unknown"; } diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index 11f22fafe..3dd7dd72b 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -145,21 +145,28 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, switch (mServer.type) { -#ifdef EATHENA_SUPPORT case ServerInfo::EATHENA: +#ifdef EATHENA_SUPPORT +#ifdef TMWA_SUPPORT mTypeField->setSelected(2); +#else // TMWA_SUPPORT + mTypeField->setSelected(0); +#endif // TMWA_SUPPORT +#else // EATHENA_SUPPORT + mTypeField->setSelected(0); +#endif // EATHENA_SUPPORT break; -#endif default: case ServerInfo::UNKNOWN: case ServerInfo::TMWATHENA: -#ifndef EATHENA_SUPPORT - case ServerInfo::EATHENA: -#endif mTypeField->setSelected(0); break; case ServerInfo::EVOL: +#ifdef TMWA_SUPPORT mTypeField->setSelected(1); +#else // TMWA_SUPPORT + mTypeField->setSelected(0); +#endif // TMWA_SUPPORT break; } @@ -220,6 +227,7 @@ void EditServerDialog::action(const ActionEvent &event) { switch (mTypeField->getSelected()) { +#ifdef TMWA_SUPPORT case 0: mServer.type = ServerInfo::TMWATHENA; break; @@ -231,6 +239,13 @@ void EditServerDialog::action(const ActionEvent &event) mServer.type = ServerInfo::EATHENA; break; #endif +#else +#ifdef EATHENA_SUPPORT + case 0: + mServer.type = ServerInfo::EATHENA; + break; +#endif +#endif default: mServer.type = ServerInfo::UNKNOWN; break; diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 2b1996bdb..23a066ade 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -66,10 +66,16 @@ static std::string serverTypeToString(const ServerInfo::Type type) { switch (type) { +#ifdef TMWA_SUPPORT case ServerInfo::TMWATHENA: return "TmwAthena"; case ServerInfo::EVOL: return "Evol"; +#else + case ServerInfo::TMWATHENA: + case ServerInfo::EVOL: + return ""; +#endif case ServerInfo::EATHENA: #ifdef EATHENA_SUPPORT return "eAthena"; @@ -90,8 +96,10 @@ static uint16_t defaultPortForServerType(const ServerInfo::Type type) return 6900; #endif case ServerInfo::UNKNOWN: +#ifdef TMWA_SUPPORT case ServerInfo::TMWATHENA: case ServerInfo::EVOL: +#endif return 6901; } } diff --git a/src/net/net.cpp b/src/net/net.cpp index 1ca5ac5c0..aee279a58 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -26,7 +26,9 @@ #include "net/loginhandler.h" +#ifdef TMWA_SUPPORT #include "net/tmwa/generalhandler.h" +#endif #ifdef EATHENA_SUPPORT #include "net/eathena/generalhandler.h" @@ -161,9 +163,6 @@ void connectToServer(const ServerInfo &server) switch (server.type) { - case ServerInfo::EVOL: - new TmwAthena::GeneralHandler; - break; case ServerInfo::EATHENA: #ifdef EATHENA_SUPPORT new EAthena::GeneralHandler; @@ -172,9 +171,14 @@ void connectToServer(const ServerInfo &server) #endif break; case ServerInfo::TMWATHENA: + case ServerInfo::EVOL: case ServerInfo::UNKNOWN: default: +#ifdef TMWA_SUPPORT new TmwAthena::GeneralHandler; +#else + new EAthena::GeneralHandler; +#endif break; } diff --git a/src/net/netconsts.h b/src/net/netconsts.h index 1ea1c579e..1977698ea 100644 --- a/src/net/netconsts.h +++ b/src/net/netconsts.h @@ -27,6 +27,10 @@ #include <stdint.h> #endif +#ifdef EATHENA_SUPPORT +static const uint16_t DEFAULT_PORT = 6900; +#else static const uint16_t DEFAULT_PORT = 6901; +#endif #endif // NET_NETCONSTS_H diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h index c523ecce7..c3e1ac5ad 100644 --- a/src/net/serverinfo.h +++ b/src/net/serverinfo.h @@ -69,7 +69,11 @@ class ServerInfo final onlineListUrl(), supportUrl(), updateMirrors(), +#ifdef EATHENA_SUPPORT + port(6900), +#else port(6901), +#endif version(), save(false), persistentIp(true) @@ -133,10 +137,16 @@ class ServerInfo final static Type parseType(const std::string &serverType) A_WARN_UNUSED { +#ifdef TMWA_SUPPORT if (compareStrI(serverType, "tmwathena") == 0) return TMWATHENA; if (compareStrI(serverType, "evol") == 0) return EVOL; +#else + if (compareStrI(serverType, "tmwathena") == 0 + || compareStrI(serverType, "evol") == 0) + return EATHENA; +#endif #ifdef EATHENA_SUPPORT else if (compareStrI(serverType, "eathena") == 0) return EATHENA; |