I guess my workaround code is not as exiting as the above code snippet, but here goes:
<GLOBAL LOC-LIST <ITABLE 48 0>>
<GLOBAL WAM-LIST <ITABLE 48 0>>
<ROUTINE MAD-MAX ()
<REPEAT ((R <FIRST? ,ROOMS>)(I 0))
<COND(<NOT .R> <RETURN>)>
<SET I <GETP .R ,P?INDEX>>
<PUT ,LOC-LIST .I .R>
<REPEAT ((O <FIRST? .R>)(J 0))
<COND(<NOT .O> <RETURN>)>
<SET J <GETP .O ,P?INDEX>>
<COND(<N=? .J 0><PUT ,WAM-LIST .J .O>)>
<SET O <NEXT? .O>>
>
<SET R <NEXT? .R>>
>
>
This code creates an index of all rooms, and an index of all WAM objects.
I kept running into limitations with the number of properties I could add to objects (and borogove did not allow me to choose version 4 for some reason), so I moved everything into tables. But for that I need to be able to look them up.
I originally was iterating through all objects to find the one with a given index, but creating empty index tables and filling them up at game start turned out to be faster.
It was also more foolproof, because manually updating a list of rooms turned out to be a pain in the backside. Also, creating a static list of objects didn’t work (probably due to their dynamic nature? creating a list of rooms did work…)