summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--bam.lua4
-rw-r--r--src/base/system.c256
-rw-r--r--src/base/system.h42
-rw-r--r--src/engine/client/client.cpp2
-rw-r--r--src/engine/client/graphics_threaded.cpp52
-rw-r--r--src/engine/server/server.cpp2
-rw-r--r--src/game/client/components/menus.cpp26
-rw-r--r--src/game/client/components/menus.h2
-rw-r--r--src/game/client/components/menus_browser.cpp22
-rw-r--r--src/game/client/components/menus_demo.cpp6
-rw-r--r--src/game/client/components/menus_ingame.cpp60
-rw-r--r--src/game/client/components/menus_listbox.cpp6
-rw-r--r--src/game/client/components/menus_settings.cpp56
-rw-r--r--src/game/client/ui.cpp8
-rw-r--r--src/mastersrv/mastersrv.cpp17
-rw-r--r--src/test/test.cpp9
-rw-r--r--src/tools/crapnet.cpp2
-rw-r--r--src/tools/fake_server.cpp5
-rw-r--r--src/tools/map_resave.cpp40
-rw-r--r--src/tools/map_version.cpp5
-rw-r--r--src/tools/packetgen.cpp2
-rw-r--r--src/versionsrv/versionsrv.cpp7
23 files changed, 384 insertions, 251 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d68db960..fc898417d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2120,6 +2120,10 @@ foreach(target ${TARGETS_OWN})
target_compile_options(${target} PRIVATE /wd4267) # Possible loss of data (size_t - int on win64).
target_compile_options(${target} PRIVATE /wd4800) # Implicit conversion of int to bool.
endif()
+ if(TARGET_OS STREQUAL "windows")
+ target_compile_definitions(${target} PRIVATE UNICODE) # Windows headers
+ target_compile_definitions(${target} PRIVATE _UNICODE) # C-runtime
+ endif()
if(OUR_FLAGS_OWN)
target_compile_options(${target} PRIVATE ${OUR_FLAGS_OWN})
endif()
diff --git a/bam.lua b/bam.lua
index ec87f9395..e22669bd1 100644
--- a/bam.lua
+++ b/bam.lua
@@ -240,6 +240,10 @@ function GenerateWindowsSettings(settings, conf, target_arch, compiler)
settings.cc.defines:Add("_WIN32_WINNT=0x0501")
end
+ -- Unicode support
+ settings.cc.defines:Add("UNICODE") -- Windows headers
+ settings.cc.defines:Add("_UNICODE") -- C-runtime
+
local icons = SharedIcons(compiler)
local manifests = SharedManifests(compiler)
diff --git a/src/base/system.c b/src/base/system.c
index f77760507..8857c5b0f 100644
--- a/src/base/system.c
+++ b/src/base/system.c
@@ -42,6 +42,8 @@
#include <errno.h>
#include <process.h>
#include <wincrypt.h>
+ #include <share.h>
+ #include <shellapi.h>
#else
#error NOT IMPLEMENTED
#endif
@@ -209,14 +211,15 @@ static void logger_stdout(const char *line)
fflush(stdout);
}
-static void logger_debugger(const char *line)
-{
#if defined(CONF_FAMILY_WINDOWS)
- OutputDebugString(line);
- OutputDebugString("\n");
-#endif
+static void logger_win_debugger(const char *line)
+{
+ WCHAR wBuffer[512];
+ MultiByteToWideChar(CP_UTF8, 0, line, -1, wBuffer, sizeof(wBuffer) / sizeof(WCHAR));
+ OutputDebugStringW(wBuffer);
+ OutputDebugStringW(L"\n");
}
-
+#endif
static IOHANDLE logfile = 0;
static void logger_file(const char *line)
@@ -238,7 +241,13 @@ void dbg_logger_stdout()
dbg_logger(logger_stdout);
}
-void dbg_logger_debugger() { dbg_logger(logger_debugger); }
+void dbg_logger_debugger()
+{
+#if defined(CONF_FAMILY_WINDOWS)
+ dbg_logger(logger_win_debugger);
+#endif
+}
+
void dbg_logger_file(const char *filename)
{
IOHANDLE handle = io_open(filename, IOFLAG_WRITE);
@@ -302,32 +311,52 @@ void mem_zero(void *block,unsigned size)
IOHANDLE io_open(const char *filename, int flags)
{
+ dbg_assert(flags == IOFLAG_READ || flags == IOFLAG_WRITE || flags == IOFLAG_APPEND, "flags must be read, write or append");
+#if defined(CONF_FAMILY_WINDOWS)
+ WCHAR wBuffer[IO_MAX_PATH_LENGTH];
if(flags == IOFLAG_READ)
{
- #if defined(CONF_FAMILY_WINDOWS)
// check for filename case sensitive
- WIN32_FIND_DATA finddata;
+ WIN32_FIND_DATAW finddata;
HANDLE handle;
- int length;
+ char buffer[IO_MAX_PATH_LENGTH];
- length = str_length(filename);
+ int length = str_length(filename);
if(!filename || !length || filename[length-1] == '\\')
return 0x0;
- handle = FindFirstFile(filename, &finddata);
+ MultiByteToWideChar(CP_UTF8, 0, filename, -1, wBuffer, sizeof(wBuffer) / sizeof(WCHAR));
+ handle = FindFirstFileW(wBuffer, &finddata);
if(handle == INVALID_HANDLE_VALUE)
return 0x0;
- else if(str_comp(filename+length-str_length(finddata.cFileName), finddata.cFileName) != 0)
+ WideCharToMultiByte(CP_UTF8, 0, finddata.cFileName, -1, buffer, sizeof(buffer), NULL, NULL);
+ if(str_comp(filename+length-str_length(buffer), buffer) != 0)
{
FindClose(handle);
return 0x0;
}
FindClose(handle);
- #endif
- return (IOHANDLE)fopen(filename, "rb");
+ return (IOHANDLE)_wfsopen(wBuffer, L"rb", _SH_DENYNO);
}
if(flags == IOFLAG_WRITE)
+ {
+ MultiByteToWideChar(CP_UTF8, 0, filename, -1, wBuffer, sizeof(wBuffer) / sizeof(WCHAR));
+ return (IOHANDLE)_wfsopen(wBuffer, L"wb", _SH_DENYNO);
+ }
+ if(flags == IOFLAG_APPEND)
+ {
+ MultiByteToWideChar(CP_UTF8, 0, filename, -1, wBuffer, sizeof(wBuffer) / sizeof(WCHAR));
+ return (IOHANDLE)_wfsopen(wBuffer, L"ab", _SH_DENYNO);
+ }
+ return 0x0;
+#else
+ if(flags == IOFLAG_READ)
+ return (IOHANDLE)fopen(filename, "rb");
+ if(flags == IOFLAG_WRITE)
return (IOHANDLE)fopen(filename, "wb");
+ if(flags == IOFLAG_APPEND)
+ return (IOHANDLE)fopen(filename, "ab");
return 0x0;
+#endif
}
unsigned io_read(IOHANDLE io, void *buffer, unsigned size)
@@ -898,7 +927,7 @@ int net_addr_from_str(NETADDR *addr, const char *string)
int size;
sa6.sin6_family = AF_INET6;
size = (int)sizeof(sa6);
- if(WSAStringToAddress(buf, AF_INET6, NULL, (struct sockaddr *)&sa6, &size) != 0)
+ if(WSAStringToAddressA(buf, AF_INET6, NULL, (struct sockaddr *)&sa6, &size) != 0)
return -1;
}
#else
@@ -985,9 +1014,11 @@ static int priv_net_create_socket(int domain, int type, struct sockaddr *addr, i
{
#if defined(CONF_FAMILY_WINDOWS)
char buf[128];
+ WCHAR wBuffer[128];
int error = WSAGetLastError();
- if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, 0, error, 0, buf, sizeof(buf), 0) == 0)
- buf[0] = 0;
+ if(FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, error, 0, wBuffer, sizeof(wBuffer) / sizeof(WCHAR), 0) == 0)
+ wBuffer[0] = 0;
+ WideCharToMultiByte(CP_UTF8, 0, wBuffer, -1, buf, sizeof(buf), NULL, NULL);
dbg_msg("net", "failed to create socket with domain %d and type %d (%d '%s')", domain, type, error, buf);
#else
dbg_msg("net", "failed to create socket with domain %d and type %d (%d '%s')", domain, type, errno, strerror(errno));
@@ -1024,11 +1055,13 @@ static int priv_net_create_socket(int domain, int type, struct sockaddr *addr, i
{
#if defined(CONF_FAMILY_WINDOWS)
char buf[128];
+ WCHAR wBuffer[128];
int error = WSAGetLastError();
if(error == WSAEADDRINUSE && use_random_port)
continue;
- if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, 0, error, 0, buf, sizeof(buf), 0) == 0)
- buf[0] = 0;
+ if(FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, error, 0, wBuffer, sizeof(wBuffer) / sizeof(WCHAR), 0) == 0)
+ wBuffer[0] = 0;
+ WideCharToMultiByte(CP_UTF8, 0, wBuffer, -1, buf, sizeof(buf), NULL, NULL);
dbg_msg("net", "failed to bind socket with domain %d and type %d (%d '%s')", domain, type, error, buf);
#else
if(errno == EADDRINUSE && use_random_port)
@@ -1480,15 +1513,18 @@ static inline time_t filetime_to_unixtime(LPFILETIME filetime)
void fs_listdir(const char *dir, FS_LISTDIR_CALLBACK cb, int type, void *user)
{
#if defined(CONF_FAMILY_WINDOWS)
- WIN32_FIND_DATA finddata;
+ WIN32_FIND_DATAW finddata;
HANDLE handle;
- char buffer[1024*2];
+ char buffer[IO_MAX_PATH_LENGTH];
+ char buffer2[IO_MAX_PATH_LENGTH];
+ WCHAR wBuffer[IO_MAX_PATH_LENGTH];
int length;
- str_format(buffer, sizeof(buffer), "%s/*", dir);
- handle = FindFirstFileA(buffer, &finddata);
+ str_format(buffer, sizeof(buffer), "%s/*", dir);
+ MultiByteToWideChar(CP_UTF8, 0, buffer, -1, wBuffer, sizeof(wBuffer) / sizeof(WCHAR));
- if (handle == INVALID_HANDLE_VALUE)
+ handle = FindFirstFileW(wBuffer, &finddata);
+ if(handle == INVALID_HANDLE_VALUE)
return;
str_format(buffer, sizeof(buffer), "%s/", dir);
@@ -1497,17 +1533,17 @@ void fs_listdir(const char *dir, FS_LISTDIR_CALLBACK cb, int type, void *user)
/* add all the entries */
do
{
- str_copy(buffer+length, finddata.cFileName, (int)sizeof(buffer)-length);
- if(cb(finddata.cFileName, fs_is_dir(buffer), type, user))
+ WideCharToMultiByte(CP_UTF8, 0, finddata.cFileName, -1, buffer2, sizeof(buffer2), NULL, NULL);
+ str_copy(buffer+length, buffer2, (int)sizeof(buffer)-length);
+ if(cb(buffer2, fs_is_dir(buffer), type, user))
break;
}
- while (FindNextFileA(handle, &finddata));
+ while(FindNextFileW(handle, &finddata));
FindClose(handle);
- return;
#else
struct dirent *entry;
- char buffer[1024*2];
+ char buffer[IO_MAX_PATH_LENGTH];
int length;
DIR *d = opendir(dir);
@@ -1526,22 +1562,24 @@ void fs_listdir(const char *dir, FS_LISTDIR_CALLBACK cb, int type, void *user)
/* close the directory and return */
closedir(d);
- return;
#endif
}
-void fs_listdir_fileinfo(const char* dir, FS_LISTDIR_CALLBACK_FILEINFO cb, int type, void* user)
+void fs_listdir_fileinfo(const char *dir, FS_LISTDIR_CALLBACK_FILEINFO cb, int type, void *user)
{
#if defined(CONF_FAMILY_WINDOWS)
- WIN32_FIND_DATA finddata;
+ WIN32_FIND_DATAW finddata;
HANDLE handle;
- char buffer[1024*2];
+ char buffer[IO_MAX_PATH_LENGTH];
+ char buffer2[IO_MAX_PATH_LENGTH];
+ WCHAR wBuffer[IO_MAX_PATH_LENGTH];
int length;
- str_format(buffer, sizeof(buffer), "%s/*", dir);
- handle = FindFirstFileA(buffer, &finddata);
+ str_format(buffer, sizeof(buffer), "%s/*", dir);
+ MultiByteToWideChar(CP_UTF8, 0, buffer, -1, wBuffer, sizeof(wBuffer) / sizeof(WCHAR));
- if (handle == INVALID_HANDLE_VALUE)
+ handle = FindFirstFileW(wBuffer, &finddata);
+ if(handle == INVALID_HANDLE_VALUE)
return;
str_format(buffer, sizeof(buffer), "%s/", dir);
@@ -1550,24 +1588,24 @@ void fs_listdir_fileinfo(const char* dir, FS_LISTDIR_CALLBACK_FILEINFO cb, int t
/* add all the entries */
do
{
- str_copy(buffer+length, finddata.cFileName, (int)sizeof(buffer)-length);
+ WideCharToMultiByte(CP_UTF8, 0, finddata.cFileName, -1, buffer2, sizeof(buffer2), NULL, NULL);
+ str_copy(buffer+length, buffer2, (int)sizeof(buffer)-length);
CFsFileInfo info;
- info.m_pName = finddata.cFileName;
+ info.m_pName = buffer2;
info.m_TimeCreated = filetime_to_unixtime(&finddata.ftCreationTime);
info.m_TimeModified = filetime_to_unixtime(&finddata.ftLastWriteTime);
if(cb(&info, fs_is_dir(buffer), type, user))
break;
}
- while (FindNextFileA(handle, &finddata));
+ while(FindNextFileW(handle, &finddata));
FindClose(handle);
- return;
#else
struct dirent *entry;
time_t created = -1, modified = -1;
- char buffer[1024*2];
+ char buffer[IO_MAX_PATH_LENGTH];
int length;
DIR *d = opendir(dir);
@@ -1594,17 +1632,18 @@ void fs_listdir_fileinfo(const char* dir, FS_LISTDIR_CALLBACK_FILEINFO cb, int t
/* close the directory and return */
closedir(d);
- return;
#endif
}
int fs_storage_path(const char *appname, char *path, int max)
{
#if defined(CONF_FAMILY_WINDOWS)
- char *home = getenv("APPDATA");
+ WCHAR *home = _wgetenv(L"APPDATA");
+ char buffer[IO_MAX_PATH_LENGTH];
if(!home)
return -1;
- str_format(path, max, "%s/%s", home, appname);
+ WideCharToMultiByte(CP_UTF8, 0, home, -1, buffer, sizeof(buffer), NULL, NULL);
+ str_format(path, max, "%s/%s", buffer, appname);
return 0;
#else
char *home = getenv("HOME");
@@ -1656,8 +1695,10 @@ int fs_storage_path(const char *appname, char *path, int max)
int fs_makedir(const char *path)
{
#if defined(CONF_FAMILY_WINDOWS)
- if(_mkdir(path) == 0)
- return 0;
+ WCHAR wBuffer[IO_MAX_PATH_LENGTH];
+ MultiByteToWideChar(CP_UTF8, 0, path, -1, wBuffer, sizeof(wBuffer) / sizeof(WCHAR));
+ if(_wmkdir(wBuffer) == 0)
+ return 0;
if(errno == EEXIST)
return 0;
return -1;
@@ -1698,46 +1739,35 @@ int fs_makedir_recursive(const char *path)
int fs_is_dir(const char *path)
{
#if defined(CONF_FAMILY_WINDOWS)
- /* TODO: do this smarter */
- WIN32_FIND_DATA finddata;
- HANDLE handle;
- char buffer[1024*2];
- str_format(buffer, sizeof(buffer), "%s/*", path);
-
- if ((handle = FindFirstFileA(buffer, &finddata)) == INVALID_HANDLE_VALUE)
- return 0;
-
- FindClose(handle);
- return 1;
+ WCHAR wPath[IO_MAX_PATH_LENGTH];
+ MultiByteToWideChar(CP_UTF8, 0, path, -1, wPath, sizeof(wPath) / sizeof(WCHAR));
+ DWORD attributes = GetFileAttributesW(wPath);
+ return attributes != INVALID_FILE_ATTRIBUTES && (attributes & FILE_ATTRIBUTE_DIRECTORY) ? 1 : 0;
#else
struct stat sb;
- if (stat(path, &sb) == -1)
- return 0;
-
- if (S_ISDIR(sb.st_mode))
- return 1;
- else
- return 0;
-#endif
-}
-
-time_t fs_getmtime(const char *path)
-{
- struct stat sb;
if(stat(path, &sb) == -1)
return 0;
-
- return sb.st_mtime;
+ return S_ISDIR(sb.st_mode) ? 1 : 0;
+#endif
}
int fs_chdir(const char *path)
{
if(fs_is_dir(path))
{
+#if defined(CONF_FAMILY_WINDOWS)
+ WCHAR wBuffer[IO_MAX_PATH_LENGTH];
+ MultiByteToWideChar(CP_UTF8, 0, path, -1, wBuffer, sizeof(wBuffer) / sizeof(WCHAR));
+ if(_wchdir(wBuffer))
+ return 1;
+ else
+ return 0;
+#else
if(chdir(path))
return 1;
else
return 0;
+#endif
}
else
return 1;
@@ -1748,7 +1778,11 @@ char *fs_getcwd(char *buffer, int buffer_size)
if(buffer == 0)
return 0;
#if defined(CONF_FAMILY_WINDOWS)
- return _getcwd(buffer, buffer_size);
+ WCHAR wBuffer[IO_MAX_PATH_LENGTH];
+ if(_wgetcwd(wBuffer, buffer_size) == 0)
+ return 0;
+ WideCharToMultiByte(CP_UTF8, 0, wBuffer, -1, buffer, buffer_size, NULL, NULL);
+ return buffer;
#else
return getcwd(buffer, buffer_size);
#endif
@@ -1773,16 +1807,34 @@ int fs_parent_dir(char *path)
int fs_remove(const char *filename)
{
- if(remove(filename) != 0)
+#if defined(CONF_FAMILY_WINDOWS)
+ WCHAR wFilename[IO_MAX_PATH_LENGTH];
+ MultiByteToWideChar(CP_UTF8, 0, filename, -1, wFilename, sizeof(wFilename) / sizeof(WCHAR));
+ if(DeleteFileW(wFilename) == 0)
+ return 1;
+ return 0;
+#else
+ if(remove(filename))
return 1;
return 0;
+#endif
}
int fs_rename(const char *oldname, const char *newname)
{
- if(rename(oldname, newname) != 0)
+#if defined(CONF_FAMILY_WINDOWS)
+ WCHAR wOldname[IO_MAX_PATH_LENGTH];
+ WCHAR wNewname[IO_MAX_PATH_LENGTH];
+ MultiByteToWideChar(CP_UTF8, 0, oldname, -1, wOldname, sizeof(wOldname) / sizeof(WCHAR));
+ MultiByteToWideChar(CP_UTF8, 0, newname, -1, wNewname, sizeof(wNewname) / sizeof(WCHAR));
+ if(MoveFileExW(wOldname, wNewname, MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED) == 0)
return 1;
return 0;
+#else
+ if(rename(oldname, newname))
+ return 1;
+ return 0;
+#endif
}
int fs_read(const char *name, void **result, unsigned *result_len)
@@ -1815,8 +1867,12 @@ char *fs_read_str(const char *name)
int fs_file_time(const char *name, time_t *created, time_t *modified)
{
#if defined(CONF_FAMILY_WINDOWS)
- WIN32_FIND_DATA finddata;
- HANDLE handle = FindFirstFile(name, &finddata);
+ WIN32_FIND_DATAW finddata;
+ HANDLE handle;
+ WCHAR wBuffer[IO_MAX_PATH_LENGTH];
+
+ MultiByteToWideChar(CP_UTF8, 0, name, -1, wBuffer, sizeof(wBuffer) / sizeof(WCHAR));
+ handle = FindFirstFileW(wBuffer, &finddata);
if(handle == INVALID_HANDLE_VALUE)
return 1;
@@ -2800,6 +2856,50 @@ int pid()
#endif
}
+void cmdline_fix(int *argc, const char ***argv)
+{
+#if defined(CONF_FAMILY_WINDOWS)
+ int wide_argc = 0;
+ WCHAR **wide_argv = CommandLineToArgvW(GetCommandLineW(), &wide_argc);
+ dbg_assert(wide_argv != NULL, "CommandLineToArgvW failure");
+
+ int total_size = 0;
+
+ for(int i = 0; i < wide_argc; i++)
+ {
+ int size = WideCharToMultiByte(CP_UTF8, 0, wide_argv[i], -1, NULL, 0, NULL, NULL);
+ dbg_assert(size != 0, "WideCharToMultiByte failure");
+ total_size += size;
+ }
+
+ char **new_argv = (char **)malloc((wide_argc + 1) * sizeof(*new_argv));
+ new_argv[0] = (char *)malloc(total_size);
+ mem_zero(new_argv[0], total_size);
+
+ int remaining_size = total_size;
+ for(int i = 0; i < wide_argc; i++)
+ {
+ int size = WideCharToMultiByte(CP_UTF8, 0, wide_argv[i], -1, new_argv[i], remaining_size, NULL, NULL);
+ dbg_assert(size != 0, "WideCharToMultiByte failure");
+
+ remaining_size -= size;
+ new_argv[i + 1] = new_argv[i] + size;
+ }
+
+ new_argv[wide_argc] = 0;
+ *argc = wide_argc;
+ *argv = (const char **)new_argv;
+#endif
+}
+
+void cmdline_free(int argc, const char **argv)
+{
+#if defined(CONF_FAMILY_WINDOWS)
+ free((void *)*argv);
+ free((char **)argv);
+#endif
+}
+
unsigned bytes_be_to_uint(const unsigned char *bytes)
{
return (bytes[0]<<24) | (bytes[1]<<16) | (bytes[2]<<8) | bytes[3];
diff --git a/src/base/system.h b/src/base/system.h
index 0a4cc4764..b8af722fe 100644
--- a/src/base/system.h
+++ b/src/base/system.h
@@ -179,7 +179,7 @@ int mem_has_null(const void *block, unsigned size);
enum {
IOFLAG_READ = 1,
IOFLAG_WRITE = 2,
- IOFLAG_RANDOM = 4,
+ IOFLAG_APPEND = 4,
IOSEEK_START = 0,
IOSEEK_CUR = 1,
@@ -196,7 +196,7 @@ typedef struct IOINTERNAL *IOHANDLE;
Parameters:
filename - File to open.
- flags - A set of flags. IOFLAG_READ, IOFLAG_WRITE, IOFLAG_RANDOM.
+ flags - A set of flags. IOFLAG_READ, IOFLAG_WRITE, IOFLAG_APPEND.
Returns:
Returns a handle to the file on success and 0 on failure.
@@ -1336,13 +1336,11 @@ void fs_listdir(const char *dir, FS_LISTDIR_CALLBACK cb, int type, void *user);
typedef struct
{
- const char* m_pName;
+ const char *m_pName;
time_t m_TimeCreated; // seconds since UNIX Epoch
time_t m_TimeModified; // seconds since UNIX Epoch
} CFsFileInfo;
-/* Group: Filesystem */
-
/*
Function: fs_listdir_fileinfo
Lists the files in a directory and gets additional file information
@@ -1353,7 +1351,7 @@ typedef struct
type - Type of the directory
user - Pointer to give to the callback
*/
-typedef int (*FS_LISTDIR_CALLBACK_FILEINFO)(const CFsFileInfo* info, int is_dir, int dir_type, void *user);
+typedef int (*FS_LISTDIR_CALLBACK_FILEINFO)(const CFsFileInfo *info, int is_dir, int dir_type, void *user);
void fs_listdir_fileinfo(const char *dir, FS_LISTDIR_CALLBACK_FILEINFO cb, int type, void *user);
/*
@@ -1409,12 +1407,6 @@ int fs_storage_path(const char *appname, char *path, int max);
int fs_is_dir(const char *path);
/*
- Function: fs_getmtime
- Gets the modification time of a file
-*/
-time_t fs_getmtime(const char *path);
-
-/*
Function: fs_chdir
Changes current working directory
@@ -1794,6 +1786,32 @@ void secure_random_fill(void *bytes, unsigned length);
int pid();
/*
+ Function: cmdline_fix
+ Fixes the command line arguments to be encoded in UTF-8 on all
+ systems.
+
+ Parameters:
+ argc - A pointer to the argc parameter that was passed to the main function.
+ argv - A pointer to the argv parameter that was passed to the main function.
+
+ Remarks:
+ - You need to call cmdline_free once you're no longer using the
+ results.
+*/
+void cmdline_fix(int *argc, const char ***argv);
+
+/*
+ Function: cmdline_free
+ Frees memory that was allocated by cmdline_fix.
+
+ Parameters:
+ argc - The argc obtained from cmdline_fix.
+ argv - The argv obtained from cmdline_fix.
+
+*/
+void cmdline_free(int argc, const char **argv);
+
+/*
Function: bytes_be_to_uint
Packs 4 big endian bytes into an unsigned
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp
index b9a2e0142..ad046c184 100644
--- a/src/engine/client/client.cpp
+++ b/src/engine/client/client.cpp
@@ -2559,6 +2559,7 @@ extern "C" int TWMain(int argc, const char **argv) // ignore_convention
int main(int argc, const char **argv) // ignore_convention
#endif
{
+ cmdline_fix(&argc, &argv);
#if defined(CONF_FAMILY_WINDOWS)
bool QuickEditMode = false;
for(int i = 1; i < argc; i++) // ignore_convention
@@ -2723,5 +2724,6 @@ int main(int argc, const char **argv) // ignore_convention
delete pEngineMap;
delete pEngineMasterServer;
+ cmdline_free(argc, argv);
return 0;
}
diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp
index 9cc5b3288..796f7de92 100644
--- a/src/engine/client/graphics_threaded.cpp
+++ b/src/engine/client/graphics_threaded.cpp
@@ -408,41 +408,35 @@ IGraphics::CTextureHandle CGraphics_Threaded::LoadTexture(const char *pFilename,
int CGraphics_Threaded::LoadPNG(CImageInfo *pImg, const char *pFilename, int StorageType)
{
- char aCompleteFilename[IO_MAX_PATH_LENGTH];
- unsigned char *pBuffer;
- png_t Png; // ignore_convention
-
// open file for reading
- png_init(0,0); // ignore_convention
-
+ char aCompleteFilename[IO_MAX_PATH_LENGTH];
IOHANDLE File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, StorageType, aCompleteFilename, sizeof(aCompleteFilename));
- if(File)
- io_close(File);
- else
+ if(!File)
{
dbg_msg("game/png", "failed to open file. filename='%s'", pFilename);
return 0;
}
- int Error = png_open_file(&Png, aCompleteFilename); // ignore_convention
+ png_init(0, 0); // ignore_convention
+ png_t Png; // ignore_convention
+ int Error = png_open_read(&Png, 0, File); // ignore_convention
if(Error != PNG_NO_ERROR)
{
- dbg_msg("game/png", "failed to open file. filename='%s'", aCompleteFilename);
- if(Error != PNG_FILE_ERROR)
- png_close_file(&Png); // ignore_convention
+ dbg_msg("game/png", "failed to read file. filename='%s'", aCompleteFilename);
+ io_close(File);
return 0;
}
if(Png.depth != 8 || (Png.color_type != PNG_TRUECOLOR && Png.color_type != PNG_TRUECOLOR_ALPHA) || Png.width > (2<<12) || Png.height > (2<<12)) // ignore_convention
{
dbg_msg("game/png", "invalid format. filename='%s'", aCompleteFilename);
- png_close_file(&Png); // ignore_convention
+ io_close(File);
return 0;
}
- pBuffer = (unsigned char *)mem_alloc(Png.width * Png.height * Png.bpp); // ignore_convention
+ unsigned char *pBuffer = (unsigned char *)mem_alloc(Png.width * Png.height * Png.bpp); // ignore_convention
png_get_data(&Png, pBuffer); // ignore_convention
- png_close_file(&Png); // ignore_convention
+ io_close(File);
pImg->m_Width = Png.width; // ignore_convention
pImg->m_Height = Png.height; // ignore_convention
@@ -483,21 +477,23 @@ void CGraphics_Threaded::ScreenshotDirect(const char *pFilename)
if(Image.m_pData)
{
// find filename
- char aWholePath[1024];
- png_t Png; // ignore_convention
-
+ char aWholePath[IO_MAX_PATH_LENGTH];
+ char aBuf[IO_MAX_PATH_LENGTH+32];
IOHANDLE File = m_pStorage->OpenFile(pFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE, aWholePath, sizeof(aWholePath));
if(File)
+ {
+ // save png
+ png_t Png; // ignore_convention
+ png_open_write(&Png, 0, File); // ignore_convention
+ png_set_data(&Png, Image.m_Width, Image.m_Height, 8, PNG_TRUECOLOR, (unsigned char *)Image.m_pData); // ignore_convention
io_close(File);
-
- // save png
- char aBuf[256];
- str_format(aBuf, sizeof(aBuf), "saved screenshot to '%s'", aWholePath);
- m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "client", aBuf);
- png_open_file_write(&Png, aWholePath); // ignore_convention
- png_set_data(&Png, Image.m_Width, Image.m_Height, 8, PNG_TRUECOLOR, (unsigned char *)Image.m_pData); // ignore_convention
- png_close_file(&Png); // ignore_convention
-
+ str_format(aBuf, sizeof(aBuf), "saved screenshot to '%s'", aWholePath);
+ }
+ else
+ {
+ str_format(aBuf, sizeof(aBuf), "failed to open file '%s'", pFilename);
+ }
+ m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "client/screenshot", aBuf);
mem_free(Image.m_pData);
}
}
diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp
index d3375782e..2f170fc9c 100644
--- a/src/engine/server/server.cpp
+++ b/src/engine/server/server.cpp
@@ -1819,6 +1819,7 @@ void HandleSigInt(int Param)
int main(int argc, const char **argv) // ignore_convention
{
+ cmdline_fix(&argc, &argv);
#if defined(CONF_FAMILY_WINDOWS)
for(int i = 1; i < argc; i++) // ignore_convention
{
@@ -1923,5 +1924,6 @@ int main(int argc, const char **argv) // ignore_convention
delete pStorage;
delete pConfigManager;
+ cmdline_free(argc, argv);
return Ret;
}
diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp
index 9ff9c514f..3c727091d 100644
--- a/src/game/client/components/menus.cpp
+++ b/src/game/client/components/menus.cpp
@@ -33,8 +33,6 @@
#include "menus.h"
#include "skins.h"
-float CMenus::ms_FontmodHeight = CUI::ms_FontmodHeight;
-
CRenderTools *CMenus::CUIElementBase::m_pRenderTools = 0;
CUI *CMenus::CUIElementBase::m_pUI = 0;
IInput *CMenus::CUIElementBase::m_pInput = 0;
@@ -181,7 +179,7 @@ bool CMenus::DoButton_Menu(CButtonContainer *pBC, const char *pText, bool Checke
TextRender()->TextColor(1.0f-FadeVal, 1.0f-FadeVal, 1.0f-FadeVal, 1.0f);
TextRender()->TextSecondaryColor(0.0f+FadeVal, 0.0f+FadeVal, 0.0f+FadeVal, 0.25f);
}
- UI()->DoLabel(&Text, pText, Text.h*ms_FontmodHeight, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Text, pText, Text.h*CUI::ms_FontmodHeight, TEXTALIGN_CENTER);
if(TextFade)
{
TextRender()->TextColor(CUI::ms_DefaultTextColor);
@@ -200,7 +198,7 @@ void CMenus::DoButton_KeySelect(CButtonContainer *pBC, const char *pText, const
pRect->HMargin(1.0f, &Label);
TextRender()->TextColor(1.0f-FadeVal, 1.0f-FadeVal, 1.0f-FadeVal, 1.0f);
TextRender()->TextSecondaryColor(0.0f+FadeVal, 0.0f+FadeVal, 0.0f+FadeVal, 0.25f);
- UI()->DoLabel(&Label, pText, Label.h*ms_FontmodHeight, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, pText, Label.h*CUI::ms_FontmodHeight, TEXTALIGN_CENTER);
TextRender()->TextColor(CUI::ms_DefaultTextColor);
TextRender()->TextSecondaryColor(CUI::ms_DefaultTextOutlineColor);
}
@@ -217,7 +215,7 @@ bool CMenus::DoButton_MenuTabTop(CButtonContainer *pBC, const char *pText, bool
Label.HMargin((Label.h*FontFactor)/2.0f, &Label);
TextRender()->TextColor(1.0f-FadeVal, 1.0f-FadeVal, 1.0f-FadeVal, FontAlpha);
TextRender()->TextSecondaryColor(0.0f+FadeVal, 0.0f+FadeVal, 0.0f+FadeVal, 0.25f*FontAlpha);
- UI()->DoLabel(&Label, pText, Label.h*ms_FontmodHeight, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, pText, Label.h*CUI::ms_FontmodHeight, TEXTALIGN_CENTER);
TextRender()->TextColor(CUI::ms_DefaultTextColor);
TextRender()->TextSecondaryColor(CUI::ms_DefaultTextOutlineColor);
return UI()->DoButtonLogic(pBC, pRect);
@@ -239,7 +237,7 @@ bool CMenus::DoButton_GridHeader(const void *pID, const char *pText, bool Checke
CUIRect Label;
pRect->VMargin(2.0f, &Label);
Label.y += 2.0f;
- UI()->DoLabel(&Label, pText, Label.h*ms_FontmodHeight*0.8f, Align);
+ UI()->DoLabel(&Label, pText, Label.h*CUI::ms_FontmodHeight*0.8f, Align);
if(Checked)
{
@@ -282,7 +280,7 @@ bool CMenus::DoButton_CheckBox(const void *pID, const char *pText, bool Checked,
Graphics()->QuadsEnd();
Label.y += 1.0f; // lame fix
- UI()->DoLabel(&Label, pText, Label.h*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, pText, Label.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
if(Locked)
{
@@ -352,7 +350,7 @@ float CMenus::DoIndependentDropdownMenu(void *pID, const CUIRect *pRect, const c
// label
Label = Header;
Label.y += 2.0f;
- UI()->DoLabel(&Label, pStr, Header.h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, pStr, Header.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
if(UI()->DoButtonLogic(pID, &Header))
*pActive ^= 1;
@@ -376,10 +374,10 @@ void CMenus::DoInfoBox(const CUIRect *pRect, const char *pLabel, const char *pVa
char aBuf[32];
str_format(aBuf, sizeof(aBuf), "%s:", pLabel);
Label.y += 2.0f;
- UI()->DoLabel(&Label, aBuf, pRect->h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, aBuf, pRect->h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
Value.y += 2.0f;
- UI()->DoLabel(&Value, pValue, pRect->h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Value, pValue, pRect->h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
}
void CMenus::DoJoystickBar(const CUIRect *pRect, float Current, float Tolerance, bool Active)
@@ -698,7 +696,7 @@ void CMenus::RenderMenubar(CUIRect Rect)
Box.HMargin(2.0f, &Box);
TextRender()->TextColor(CUI::ms_HighlightTextColor);
TextRender()->TextSecondaryColor(CUI::ms_HighlightTextOutlineColor);
- UI()->DoLabel(&Box, Localize("Demos"), Box.h*ms_FontmodHeight, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Box, Localize("Demos"), Box.h*CUI::ms_FontmodHeight, TEXTALIGN_CENTER);
TextRender()->TextColor(CUI::ms_DefaultTextColor);
TextRender()->TextSecondaryColor(CUI::ms_DefaultTextOutlineColor);
}
@@ -1107,7 +1105,7 @@ void CMenus::RenderMenu(CUIRect Screen)
Button.Draw(Color, 5.0f, CUIRect::CORNER_BL);
// draw non-blending X
- UI()->DoLabel(&Button, "\xE2\x9C\x95", Button.h*ms_FontmodHeight, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Button, "\xE2\x9C\x95", Button.h*CUI::ms_FontmodHeight, TEXTALIGN_CENTER);
if(UI()->DoButtonLogic(&s_QuitButton, &Button))
m_Popup = POPUP_QUIT;
@@ -1234,7 +1232,7 @@ void CMenus::RenderMenu(CUIRect Screen)
}
const float ButtonHeight = 20.0f;
- const float FontSize = ButtonHeight*ms_FontmodHeight*0.8f;
+ const float FontSize = ButtonHeight*CUI::ms_FontmodHeight*0.8f;
const float SpacingH = 2.0f;
const float SpacingW = 3.0f;
CUIRect Box = Screen;
@@ -1250,7 +1248,7 @@ void CMenus::RenderMenu(CUIRect Screen)
CUIRect Part;
Box.HSplitTop(ButtonHeight+5.0f, &Part, &Box);
Part.y += 3.0f;
- UI()->DoLabel(&Part, pTitle, Part.h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Part, pTitle, Part.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
// inner box
CUIRect BottomBar;
diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h
index 5ab6ea302..6ef00370f 100644
--- a/src/game/client/components/menus.h
+++ b/src/game/client/components/menus.h
@@ -363,8 +363,6 @@ private:
int64 m_LastInput;
- static float ms_FontmodHeight;
-
// for settings
bool m_NeedRestartPlayer;
bool m_NeedRestartGraphics;
diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp
index 976494b52..32bf71e44 100644
--- a/src/game/client/components/menus_browser.cpp
+++ b/src/game/client/components/menus_browser.cpp
@@ -520,13 +520,13 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect View, const CServerInfo *pEn
{
TextRender()->TextColor(TextBaseColor);
TextRender()->TextSecondaryColor(TextBaseOutlineColor);
- Button.y += (Button.h - FontSize/ms_FontmodHeight)/2.0f;
+ Button.y += (Button.h - FontSize/CUI::ms_FontmodHeight)/2.0f;
UI()->DoLabelHighlighted(&Button, pEntry->m_aName, (pEntry->m_QuickSearchHit&IServerBrowser::QUICK_SERVERNAME) ? Config()->m_BrFilterString : 0, FontSize, TextBaseColor, HighlightColor);
}
else if(ID == COL_BROWSER_MAP)
{
TextRender()->TextColor(TextBaseColor);
- Button.y += (Button.h - FontSize/ms_FontmodHeight)/2.0f;
+ Button.y += (Button.h - FontSize/CUI::ms_FontmodHeight)/2.0f;
UI()->DoLabelHighlighted(&Button, pEntry->m_aMap, (pEntry->m_QuickSearchHit&IServerBrowser::QUICK_MAPNAME) ? Config()->m_BrFilterString : 0, FontSize, TextBaseColor, HighlightColor);
}
else if(ID == COL_BROWSER_PLAYERS)
@@ -562,7 +562,7 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect View, const CServerInfo *pEn
str_format(aTemp, sizeof(aTemp), "%d/%d", Num, Max);
if(Config()->m_BrFilterString[0] && (pEntry->m_QuickSearchHit&IServerBrowser::QUICK_PLAYER))
TextRender()->TextColor(TextHighlightColor.r, TextHighlightColor.g, TextHighlightColor.b, TextAlpha);
- Button.y += (Button.h - FontSize/ms_FontmodHeight)/2.0f;
+ Button.y += (Button.h - FontSize/CUI::ms_FontmodHeight)/2.0f;
if(Num < 100)
Button.x += s_RenderOffset;
@@ -607,7 +607,7 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect View, const CServerInfo *pEn
str_format(aTemp, sizeof(aTemp), "%d", Ping);
TextRender()->TextColor(Color);
TextRender()->TextSecondaryColor(TextBaseOutlineColor);
- Button.y += (Button.h - FontSize/ms_FontmodHeight)/2.0f;
+ Button.y += (Button.h - FontSize/CUI::ms_FontmodHeight)/2.0f;
Button.w -= 4.0f;
UI()->DoLabel(&Button, aTemp, FontSize, TEXTALIGN_RIGHT);
}
@@ -622,7 +622,7 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect View, const CServerInfo *pEn
// gametype text
TextRender()->TextColor(TextBaseColor);
TextRender()->TextSecondaryColor(TextBaseOutlineColor);
- Button.y += (Button.h - FontSize/ms_FontmodHeight)/2.0f;
+ Button.y += (Button.h - FontSize/CUI::ms_FontmodHeight)/2.0f;
UI()->DoLabelHighlighted(&Button, pEntry->m_aGameType, (pEntry->m_QuickSearchHit&IServerBrowser::QUICK_GAMETYPE) ? Config()->m_BrFilterString : 0, FontSize, TextBaseColor, HighlightColor);
}
}
@@ -673,12 +673,12 @@ void CMenus::RenderFilterHeader(CUIRect View, int FilterIndex)
View.VSplitLeft(20.0f, 0, &View); // little space
View.y += 2.0f;
- UI()->DoLabel(&View, pFilter->Name(), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&View, pFilter->Name(), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
View.VSplitRight(20.0f, &View, 0); // little space
char aBuf[128];
str_format(aBuf, sizeof(aBuf), Localize("%d servers, %d players"), pFilter->NumSortedServers(), pFilter->NumPlayers());
- UI()->DoLabel(&View, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_RIGHT);
+ UI()->DoLabel(&View, aBuf, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_RIGHT);
EditButtons.VSplitRight(ButtonHeight, &EditButtons, &Button);
Button.Margin(2.0f, &Button);
@@ -1131,7 +1131,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
// bottom
float SpacingW = 3.0f;
float ButtonWidth = (Status.w/6.0f)-(SpacingW*5.0)/6.0f;
- float FontSize = ButtonHeight*ms_FontmodHeight*0.8f;
+ float FontSize = ButtonHeight*CUI::ms_FontmodHeight*0.8f;
// cut view
CUIRect Left, Label, EditBox, Button;
@@ -1475,7 +1475,7 @@ void CMenus::RenderServerbrowserFriendTab(CUIRect View)
UI()->DoLabel(&Label, Localize("Name"), FontSize, TEXTALIGN_LEFT);
static char s_aName[MAX_NAME_ARRAY_SIZE] = { 0 };
static CLineInput s_NameInput(s_aName, sizeof(s_aName), MAX_NAME_LENGTH);
- UI()->DoEditBox(&s_NameInput, &Button, Button.h*ms_FontmodHeight*0.8f);
+ UI()->DoEditBox(&s_NameInput, &Button, Button.h*CUI::ms_FontmodHeight*0.8f);
BottomArea.HSplitTop(HeaderHeight, &Button, &BottomArea);
BottomArea.HSplitTop(SpacingH, 0, &BottomArea);
@@ -1483,7 +1483,7 @@ void CMenus::RenderServerbrowserFriendTab(CUIRect View)
UI()->DoLabel(&Label, Localize("Clan"), FontSize, TEXTALIGN_LEFT);
static char s_aClan[MAX_CLAN_ARRAY_SIZE] = { 0 };
static CLineInput s_ClanInput(s_aClan, sizeof(s_aClan), MAX_CLAN_LENGTH);
- UI()->DoEditBox(&s_ClanInput, &Button, Button.h*ms_FontmodHeight*0.8f);
+ UI()->DoEditBox(&s_ClanInput, &Button, Button.h*CUI::ms_FontmodHeight*0.8f);
BottomArea.HSplitTop(HeaderHeight, &Button, &BottomArea);
Button.Draw(vec4(1.0f, 1.0f, 1.0f, 0.25f));
@@ -2038,7 +2038,7 @@ void CMenus::RenderDetailScoreboard(CUIRect View, const CServerInfo *pInfo, int
// score
if(!(pInfo->m_aClients[i].m_PlayerType&CServerInfo::CClient::PLAYERFLAG_SPEC))
{
- Score.y += (Score.h - FontSize/ms_FontmodHeight)/2.0f;
+ Score.y += (Score.h - FontSize/CUI::ms_FontmodHeight)/2.0f;
char aTemp[16];
FormatScore(aTemp, sizeof(aTemp), pInfo->m_Flags&IServerBrowser::FLAG_TIMESCORE, &pInfo->m_aClients[i]);
UI()->DoLabel(&Score, aTemp, FontSize, TEXTALIGN_LEFT);
diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp
index 1064a1075..c9fbe31c5 100644
--- a/src/game/client/components/menus_demo.cpp
+++ b/src/game/client/components/menus_demo.cpp
@@ -587,7 +587,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
if(ID == COL_DEMO_NAME)
{
Button.x += FileIcon.w + 10.0f;
- UI()->DoLabel(&Button, DemoItem.m_aName, Item.m_Rect.h*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Button, DemoItem.m_aName, Item.m_Rect.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
}
else if(ID == COL_DEMO_LENGTH && !DemoItem.m_IsDir && DemoItem.m_InfosLoaded && DemoItem.m_Valid)
{
@@ -597,7 +597,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
Button.VMargin(4.0f, &Button);
if(!Item.m_Selected)
TextRender()->TextColor(CUI::ms_TransparentTextColor);
- UI()->DoLabel(&Button, aLength, Item.m_Rect.h*ms_FontmodHeight*0.8f, TEXTALIGN_RIGHT);
+ UI()->DoLabel(&Button, aLength, Item.m_Rect.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_RIGHT);
}
else if(ID == COL_DEMO_DATE && !DemoItem.m_IsDir)
{
@@ -605,7 +605,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
str_timestamp_ex(DemoItem.m_Date, aDate, sizeof(aDate), FORMAT_SPACE);
if(!Item.m_Selected)
TextRender()->TextColor(CUI::ms_TransparentTextColor);
- UI()->DoLabel(&Button, aDate, Item.m_Rect.h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Button, aDate, Item.m_Rect.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
}
TextRender()->TextColor(CUI::ms_DefaultTextColor);
if(Item.m_Selected)
diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp
index efffdbeb9..6d42351c3 100644
--- a/src/game/client/components/menus_ingame.cpp
+++ b/src/game/client/components/menus_ingame.cpp
@@ -70,7 +70,7 @@ void CMenus::RenderGame(CUIRect MainView)
// game options
MainView.HSplitTop(20.0f, &Label, &MainView);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Game options"), 20.0f*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Game options"), 20.0f*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
MainView.Draw(vec4(0.0, 0.0, 0.0, 0.25f));
if(Info.m_aNotification[0] != 0)
@@ -220,7 +220,7 @@ void CMenus::RenderPlayers(CUIRect MainView)
// player options
MainView.HSplitTop(ButtonHeight, &Label, &MainView);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Player options"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Player options"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
MainView.Draw(vec4(0.0, 0.0, 0.0, 0.25f));
// prepare headline
@@ -244,7 +244,7 @@ void CMenus::RenderPlayers(CUIRect MainView)
Row.VSplitLeft(ButtonHeight+Spacing, 0, &Row);
Row.VSplitLeft(NameWidth, &Label, &Row);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Player"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, Localize("Player"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
Row.VSplitRight(2*ButtonHeight, &Row, &Label);
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GUIICONS].m_Id);
@@ -301,17 +301,17 @@ void CMenus::RenderPlayers(CUIRect MainView)
Label.y += 2.0f;
if(Config()->m_ClShowUserId)
{
- UI()->DrawClientID(ButtonHeight*ms_FontmodHeight*0.8f, vec2(Label.x, Label.y), i);
+ UI()->DrawClientID(ButtonHeight*CUI::ms_FontmodHeight*0.8f, vec2(Label.x, Label.y), i);
Label.VSplitLeft(ButtonHeight, 0, &Label);
}
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%s", Config()->m_ClShowsocial ? m_pClient->m_aClients[i].m_aName : "");
- UI()->DoLabel(&Label, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
Row.VSplitLeft(Spacing, 0, &Row);
Row.VSplitLeft(ClanWidth, &Label, &Row);
Label.y += 2.0f;
str_format(aBuf, sizeof(aBuf), "%s", Config()->m_ClShowsocial ? m_pClient->m_aClients[i].m_aClan : "");
- UI()->DoLabel(&Label, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
// ignore button
Row.VSplitRight(ButtonHeight/2, &Row, 0);
@@ -372,33 +372,33 @@ void CMenus::RenderServerInfo(CUIRect MainView)
ServerInfo.HSplitTop(ButtonHeight, &Label, &ServerInfo);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Server info"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Server info"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
ServerInfo.Draw(vec4(0.0, 0.0, 0.0, 0.25f));
ServerInfo.Margin(5.0f, &ServerInfo);
ServerInfo.HSplitTop(2*ButtonHeight, &Label, &ServerInfo);
Label.y += 2.0f;
- UI()->DoLabel(&Label, CurrentServerInfo.m_aName, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT, Label.w);
+ UI()->DoLabel(&Label, CurrentServerInfo.m_aName, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT, Label.w);
ServerInfo.HSplitTop(ButtonHeight, &Label, &ServerInfo);
Label.y += 2.0f;
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Address"), CurrentServerInfo.m_aHostname);
- UI()->DoLabel(&Label, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
ServerInfo.HSplitTop(ButtonHeight, &Label, &ServerInfo);
Label.y += 2.0f;
str_format(aBuf, sizeof(aBuf), "%s: %d", Localize("Ping"), m_pClient->m_Snap.m_pLocalInfo->m_Latency);
- UI()->DoLabel(&Label, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
ServerInfo.HSplitTop(ButtonHeight, &Label, &ServerInfo);
Label.y += 2.0f;
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Version"), CurrentServerInfo.m_aVersion);
- UI()->DoLabel(&Label, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
ServerInfo.HSplitTop(ButtonHeight, &Label, &ServerInfo);
Label.y += 2.0f;
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Password"), CurrentServerInfo.m_Flags&IServerBrowser::FLAG_PASSWORD ? Localize("Yes", "With") : Localize("No", "Without/None"));
- UI()->DoLabel(&Label, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
const bool IsFavorite = CurrentServerInfo.m_Favorite;
ServerInfo.HSplitBottom(ButtonHeight, &ServerInfo, &Label);
@@ -426,19 +426,19 @@ void CMenus::RenderServerInfo(CUIRect MainView)
GameInfo.HSplitTop(ButtonHeight, &Label, &GameInfo);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Game info"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Game info"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
GameInfo.Draw(vec4(0.0, 0.0, 0.0, 0.25f));
GameInfo.Margin(5.0f, &GameInfo);
GameInfo.HSplitTop(ButtonHeight, &Label, &GameInfo);
Label.y += 2.0f;
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Game type"), CurrentServerInfo.m_aGameType);
- UI()->DoLabel(&Label, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
GameInfo.HSplitTop(ButtonHeight, &Label, &GameInfo);
Label.y += 2.0f;
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Map"), CurrentServerInfo.m_aMap);
- UI()->DoLabel(&Label, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
GameInfo.HSplitTop(ButtonHeight, &Label, &GameInfo);
Label.y += 2.0f;
@@ -456,22 +456,22 @@ void CMenus::RenderServerInfo(CUIRect MainView)
break;
}
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Difficulty"), pLevelName);
- UI()->DoLabel(&Label, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
GameInfo.HSplitTop(ButtonHeight, &Label, &GameInfo);
Label.y += 2.0f;
str_format(aBuf, sizeof(aBuf), "%s: %d", Localize("Score limit"), m_pClient->m_GameInfo.m_ScoreLimit);
- UI()->DoLabel(&Label, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
GameInfo.HSplitTop(ButtonHeight, &Label, &GameInfo);
Label.y += 2.0f;
str_format(aBuf, sizeof(aBuf), "%s: %d", Localize("Time limit"), m_pClient->m_GameInfo.m_TimeLimit);
- UI()->DoLabel(&Label, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
GameInfo.HSplitBottom(ButtonHeight, &GameInfo, &Label);
Label.y += 2.0f;
str_format(aBuf, sizeof(aBuf), "%s: %d/%d", Localize("Players"), m_pClient->m_GameInfo.m_NumPlayers, CurrentServerInfo.m_MaxClients);
- UI()->DoLabel(&Label, aBuf, ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
// motd
Motd.HSplitTop(2.0f, 0, &Motd);
@@ -479,7 +479,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
Motd.HSplitTop(ButtonHeight, &Label, &Motd);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("MOTD"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("MOTD"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
Motd.Draw(vec4(0.0, 0.0, 0.0, 0.25f));
Motd.Margin(5.0f, &Motd);
@@ -487,13 +487,13 @@ void CMenus::RenderServerInfo(CUIRect MainView)
vec2 ScrollOffset(0, 0);
CScrollRegionParams ScrollParams;
- ScrollParams.m_ScrollUnit = ButtonHeight*ms_FontmodHeight*0.8f*3; // 3 rows per scroll
+ ScrollParams.m_ScrollUnit = ButtonHeight*CUI::ms_FontmodHeight*0.8f*3; // 3 rows per scroll
s_ScrollRegion.Begin(&Motd, &ScrollOffset, &ScrollParams);
Motd.y += ScrollOffset.y;
static CTextCursor s_MenuMotdCursor;
- s_MenuMotdCursor.m_FontSize = ButtonHeight*ms_FontmodHeight*0.8f;
+ s_MenuMotdCursor.m_FontSize = ButtonHeight*CUI::ms_FontmodHeight*0.8f;
s_MenuMotdCursor.MoveTo(Motd.x, Motd.y);
s_MenuMotdCursor.m_MaxWidth = Motd.w;
s_MenuMotdCursor.m_MaxLines = -1;
@@ -503,7 +503,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
// define the MOTD text area and make it scrollable
CUIRect MotdTextArea;
- Motd.HSplitTop(s_MenuMotdCursor.BoundingBox().Bottom()-Motd.y+ButtonHeight*ms_FontmodHeight*0.8f+5.0f, &MotdTextArea, &Motd);
+ Motd.HSplitTop(s_MenuMotdCursor.BoundingBox().Bottom()-Motd.y+ButtonHeight*CUI::ms_FontmodHeight*0.8f+5.0f, &MotdTextArea, &Motd);
s_ScrollRegion.AddRect(MotdTextArea);
s_ScrollRegion.End();
@@ -533,7 +533,7 @@ bool CMenus::RenderServerControlServer(CUIRect MainView)
for(int i = pOption->m_IsSubheader ? 1 : 0; i < pOption->m_Depth; i++)
Item.m_Rect.VSplitLeft(10.0f, 0, &Item.m_Rect);
- UI()->DoLabel(&Item.m_Rect, pOption->m_aDescription, Item.m_Rect.h*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Item.m_Rect, pOption->m_aDescription, Item.m_Rect.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
}
}
@@ -590,7 +590,7 @@ void CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
{
Row.VSplitLeft(Row.h, &Label, &Row);
Label.y += 2.0f;
- UI()->DrawClientID(Label.h*ms_FontmodHeight*0.8f, vec2(Label.x, Label.y), s_aPlayerIDs[i]);
+ UI()->DrawClientID(Label.h*CUI::ms_FontmodHeight*0.8f, vec2(Label.x, Label.y), s_aPlayerIDs[i]);
}
Row.VSplitLeft(Spacing, 0, &Row);
@@ -598,12 +598,12 @@ void CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
Label.y += 2.0f;
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%s", Config()->m_ClShowsocial ? m_pClient->m_aClients[s_aPlayerIDs[i]].m_aName : "");
- UI()->DoLabel(&Label, aBuf, Label.h*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, Label.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
Row.VSplitLeft(Spacing, 0, &Row);
Row.VSplitLeft(ClanWidth, &Label, &Row);
Label.y += 2.0f;
str_format(aBuf, sizeof(aBuf), "%s", Config()->m_ClShowsocial ? m_pClient->m_aClients[s_aPlayerIDs[i]].m_aClan : "");
- UI()->DoLabel(&Label, aBuf, Label.h*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Label, aBuf, Label.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
}
}
@@ -760,7 +760,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(s_ControlPage == 0)
{
const char *pSearchLabel = Localize("Search:");
- const float FontSize = Search.h*ms_FontmodHeight*0.8f;
+ const float FontSize = Search.h*CUI::ms_FontmodHeight*0.8f;
CUIRect Label;
Search.VSplitLeft(TextRender()->TextWidth(FontSize, pSearchLabel, -1) + 10.0f, &Label, &Search);
Label.y += 2.0f;
@@ -773,7 +773,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(pNotification)
{
Bottom.y += 2.0f;
- UI()->DoLabel(&Bottom, pNotification, Bottom.h*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Bottom, pNotification, Bottom.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
}
else
{
@@ -785,7 +785,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
// render reason
const char *pReasonLabel = Localize("Reason:");
- const float FontSize = Reason.h*ms_FontmodHeight*0.8f;
+ const float FontSize = Reason.h*CUI::ms_FontmodHeight*0.8f;
Reason.VSplitLeft(TextRender()->TextWidth(FontSize, pReasonLabel, -1) + 10.0f, &Label, &Reason);
Label.y += 2.0f;
UI()->DoLabel(&Label, pReasonLabel, FontSize, TEXTALIGN_LEFT);
diff --git a/src/game/client/components/menus_listbox.cpp b/src/game/client/components/menus_listbox.cpp
index be0f2fc06..a9ed04d70 100644
--- a/src/game/client/components/menus_listbox.cpp
+++ b/src/game/client/components/menus_listbox.cpp
@@ -37,7 +37,7 @@ void CMenus::CListBox::DoHeader(const CUIRect *pRect, const char *pTitle,
// draw header
View.HSplitTop(HeaderHeight, &Header, &View);
Header.y += 2.0f;
- m_pUI->DoLabel(&Header, pTitle, Header.h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ m_pUI->DoLabel(&Header, pTitle, Header.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
View.HSplitTop(Spacing, &Header, &View);
@@ -65,7 +65,7 @@ bool CMenus::CListBox::DoFilter(float FilterHeight, float Spacing)
View.HSplitTop(FilterHeight, &Filter, &View);
Filter.Margin(Spacing, &Filter);
- float FontSize = Filter.h*ms_FontmodHeight*0.8f;
+ float FontSize = Filter.h*CUI::ms_FontmodHeight*0.8f;
CUIRect Label, EditBox;
Filter.VSplitLeft(Filter.w/5.0f, &Label, &EditBox);
@@ -107,7 +107,7 @@ void CMenus::CListBox::DoStart(float RowHeight, int NumItems, int ItemsPerRow, i
View.HSplitBottom(m_FooterHeight, &View, &Footer);
Footer.VSplitLeft(10.0f, 0, &Footer);
Footer.y += 2.0f;
- m_pUI->DoLabel(&Footer, m_pBottomText, Footer.h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ m_pUI->DoLabel(&Footer, m_pBottomText, Footer.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
}
// setup the variables
diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp
index b9dd42486..edf81d4ff 100644
--- a/src/game/client/components/menus_settings.cpp
+++ b/src/game/client/components/menus_settings.cpp
@@ -180,13 +180,13 @@ void CMenus::RenderHSLPicker(CUIRect MainView)
// label
Label.VSplitMid(&Label, &Button, 0.0f);
Label.y += 4.0f;
- UI()->DoLabel(&Label, apNames[i], SliderHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, apNames[i], SliderHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
// value label
char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d", *apVars[i]);
Button.y += 4.0f;
- UI()->DoLabel(&Button, aBuf, SliderHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Button, aBuf, SliderHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
// button <
Section.VSplitLeft(SliderHeight, &Button, &Bar);
@@ -752,7 +752,7 @@ void CMenus::RenderLanguageSelection(CUIRect MainView, bool Header)
TextRender()->TextSecondaryColor(CUI::ms_HighlightTextOutlineColor);
}
Item.m_Rect.y += 2.0f;
- UI()->DoLabel(&Item.m_Rect, r.front().m_Name, Item.m_Rect.h*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Item.m_Rect, r.front().m_Name, Item.m_Rect.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
if(Item.m_Selected)
{
TextRender()->TextColor(CUI::ms_DefaultTextColor);
@@ -847,7 +847,7 @@ void CMenus::RenderThemeSelection(CUIRect MainView, bool Header)
TextRender()->TextSecondaryColor(CUI::ms_HighlightTextOutlineColor);
}
Item.m_Rect.y += 2.0f;
- UI()->DoLabel(&Item.m_Rect, aName, Item.m_Rect.h*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Item.m_Rect, aName, Item.m_Rect.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
if(Item.m_Selected)
{
TextRender()->TextColor(CUI::ms_DefaultTextColor);
@@ -903,7 +903,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
// render game menu
Game.HSplitTop(ButtonHeight, &Label, &Game);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Game"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Game"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
Game.VSplitMid(&GameLeft, &GameRight, Spacing);
@@ -1015,7 +1015,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
// render client menu
Client.HSplitTop(ButtonHeight, &Label, &Client);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Client"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Client"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
Client.HSplitTop(Spacing, 0, &Client);
Client.HSplitTop(ButtonHeight, &Button, &Client);
@@ -1095,7 +1095,7 @@ void CMenus::RenderSettingsTeeCustom(CUIRect MainView)
MainView.HSplitTop(ButtonHeight, &Label, &MainView);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Customize"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Customize"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
// skin part selection
MainView.HSplitTop(SpacingH, 0, &MainView);
@@ -1183,7 +1183,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
Left.HSplitTop(ButtonHeight, &Label, &Left);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Tee"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Tee"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
// Preview
{
@@ -1235,7 +1235,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
Top.VSplitLeft(Top.w/3.0f+SpacingW/2.0f, &Label, &Top);
Label.y += 17.0f;
- UI()->DoLabel(&Label, Localize("Normal:"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Normal:"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
Top.Draw(vec4(0.0f, 0.0f, 0.0f, 0.25f));
@@ -1287,7 +1287,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
Bottom.VSplitLeft(Bottom.w/3.0f+SpacingW/2.0f, &Label, &Bottom);
Label.y += 17.0f;
- UI()->DoLabel(&Label, Localize("Team:"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Team:"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
Bottom.VSplitMid(&TeeLeft, &TeeRight, SpacingW);
@@ -1312,7 +1312,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
Right.HSplitTop(ButtonHeight, &Label, &Right);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Personal"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Personal"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
// Personal
{
@@ -1336,7 +1336,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
Bottom.VSplitLeft(100.0f, &Label, &Button);
Label.y += 17.0f;
- UI()->DoLabel(&Label, Localize("Flag:"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Flag:"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
Button.w = (SkinHeight - 20.0f) * 2 + 20.0f;
Button.Draw(vec4(0.0f, 0.0f, 0.0f, 0.25f));
@@ -1613,7 +1613,7 @@ bool CMenus::DoResolutionList(CUIRect* pRect, CListBox* pListBox,
TextRender()->TextSecondaryColor(CUI::ms_HighlightTextOutlineColor);
}
Item.m_Rect.y += 2.0f;
- UI()->DoLabel(&Item.m_Rect, aBuf, Item.m_Rect.h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Item.m_Rect, aBuf, Item.m_Rect.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
if(Item.m_Selected)
{
TextRender()->TextColor(CUI::ms_DefaultTextColor);
@@ -1680,7 +1680,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
// render screen menu
ScreenLeft.HSplitTop(ButtonHeight, &Label, &ScreenLeft);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Screen"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Screen"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
ScreenLeft.VSplitMid(&ScreenLeft, &ScreenRight, Spacing);
@@ -1709,7 +1709,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
Button.VSplitLeft(100.0f-25.0f, &Text, &Button); // make button appear centered with FSAA
str_format(aBuf, sizeof(aBuf), Localize("Screen:"));
Text.y += 2.0f;
- UI()->DoLabel(&Text, aBuf, Text.h*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Text, aBuf, Text.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
Button.VSplitLeft(120.0f, &Button, 0);
str_format(aBuf, sizeof(aBuf), "#%d (%dx%d)", Config()->m_GfxScreen+1, Graphics()->DesktopWidth(), Graphics()->DesktopHeight());
@@ -1732,7 +1732,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
char aBuf[32];
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Anti Aliasing"));
Text.y += 2.0f;
- UI()->DoLabel(&Text, aBuf, Text.h*ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
+ UI()->DoLabel(&Text, aBuf, Text.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_LEFT);
Button.VSplitLeft(70.0f, &Button, 0);
str_format(aBuf, sizeof(aBuf), "%dx", Config()->m_GfxFsaaSamples);
@@ -1775,7 +1775,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
// render texture menu
Texture.HSplitTop(ButtonHeight, &Label, &Texture);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Texture"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Texture"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
Texture.HSplitTop(Spacing, 0, &Texture);
Texture.HSplitTop(ButtonHeight, &Button, &Texture);
@@ -1813,7 +1813,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
// draw header
MainView.HSplitTop(ButtonHeight, &Header, &MainView);
Header.y += 2.0f;
- UI()->DoLabel(&Header, Localize("Resolution"), Header.h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Header, Localize("Resolution"), Header.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
MainView.HSplitTop(Spacing, 0, &MainView);
MainView.HSplitTop(ButtonHeight, &Button, &MainView);
@@ -1826,11 +1826,11 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%s", Localize("Recommended"));
HeaderLeft.y += 2;
- UI()->DoLabel(&HeaderLeft, aBuf, HeaderLeft.h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&HeaderLeft, aBuf, HeaderLeft.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
str_format(aBuf, sizeof(aBuf), "%s", Localize("Other"));
HeaderRight.y += 2;
- UI()->DoLabel(&HeaderRight, aBuf, HeaderRight.h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&HeaderRight, aBuf, HeaderRight.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
MainView.HSplitTop(Spacing, 0, &MainView);
@@ -1844,7 +1844,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
const float HiDPIScale = Graphics()->ScreenHiDPIScale();
str_format(aBuf, sizeof(aBuf), Localize("Current: %dx%d (%d:%d)"), (int)(s_GfxScreenWidth*HiDPIScale), (int)(s_GfxScreenHeight*HiDPIScale), s_GfxScreenWidth/g, s_GfxScreenHeight/g);
Button.y += 2;
- UI()->DoLabel(&Button, aBuf, Button.h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Button, aBuf, Button.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
static int s_LastScreen = Config()->m_GfxScreen;
if(s_LastScreen != Config()->m_GfxScreen)
@@ -1927,7 +1927,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
// render sound menu
Sound.HSplitTop(ButtonHeight, &Label, &Sound);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Sound"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Sound"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
Sound.HSplitTop(Spacing, 0, &Sound);
CUIRect UseSoundButton;
@@ -1953,7 +1953,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
// render detail menu
Detail.HSplitTop(ButtonHeight, &Label, &Detail);
Label.y += 2.0f;
- UI()->DoLabel(&Label, Localize("Detail"), ButtonHeight*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Label, Localize("Detail"), ButtonHeight*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
// split menu
CUIRect Left, Right;
@@ -1972,10 +1972,10 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
char aBuf[32];
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Sample rate"));
Text.y += 2.0f;
- UI()->DoLabel(&Text, aBuf, Text.h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Text, aBuf, Text.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
Unit.y += 2.0f;
- UI()->DoLabel(&Unit, "kHz", Unit.h*ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&Unit, "kHz", Unit.h*CUI::ms_FontmodHeight*0.8f, TEXTALIGN_CENTER);
if(Config()->m_SndRate != 48000 && Config()->m_SndRate != 44100)
Config()->m_SndRate = 48000;
@@ -2143,16 +2143,16 @@ void CMenus::RenderSettings(CUIRect MainView)
TextRender()->TextColor(0.973f, 0.863f, 0.207f, 1.0f);
RestartWarning.y += 2.0f;
if(m_NeedRestartGraphics || m_NeedRestartSound)
- UI()->DoLabel(&RestartWarning, Localize("You must restart the game for all settings to take effect."), RestartWarning.h*ms_FontmodHeight*0.75f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&RestartWarning, Localize("You must restart the game for all settings to take effect."), RestartWarning.h*CUI::ms_FontmodHeight*0.75f, TEXTALIGN_CENTER);
else if(Client()->State() == IClient::STATE_ONLINE)
{
if(m_NeedRestartPlayer || NeedRestartTee)
- UI()->DoLabel(&RestartWarning, Localize("You must reconnect to change identity."), RestartWarning.h*ms_FontmodHeight*0.75f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&RestartWarning, Localize("You must reconnect to change identity."), RestartWarning.h*CUI::ms_FontmodHeight*0.75f, TEXTALIGN_CENTER);
else if(m_SkinModified)
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), Localize("You have to wait %1.0f seconds to change identity."), m_pClient->m_LastSkinChangeTime+6.5f - Client()->LocalTime());
- UI()->DoLabel(&RestartWarning, aBuf, RestartWarning.h*ms_FontmodHeight*0.75f, TEXTALIGN_CENTER);
+ UI()->DoLabel(&RestartWarning, aBuf, RestartWarning.h*CUI::ms_FontmodHeight*0.75f, TEXTALIGN_CENTER);
}
}
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
diff --git a/src/game/client/ui.cpp b/src/game/client/ui.cpp
index cf65fcf6a..3b69db1e8 100644
--- a/src/game/client/ui.cpp
+++ b/src/game/client/ui.cpp
@@ -409,7 +409,7 @@ bool CUI::DoEditBox(CLineInput *pLineInput, const CUIRect *pRect, float FontSize
CUIRect Textbox = *pRect;
Textbox.Draw(pColorFunction->GetColor(LastActiveItem() == pLineInput, Inside), 5.0f, Corners);
Textbox.VMargin(Spacing, &Textbox);
- Textbox.HMargin((Textbox.h-FontSize/ms_FontmodHeight)/2, &Textbox);
+ Textbox.HMargin((Textbox.h-FontSize/CUI::ms_FontmodHeight)/2, &Textbox);
const char *pDisplayStr = pLineInput->GetString();
char aStars[128];
@@ -480,7 +480,7 @@ void CUI::DoEditBoxOption(CLineInput *pLineInput, const CUIRect *pRect, const ch
CUIRect Label, EditBox;
pRect->VSplitLeft(VSplitVal, &Label, &EditBox);
- const float FontSize = pRect->h*ms_FontmodHeight*0.8f;
+ const float FontSize = pRect->h*CUI::ms_FontmodHeight*0.8f;
char aBuf[32];
str_format(aBuf, sizeof(aBuf), "%s:", pStr);
Label.y += 2.0f;
@@ -632,7 +632,7 @@ void CUI::DoScrollbarOption(const void *pID, int *pOption, const CUIRect *pRect,
else
str_format(aBuf, sizeof(aBuf), "%s: \xe2\x88\x9e", pStr);
- float FontSize = pRect->h*ms_FontmodHeight*0.8f;
+ float FontSize = pRect->h*CUI::ms_FontmodHeight*0.8f;
float VSplitVal = maximum(TextRender()->TextWidth(FontSize, aBuf, -1), TextRender()->TextWidth(FontSize, aBufMax, -1));
pRect->Draw(vec4(0.0f, 0.0f, 0.0f, 0.25f));
@@ -659,7 +659,7 @@ void CUI::DoScrollbarOptionLabeled(const void *pID, int *pOption, const CUIRect
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "%s: %s", pStr, aLabels[Value]);
- float FontSize = pRect->h*ms_FontmodHeight*0.8f;
+ float FontSize = pRect->h*CUI::ms_FontmodHeight*0.8f;
pRect->Draw(vec4(0.0f, 0.0f, 0.0f, 0.25f));
diff --git a/src/mastersrv/mastersrv.cpp b/src/mastersrv/mastersrv.cpp
index 624a9f3fe..e19672313 100644
--- a/src/mastersrv/mastersrv.cpp
+++ b/src/mastersrv/mastersrv.cpp
@@ -280,14 +280,11 @@ void ReloadBans()
m_pConsole->ExecuteFile("master.cfg");
}
-int main(int argc, const char **argv) // ignore_convention
+int main(int argc, const char **argv)
{
- int64 LastBuild = 0, LastBanReload = 0;
- ServerType Type = SERVERTYPE_INVALID;
- NETADDR BindAddr;
-
dbg_logger_stdout();
-
+ cmdline_fix(&argc, &argv);
+
mem_copy(m_CountData.m_Header, SERVERBROWSE_COUNT, sizeof(SERVERBROWSE_COUNT));
int FlagMask = CFGFLAG_MASTER;
@@ -307,9 +304,10 @@ int main(int argc, const char **argv) // ignore_convention
pConfigManager->Init(FlagMask);
m_pConsole->Init();
m_NetBan.Init(m_pConsole, pStorage);
- if(argc > 1) // ignore_convention
- m_pConsole->ParseArguments(argc-1, &argv[1]); // ignore_convention
+ if(argc > 1)
+ m_pConsole->ParseArguments(argc-1, &argv[1]);
+ NETADDR BindAddr;
if(pConfig->m_Bindaddr[0] && net_host_lookup(pConfig->m_Bindaddr, &BindAddr, NETTYPE_ALL) == 0)
{
// got bindaddr
@@ -345,6 +343,8 @@ int main(int argc, const char **argv) // ignore_convention
dbg_msg("mastersrv", "started");
+ int64 LastBuild = 0, LastBanReload = 0;
+ ServerType Type = SERVERTYPE_INVALID;
while(1)
{
m_NetOp.Update();
@@ -460,5 +460,6 @@ int main(int argc, const char **argv) // ignore_convention
thread_sleep(1);
}
+ cmdline_free(argc, argv);
return 0;
}
diff --git a/src/test/test.cpp b/src/test/test.cpp
index c14df1dd3..ccef77b33 100644
--- a/src/test/test.cpp
+++ b/src/test/test.cpp
@@ -17,9 +17,12 @@ void CTestInfo::Filename(char *pBuffer, int BufferLength, const char *pSuffix)
str_format(pBuffer, BufferLength, "%s%s", m_aFilenamePrefix, pSuffix);
}
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
{
- ::testing::InitGoogleTest(&argc, argv);
+ cmdline_fix(&argc, &argv);
+ ::testing::InitGoogleTest(&argc, const_cast<char **>(argv));
net_init();
- return RUN_ALL_TESTS();
+ int Result = RUN_ALL_TESTS();
+ cmdline_free(argc, argv);
+ return Result;
}
diff --git a/src/tools/crapnet.cpp b/src/tools/crapnet.cpp
index 20cea2bde..146f1fb48 100644
--- a/src/tools/crapnet.cpp
+++ b/src/tools/crapnet.cpp
@@ -206,7 +206,7 @@ void Run(unsigned short Port, NETADDR Dest)
}
}
-int main(int argc, char **argv) // ignore_convention
+int main(int argc, const char **argv)
{
NETADDR Addr = {NETTYPE_IPV4, {127,0,0,1},8303};
dbg_logger_stdout();
diff --git a/src/tools/fake_server.cpp b/src/tools/fake_server.cpp
index 81bb1cebb..0e1e481a8 100644
--- a/src/tools/fake_server.cpp
+++ b/src/tools/fake_server.cpp
@@ -148,8 +148,10 @@ static int Run()
}
}
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
{
+ cmdline_fix(&argc, &argv);
+
pNet = new CNetServer;
while(argc)
@@ -214,6 +216,7 @@ int main(int argc, char **argv)
int RunReturn = Run();
delete pNet;
+ cmdline_free(argc, argv);
return RunReturn;
}
diff --git a/src/tools/map_resave.cpp b/src/tools/map_resave.cpp
index 0a624b0f4..45d025e39 100644
--- a/src/tools/map_resave.cpp
+++ b/src/tools/map_resave.cpp
@@ -6,40 +6,40 @@
int main(int argc, const char **argv)
{
- IStorage *pStorage = CreateStorage("Teeworlds", IStorage::STORAGETYPE_BASIC, argc, argv);
- int Index, ID = 0, Type = 0, Size;
- void *pPtr;
- char aFileName[1024];
- CDataFileReader DataFile;
- CDataFileWriter df;
+ cmdline_fix(&argc, &argv);
+ IStorage *pStorage = CreateStorage("Teeworlds", IStorage::STORAGETYPE_BASIC, argc, argv);
if(!pStorage || argc != 3)
return -1;
- str_format(aFileName, sizeof(aFileName), "%s", argv[2]);
-
- if(!DataFile.Open(pStorage, argv[1], IStorage::TYPE_ALL))
+ CDataFileReader Reader;
+ if(!Reader.Open(pStorage, argv[1], IStorage::TYPE_ALL))
return -1;
- if(!df.Open(pStorage, aFileName))
+
+ CDataFileWriter Writer;
+ if(!Writer.Open(pStorage, argv[2]))
return -1;
// add all items
- for(Index = 0; Index < DataFile.NumItems(); Index++)
+ for(int Index = 0; Index < Reader.NumItems(); Index++)
{
- pPtr = DataFile.GetItem(Index, &Type, &ID);
- Size = DataFile.GetItemSize(Index);
- df.AddItem(Type, ID, Size, pPtr);
+ int Type, ID;
+ void *pPtr = Reader.GetItem(Index, &Type, &ID);
+ int Size = Reader.GetItemSize(Index);
+ Writer.AddItem(Type, ID, Size, pPtr);
}
// add all data
- for(Index = 0; Index < DataFile.NumData(); Index++)
+ for(int Index = 0; Index < Reader.NumData(); Index++)
{
- pPtr = DataFile.GetData(Index);
- Size = DataFile.GetDataSize(Index);
- df.AddData(Size, pPtr);
+ void *pPtr = Reader.GetData(Index);
+ int Size = Reader.GetDataSize(Index);
+ Writer.AddData(Size, pPtr);
}
- DataFile.Close();
- df.Finish();
+ Reader.Close();
+ Writer.Finish();
+
+ cmdline_free(argc, argv);
return 0;
}
diff --git a/src/tools/map_version.cpp b/src/tools/map_version.cpp
index fbeb27d74..55b28c3a4 100644
--- a/src/tools/map_version.cpp
+++ b/src/tools/map_version.cpp
@@ -46,8 +46,10 @@ io_write(s_File, aBuf, str_length(aBuf));
return 0;
}
-int main(int argc, const char **argv) // ignore_convention
+int main(int argc, const char **argv)
{
+ cmdline_fix(&argc, &argv);
+
IKernel *pKernel = IKernel::Create();
s_pStorage = CreateStorage("Teeworlds", IStorage::STORAGETYPE_BASIC, argc, argv);
s_pEngineMap = CreateEngineMap();
@@ -67,5 +69,6 @@ int main(int argc, const char **argv) // ignore_convention
io_close(s_File);
}
+ cmdline_free(argc, argv);
return 0;
}
diff --git a/src/tools/packetgen.cpp b/src/tools/packetgen.cpp
index 0d3f5c0e2..25fa7ebf8 100644
--- a/src/tools/packetgen.cpp
+++ b/src/tools/packetgen.cpp
@@ -28,7 +28,7 @@ void Run(NETADDR Dest)
}
}
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
{
NETADDR Dest = {NETTYPE_IPV4, {127,0,0,1}, 8303};
Run(Dest);
diff --git a/src/versionsrv/versionsrv.cpp b/src/versionsrv/versionsrv.cpp
index 698251060..1413d8baa 100644
--- a/src/versionsrv/versionsrv.cpp
+++ b/src/versionsrv/versionsrv.cpp
@@ -79,11 +79,10 @@ void SendVer(NETADDR *pAddr, TOKEN ResponseToken)
g_NetOp.Send(&p, ResponseToken);
}
-int main(int argc, const char **argv) // ignore_convention
+int main(int argc, const char **argv)
{
- NETADDR BindAddr;
-
dbg_logger_stdout();
+ cmdline_fix(&argc, &argv);
int FlagMask = 0;
IKernel *pKernel = IKernel::Create();
@@ -100,6 +99,7 @@ int main(int argc, const char **argv) // ignore_convention
pConfigManager->Init(FlagMask);
pConsole->Init();
+ NETADDR BindAddr;
mem_zero(&BindAddr, sizeof(BindAddr));
BindAddr.type = NETTYPE_ALL;
BindAddr.port = VERSIONSRV_PORT;
@@ -155,5 +155,6 @@ int main(int argc, const char **argv) // ignore_convention
thread_sleep(1);
}
+ cmdline_free(argc, argv);
return 0;
}