Skip to content

Commit

Permalink
Elevates InvalidIndexOperation pragma to an error. (#6653)
Browse files Browse the repository at this point in the history
# About the pull request

Elevates InvalidIndexOperation to be an error in OD compile.

# Explain why it's good for the game


![image](https://github.com/cmss13-devs/cmss13/assets/41448081/91ee3ede-c268-493d-ab86-4da7bf5cf8aa)

---------

Co-authored-by: John Doe <[email protected]>
  • Loading branch information
Zonespace27 and johndoe2013 committed Jul 10, 2024
1 parent fe6eb26 commit 8a06fc0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions code/__pragmas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#pragma InvalidOverride error
#pragma DanglingVarType error
#pragma MissingInterpolatedExpression error
#pragma InvalidIndexOperation error

//3000-3999
#pragma EmptyBlock error
3 changes: 2 additions & 1 deletion code/datums/components/_component.dm
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,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/game/machinery/vending/cm_vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,8 @@ GLOBAL_LIST_INIT(cm_vending_gear_corresponding_types_list, list(
var/obj/item/item_ref = myprod[3]
var/priority = myprod[priority_index]
if(islist(item_ref)) // multi-vending
item_ref = item_ref[1]
var/list/ref_list = item_ref
item_ref = ref_list[1]

var/is_category = item_ref == null

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 @@ -4,11 +4,12 @@
var/header
if(D)
if(islist(D))
var/list/var_list = D
var/index = name
if (value)
name = D[name] //name is really the index until this line
name = var_list[name] //name is really the index until this line
else
value = D[name]
value = var_list[name]
header = "<li style='backgroundColor:white'>[VV_HREF_TARGET_1V(D, VV_HK_LIST_EDIT, "E", index)][VV_HREF_TARGET_1V(D, VV_HK_LIST_CHANGE, "C", index)][VV_HREF_TARGET_1V(D, VV_HK_LIST_REMOVE, "-", index)] "
else
header = "<li style='backgroundColor:white'>[VV_HREF_TARGET_1V(D, VV_HK_BASIC_EDIT, "E", name)][VV_HREF_TARGET_1V(D, VV_HK_BASIC_CHANGE, "C", name)][VV_HREF_TARGET_1V(D, VV_HK_BASIC_MASSEDIT, "M", name)] "
Expand Down
3 changes: 3 additions & 0 deletions code/modules/paperwork/notepad.dm
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
else
to_chat(usr, SPAN_NOTICE("You need to hold it in your hands!"))

/obj/item/notepad/proc/operator[](index_num)
return contents[index_num]

/obj/item/notepad/verb/rename()
set name = "Rename notepad"
set category = "Object"
Expand Down
3 changes: 3 additions & 0 deletions code/modules/paperwork/paper_bundle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@
else
to_chat(usr, SPAN_NOTICE("You need to hold it in your hands!"))

/obj/item/paper_bundle/proc/operator[](index_num)
return contents[index_num]

/obj/item/paper_bundle/verb/rename()
set name = "Rename bundle"
set category = "Object"
Expand Down

0 comments on commit 8a06fc0

Please sign in to comment.