Skip to content

Commit

Permalink
server: fixed date in SV_WriteAttackLog, removed sv_serverRestarting,…
Browse files Browse the repository at this point in the history
… refs #31
  • Loading branch information
JanSimek committed Dec 10, 2012
1 parent 269f734 commit 1e1de96
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 83 deletions.
2 changes: 1 addition & 1 deletion src/cgame/cg_draw.c
Expand Up @@ -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)
Expand Down
15 changes: 2 additions & 13 deletions src/game/g_vote.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down
14 changes: 4 additions & 10 deletions src/renderer/tr_font.c
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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);
}

Expand Down
6 changes: 1 addition & 5 deletions src/server/sv_ccmds.c
Expand Up @@ -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));

Expand All @@ -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
Expand Down Expand Up @@ -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");
}

//===============================================================
Expand Down
87 changes: 33 additions & 54 deletions src/server/sv_init.c
Expand Up @@ -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;
Expand Down Expand Up @@ -462,7 +458,7 @@ void SV_SetExpectedHunkUsage(char *mapname)
SV_ClearServer
================
*/
void SV_ClearServer(void)
static void SV_ClearServer(void)
{
int i;

Expand Down Expand Up @@ -499,23 +495,19 @@ 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;
int checksum;
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);
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -758,8 +748,6 @@ void SV_SpawnServer(char *server)

SV_UpdateConfigStrings();

Cvar_Set("sv_serverRestarting", "0");

Com_Printf("-----------------------------------\n");
}

Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1e1de96

Please sign in to comment.