From 603898adbe70e5b017617d24972f54bb8739ba22 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Wed, 31 May 2017 08:39:39 -0500 Subject: [PATCH 1/2] Fixes faulty query and logic --- code/controllers/subsystem/dbcore.dm | 2 +- code/game/gamemodes/game_mode.dm.rej | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 code/game/gamemodes/game_mode.dm.rej diff --git a/code/controllers/subsystem/dbcore.dm b/code/controllers/subsystem/dbcore.dm index b052b20f5d..864274b8fb 100644 --- a/code/controllers/subsystem/dbcore.dm +++ b/code/controllers/subsystem/dbcore.dm @@ -33,7 +33,7 @@ SUBSYSTEM_DEF(dbcore) //This is as close as we can get to the true round end before Disconnect() without changing where it's called, defeating the reason this is a subsystem if(SSdbcore.Connect()) var/sql_station_name = sanitizeSQL(station_name()) - var/datum/DBQuery/query_round_end = SSdbcore.NewQuery("INSERT INTO [format_table_name("round")] (end_datetime, game_mode_result, end_state, station_name) VALUES (Now(), '[SSticker.mode_result]', '[SSticker.end_state]', '[sql_station_name]') WHERE id = [GLOB.round_id]") + var/datum/DBQuery/query_round_end = SSdbcore.NewQuery("UPDATE [format_table_name("round")] SET end_datetime = Now(), game_mode_result = '[SSticker.mode_result]', end_state = '[SSticker.end_state]', station_name = '[sql_station_name]' WHERE id = [GLOB.round_id]") query_round_end.Execute() if(IsConnected()) Disconnect() diff --git a/code/game/gamemodes/game_mode.dm.rej b/code/game/gamemodes/game_mode.dm.rej new file mode 100644 index 0000000000..c834b64a56 --- /dev/null +++ b/code/game/gamemodes/game_mode.dm.rej @@ -0,0 +1,10 @@ +diff a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm (rejected hunks) +@@ -84,8 +84,6 @@ + var/sql + if(SSticker && SSticker.mode) + sql += "game_mode = '[SSticker.mode]'" +- if(sql) +- sql += ", " + if(GLOB.revdata.originmastercommit) + if(sql) + sql += ", " From 78d0ec662ccd2cf73c39be1996ea62a57572c4a6 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Thu, 8 Jun 2017 03:48:22 -0500 Subject: [PATCH 2/2] cleanup --- code/game/gamemodes/game_mode.dm | 26 +++++++++++++------------- code/game/gamemodes/game_mode.dm.rej | 10 ---------- 2 files changed, 13 insertions(+), 23 deletions(-) delete mode 100644 code/game/gamemodes/game_mode.dm.rej diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index c57e9180f5..1852fe0770 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -80,17 +80,17 @@ report = config.intercept addtimer(CALLBACK(GLOBAL_PROC, .proc/display_roundstart_logout_report), ROUNDSTART_LOGOUT_REPORT_TIME) - if(SSdbcore.Connect()) - var/sql - if(SSticker && SSticker.mode) - sql += "game_mode = '[SSticker.mode]'" - if(sql) - sql += ", " - if(GLOB.revdata.commit) - sql += "commit_hash = '[GLOB.revdata.commit]'" - if(sql) - var/datum/DBQuery/query_round_game_mode = SSdbcore.NewQuery("UPDATE [format_table_name("round")] SET [sql] WHERE id = [GLOB.round_id]") - query_round_game_mode.Execute() + if(SSdbcore.Connect()) + var/sql + if(SSticker && SSticker.mode) + sql += "game_mode = '[SSticker.mode]'" + if(GLOB.revdata.originmastercommit) + if(sql) + sql += ", " + sql += "commit_hash = '[GLOB.revdata.originmastercommit]'" + if(sql) + var/datum/DBQuery/query_round_game_mode = SSdbcore.NewQuery("UPDATE [format_table_name("round")] SET [sql] WHERE id = [GLOB.round_id]") + query_round_game_mode.Execute() if(report) addtimer(CALLBACK(src, .proc/send_intercept, 0), rand(waittime_l, waittime_h)) generate_station_goals() @@ -239,11 +239,11 @@ if(ishuman(M)) if(!M.stat) surviving_humans++ - if(M.z == ZLEVEL_CENTCOM) + if(M.z == ZLEVEL_CENTCOM) escaped_humans++ if(!M.stat) surviving_total++ - if(M.z == ZLEVEL_CENTCOM) + if(M.z == ZLEVEL_CENTCOM) escaped_total++ diff --git a/code/game/gamemodes/game_mode.dm.rej b/code/game/gamemodes/game_mode.dm.rej deleted file mode 100644 index c834b64a56..0000000000 --- a/code/game/gamemodes/game_mode.dm.rej +++ /dev/null @@ -1,10 +0,0 @@ -diff a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm (rejected hunks) -@@ -84,8 +84,6 @@ - var/sql - if(SSticker && SSticker.mode) - sql += "game_mode = '[SSticker.mode]'" -- if(sql) -- sql += ", " - if(GLOB.revdata.originmastercommit) - if(sql) - sql += ", "