Add OPTION_WEBSERVER to cmake
to be able to build with/without WEBSERVER services git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6270 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: c0b1609bda1538082cb2a657166feaa6cc83d31b Former-commit-id: 0152c643f33dc0b9ce46e90279eb85d471d56e82
This commit is contained in:
parent
a5486d95c0
commit
af9039930c
17 changed files with 157 additions and 52 deletions
|
@ -264,16 +264,17 @@ MACRO(CHECK_LIBRARIES)
|
|||
ENDIF(SDL_FOUND)
|
||||
ENDIF(OPTION_SDL2)
|
||||
|
||||
IF(OPTION_WEBSERVER)
|
||||
# CURL
|
||||
Find_Package(CURL)
|
||||
|
||||
# CURL
|
||||
Find_Package(CURL)
|
||||
|
||||
IF(CURL_FOUND)
|
||||
SET(HAVE_CURL 1)
|
||||
MESSAGE(STATUS "Looking for library CURL - found")
|
||||
ELSE(CURL_FOUND)
|
||||
MESSAGE(STATUS "Looking for library CURL - NOT found")
|
||||
ENDIF(CURL_FOUND)
|
||||
IF(CURL_FOUND)
|
||||
SET(HAVE_CURL 1)
|
||||
MESSAGE(STATUS "Looking for library CURL - found")
|
||||
ELSE(CURL_FOUND)
|
||||
MESSAGE(STATUS "Looking for library CURL - NOT found")
|
||||
ENDIF(CURL_FOUND)
|
||||
ENDIF(OPTION_WEBSERVER)
|
||||
|
||||
|
||||
# OSG
|
||||
|
|
|
@ -187,9 +187,11 @@ MACRO(_FIND_3RDPARTY_DEPENDENCIES ROOT_DIR)
|
|||
|
||||
# JPEG.
|
||||
_FIND_3RDPARTY_DEPENDENCY(JPEG jpeglib.h "" "jpeg_s;jpeg;jpeg-8;jpeg-9" ${ROOT_DIR} "")
|
||||
|
||||
# CURL.
|
||||
_FIND_3RDPARTY_DEPENDENCY(CURL curl/curl.h "" "libcurl;libcurl_imp" ${ROOT_DIR} "")
|
||||
|
||||
IF(OPTION_WEBSERVER)
|
||||
# CURL.
|
||||
_FIND_3RDPARTY_DEPENDENCY(CURL curl/curl.h "" "libcurl;libcurl_imp" ${ROOT_DIR} "")
|
||||
ENDIF(OPTION_WEBSERVER)
|
||||
|
||||
# ZLib.
|
||||
_FIND_3RDPARTY_DEPENDENCY(ZLIB zlib.h "" "z;zlib;zlib1" ${ROOT_DIR} "D")
|
||||
|
@ -401,8 +403,10 @@ MACRO(SD_INSTALL_CUSTOM_3RDPARTY TARGET_NAME)
|
|||
_FIND_3RDPARTY_DLL("${JPEG_LIBRARY}" "jpeg;jpeg-8;jpeg-9" "lib" _DLL_PATHNAME)
|
||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||
|
||||
_FIND_3RDPARTY_DLL("${CURL_LIBRARY}" "curl" "lib" _DLL_PATHNAME)
|
||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||
IF(OPTION_WEBSERVER)
|
||||
_FIND_3RDPARTY_DLL("${CURL_LIBRARY}" "curl" "lib" _DLL_PATHNAME)
|
||||
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
|
||||
ENDIF(OPTION_WEBSERVER)
|
||||
|
||||
# 2) Copy found 3rd party DLL files to the bin folder (for running without installing).
|
||||
#MESSAGE(STATUS "3rdParty dependencies : Will install ${_THIRDPARTY_DLL_PATHNAMES}")
|
||||
|
|
|
@ -81,6 +81,8 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
|
|||
SET(OPTION_SDL2 true CACHE BOOL "Build with SDL2 instead of SDL 1.2")
|
||||
SET(OPTION_SDL_JOYSTICK true CACHE BOOL "Use SDL for Joystick instead of PLIB")
|
||||
|
||||
SET(OPTION_WEBSERVER false CACHE BOOL "Build with WebServer functionality")
|
||||
|
||||
IF(APPLE)
|
||||
# Automatically set OPTION_USE_MACPORTS (at least until someone fixes the regular APPLE build)
|
||||
MESSAGE(STATUS "Automatically set OPTION_USE_MACPORTS (at least until someone fixes the regular APPLE build)")
|
||||
|
@ -192,6 +194,10 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
|
|||
ADD_DEFINITIONS(-DSDL_JOYSTICK)
|
||||
ENDIF(OPTION_SDL_JOYSTICK)
|
||||
|
||||
IF(OPTION_WEBSERVER)
|
||||
ADD_DEFINITIONS(-DWEBSERVER)
|
||||
ENDIF(OPTION_WEBSERVER)
|
||||
|
||||
IF(OPTION_USE_MACPORTS)
|
||||
ADD_DEFINITIONS(-DUSE_MACPORTS)
|
||||
ENDIF(OPTION_USE_MACPORTS)
|
||||
|
|
|
@ -437,30 +437,32 @@ MACRO(ADD_JPEG_LIBRARY TARGET)
|
|||
|
||||
ENDMACRO(ADD_JPEG_LIBRARY TARGET)
|
||||
|
||||
#CURL
|
||||
MACRO(ADD_CURL_INCLUDEDIR)
|
||||
IF(OPTION_WEBSERVER)
|
||||
#CURL
|
||||
MACRO(ADD_CURL_INCLUDEDIR)
|
||||
|
||||
FIND_PACKAGE(CURL)
|
||||
FIND_PACKAGE(CURL)
|
||||
|
||||
IF(CURL_FOUND)
|
||||
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
|
||||
ELSE(CURL_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find CURL header files")
|
||||
ENDIF(CURL_FOUND)
|
||||
IF(CURL_FOUND)
|
||||
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
|
||||
ELSE(CURL_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find CURL header files")
|
||||
ENDIF(CURL_FOUND)
|
||||
|
||||
ENDMACRO(ADD_CURL_INCLUDEDIR)
|
||||
ENDMACRO(ADD_CURL_INCLUDEDIR)
|
||||
|
||||
MACRO(ADD_CURL_LIBRARY TARGET)
|
||||
MACRO(ADD_CURL_LIBRARY TARGET)
|
||||
|
||||
FIND_PACKAGE(CURL)
|
||||
FIND_PACKAGE(CURL)
|
||||
|
||||
IF(CURL_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${CURL_LIBRARY})
|
||||
ELSE(CURL_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find CURL libraries")
|
||||
ENDIF(CURL_FOUND)
|
||||
IF(CURL_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${CURL_LIBRARY})
|
||||
ELSE(CURL_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find CURL libraries")
|
||||
ENDIF(CURL_FOUND)
|
||||
|
||||
ENDMACRO(ADD_CURL_LIBRARY TARGET)
|
||||
ENDMACRO(ADD_CURL_LIBRARY TARGET)
|
||||
ENDIF(OPTION_WEBSERVER)
|
||||
|
||||
MACRO(ADD_X11_INCLUDEDIR)
|
||||
|
||||
|
|
|
@ -1681,6 +1681,7 @@ GfParmWriteBuf (void *handle, char *buf, int size) /* Never used in current code
|
|||
return 0; // Success
|
||||
}
|
||||
|
||||
#ifdef WEBSERVER
|
||||
/** Write a configuration string.
|
||||
@ingroup conf
|
||||
@param handle Configuration handle
|
||||
|
@ -1710,6 +1711,7 @@ GfParmWriteString (void *handle, std::string& str)
|
|||
|
||||
return 0; // Success
|
||||
}
|
||||
#endif //WEBSERVER
|
||||
|
||||
/** Set the dtd path and header if necessary
|
||||
@ingroup conf
|
||||
|
|
|
@ -413,8 +413,9 @@ TGF_API int GfParmWriteFile(const char *file, void* handle, const char *name);
|
|||
TGF_API int GfParmWriteFileSDHeader(const char *file, void* handle, const char *name, const char *author, bool trace = true);
|
||||
/* write a parameter file to a supplied buffer */
|
||||
TGF_API int GfParmWriteBuf(void *handle, char *buf, int size);/* Never used in current codebase: to be removed? */
|
||||
#ifdef WEBSERVER
|
||||
TGF_API int GfParmWriteString(void *handle, std::string& str);
|
||||
|
||||
#endif //WEBSERVER
|
||||
|
||||
TGF_API char *GfParmGetName(void *handle);
|
||||
TGF_API char *GfParmGetFileName(void *handle);
|
||||
|
|
|
@ -13,17 +13,31 @@ ADD_JPEG_INCLUDEDIR()
|
|||
ADD_PLIB_INCLUDEDIR()
|
||||
ADD_OPENAL_INCLUDEDIR()
|
||||
ADD_VORBIS_INCLUDEDIR()
|
||||
ADD_CURL_INCLUDEDIR()
|
||||
IF(OPTION_WEBSERVER)
|
||||
ADD_CURL_INCLUDEDIR()
|
||||
ENDIF(OPTION_WEBSERVER)
|
||||
|
||||
IF(OPTION_WEBSERVER)
|
||||
SET(_SOURCES control.cpp glfeatures.cpp guibutton.cpp guifont.cpp
|
||||
guiimage.cpp guimenu.cpp guiscrollbar.cpp guitexture.cpp
|
||||
tgfclient.cpp gui.cpp guiedit.cpp guihelp.cpp
|
||||
guilabel.cpp guiobject.cpp guiscrollist.cpp
|
||||
guicombobox.cpp guicheckbox.cpp guiprogresbar.cpp
|
||||
guiscreen.cpp guieventloop.cpp guiapplication.cpp
|
||||
musicplayer.cpp musicplayer.h
|
||||
glfeatures.h gui.h guiscreen.h guimenu.h tgfclient.h guifont.h
|
||||
webserver.h webserver.cpp)
|
||||
ELSE(OPTION_WEBSERVER)
|
||||
SET(_SOURCES control.cpp glfeatures.cpp guibutton.cpp guifont.cpp
|
||||
guiimage.cpp guimenu.cpp guiscrollbar.cpp guitexture.cpp
|
||||
tgfclient.cpp gui.cpp guiedit.cpp guihelp.cpp
|
||||
guilabel.cpp guiobject.cpp guiscrollist.cpp
|
||||
guicombobox.cpp guicheckbox.cpp guiprogresbar.cpp
|
||||
guiscreen.cpp guieventloop.cpp guiapplication.cpp
|
||||
musicplayer.cpp musicplayer.h
|
||||
glfeatures.h gui.h guiscreen.h guimenu.h tgfclient.h guifont.h)
|
||||
ENDIF(OPTION_WEBSERVER)
|
||||
|
||||
SET(_SOURCES control.cpp glfeatures.cpp guibutton.cpp guifont.cpp
|
||||
guiimage.cpp guimenu.cpp guiscrollbar.cpp guitexture.cpp
|
||||
tgfclient.cpp gui.cpp guiedit.cpp guihelp.cpp
|
||||
guilabel.cpp guiobject.cpp guiscrollist.cpp
|
||||
guicombobox.cpp guicheckbox.cpp guiprogresbar.cpp
|
||||
guiscreen.cpp guieventloop.cpp guiapplication.cpp
|
||||
musicplayer.cpp musicplayer.h
|
||||
glfeatures.h gui.h guiscreen.h guimenu.h tgfclient.h guifont.h
|
||||
webserver.h webserver.cpp)
|
||||
SET(_OTHER_SOURCES guimenutest.xml)
|
||||
|
||||
SET(_SOURCES ${_SOURCES}
|
||||
|
@ -65,7 +79,9 @@ ADD_SDLIB_LIBRARY(tgfclient portability tgf networking)
|
|||
|
||||
ADD_PNG_LIBRARY(tgfclient)
|
||||
ADD_JPEG_LIBRARY(tgfclient)
|
||||
ADD_CURL_LIBRARY(tgfclient)
|
||||
IF(OPTION_WEBSERVER)
|
||||
ADD_CURL_LIBRARY(tgfclient)
|
||||
ENDIF(OPTION_WEBSERVER)
|
||||
|
||||
IF(OPENGL_FOUND)
|
||||
TARGET_LINK_LIBRARIES(tgfclient ${OPENGL_LIBRARY})
|
||||
|
|
|
@ -20,10 +20,12 @@
|
|||
|
||||
#include "tgfclient.h"
|
||||
|
||||
#ifdef WEBSERVER
|
||||
#include "webserver.h"
|
||||
|
||||
extern NotificationManager notifications;
|
||||
extern TGFCLIENT_API WebServer webServer;
|
||||
#endif //WEBSERVER
|
||||
|
||||
|
||||
|
||||
|
@ -301,8 +303,10 @@ void GfuiEventLoop::postRedisplay(void)
|
|||
|
||||
void GfuiEventLoop::forceRedisplay()
|
||||
{
|
||||
#ifdef WEBSERVER
|
||||
webServer.updateAsyncStatus();
|
||||
notifications.updateStatus();
|
||||
notifications.updateStatus();
|
||||
#endif //WEBSERVER
|
||||
|
||||
if (_pPrivate->cbDisplay)
|
||||
_pPrivate->cbDisplay();
|
||||
|
@ -311,8 +315,10 @@ void GfuiEventLoop::forceRedisplay()
|
|||
|
||||
void GfuiEventLoop::redisplay()
|
||||
{
|
||||
#ifdef WEBSERVER
|
||||
//temp
|
||||
_pPrivate->bRedisplay=true;
|
||||
#endif //WEBSERVER
|
||||
|
||||
// Refresh display if requested and if any redisplay CB.
|
||||
if (_pPrivate->bRedisplay)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
@author <a href=mailto:madbad82@gmail.com>MadBad</a>
|
||||
@version $Id$
|
||||
*/
|
||||
#ifdef WEBSERVER
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -904,5 +905,6 @@ int WebServer::sendRaceEnd (int race_id, int endposition){
|
|||
|
||||
//initialize the web server
|
||||
WebServer webServer;
|
||||
#endif //WEBSERVER
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
@author <a href=mailto:madbad82@gmail.com>MadBad</a>
|
||||
@version $Id$
|
||||
*/
|
||||
#ifdef WEBSERVER
|
||||
#include "tgfclient.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
@ -124,5 +125,6 @@ class TGFCLIENT_API WebServer {
|
|||
//destructor
|
||||
~WebServer();
|
||||
};
|
||||
#endif //WEBSERVER
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,11 @@ SET(_OTHER_SOURCES )
|
|||
|
||||
ADD_INTERFACE_INCLUDEDIR()
|
||||
|
||||
ADD_SDLIB_INCLUDEDIR(math portability robottools tgf tgfdata networking tgfclient)
|
||||
IF(OPTION_WEBSERVER)
|
||||
ADD_SDLIB_INCLUDEDIR(math portability robottools tgf tgfdata networking tgfclient)
|
||||
ELSE(OPTION_WEBSERVER)
|
||||
ADD_SDLIB_INCLUDEDIR(math portability robottools tgf tgfdata networking)
|
||||
ENDIF(OPTION_WEBSERVER)
|
||||
|
||||
ADD_PLIB_INCLUDEDIR()
|
||||
|
||||
|
|
|
@ -27,8 +27,10 @@
|
|||
#include <string>
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
#ifdef WEBSERVER
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
#endif //WEBSERVER
|
||||
|
||||
#ifdef THIRD_PARTY_SQLITE3
|
||||
#include <sqlite3.h>
|
||||
|
@ -42,7 +44,9 @@
|
|||
|
||||
#include <portability.h>
|
||||
#include <tgf.hpp>
|
||||
#ifdef WEBSERVER
|
||||
#include <webserver.h>
|
||||
#endif //WEBSERVER
|
||||
|
||||
#include <racemanagers.h>
|
||||
#include <race.h>
|
||||
|
@ -58,7 +62,10 @@
|
|||
|
||||
#include "raceinit.h"
|
||||
|
||||
#ifdef WEBSERVER
|
||||
extern TGFCLIENT_API WebServer webServer;
|
||||
#endif //WEBSERVER
|
||||
|
||||
|
||||
static const char *aPszSkillLevelNames[] =
|
||||
{ ROB_VAL_ARCADE, ROB_VAL_SEMI_ROOKIE, ROB_VAL_ROOKIE, ROB_VAL_AMATEUR, ROB_VAL_SEMI_PRO, ROB_VAL_PRO };
|
||||
|
@ -958,7 +965,7 @@ ReInitCars(void)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WEBSERVER
|
||||
// webServer lap logger.
|
||||
//Find human cars
|
||||
for (int i = 0; i < ReInfo->s->_ncars; i++) {
|
||||
|
@ -980,7 +987,7 @@ ReInitCars(void)
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
#endif //WEBSERVER
|
||||
|
||||
|
||||
ReInfo->_rePitRequester = 0;
|
||||
|
|
|
@ -58,7 +58,6 @@ extern tModList *ReRacingRobotsModList;
|
|||
struct RmInfo;
|
||||
extern struct RmInfo *ReInfo;
|
||||
|
||||
|
||||
#endif /* _RACEINIT_H_ */
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
|
||||
#include <portability.h>
|
||||
#include <robot.h>
|
||||
#ifdef WEBSERVER
|
||||
#include <webserver.h>
|
||||
#endif //WEBSERVER
|
||||
|
||||
#include "standardgame.h"
|
||||
|
||||
|
|
|
@ -38,7 +38,9 @@
|
|||
#include <robot.h>
|
||||
#include <raceman.h>
|
||||
#include <replay.h>
|
||||
#ifdef WEBSERVER
|
||||
#include <webserver.h>
|
||||
#endif //WEBSERVER
|
||||
|
||||
#include "standardgame.h"
|
||||
|
||||
|
@ -372,7 +374,8 @@ void ReSituationUpdater::runOneStep(double deltaTimeIncrement)
|
|||
if (replayRecord && pCurrReInfo->s->currentTime >= replayTimestamp) {
|
||||
replaySituation(pCurrReInfo);
|
||||
}
|
||||
|
||||
|
||||
#ifdef WEBSERVER
|
||||
// webServer lap logger.
|
||||
extern TGFCLIENT_API WebServer webServer;
|
||||
//Find human cars
|
||||
|
@ -421,6 +424,8 @@ void ReSituationUpdater::runOneStep(double deltaTimeIncrement)
|
|||
}
|
||||
}
|
||||
webServer.updateAsyncStatus();
|
||||
#endif //WEBSERVER
|
||||
|
||||
}
|
||||
|
||||
int ReSituationUpdater::threadLoop(void* pUpdater)
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
#include <playerpref.h>
|
||||
#include <graphic.h>
|
||||
#include <gui.h>
|
||||
#ifdef WEBSERVER
|
||||
#include <webserver.h>
|
||||
#endif //WEBSERVER
|
||||
|
||||
#include <drivers.h>
|
||||
|
||||
|
@ -41,8 +43,10 @@ static const char *PlayerNamePrompt = "-- Enter name --";
|
|||
static const char *NoPlayer = "-- No one --";
|
||||
static const char *HumanDriverModuleName = "human";
|
||||
static const char *DefaultCarName = "sc-lynx-220";
|
||||
#ifdef WEBSERVER
|
||||
static const char *DefaultWebserverusername = "username";
|
||||
static const char *DefaultWebserverpassword = "password";
|
||||
#endif //WEBSERVER
|
||||
|
||||
static const char *SkillLevelString[] = { ROB_VAL_ARCADE, ROB_VAL_SEMI_ROOKIE, ROB_VAL_ROOKIE, ROB_VAL_AMATEUR, ROB_VAL_SEMI_PRO, ROB_VAL_PRO };
|
||||
static const int NbSkillLevels = sizeof(SkillLevelString) / sizeof(SkillLevelString[0]);
|
||||
|
@ -68,16 +72,20 @@ static int AutoReverseEditId;
|
|||
static int AutoReverseLeftId;
|
||||
static int AutoReverseRightId;
|
||||
static int AutoReverseLabelId;
|
||||
#ifdef WEBSERVER
|
||||
static int WebUsernameEditId;
|
||||
static int WebPasswordEditId;
|
||||
#endif //WEBSERVER
|
||||
|
||||
/* Struct to define a generic ("internal name / id", "displayable name") pair */
|
||||
typedef struct tInfo
|
||||
{
|
||||
char *name;
|
||||
char *dispname;
|
||||
#ifdef WEBSERVER
|
||||
char *webserverusername;
|
||||
char *webserverpassword;
|
||||
#endif //WEBSERVER
|
||||
|
||||
} tInfo;
|
||||
|
||||
|
@ -90,9 +98,13 @@ public:
|
|||
const char *defcarname = 0, int racenumber = 0, int skilllevel = 0,
|
||||
float *color = 0,
|
||||
tGearChangeMode gearchangemode = GEAR_MODE_AUTO, int autoreverse = 0,
|
||||
int nbpitstops = 0,
|
||||
int nbpitstops = 0
|
||||
#ifdef WEBSERVER
|
||||
,
|
||||
const char *webserverusername = 0,
|
||||
const char *webserverpassword = 0)
|
||||
const char *webserverpassword = 0
|
||||
#endif //WEBSERVER
|
||||
)
|
||||
{
|
||||
_info.name = 0;
|
||||
setName(name);
|
||||
|
@ -105,10 +117,12 @@ public:
|
|||
_nbpitstops = nbpitstops;
|
||||
_skilllevel = skilllevel;
|
||||
_autoreverse = autoreverse;
|
||||
#ifdef WEBSERVER
|
||||
_webserverusername = 0;
|
||||
setWebserverusername(webserverusername);
|
||||
_webserverpassword = 0;
|
||||
setWebserverpassword(webserverpassword);
|
||||
#endif //WEBSERVER
|
||||
_color[0] = color ? color[0] : 1.0;
|
||||
_color[1] = color ? color[1] : 1.0;
|
||||
_color[2] = color ? color[2] : 0.5;
|
||||
|
@ -128,10 +142,12 @@ public:
|
|||
_nbpitstops = src._nbpitstops;
|
||||
_skilllevel = src._skilllevel;
|
||||
_autoreverse = src._autoreverse;
|
||||
#ifdef WEBSERVER
|
||||
_info.webserverusername = 0;
|
||||
setWebserverusername(src._info.webserverusername);
|
||||
_info.webserverpassword = 0;
|
||||
setWebserverpassword(src._info.webserverpassword);
|
||||
#endif //WEBSERVER
|
||||
_color[0] = src._color[0];
|
||||
_color[1] = src._color[1];
|
||||
_color[2] = src._color[2];
|
||||
|
@ -147,8 +163,10 @@ public:
|
|||
float color(int idx) const { return (idx >= 0 && idx < 4) ? _color[idx] : 0.0; }
|
||||
int skillLevel() const { return _skilllevel; }
|
||||
int autoReverse() const { return _autoreverse; }
|
||||
#ifdef WEBSERVER
|
||||
const char *webserverusername() const { return _webserverusername; }
|
||||
const char *webserverpassword() const { return _webserverpassword; }
|
||||
#endif //WEBSERVER
|
||||
|
||||
void setName(const char *name)
|
||||
{
|
||||
|
@ -177,6 +195,8 @@ public:
|
|||
_defcarname = new char[strlen(defcarname)+1];
|
||||
strcpy(_defcarname, defcarname); // Can't use strdup : free crashes in destructor !?
|
||||
}
|
||||
|
||||
#ifdef WEBSERVER
|
||||
void setWebserverusername(const char *webserverusername)
|
||||
{
|
||||
if (_webserverusername)
|
||||
|
@ -195,6 +215,8 @@ public:
|
|||
_webserverpassword = new char[strlen(webserverpassword)+1];
|
||||
strcpy(_webserverpassword, webserverpassword); // Can't use strdup : free crashes in destructor !?
|
||||
}
|
||||
#endif //WEBSERVER
|
||||
|
||||
void setRaceNumber(int raceNumber) { _racenumber = raceNumber; }
|
||||
void setGearChangeMode(tGearChangeMode gearChangeMode) { _gearchangemode = gearChangeMode; }
|
||||
void setNbPitStops(int nbPitStops) { _nbpitstops = nbPitStops; }
|
||||
|
@ -209,10 +231,14 @@ public:
|
|||
delete[] _info.name;
|
||||
if (_defcarname)
|
||||
delete[] _defcarname;
|
||||
|
||||
#ifdef WEBSERVER
|
||||
if (_webserverusername)
|
||||
delete[] _webserverusername;
|
||||
if (_webserverpassword)
|
||||
delete[] _webserverpassword;
|
||||
#endif //WEBSERVER
|
||||
|
||||
}
|
||||
|
||||
// Gear change mode enum to string conversion
|
||||
|
@ -243,8 +269,10 @@ private:
|
|||
float _color[4];
|
||||
int _skilllevel;
|
||||
int _autoreverse;
|
||||
#ifdef WEBSERVER
|
||||
char* _webserverusername;
|
||||
char* _webserverpassword;
|
||||
#endif //WEBSERVER
|
||||
};
|
||||
|
||||
|
||||
|
@ -289,12 +317,13 @@ refreshEditVal(void)
|
|||
GfuiLabelSetText(ScrHandle, AutoReverseEditId, "");
|
||||
GfuiEnable(ScrHandle, AutoReverseEditId, GFUI_DISABLE);
|
||||
|
||||
#ifdef WEBSERVER
|
||||
GfuiEditboxSetString(ScrHandle, WebUsernameEditId, "");
|
||||
GfuiEnable(ScrHandle, WebUsernameEditId, GFUI_DISABLE);
|
||||
|
||||
GfuiEditboxSetString(ScrHandle, WebPasswordEditId, "");
|
||||
GfuiEnable(ScrHandle, WebPasswordEditId, GFUI_DISABLE);
|
||||
|
||||
#endif //WEBSERVER
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -322,6 +351,7 @@ refreshEditVal(void)
|
|||
GfuiLabelSetText(ScrHandle, AutoReverseEditId, Yn[(*CurrPlayer)->autoReverse()]);
|
||||
GfuiEnable(ScrHandle, AutoReverseEditId, GFUI_ENABLE);
|
||||
|
||||
#ifdef WEBSERVER
|
||||
snprintf(buf, sizeof(buf), "%s", (*CurrPlayer)->webserverusername());
|
||||
GfuiEditboxSetString(ScrHandle, WebUsernameEditId, buf);
|
||||
GfuiEnable(ScrHandle, WebUsernameEditId, GFUI_ENABLE);
|
||||
|
@ -329,6 +359,7 @@ refreshEditVal(void)
|
|||
snprintf(buf, sizeof(buf), "%s", (*CurrPlayer)->webserverpassword());
|
||||
GfuiEditboxSetString(ScrHandle, WebPasswordEditId, buf);
|
||||
GfuiEnable(ScrHandle, WebPasswordEditId, GFUI_ENABLE);
|
||||
#endif //WEBSERVER
|
||||
|
||||
|
||||
if ((*CurrPlayer)->gearChangeMode() == GEAR_MODE_AUTO)
|
||||
|
@ -432,8 +463,10 @@ PutPlayerSettings(unsigned index)
|
|||
GfParmSetStr(PrefHdle, drvSectionPath, HM_ATT_TRANS, player->gearChangeModeString());
|
||||
GfParmSetNum(PrefHdle, drvSectionPath, HM_ATT_NBPITS, (char*)NULL, (tdble)player->nbPitStops());
|
||||
GfParmSetStr(PrefHdle, drvSectionPath, HM_ATT_AUTOREVERSE, Yn[player->autoReverse()]);
|
||||
#ifdef WEBSERVER
|
||||
GfParmSetStr(PrefHdle, drvSectionPath, "WebServerUsername", player->webserverusername());
|
||||
GfParmSetStr(PrefHdle, drvSectionPath, "WebServerPassword", player->webserverpassword());
|
||||
#endif //WEBSERVER
|
||||
|
||||
|
||||
/* Allow neutral gear in sequential mode if neutral gear command not defined */
|
||||
|
@ -702,11 +735,14 @@ GenPlayerList(void)
|
|||
PlayersInfo[i]->setAutoReverse(1);
|
||||
}
|
||||
|
||||
#ifdef WEBSERVER
|
||||
str = GfParmGetStr(PrefHdle, sstring, "WebServerUsername", 0);
|
||||
PlayersInfo[i]->setWebserverusername(str);
|
||||
|
||||
str = GfParmGetStr(PrefHdle, sstring, "WebServerPassword", 0);
|
||||
PlayersInfo[i]->setWebserverpassword(str);
|
||||
#endif //WEBSERVER
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -792,6 +828,7 @@ onChangeName(void * /* dummy */)
|
|||
UpdtScrollList();
|
||||
}
|
||||
|
||||
#ifdef WEBSERVER
|
||||
static void
|
||||
onChangeWebserverusername(void * /* dummy */)
|
||||
{
|
||||
|
@ -853,6 +890,7 @@ static void onWebserverLoginTest(void * /* dummy */)
|
|||
GfuiApp().eventLoop().postRedisplay();
|
||||
}
|
||||
}
|
||||
#endif //WEBSERVER
|
||||
|
||||
//#641 New player name should get empty when clicking on it
|
||||
// In the Player Configuration menu, when you create
|
||||
|
@ -1056,12 +1094,14 @@ PlayerConfigMenuInit(void *prevMenu)
|
|||
GfuiMenuCreateButtonControl(ScrHandle, param, "ApplyButton", NULL, onSavePlayerList);
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "CancelButton", NULL, onQuitPlayerConfig);
|
||||
|
||||
#ifdef WEBSERVER
|
||||
/* Web username and password editbox */
|
||||
WebUsernameEditId = GfuiMenuCreateEditControl(ScrHandle, param, "webusernameedit", NULL, NULL, onChangeWebserverusername);
|
||||
WebPasswordEditId = GfuiMenuCreateEditControl(ScrHandle, param, "webpasswordedit", NULL, NULL, onChangeWebserverpassword);
|
||||
|
||||
/* Web test button */
|
||||
GfuiMenuCreateButtonControl(ScrHandle, param, "weblogintest", NULL, onWebserverLoginTest);
|
||||
#endif //WEBSERVER
|
||||
|
||||
|
||||
// Close menu XML descriptor.
|
||||
|
|
|
@ -115,8 +115,12 @@ RmLoadingScreenStart(const char *title, const char *bgimg)
|
|||
// Display screen.
|
||||
GfuiScreenActivate(HScreen);
|
||||
GfuiDisplay();
|
||||
|
||||
#ifdef WEBSERVER
|
||||
//force one redisplay
|
||||
GfuiApp().eventLoop().forceRedisplay();
|
||||
#endif //WEBSERVER
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -176,7 +180,9 @@ RmLoadingScreenSetText(const char *text)
|
|||
while (i != CurTextLineIdx);
|
||||
|
||||
GfuiDisplay();
|
||||
#ifdef WEBSERVER
|
||||
//force one redisplay
|
||||
GfuiApp().eventLoop().forceRedisplay();
|
||||
#endif //WEBSERVER
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue