I had a brainwave about how to optimize my code, but then it fell flat. I had been doing the following:
... in order to cross reference rooms with the building they belong to. But then every time I wanted to know which building a room belonged to, I had to do this:
... in order to iterate through the buildings until I found the right one. Then I read more about types and the type identifier and I *thought* I could do this:
But I get an "Illegal Type Conversion" error. I think it's a shame I can't store the type identifier as a variable, for future use. Is this something that is legal in BlitzMax? Even better, is it possible in B3D?
house.building = New building house\id = nextid: nextid = nextid+1 space.room = New room space\buildingID = house\id
... in order to cross reference rooms with the building they belong to. But then every time I wanted to know which building a room belonged to, I had to do this:
space.room = First room house.building = First building While house\id <> space\buildingID house = After house Wend
... in order to iterate through the buildings until I found the right one. Then I read more about types and the type identifier and I *thought* I could do this:
house.building = New building space.room = New room space\buildingID = house
But I get an "Illegal Type Conversion" error. I think it's a shame I can't store the type identifier as a variable, for future use. Is this something that is legal in BlitzMax? Even better, is it possible in B3D?