Files
Bubberstation/code/game/objects/items
Timberpoes 8fef5536c8 Fix pass-by-ref issue causing ID card access lists to be incorrectly mutated. (#61117)
stored_card.GetAccess() eventually leads to /obj/item/card/id/GetAccess() being called. This proc returns the actual access list associated with the ID card rather than a .Copy() of it.

As a result, the line total_access = stored_card.GetAccess() is storing a reference to the stored_card's actual access list.

total_access |= card_slot2.stored_card.GetAccess() is then mutating the first ID card's access list via the reference.

The result? When /obj/item/computer_hardware/card_slot/GetAccess() is called with 2 ID cards in a modular computer, the second ID card gives all of its accesses to the first ID card thanks to the |= operation.

There are a number of ways around this. Some pieces of code do var/list/thing = list() and then |= every GetAccess() since it's guaranteed to return a list. This creates new lists instead.

However, I feel GetAccess() for ID cards really shouldn't be returning a ref to the list. Instead, it now returns a Copy() of the list and code implementing behaviour using GetAccess() doesn't need to worry about list mutation at all.
2021-09-01 13:05:18 +01:00
..
2021-08-30 21:35:02 -07:00
2021-07-20 17:50:22 +01:00
2021-07-26 16:35:46 -07:00
2021-08-20 14:28:34 -04:00
2021-08-25 21:33:16 -03:00
2021-07-29 02:17:03 -07:00
2021-07-28 16:00:56 -07:00
2021-08-29 15:42:53 +03:00
2021-07-26 16:35:46 -07:00
2021-06-22 00:17:26 -07:00