--- a/CMakeLists.txt Mon Apr 13 09:27:21 2009 +0000
+++ b/CMakeLists.txt Mon Apr 13 09:36:25 2009 +0000
@@ -24,7 +24,7 @@
if(WITH_SERVER)
set(HAVE_NETSERVER true)
- add_subdirectory(netserver)
+ add_subdirectory(gameServer)
else(WITH_SERVER)
set(HAVE_NETSERVER false)
endif(WITH_SERVER)
--- a/QTfrontend/gamecfgwidget.cpp Mon Apr 13 09:27:21 2009 +0000
+++ b/QTfrontend/gamecfgwidget.cpp Mon Apr 13 09:36:25 2009 +0000
@@ -50,6 +50,9 @@
GBoxOptionsLayout->addWidget(GameSchemes, 0, 1);
connect(GameSchemes, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeChanged(int)));
+ GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Game scheme"), GBoxOptions), 0, 0);
+
+
QPushButton * goToSchemePage = new QPushButton(GBoxOptions);
goToSchemePage->setText(tr("Edit schemes"));
GBoxOptionsLayout->addWidget(goToSchemePage, 1, 0, 1, 2);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gameServer/CMakeLists.txt Mon Apr 13 09:36:25 2009 +0000
@@ -0,0 +1,41 @@
+find_program(ghc_executable ghc)
+
+if (NOT ghc_executable)
+ message(FATAL_ERROR "Cannot find GHC")
+endif(NOT ghc_executable)
+
+set(hwserver_sources
+ OfficialServer/DBInteraction.hs
+ Actions.hs
+ ClientIO.hs
+ CoreTypes.hs
+ HWProtoCore.hs
+ HWProtoInRoomState.hs
+ HWProtoLobbyState.hs
+ HWProtoNEState.hs
+ NetRoutines.hs
+ Opts.hs
+ ServerCore.hs
+ Utils.hs
+ hedgewars-server.hs
+ )
+
+set(hwserv_main ${hedgewars_SOURCE_DIR}/gameServer/hedgewars-server.hs)
+
+set(ghc_flags
+ --make ${hwserv_main}
+ -i${hedgewars_SOURCE_DIR}/gameServer
+ -o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}
+ -odir ${CMAKE_CURRENT_BINARY_DIR}
+ -hidir ${CMAKE_CURRENT_BINARY_DIR})
+
+add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}"
+ COMMAND "${ghc_executable}"
+ ARGS ${ghc_flags}
+ MAIN_DEPENDENCY ${hwserv_main}
+ DEPENDS ${hwserver_sources}
+ )
+
+add_custom_target(hedgewars-server ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}")
+
+install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)
--- a/gameServer/OfficialServer/DBInteraction.hs Mon Apr 13 09:27:21 2009 +0000
+++ b/gameServer/OfficialServer/DBInteraction.hs Mon Apr 13 09:36:25 2009 +0000
@@ -1,11 +1,15 @@
+{-# LANGUAGE CPP #-}
module OfficialServer.DBInteraction
(
startDBConnection
) where
-import Prelude hiding (catch);
+#if defined(OFFICIAL_SERVER)
import Database.HDBC
import Database.HDBC.MySQL
+#endif
+
+import Prelude hiding (catch);
import System.IO
import Control.Concurrent
import Control.Exception
@@ -35,6 +39,7 @@
-- to be deleted --------------------------------------------------
-------------------------------------------------------------------
+#if defined(OFFICIAL_SERVER)
dbQueryString =
"select users.pass, users_roles.rid from users left join users_roles on users.uid = users_roles.uid where users.name = ?"
@@ -68,6 +73,9 @@
threadDelay (5 * 10^6)
dbConnectionLoop serverInfo
+#else
+dbConnectionLoop = fakeDbConnection
+#endif
startDBConnection serverInfo =
if (not . null $ dbHost serverInfo) then