[MIRROR] [s] Fixes datum antag is_banned (#3523)

* Fixes datum antag jobbans (#31901)

* [s] Fixes datum antag is_banned
This commit is contained in:
CitadelStationBot
2017-10-20 12:48:15 -05:00
committed by Poojawa
parent 655478e014
commit c0e00ab5ca
7 changed files with 15 additions and 14 deletions
+6 -6
View File
@@ -1,7 +1,7 @@
//returns a reason if M is banned from rank, returns 0 otherwise
//returns a reason if M is banned from rank, returns FALSE otherwise
/proc/jobban_isbanned(mob/M, rank)
if(!M || !istype(M) || !M.ckey)
return 0
return FALSE
if(!M.client) //no cache. fallback to a datum/DBQuery
var/datum/DBQuery/query_jobban_check_ban = SSdbcore.NewQuery("SELECT reason FROM [format_table_name("ban")] WHERE ckey = '[sanitizeSQL(M.ckey)]' AND (bantype = 'JOB_PERMABAN' OR (bantype = 'JOB_TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned) AND job = '[sanitizeSQL(rank)]'")
@@ -9,17 +9,17 @@
return
if(query_jobban_check_ban.NextRow())
var/reason = query_jobban_check_ban.item[1]
return reason ? reason : 1 //we don't want to return "" if there is no ban reason, as that would evaluate to false
return reason ? reason : TRUE //we don't want to return "" if there is no ban reason, as that would evaluate to false
else
return 0
return FALSE
if(!M.client.jobbancache)
jobban_buildcache(M.client)
if(rank in M.client.jobbancache)
var/reason = M.client.jobbancache[rank]
return (reason) ? reason : 1 //see above for why we need to do this
return 0
return (reason) ? reason : TRUE //see above for why we need to do this
return FALSE
/proc/jobban_buildcache(client/C)
if(!SSdbcore.Connect())