Add return type annotations to some procs, other lint fixes

This commit is contained in:
oranges
2019-07-03 19:31:11 +12:00
committed by Ling
parent 3e8de658a4
commit 56e5dbb7b1
20 changed files with 51 additions and 23 deletions

View File

@@ -41,6 +41,12 @@
//Create a list global that is initialized as an empty list
#define GLOBAL_LIST_EMPTY(X) GLOBAL_LIST_INIT(X, list())
// Create a typed list global with an initializer expression
#define GLOBAL_LIST_INIT_TYPED(X, Typepath, InitValue) GLOBAL_RAW(/list##Typepath/X); GLOBAL_MANAGED(X, InitValue)
// Create a typed list global that is initialized as an empty list
#define GLOBAL_LIST_EMPTY_TYPED(X, Typepath) GLOBAL_LIST_INIT_TYPED(X, Typepath, list())
//Create a typed global with an initializer expression
#define GLOBAL_DATUM_INIT(X, Typepath, InitValue) GLOBAL_RAW(Typepath/##X); GLOBAL_MANAGED(X, InitValue)

View File

@@ -0,0 +1,13 @@
// Interfaces for the SpacemanDMM linter, define'd to nothing when the linter
// is not in use.
// The SPACEMAN_DMM define is set by the linter and other tooling when it runs.
#ifdef SPACEMAN_DMM
#define RETURN_TYPE(X) set SpacemanDMM_return_type = X
#define SHOULD_CALL_PARENT(X) set SpacemanDMM_should_call_parent = X
#define UNLINT(X) SpacemanDMM_unlint(X)
#else
#define RETURN_TYPE(X)
#define SHOULD_CALL_PARENT(X)
#define UNLINT(X) X
#endif

View File

@@ -124,6 +124,7 @@
//returns a new list with only atoms that are in typecache L
/proc/typecache_filter_list(list/atoms, list/typecache)
RETURN_TYPE(/list)
. = list()
for(var/thing in atoms)
var/atom/A = thing
@@ -131,6 +132,7 @@
. += A
/proc/typecache_filter_list_reverse(list/atoms, list/typecache)
RETURN_TYPE(/list)
. = list()
for(var/thing in atoms)
var/atom/A = thing
@@ -257,6 +259,7 @@
//Pick a random element from the list and remove it from the list.
/proc/pick_n_take(list/L)
RETURN_TYPE(L[_].type)
if(L.len)
var/picked = rand(1,L.len)
. = L[picked]

View File

@@ -7,7 +7,7 @@
#define WRITE_LOG(log, text) rustg_log_write(log, text)
//print a warning message to world.log
#define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [src] usr: [usr].")
#define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [UNLINT(src)] usr: [usr].")
/proc/warning(msg)
msg = "## WARNING: [msg]"
log_world(msg)

View File

@@ -1,9 +1,9 @@
//faster than having to constantly loop for them
GLOBAL_LIST_EMPTY(all_mutations) //type = initialized mutation
GLOBAL_LIST_EMPTY_TYPED(all_mutations, /datum/mutation/human) //type = initialized mutation
GLOBAL_LIST_EMPTY(full_sequences) //type = correct sequence
GLOBAL_LIST_EMPTY(bad_mutations) //bad initialized mutations
GLOBAL_LIST_EMPTY(good_mutations) //good initialized mutations
GLOBAL_LIST_EMPTY(not_good_mutations) //neutral initialized mutations
GLOBAL_LIST_EMPTY(alias_mutations) //alias = type
GLOBAL_LIST_EMPTY(mutation_recipes)
GLOBAL_LIST_EMPTY(mutation_recipes)

View File

@@ -47,6 +47,6 @@ GLOBAL_LIST_EMPTY(vr_spawnpoints)
//used by jump-to-area etc. Updated by area/updateName()
GLOBAL_LIST_EMPTY(sortedAreas)
/// An association from typepath to area instance. Only includes areas with `unique` set.
GLOBAL_LIST_EMPTY(areas_by_type)
GLOBAL_LIST_EMPTY_TYPED(areas_by_type, /area)
GLOBAL_LIST_EMPTY(all_abstract_markers)

View File

