diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index ced91ac0287..1a63456c728 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -163,4 +163,9 @@ #define MAT_BANANIUM "$bananium" #define MAX_STACK_SIZE 50 -//The maximum size of a stack object. \ No newline at end of file + +//unmagic-strings for types of polls +#define POLLTYPE_OPTION "OPTION" +#define POLLTYPE_TEXT "TEXT" +#define POLLTYPE_RATING "NUMVAL" +#define POLLTYPE_MULTI "MULTICHOICE" \ No newline at end of file diff --git a/code/modules/admin/create_poll.dm b/code/modules/admin/create_poll.dm index 78caa924b35..6e690b469ac 100644 --- a/code/modules/admin/create_poll.dm +++ b/code/modules/admin/create_poll.dm @@ -40,13 +40,13 @@ var/choice_amount = 0 switch(polltype) if("Single Option") - polltype = "OPTION" + polltype = POLLTYPE_OPTION if("Text Reply") - polltype = "TEXT" + polltype = POLLTYPE_TEXT if("Rating") - polltype = "NUMVAL" + polltype = POLLTYPE_RATING if("Multiple Choice") - polltype = "MULTICHOICE" + polltype = POLLTYPE_MULTI choice_amount = input("How many choices should be allowed?","Select choice amount") as num|null if(!choice_amount) return @@ -93,7 +93,7 @@ var/err = query_polladd_question.ErrorMsg() log_game("SQL ERROR adding new poll question to table. Error : \[[err]\]\n") return - if(polltype == "TEXT") + if(polltype == POLLTYPE_TEXT) log_admin("[key_name(usr)] has created a new server poll. Poll type: [polltype] - Admin Only: [adminonly ? "Yes" : "No"] - Question: [question]") message_admins("[key_name_admin(usr)] has created a new server poll. Poll type: [polltype] - Admin Only: [adminonly ? "Yes" : "No"]
Question: [question]") return @@ -107,7 +107,7 @@ pollid = query_get_id.item[1] var/add_option = 1 while(add_option) - var/option = input("Write your option","Option") as message|null + var/option = input("Write your option",POLLTYPE_OPTION) as message|null if(!option) return pollid option = sanitizeSQL(option) @@ -124,7 +124,7 @@ var/descmin = "" var/descmid = "" var/descmax = "" - if(polltype == "NUMVAL") + if(polltype == POLLTYPE_RATING) minval = input("Set minimum rating value.","Minimum rating") as num|null if(!minval) return pollid diff --git a/code/modules/mob/new_player/poll.dm b/code/modules/mob/new_player/poll.dm index 7be517eb2d9..d9e240936d7 100644 --- a/code/modules/mob/new_player/poll.dm +++ b/code/modules/mob/new_player/poll.dm @@ -64,7 +64,7 @@ switch(polltype) //Polls that have enumerated options - if("OPTION") + if(POLLTYPE_OPTION) var/DBQuery/voted_query = dbcon.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[usr.ckey]'") voted_query.Execute() @@ -117,7 +117,7 @@ src << browse(output,"window=playerpoll;size=500x250") //Polls with a text input - if("TEXT") + if(POLLTYPE_TEXT) var/DBQuery/voted_query = dbcon.NewQuery("SELECT replytext FROM [format_table_name("poll_textreply")] WHERE pollid = [pollid] AND ckey = '[usr.ckey]'") voted_query.Execute() @@ -159,7 +159,7 @@ src << browse(output,"window=playerpoll;size=500x500") //Polls with a text input - if("NUMVAL") + if(POLLTYPE_RATING) var/DBQuery/voted_query = dbcon.NewQuery("SELECT o.text, v.rating FROM [format_table_name("poll_option")] o, erro_poll_vote v WHERE o.pollid = [pollid] AND v.ckey = '[usr.ckey]' AND o.id = v.optionid") voted_query.Execute() @@ -228,7 +228,7 @@ output += "" src << browse(output,"window=playerpoll;size=500x500") - if("MULTICHOICE") + if(POLLTYPE_MULTI) var/DBQuery/voted_query = dbcon.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[usr.ckey]'") voted_query.Execute() @@ -308,7 +308,7 @@ var/multiplechoiceoptions = 0 while(select_query.NextRow()) - if(select_query.item[4] != "OPTION" && select_query.item[4] != "MULTICHOICE") + if(select_query.item[4] != POLLTYPE_OPTION && select_query.item[4] != POLLTYPE_MULTI) return validpoll = 1 if(select_query.item[5]) @@ -377,7 +377,7 @@ var/validpoll = 0 while(select_query.NextRow()) - if(select_query.item[4] != "TEXT") + if(select_query.item[4] != POLLTYPE_TEXT) return validpoll = 1 break @@ -435,7 +435,7 @@ var/validpoll = 0 while(select_query.NextRow()) - if(select_query.item[4] != "NUMVAL") + if(select_query.item[4] != POLLTYPE_RATING) return validpoll = 1 break