foxygit / doom Log in
commit 400f9d1930205d350af857cdd1a70f9b0d9ad484
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Mon Jan 20 22:18:07 2020 +0100
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Mon Jan 20 22:18:07 2020 +0100

    pass wbstartstruct_t * as const to all the functions which don't change it

    Thanks @turol for the suggestion.
---
 src/doom/statdump.c | 14 +++++++-------
 src/doom/statdump.h |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/doom/statdump.c b/src/doom/statdump.c
index bbcdca7b..d096a61e 100644
--- a/src/doom/statdump.c
+++ b/src/doom/statdump.c
@@ -60,7 +60,7 @@ static GameMission_t discovered_gamemission = none;
  * how to format the level name.  Unfortunately, in some cases it is
  * impossible to determine whether this is Doom 1 or Doom 2. */

-static void DiscoverGamemode(wbstartstruct_t *stats, int num_stats)
+static void DiscoverGamemode(const wbstartstruct_t *stats, int num_stats)
 {
     int partime;
     int level;
@@ -115,7 +115,7 @@ static void DiscoverGamemode(wbstartstruct_t *stats, int num_stats)

 /* Returns the number of players active in the given stats buffer. */

-static int GetNumPlayers(wbstartstruct_t *stats)
+static int GetNumPlayers(const wbstartstruct_t *stats)
 {
     int i;
     int num_players = 0;
@@ -157,10 +157,10 @@ static void PrintPercentage(FILE *stream, int amount, int total)

 /* Display statistics for a single player. */

-static void PrintPlayerStats(FILE *stream, wbstartstruct_t *stats,
+static void PrintPlayerStats(FILE *stream, const wbstartstruct_t *stats,
         int player_num)
 {
-    wbplayerstruct_t *player = &stats->plyr[player_num];
+    const wbplayerstruct_t *player = &stats->plyr[player_num];

     fprintf(stream, "Player %i (%s):\n", player_num + 1,
             player_colors[player_num]);
@@ -186,7 +186,7 @@ static void PrintPlayerStats(FILE *stream, wbstartstruct_t *stats,

 /* Frags table for multiplayer games. */

-static void PrintFragsTable(FILE *stream, wbstartstruct_t *stats)
+static void PrintFragsTable(FILE *stream, const wbstartstruct_t *stats)
 {
     int x, y;

@@ -266,7 +266,7 @@ static void PrintLevelName(FILE *stream, int episode, int level)

 /* Print details of a statistics buffer to the given file. */

-static void PrintStats(FILE *stream, wbstartstruct_t *stats)
+static void PrintStats(FILE *stream, const wbstartstruct_t *stats)
 {
     short leveltime, partime;
     int i;
@@ -296,7 +296,7 @@ static void PrintStats(FILE *stream, wbstartstruct_t *stats)
     fprintf(stream, "\n");
 }

-void StatCopy(wbstartstruct_t *stats)
+void StatCopy(const wbstartstruct_t *stats)
 {
     if (M_ParmExists("-statdump") && num_captured_stats < MAX_CAPTURES)
     {
diff --git a/src/doom/statdump.h b/src/doom/statdump.h
index 48db2ad2..f4f11efe 100644
--- a/src/doom/statdump.h
+++ b/src/doom/statdump.h
@@ -17,7 +17,7 @@
 #ifndef DOOM_STATDUMP_H
 #define DOOM_STATDUMP_H

-void StatCopy(wbstartstruct_t *stats);
+void StatCopy(const wbstartstruct_t *stats);
 void StatDump(void);

 #endif /* #ifndef DOOM_STATDUMP_H */