@@ -4,7 +4,7 @@ SUBSYSTEM_DEF(job)
flags = SS_NO_FIRE
var/list/occupations = list() //List of all jobs
var/list/name_occupations = list() //Dict of all jobs, keys are titles
var/list/datum/job/name_occupations = list() //Dict of all jobs, keys are titles
var/list/type_occupations = list() //Dict of all jobs, keys are types
var/list/unassigned = list() //Players who need jobs
var/initial_players_to_assign = 0 //used for checking against population caps
@@ -360,7 +360,7 @@ SUBSYSTEM_DEF(job)
if(!GiveRandomJob(player))
if(!AssignRole(player, SSjob.overflow_role)) //If everything is already filled, make them an assistant
return FALSE //Living on the edge, the forced antagonist couldn't be assigned to overflow role (bans, client age) - just reroll
return validate_required_jobs(required_jobs)
/datum/controller/subsystem/job/proc/validate_required_jobs(list/required_jobs)

View File

@@ -184,6 +184,7 @@
// The type arg is casted so initial works, you shouldn't be passing a real instance into this
/datum/proc/GetComponent(datum/component/c_type)
RETURN_TYPE(c_type)
if(initial(c_type.dupe_mode) == COMPONENT_DUPE_ALLOWED)
stack_trace("GetComponent was called to get a component of which multiple copies could be on an object. This can easily break and should be changed. Type: \[[c_type]\]")
var/list/dc = datum_components

View File

@@ -299,7 +299,7 @@
Deletion.Cut(Deletion.len)
qdel(DL)
/datum/component/personal_crafting/proc/component_ui_interact(obj/screen/crafting/image, location, control, params, user)
/datum/component/personal_crafting/proc/component_ui_interact(obj/screen/craft/image, location, control, params, user)
if(user == parent)
ui_interact(user)

View File

@@ -657,14 +657,14 @@ Code:
if("botlist")
active_bot = null
if("summon") //Args are in the correct order, they are stated here just as an easy reminder.
active_bot.bot_control(command= "summon", user_turf= get_turf(usr), user_access= host_pda.GetAccess())
active_bot.bot_control("summon", usr, host_pda.GetAccess())
else //Forward all other bot commands to the bot itself!
active_bot.bot_control(command= href_list["op"], user= usr)
active_bot.bot_control(href_list["op"], usr)
if(href_list["mule"]) //MULEbots are special snowflakes, and need different args due to how they work.
var/mob/living/simple_animal/bot/mulebot/mule = active_bot
if (istype(mule))
mule.bot_control(command=href_list["mule"], user=usr, pda=TRUE)
mule.bot_control(href_list["mule"], usr, pda=TRUE)
if(!host_pda)
return

View File

