From 1e1de967afcb1d7a21662f944a5c42d01461358b Mon Sep 17 00:00:00 2001 From: Radegast Date: Mon, 10 Dec 2012 23:47:28 +0000 Subject: [PATCH] server: fixed date in SV_WriteAttackLog, removed sv_serverRestarting, refs #31 --- src/cgame/cg_draw.c | 2 +- src/game/g_vote.c | 15 +------- src/renderer/tr_font.c | 14 ++----- src/server/sv_ccmds.c | 6 +-- src/server/sv_init.c | 87 ++++++++++++++++-------------------------- 5 files changed, 41 insertions(+), 83 deletions(-) diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index ebb38592d..1fb124dd8 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -3277,7 +3277,7 @@ static void CG_DrawFlashDamage(void) if (cg.v_dmg_time > cg.time) { vec4_t col; - float redFlash = fabs(cg.v_dmg_pitch * ((cg.v_dmg_time - cg.time) / DAMAGE_TIME)); + float redFlash = fabs(cg.v_dmg_pitch * ((cg.v_dmg_time - cg.time) / DAMAGE_TIME)); // blend the entire screen red if (redFlash > 5) diff --git a/src/game/g_vote.c b/src/game/g_vote.c index 3f1442724..623e3cdad 100644 --- a/src/game/g_vote.c +++ b/src/game/g_vote.c @@ -55,20 +55,17 @@ static const char *DISABLED = "DISABLED"; static const char *gameNames[] = { - "Single Player", - "Cooperative", + "Single Player", // Obsolete + "Cooperative", // Obsolete "Objective", "Stopwatch", "Campaign", "Last Man Standing" }; - -// // Update info: // 1. Add line to aVoteInfo w/appropriate info // 2. Add implementation for attempt and success (see an existing command for an example) -// typedef struct { unsigned int dwGameTypes; @@ -316,20 +313,12 @@ void G_voteSetVoteString(const char *desc) trap_SendConsoleCommand(EXEC_APPEND, va("%s\n", level.voteInfo.voteString)); } - - - - - //////////////////////////////////////////////////////// // // Actual vote command implementation // //////////////////////////////////////////////////////// - - - // *** Load competition settings for current mode *** int G_Comp_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd) { diff --git a/src/renderer/tr_font.c b/src/renderer/tr_font.c index d53c06817..99b706154 100644 --- a/src/renderer/tr_font.c +++ b/src/renderer/tr_font.c @@ -40,9 +40,7 @@ * * How to generate new font data files * =================================== - * 1. Compile ET: Legacy with Freetype support: - * premake4 --with-freetype gmake - * make + * 1. Compile ET: Legacy with Freetype support by enabling FEATURE_FREETYPE in CMake * 2. Delete the fontname_x_xx.tga files and fontname_xx.dat files from the fonts * path. * 3. In a ui script, specify a font, smallFont, and bigFont keyword with font @@ -164,9 +162,9 @@ void WriteTGA(char *filename, byte *data, int width, int height) for (i = 18 ; i < c ; i += 4) { buffer[i] = data[i - 18 + 2]; // blue - buffer[i + 1] = data[i - 18 + 1]; // green - buffer[i + 2] = data[i - 18 + 0]; // red - buffer[i + 3] = data[i - 18 + 3]; // alpha + buffer[i + 1] = data[i - 18 + 1]; // green + buffer[i + 2] = data[i - 18 + 0]; // red + buffer[i + 3] = data[i - 18 + 3]; // alpha } // flip upside down @@ -184,10 +182,6 @@ void WriteTGA(char *filename, byte *data, int width, int height) ri.FS_WriteFile(filename, buffer, c); - //f = fopen (filename, "wb"); - //fwrite (buffer, 1, c, f); - //fclose (f); - ri.Free(buffer); } diff --git a/src/server/sv_ccmds.c b/src/server/sv_ccmds.c index 116f0f9f4..dcba637fb 100644 --- a/src/server/sv_ccmds.c +++ b/src/server/sv_ccmds.c @@ -300,7 +300,7 @@ static void SV_MapRestart_f(void) svs.snapFlagServerBit ^= SNAPFLAG_SERVERCOUNT; // generate a new serverid - // TTimo - don't update restartedserverId there, otherwise we won't deal correctly with multiple map_restart + // don't update restartedserverId there, otherwise we won't deal correctly with multiple map_restart sv.serverId = com_frameTime; Cvar_Set("sv_serverid", va("%i", sv.serverId)); @@ -310,8 +310,6 @@ static void SV_MapRestart_f(void) sv.state = SS_LOADING; sv.restarting = qtrue; - Cvar_Set("sv_serverRestarting", "1"); - SV_RestartGameProgs(); // run a few frames to allow everything to settle @@ -369,8 +367,6 @@ static void SV_MapRestart_f(void) // run another frame to allow things to look at all the players VM_Call(gvm, GAME_RUN_FRAME, svs.time); svs.time += FRAMETIME; - - Cvar_Set("sv_serverRestarting", "0"); } //=============================================================== diff --git a/src/server/sv_init.c b/src/server/sv_init.c index 75575e6bf..c531030a3 100644 --- a/src/server/sv_init.c +++ b/src/server/sv_init.c @@ -407,13 +407,9 @@ void SV_ChangeMaxClients(void) } } -/* -==================== -SV_SetExpectedHunkUsage - - Sets com_expectedhunkusage, so the client knows how to draw the percentage bar -==================== -*/ +/** + * @brief Sets com_expectedhunkusage, so the client knows how to draw the percentage bar + */ void SV_SetExpectedHunkUsage(char *mapname) { int handle; @@ -462,7 +458,7 @@ void SV_SetExpectedHunkUsage(char *mapname) SV_ClearServer ================ */ -void SV_ClearServer(void) +static void SV_ClearServer(void) { int i; @@ -499,15 +495,11 @@ void SV_TouchCGameDLL(void) } } -/* -================ -SV_SpawnServer - -Change the server to a new map, taking all connected -clients along with it. -This is NOT called for map_restart -================ -*/ +/** + * @brief Change the server to a new map, taking all connected + * clients along with it. + * This is NOT called for map_restart + */ void SV_SpawnServer(char *server) { int i; @@ -515,7 +507,7 @@ void SV_SpawnServer(char *server) qboolean isBot; const char *p; - // ydnar: broadcast a level change to all connected clients + // broadcast a level change to all connected clients if (svs.clients && !com_errorEntered) { SV_FinalCommand("spawnserver", qfalse); @@ -537,7 +529,7 @@ void SV_SpawnServer(char *server) // clear the whole hunk because we're (re)loading the server Hunk_Clear(); - // clear collision map data // (SA) NOTE: TODO: used in missionpack + // clear collision map data CM_ClearMap(); // wipe the entire per-level structure @@ -595,7 +587,7 @@ void SV_SpawnServer(char *server) // DO_LIGHT_DEDICATED // only comment out when you need a new pure checksum string and it's associated random feed - //Com_DPrintf("SV_SpawnServer checksum feed: %p\n", sv.checksumFeed); + // Com_DPrintf("SV_SpawnServer checksum feed: %p\n", sv.checksumFeed); #else // DO_LIGHT_DEDICATED implementation below // we are not able to randomize the checksum feed since the feed is used as key for pure_checksum computations @@ -627,8 +619,6 @@ void SV_SpawnServer(char *server) // to load during actual gameplay sv.state = SS_LOADING; - Cvar_Set("sv_serverRestarting", "1"); - // load and spawn all other entities SV_InitGameProgs(); @@ -758,8 +748,6 @@ void SV_SpawnServer(char *server) SV_UpdateConfigStrings(); - Cvar_Set("sv_serverRestarting", "0"); - Com_Printf("-----------------------------------\n"); } @@ -771,7 +759,7 @@ void SV_WriteAttackLog(const char *log) qtime_t time; Com_RealTime(&time); - Com_sprintf(string, sizeof(string), "%i/%i/%i %i:%i:%i %s", time.tm_mon + 1, time.tm_mday, time.tm_mon + 1, time.tm_hour, time.tm_min, time.tm_sec, log); + Com_sprintf(string, sizeof(string), "%i/%i/%i %i:%i:%i %s", 1900 + time.tm_year, time.tm_mday, time.tm_mon + 1, time.tm_hour, time.tm_min, time.tm_sec, log); FS_Write(string, strlen(string), attHandle); } else @@ -805,13 +793,24 @@ void SV_InitAttackLog() } } -/* -=============== -SV_Init +void SV_CloseAttackLog() +{ + if (attHandle > 0) + { + SV_WriteAttackLog("-------------------------------------------------------------------------------\n"); + SV_WriteAttackLog("End server attack log\n"); // FIXME: add date & additional info + SV_WriteAttackLog("-------------------------------------------------------------------------------\n"); + Com_Printf("Server attack log closed.\n"); + } -Only called at main exe startup, not for each game -=============== -*/ + FS_FCloseFile(attHandle); + + attHandle = 0; // local handle +} + +/** + * @brief Only called at main exe startup, not for each game + */ void SV_BotInitBotLib(void); void SV_Init(void) @@ -1009,29 +1008,9 @@ void SV_FinalCommand(char *cmd, qboolean disconnect) } } -void SV_CloseAttackLog() -{ - if (attHandle > 0) - { - SV_WriteAttackLog("-------------------------------------------------------------------------------\n"); - SV_WriteAttackLog("End server attack log\n"); // FIXME: add date & additional info - SV_WriteAttackLog("-------------------------------------------------------------------------------\n"); - Com_Printf("Server attack log closed.\n"); - } - - FS_FCloseFile(attHandle); - - attHandle = 0; // local handle -} - -/* -================ -SV_Shutdown - -Called when each game quits, -before Sys_Quit or Sys_Error -================ -*/ +/** + * @brief Called when each game quits, before Sys_Quit or Sys_Error + */ void SV_Shutdown(char *finalmsg) { // close attack log