Skip to content

Commit

Permalink
fixed room_find
Browse files Browse the repository at this point in the history
  • Loading branch information
omicronrex committed Aug 8, 2024
1 parent a9c39e7 commit cc82569
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions source/indexing.gml
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@
//returns: room id, or noone
//Finds a room by its name. if the room doesn't exist, noone is returned.
//The first time this function is called, extra time is spent building an index, and subsequent calls are much faster.
var __l,__i;

var l,i;
if (__gm82core_index_rooms==noone) {
__gm82core_index_rooms=ds_map_create()
i=room_first while (i!=room_last) {ds_map_add(__gm82core_index_objects,object_get_name(i),i) i=room_next(i)}
__i=room_first while (__i!=room_last) {ds_map_add(__gm82core_index_rooms,room_get_name(__i),__i) __i=room_next(__i)}
//add last room
ds_map_add(__gm82core_index_rooms,room_get_name(__i),__i)
}
if (ds_map_exists(__gm82core_index_rooms,argument0)) return ds_map_find_value(__gm82core_index_rooms,argument0)
return noone

0 comments on commit cc82569

Please sign in to comment.