@@ -238,6 +238,7 @@
return ..()
/obj/structure/blob/proc/chemeffectreport(mob/user)
RETURN_TYPE(/list)
. = list()
if(overmind)
. += list("<b>Material: <font color=\"[overmind.blobstrain.color]\">[overmind.blobstrain.name]</font><span class='notice'>.</span></b>",
@@ -247,11 +248,11 @@
. += "<b>No Material Detected!</b>"
/obj/structure/blob/proc/typereport(mob/user)
RETURN_TYPE(/list)
return list("<b>Blob Type:</b> <span class='notice'>[uppertext(initial(name))]</span>",
"<b>Health:</b> <span class='notice'>[obj_integrity]/[max_integrity]</span>",
"<b>Effects:</b> <span class='notice'>[scannerreport()]</span>")
/obj/structure/blob/attack_animal(mob/living/simple_animal/M)
if(ROLE_BLOB in M.faction) //sorry, but you can't kill the blob as a blobbernaut
return

View File

@@ -14,7 +14,7 @@
var/should_equip = TRUE
var/traitor_kind = TRAITOR_HUMAN //Set on initial assignment
var/datum/syndicate_contract/current_contract
var/list/assigned_contracts = list()
var/list/datum/syndicate_contract/assigned_contracts = list()
var/contract_TC_payed_out = 0
var/contract_TC_to_redeem = 0
can_hijack = HIJACK_HIJACKER
@@ -39,7 +39,7 @@
var/total = 0
var/lowest_paying_sum = 0
var/datum/syndicate_contract/lowest_paying_contract
for (var/i = 1; i <= contract_generation_quantity; i++)
var/datum/syndicate_contract/contract_to_add = new(owner)
var/contract_payout_total = contract_to_add.contract.payout + contract_to_add.contract.payout_bonus
@@ -394,7 +394,7 @@
if (completed_contracts > 0)
var/pluralCheck = "contract"
if (completed_contracts > 1)
if (completed_contracts > 1)
pluralCheck = "contracts"
result += "<br>Completed <span class='greentext'>[completed_contracts]</span> [pluralCheck] for a total of \
<span class='greentext'>[tc_total] TC</span>!<br>"

View File

@@ -72,11 +72,13 @@
air.copy_from(copy)
/turf/return_air()
RETURN_TYPE(/datum/gas_mixture)
var/datum/gas_mixture/GM = new
GM.copy_from_turf(src)
return GM
/turf/open/return_air()
RETURN_TYPE(/datum/gas_mixture)
return air
/turf/temperature_expose()

View File

@@ -5,6 +5,7 @@ GLOBAL_LIST_INIT(duplicate_forbidden_vars,list(
))
/proc/DuplicateObject(atom/original, perfectcopy = TRUE, sameloc, atom/newloc = null, nerf, holoitem)
RETURN_TYPE(original.type)
if(!original)
return
var/atom/O

View File

@@ -152,6 +152,7 @@
return .
/mob/living/carbon/human/proc/get_bank_account()
RETURN_TYPE(/datum/bank_account)
var/datum/bank_account/account
var/obj/item/card/id/I = get_idcard()

View File

@@ -833,7 +833,7 @@
/mob/living/silicon/ai/can_buckle()
return 0
/mob/living/silicon/ai/incapacitated(ignore_restraints = FALSE, ignore_grab = FALSE, check_immobilized = FALSE)
/mob/living/silicon/ai/incapacitated(ignore_restraints = FALSE, ignore_grab = FALSE, check_immobilized = FALSE, ignore_stasis = FALSE)
if(aiRestorePowerRoutine)
return TRUE
return ..()

View File

@@ -672,11 +672,11 @@ Pass a positive integer as an argument to override a bot's default speed.
destination = nearest_beacon
//PDA control. Some bots, especially MULEs, may have more parameters.
/mob/living/simple_animal/bot/proc/bot_control(command, mob/user, turf/user_turf, list/user_access = list())
/mob/living/simple_animal/bot/proc/bot_control(command, mob/user, list/user_access = list())
if(!on || emagged == 2 || remote_disabled) //Emagged bots do not respect anyone's authority! Bots with their remote controls off cannot get commands.
return TRUE //ACCESS DENIED
if(client)
bot_control_message(command,user,user_turf,user_access)
bot_control_message(command, user)
// process control input
switch(command)
if("patroloff")
@@ -688,7 +688,7 @@ Pass a positive integer as an argument to override a bot's default speed.
if("summon")
bot_reset()
summon_target = user_turf
summon_target = get_turf(user)
if(user_access.len != 0)
access_card.access = user_access + prev_access //Adds the user's access, if any.
mode = BOT_SUMMON
@@ -700,15 +700,14 @@ Pass a positive integer as an argument to override a bot's default speed.
return
//
/mob/living/simple_animal/bot/proc/bot_control_message(command,user,user_turf,user_access)
/mob/living/simple_animal/bot/proc/bot_control_message(command, user)
switch(command)
if("patroloff")
to_chat(src, "<span class='warning big'>STOP PATROL</span>")
if("patrolon")
to_chat(src, "<span class='warning big'>START PATROL</span>")
if("summon")
var/area/a = get_area(user_turf)
to_chat(src, "<span class='warning big'>PRIORITY ALERT:[user] in [a.name]!</span>")
to_chat(src, "<span class='warning big'>PRIORITY ALERT:[user] in [get_area_name(user)]!</span>")
if("stop")
to_chat(src, "<span class='warning big'>STOP!</span>")

View File

@@ -15,7 +15,7 @@
var/setting = 1 // displayed range is 3 * setting
var/max_range = 3 // displayed max range is 3 * max range
/datum/effect_system/smoke_spread/chem/smoke_machine/set_up(datum/reagents/carry, setting=1, efficiency=10, loc)
/datum/effect_system/smoke_spread/chem/smoke_machine/set_up(datum/reagents/carry, setting=1, efficiency=10, loc, silent=FALSE)
amount = setting
carry.copy_to(chemholder, 20)
carry.remove_any(amount * 16 / efficiency)

View File

@@ -79,7 +79,7 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
sell()
/obj/docking_port/mobile/supply/proc/buy()
var/list/miscboxes = list() //miscboxes are combo boxes that contain all small_item orders grouped
var/list/obj/miscboxes = list() //miscboxes are combo boxes that contain all small_item orders grouped
var/list/misc_order_num = list() //list of strings of order numbers, so that the manifest can show all orders in a box
var/list/misc_contents = list() //list of lists of items that each box will contain
if(!SSshuttle.shoppinglist.len)

View File

@@ -61,6 +61,7 @@
.++
/obj/vehicle/proc/return_controllers_with_flag(flag)
RETURN_TYPE(/list/mob)
. = list()
for(var/i in occupants)
if(occupants[i] & flag)