Skip to content

Commit

Permalink
Removes stupid listlike var access code (tgstation#84648)
Browse files Browse the repository at this point in the history
## About The Pull Request

[Removes all other listlike var
accesses](tgstation@4c5996b)

Also fucking dumpsters an unused proc that allowed for arbitrary
variable modifcation. Bad juju

This is undefined behavior and errors in later 515 versions. also it's
stupid as hell
  • Loading branch information
LemonInTheDark authored Jul 5, 2024
1 parent 12b9259 commit 78fc873
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion code/__HELPERS/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(list(
* A list of all machinery tied to an area along with the area itself. key=area name,value=list(area,list of machinery)
* we use this to keep track of what areas are affected by the blueprints & what machinery of these areas needs to be reconfigured accordingly
*/
var/area/affected_areas = list()
var/list/area/affected_areas = list()
for(var/turf/the_turf as anything in turfs)
var/area/old_area = the_turf.loc

Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/paths/path.dm
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ GLOBAL_LIST_INIT(can_pass_info_vars, GLOBAL_PROC_REF(can_pass_check_vars))

/datum/can_pass_info/proc/compare_against(datum/can_pass_info/check_against)
for(var/comparable_var in GLOB.can_pass_info_vars)
if(!(vars[comparable_var] ~= check_against[comparable_var]))
if(!(vars[comparable_var] ~= check_against.vars[comparable_var]))
return FALSE
if(!pulling_info != !check_against.pulling_info)
return FALSE
Expand Down
6 changes: 0 additions & 6 deletions code/__HELPERS/records.dm

This file was deleted.

2 changes: 1 addition & 1 deletion code/controllers/subsystem/research.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SUBSYSTEM_DEF(research)
//TECHWEB STATIC
var/list/techweb_nodes = list() //associative id = node datum
var/list/techweb_designs = list() //associative id = node datum
var/list/datum/design/item_to_design = list() //typepath = list of design datums
var/list/list/datum/design/item_to_design = list() //typepath = list of design datums

///List of all techwebs, generating points or not.
///Autolathes, Mechfabs, and others all have shared techwebs, for example.
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/spatial_gridmap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ SUBSYSTEM_DEF(spatial_grid)
. = list()

//technically THIS list only contains lists, but inside those lists are grid cell datums and we can go without a SINGLE var init if we do this
var/list/datum/spatial_grid_cell/grid_level = grids_by_z_level[center_turf.z]
var/list/list/datum/spatial_grid_cell/grid_level = grids_by_z_level[center_turf.z]

switch(type)
if(SPATIAL_GRID_CONTENTS_TYPE_CLIENTS)
Expand Down
10 changes: 9 additions & 1 deletion code/datums/ai/_ai_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,15 @@ multiple modular subtrees with behaviors
if(ai_status == AI_STATUS_OFF)
return

if(exited && (get_dist(pawn, (islist(exited) ? exited[1] : exited)) <= interesting_dist)) //is our target in between interesting cells?
var/distance = INFINITY
if(islist(exited))
var/list/exited_list = exited
distance = get_dist(pawn, exited_list[1])
else if(isatom(exited))
var/atom/exited_atom = exited
distance = get_dist(pawn, exited_atom)

if(distance <= interesting_dist) //is our target in between interesting cells?
return

if(should_idle())
Expand Down
3 changes: 2 additions & 1 deletion code/datums/components/_component.dm
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@
var/datum/component/C = dc[c_type]
if(C)
if(length(C))
C = C[1]
var/list/component_list = C
C = component_list[1]
if(C.type == c_type)
return C
return null
Expand Down
3 changes: 2 additions & 1 deletion code/datums/greyscale/_greyscale_config.dm
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,9 @@
for(var/datum/greyscale_layer/layer as anything in group)
var/icon/layer_icon
if(islist(layer))
var/list/layer_list = layer
layer_icon = GenerateLayerGroup(colors, layer, render_steps, new_icon || last_external_icon)
layer = layer[1] // When there are multiple layers in a group like this we use the first one's blend mode
layer = layer_list[1] // When there are multiple layers in a group like this we use the first one's blend mode
else
layer_icon = layer.Generate(colors, render_steps, new_icon || last_external_icon)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@
if(response.body == "[]")
dat += "<center><b>0 bans detected for [ckey]</b></center>"
else
bans = json_decode(response["body"])
bans = json_decode(response.body)

//Ignore bans from non-whitelisted sources, if a whitelist exists
var/list/valid_sources
Expand Down
5 changes: 3 additions & 2 deletions code/modules/admin/view_variables/debug_variables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
/proc/debug_variable(name, value, level, datum/owner, sanitize = TRUE, display_flags = NONE) //if D is a list, name will be index, and value will be assoc value.
if(owner)
if(islist(owner))
var/list/list_owner = owner
var/index = name
if (value)
name = owner[name] //name is really the index until this line
name = list_owner[name] //name is really the index until this line
else
value = owner[name]
value = list_owner[name]
. = "<li style='backgroundColor:white'>([VV_HREF_TARGET_1V(owner, VV_HK_LIST_EDIT, "E", index)]) ([VV_HREF_TARGET_1V(owner, VV_HK_LIST_CHANGE, "C", index)]) ([VV_HREF_TARGET_1V(owner, VV_HK_LIST_REMOVE, "-", index)]) "
else
. = "<li style='backgroundColor:white'>([VV_HREF_TARGET_1V(owner, VV_HK_BASIC_EDIT, "E", name)]) ([VV_HREF_TARGET_1V(owner, VV_HK_BASIC_CHANGE, "C", name)]) ([VV_HREF_TARGET_1V(owner, VV_HK_BASIC_MASSEDIT, "M", name)]) "
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mapping/mapping_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_atoms_ontop)
if(response.errored || response.status_code != 200)
query_in_progress = FALSE
CRASH("Failed to fetch mapped custom json from url [json_url], code: [response.status_code], error: [response.error]")
var/json_data = response["body"]
var/json_data = response.body
json_cache[json_url] = json_data
query_in_progress = FALSE
return json_data
Expand Down
2 changes: 1 addition & 1 deletion code/modules/vehicles/_vehicle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
var/canmove = TRUE
var/list/autogrant_actions_passenger //plain list of typepaths
var/list/autogrant_actions_controller //assoc list "[bitflag]" = list(typepaths)
var/list/mob/occupant_actions //assoc list mob = list(type = action datum assigned to mob)
var/list/list/datum/action/occupant_actions //assoc list mob = list(type = action datum assigned to mob)
///This vehicle will follow us when we move (like atrailer duh)
var/obj/vehicle/trailer
var/are_legs_exposed = FALSE
Expand Down
2 changes: 1 addition & 1 deletion code/modules/vehicles/mecha/mech_fabricator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@

for(var/datum/design/design in cached_designs)
var/cost = list()
var/list/materials = design["materials"]
var/list/materials = design.materials
for(var/datum/material/mat in materials)
cost[mat.name] = OPTIMAL_COST(materials[mat] * component_coeff)

Expand Down
1 change: 0 additions & 1 deletion tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@
#include "code\__HELPERS\radio.dm"
#include "code\__HELPERS\randoms.dm"
#include "code\__HELPERS\reagents.dm"
#include "code\__HELPERS\records.dm"
#include "code\__HELPERS\ref.dm"
#include "code\__HELPERS\roundend.dm"
#include "code\__HELPERS\sanitize_values.dm"
Expand Down

0 comments on commit 78fc873

Please sign in to comment.