commit aa1c125d
Print gametype on the index page
Changed files
| M | src/pages/common_pages.cpp before |
| M | src/pages/index.cpp before |
| M | src/pages/pages.hpp before |
| M | templates/index.tpl before |
diff --git a/src/pages/common_pages.cpp b/src/pages/common_pages.cpp
index 1b6a6d6..dc202ae 100644
--- a/src/pages/common_pages.cpp
+++ b/src/pages/common_pages.cpp
@@ -63,6 +63,26 @@ std::string getWeaponName(int modtype) {
}
}
+std::string getGametypeName(int gametype) {
+ switch(gametype) {
+ case 0: return "FFA";
+ case 1: return "Tournament";
+ case 2: return "Single Player";
+ case 3: return "TDM";
+ case 4: return "CTF";
+ case 5: return "One Flag CTF";
+ case 6: return "Overload";
+ case 7: return "Harvester";
+ case 8: return "Elimination";
+ case 9: return "CTF Elimination";
+ case 10: return "LMS";
+ case 11: return "Double Domination";
+ case 12: return "Domination";
+ case 13: return "Possession";
+ default: return "Unknown";
+ }
+}
+
// Player management functions
OastatPlayer getPlayer(cppdb::session& database, int playerid) {
OastatPlayer ret;
diff --git a/src/pages/index.cpp b/src/pages/index.cpp
index bfb3890..3aa034a 100644
--- a/src/pages/index.cpp
+++ b/src/pages/index.cpp
@@ -83,6 +83,7 @@ void write_html_index(cppdb::session& database, const std::string& output_dir) {
sub_dict->SetValue("EVEN_LINE", (i%2)?"1":"0");
sub_dict->SetValue("GAMENUMBER", std::to_string(game.gamenumber) );
sub_dict->SetValue("MAPNAME", game.mapname);
+ sub_dict->SetValue("GAMETYPE", getGametypeName(game.gametype));
sub_dict->SetValue("TIME", getTimeStamp(game.time));
sub_dict->SetValue("SERVERNAME", game.servername);
}
diff --git a/src/pages/pages.hpp b/src/pages/pages.hpp
index ac8a1ce..6b73caf 100644
--- a/src/pages/pages.hpp
+++ b/src/pages/pages.hpp
@@ -52,6 +52,7 @@ void write_html_map(cppdb::session& database, const std::string& mapname, const
// Utility functions
std::string getWeaponName(int modtype);
+std::string getGametypeName(int gametype);
std::string getTimeStamp(const tm& _datetime);
// Global data accessors
diff --git a/templates/index.tpl b/templates/index.tpl
index a899c34..186f14b 100644
--- a/templates/index.tpl
+++ b/templates/index.tpl
@@ -133,6 +133,7 @@
<tr>
<th>Game</th>
<th>Map</th>
+ <th>Gametype</th>
<th>Played at</th>
<th>Server name</th>
</tr>
@@ -140,6 +141,7 @@
<tr>
<td><a href="game/{{GAMENUMBER}}.html">{{GAMENUMBER}}</a></td>
<td>{{MAPNAME}}</td>
+ <td>{{GAMETYPE}}</td>
<td>{{TIME}}</td>
<td>{{SERVERNAME}}</td>
</tr>