git repos / oastat

commit 1dfac2d9

sago007 · 2019-05-11 13:48
1dfac2d9cd37dbb46cf3a2ad433f28a6a5b64a51 patch · browse files
parent e729aedfba1b1c71482e1a919febddb0adb35bce

Stop committing games without a kill by a human player

Changed files

M src/db/Db2CppDb.cpp before
diff --git a/src/db/Db2CppDb.cpp b/src/db/Db2CppDb.cpp index 6f52686..43edc65 100644 --- a/src/db/Db2CppDb.cpp +++ b/src/db/Db2CppDb.cpp
@@ -178,6 +178,15 @@ void Db2CppDb::addGameCvar(const std::string &cvar, const std::string &value)
*/
void Db2CppDb::endGame(int second)
{
+ if (true) {
+ //Not ok if no human kills
+ cppdb::result res = *sql << "select k.gamenumber"
+ " from oastat_kills k, oastat_players p"
+ " where p.playerid = k.attacker and p.isbot = 'n' and k.target <> k.attacker and p.guid <> 'WORLD' and k.gamenumber = ?" << gamenumber;
+ if (!res.next()) {
+ isok = false;
+ }
+ }
if (!isok) {
return;
}