X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=blobdiff_plain;f=src%2Fgame%2Fg_game.pas;h=ef256d18c597441246b1fd81e115d67b259a1c77;hp=686f15692b6a73af4f9c728254ef1948967cba24;hb=1b867d9fa61767acfef258fe29b900d3fd1af104;hpb=76b68febf6f7d7a3f0a45e47b57606ac8f40a083 diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 686f156..ef256d1 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -125,7 +125,7 @@ procedure g_Game_Announce_KillCombo(Param: Integer); procedure g_Game_Announce_BodyKill(SpawnerUID: Word); procedure g_Game_StartVote(Command, Initiator: string); procedure g_Game_CheckVote; -procedure g_TakeScreenShot(Filename: string = ''; StatShot: Boolean = False); +procedure g_TakeScreenShot(Filename: string = ''); procedure g_FatalError(Text: String); procedure g_SimpleError(Text: String); function g_Game_IsTestMap(): Boolean; @@ -660,30 +660,43 @@ begin AssignFile(s, fname); try Rewrite(s); - // line 1: stats version, datetime, server name, map name, game mode, time limit, score limit, dmflags, game time, number of players + // line 1: stats ver, datetime, server name, map name, game mode, time limit, score limit, dmflags, game time, num players if g_Game_IsNet then fname := NetServerName else fname := ''; map := g_ExtractWadNameNoPath(gMapInfo.Map) + ':/' + g_ExtractFileName(gMapInfo.Map); mode := g_Game_ModeToText(Stat.GameMode); - etime := Format('%d:%.2d:%.2d', [Stat.GameTime div 1000 div 3600, - (Stat.GameTime div 1000 div 60) mod 60, - Stat.GameTime div 1000 mod 60]); + etime := Format('%d:%.2d:%.2d', [ + Stat.GameTime div 1000 div 3600, + (Stat.GameTime div 1000 div 60) mod 60, + Stat.GameTime div 1000 mod 60 + ]); WriteLn(s, 'stats_ver,datetime,server,map,mode,timelimit,scorelimit,dmflags,time,num_players'); - WriteLn(s, - Format('%d,%s,%s,%s,%s,%u,%u,%u,%s,%d', - [STATFILE_VERSION, StatDate, fname, map, mode, gGameSettings.TimeLimit, gGameSettings.GoalLimit, gGameSettings.Options, etime, Length(Stat.PlayerStat)])); + WriteLn(s, Format('%d,%s,%s,%s,%s,%u,%u,%u,%s,%d', [ + STATFILE_VERSION, + StatDate, + dquoteStr(fname), + dquoteStr(map), + mode, + gGameSettings.TimeLimit, + gGameSettings.GoalLimit, + gGameSettings.Options, + etime, + Length(Stat.PlayerStat) + ])); // line 2: game specific shit // if it's a team game: red score, blue score // if it's a coop game: monsters killed, monsters total, secrets found, secrets total // otherwise nothing if Stat.GameMode in [GM_TDM, GM_CTF] then - WriteLn(s, Format('red_score,blue_score' + LineEnding + '%d,%d', [Stat.TeamStat[TEAM_RED].Goals, Stat.TeamStat[TEAM_BLUE].Goals])) + WriteLn(s, + Format('red_score,blue_score' + LineEnding + '%d,%d', [Stat.TeamStat[TEAM_RED].Goals, Stat.TeamStat[TEAM_BLUE].Goals])) else if Stat.GameMode in [GM_COOP, GM_SINGLE] then - WriteLn(s, Format('mon_killed,mon_total,secrets_found,secrets_total' + LineEnding + '%d,%d,%d,%d', [gCoopMonstersKilled, gTotalMonsters, gCoopSecretsFound, gSecretsCount])); + WriteLn(s, + Format('mon_killed,mon_total,secrets_found,secrets_total' + LineEnding + '%d,%d,%d,%d',[gCoopMonstersKilled, gTotalMonsters, gCoopSecretsFound, gSecretsCount])); // lines 3-...: team, player name, frags, deaths WriteLn(s, 'team,name,frags,deaths'); for I := Low(Stat.PlayerStat) to High(Stat.PlayerStat) do with Stat.PlayerStat[I] do - WriteLn(s, Format('%d,%s,%d,%d', [Team, Name, Frags, Deaths])); + WriteLn(s, Format('%d,%s,%d,%d', [Team, dquoteStr(Name), Frags, Deaths])); except g_Console_Add(Format(_lc[I_CONSOLE_ERROR_WRITE], [fname])); end; @@ -2861,7 +2874,7 @@ begin // HACK: take stats screenshot immediately after the first frame of the stats showing if gScreenshotStats and not StatShotDone then begin - g_TakeScreenShot('stats/' + StatFilename, True); + g_TakeScreenShot('stats/' + StatFilename); StatShotDone := True; end; end; @@ -7299,7 +7312,7 @@ begin end; end; -procedure g_TakeScreenShot(Filename: string = ''; StatShot: Boolean = False); +procedure g_TakeScreenShot(Filename: string = ''); var s: TStream; t: TDateTime; dir, date, name: String; begin if e_NoGraphics then Exit;