-ADD_LIBRARY (Common Config.cxx Console.cxx FileSystem.cxx Message.cxx Misc.cxx Netcode.cxx RegEx.cxx)
+ADD_LIBRARY (Common Config.cxx Console.cxx FileSystem.cxx Message.cxx Misc.cxx Netcode.cxx RegEx.cxx
+ Time.cxx)
delete mIncludeRegEx;
}
-bool PConfig::LoadOptions(const char* nConfigTemplate[][2], const char* nConfigFile, int nDepth)
+bool PConfig::LoadOptions(const char *const nConfigTemplate[][2], const char *nConfigFile, int nDepth)
{
FILE *ConfigFile;
char line[255];
RegEx *mOptValRegEx;
RegEx *mIncludeRegEx;
- bool LoadOptions(const char *nConfigTemplate[][2], const char *nConfigFile, int32_t nDepth);
+ bool LoadOptions(const char *const nConfigTemplate[][2], const char *nConfigFile, int32_t nDepth);
public:
PConfig();
~PConfig();
- inline bool LoadOptions(const char *nConfigTemplate[][2], const char *nConfigFile)
+ inline bool LoadOptions(const char *const nConfigTemplate[][2], const char *nConfigFile)
{ return LoadOptions(nConfigTemplate, nConfigFile, 0); }
inline const std::string &GetOption(const char *Name) const { return GetOption((std::string) Name); }
const std::string &GetOption(const std::string Name) const;
--- /dev/null
+#pragma once
+
+namespace DefMain
+{
+ static const char *const Name = "TinNS";
+ static const char *const Version = "0.3 C++11 development";
+}
#include "Common/Config.hxx"
#include "Common/Console.hxx"
+#include "Common/Defaults.hxx"
#include "Common/FileSystem.hxx"
#include "Common/Message.hxx"
#include "Common/Misc.hxx"
#include "Common/Netcode.hxx"
#include "Common/RegEx.hxx"
-#include "Common/SVNrevision.hxx"
-#include "Common/Version.hxx"
+#include "Common/Time.hxx"
+++ /dev/null
-#pragma once
-
-#define TINNS_SVN_REVISION "AKIKO_CMAKE_R3"
-
--- /dev/null
+#include "Common/Time.hxx"
+
+namespace Time
+{
+ //--- functions ---
+
+ Timepoint now()
+ {
+ return Clock::now();
+ }
+
+ time_t toTimeT(const Timepoint &timepoint)
+ {
+ return Clock::to_time_t(timepoint);
+ }
+
+ Timepoint toTimepoint(const time_t timet)
+ {
+ return Clock::from_time_t(timet);
+ }
+}
--- /dev/null
+#pragma once
+
+#include <chrono>
+
+namespace Time
+{
+ //--- types ---
+ using Clock = std::chrono::system_clock;
+ using Rep = Clock::rep;
+ using Period = Clock::period;
+ using Duration = Clock::duration;
+ using Timepoint = Clock::time_point;
+
+ //--- functions ---
+ Timepoint now();
+ time_t toTimeT(const Timepoint &timepoint);
+ Timepoint toTimepoint(const time_t timet);
+}
+++ /dev/null
-#pragma once
-
-#include "Common/SVNrevision.hxx"
-
-#define TINNS_PATCH_VERSION "0.0.2 Dev"
-#define TINNS_INFO_VERSION "0.0.2 Dev"
-#define TINNS_GAME_VERSION "0.1.38 Dev"
TODO: put a single data_directory entry as the root directory for all NC data
*/
-static const char *GameConfigTemplate[][2] = {
+static const char *const GameConfigTemplate[][2] = {
// {option_name, default_value} if default_value is empty string, it means option is mandatory
// List ends with empty string for option_name
{"info_sql_host", "127.0.0.1"},
{"", ""} // do not change this line (end mark)
};
-static const char *CommandsTemplate[][2] = {
+static const char *const CommandsTemplate[][2] = {
{"debug", "100"},
{"settime", "100"},
{"warp", "0"},
void PCommands::doCmdversion()
{
char tmpChatMsg[300];
- snprintf(tmpChatMsg, 299, "You are on TinNS server %s runnig version %s - SVN Rev. %s", Config->GetOption("server_name").c_str(), ServerVersion, SVNRevision);
+ snprintf(tmpChatMsg, 299, "You are on TinNS server %s runnig version %s - SVN Rev. %s",
+ Config->GetOption("server_name").c_str(), DefMain::Version, DefMain::Version);
tmpChatMsg[299] = '\0';
Chat->send(source, CHAT_DIRECT, "System", tmpChatMsg);
// TODO: - Get logfile name from config file
-const char ServerVersion[] = TINNS_GAME_VERSION;
-const char SVNRevision[] = TINNS_SVN_REVISION;
-
PVehicles *Vehicles = 0;
PMySQL *MySQL = 0;
PConsole *Console = 0;
Console->Print(WHITE, BLUE, "/-------------------------------------------------------------------\\");
Console->Print(WHITE, BLUE, "| TinNS (TinNS is not a Neocron Server) |");
Console->Print(WHITE, BLUE, "| Copyright (C) 2005 Linux Addicted Community |");
- Console->Print(WHITE, BLUE, "| maintainer Akiko <akiko@gmx.org> |");
+ Console->Print(WHITE, BLUE, "| maintainer Akiko <akiko@linux-addicte.net> |");
Console->Print(WHITE, BLUE, "| ========================================== |");
Console->Print(WHITE, BLUE, "| Head coders: The packet analyzing team: |");
Console->Print(WHITE, BLUE, "| - Akiko - MaxxJag |");
//char svnrev[10];
//GetSVNRev(svnrev);
Console->LPrint("You are running TinNS Gameserver version");
- Console->LPrint(GREEN, BLACK, " %s", ServerVersion);
+ Console->LPrint(GREEN, BLACK, " %s", DefMain::Version);
Console->LPrint(WHITE, BLACK, " - SVN Rev");
- Console->LPrint(GREEN, BLACK, " %s", SVNRevision);
+ Console->LPrint(GREEN, BLACK, " %s", DefMain::Version);
Console->LClose();
Config = new PConfig();
//Infoserver update
extern class PISC *ISC;
-extern const char ServerVersion[];
-extern const char SVNRevision[];
-
bool InitTinNS();
void Shutdown();
static const uint32_t mCabIntervalTime;
static const uint32_t mOpenDoorOffset [];
static const uint32_t mOpenDoorDuration [];
- static const char* mSubwayStationName [];
+ static const char *mSubwayStationName [];
static PCharCoordinates mCabExitPositions [2][mStationsNumber];
PSubwayInfo mSubways[mCabsNumber];
#pragma once
-static const char *InfoConfigTemplate[][2] = {
+static const char *const InfoConfigTemplate[][2] = {
// {option_name, default_value} if default_value is empty string, it means option is mandatory
// List ends with empty string for option_name
{"sql_host", "127.0.0.1"}, // should be renanmed to info_sql_host
#include "InfoServer/Includes.hxx"
#include "Common/Includes.hxx"
-const char ServerVersion[] = TINNS_INFO_VERSION;
-const char SVNRevision[] = TINNS_SVN_REVISION;
-
ServerSocket* ServerSock = 0;
PMySQL *MySQL = 0;
PConsole *Console = 0;
Console->Print("Starting TinNS Infoserver");
Console->Print(WHITE, BLUE, "/-------------------------------------------------------------------\\");
Console->Print(WHITE, BLUE, "| TinNS (TinNS is not a Neocron Server) |");
- Console->Print(WHITE, BLUE, "| Copyright (C) 2005 Linux Addicted Community |");
- Console->Print(WHITE, BLUE, "| maintainer Akiko <akiko@gmx.org> |");
+ Console->Print(WHITE, BLUE, "| Copyright (C) 2005 Linux Addicted Community |");
+ Console->Print(WHITE, BLUE, "| maintainer Akiko <akiko@linux-addicted.net> |");
Console->Print(WHITE, BLUE, "| ========================================== |");
Console->Print(WHITE, BLUE, "| Head coders: The packet analyzing team: |");
Console->Print(WHITE, BLUE, "| - Akiko - MaxxJag |");
Console->Print(WHITE, BLUE, "| - Hammag |");
Console->Print(WHITE, BLUE, "|-------------------------------------------------------------------|");
Console->Print(WHITE, BLUE, "| This project would'nt be at its current stage without the help |");
- Console->Print(WHITE, BLUE, "| from the NeoPolis team, special thanks to you guys! |");
+ Console->Print(WHITE, BLUE, "| from the NeoPolis team, special thanks to you guys! |");
Console->Print(WHITE, BLUE, "|-------------------------------------------------------------------|");
Console->Print(WHITE, BLUE, "| This project is under GPL, see any source file for more details |");
Console->Print(WHITE, BLUE, "\\-------------------------------------------------------------------/");
//char svnrev[10];
//GetSVNRev(svnrev);
Console->LPrint("You are running TinNS Infoserver version");
- Console->LPrint(GREEN, BLACK, " %s", ServerVersion);
+ Console->LPrint(GREEN, BLACK, " %s", DefMain::Version);
Console->LPrint(WHITE, BLACK, " - SVN Rev");
- Console->LPrint(GREEN, BLACK, " %s", SVNRevision);
+ Console->LPrint(GREEN, BLACK, " %s", DefMain::Version);
Console->LClose();
Config = new PConfig();
extern class PMySQL* MySQL;
//extern class PAccounts* Accounts; // To be removed
-extern const char ServerVersion[];
-extern const char SVNRevision[];
-
bool Init();
void Shutdown();
bool AdditionnalConfigChecks();
#pragma once
-static const char *PatchConfigTemplate[][2] = {
+static const char *const PatchConfigTemplate[][2] = {
// {option_name, default_value} if default_value is empty string, it means option is mandatory
// List ends with empty string for option_name
{"server_version", "200"},
#include "PatchServer/Includes.hxx"
#include "Common/Includes.hxx"
-const char ServerVersion[] = TINNS_PATCH_VERSION;
-const char SVNRevision[] = TINNS_SVN_REVISION;
-
ServerSocket* ServerSock = 0;
PConsole *Console = 0;
PServer *Server = 0;
Console->Print(WHITE, BLUE, "/-------------------------------------------------------------------\\");
Console->Print(WHITE, BLUE, "| TinNS (TinNS is not a Neocron Server) |");
Console->Print(WHITE, BLUE, "| Copyright (C) 2005 Linux Addicted Community |");
- Console->Print(WHITE, BLUE, "| maintainer Akiko <akiko@gmx.org> |");
+ Console->Print(WHITE, BLUE, "| maintainer Akiko <akiko@linux-addicted.net> |");
Console->Print(WHITE, BLUE, "| ========================================== |");
Console->Print(WHITE, BLUE, "| Head coders: The packet analyzing team: |");
Console->Print(WHITE, BLUE, "| - Akiko - MaxxJag |");
//char svnrev[10];
//GetSVNRev(svnrev);
Console->LPrint("You are running TinNS Patchserver version");
- Console->LPrint(GREEN, BLACK, " %s", ServerVersion);
+ Console->LPrint(GREEN, BLACK, " %s", DefMain::Version);
Console->LPrint(WHITE, BLACK, " - SVN Rev");
- Console->LPrint(GREEN, BLACK, " %s", SVNRevision);
+ Console->LPrint(GREEN, BLACK, " %s", DefMain::Version);
Console->LClose();
Config = new PConfig();
extern class PServer *Server;
extern class PPatchServer *PatchServer;
-extern const char ServerVersion[];
-extern const char SVNRevision[];
-
bool InitTinNS();
void Shutdown();