proc/GenMap(var/x,var/y,var/z,var/floortype,var/walltype,var/iterations) |
Problem description:
Okay, I haven't tested that, but as far as I know it works.
My problem is thus: How do I make that more elegant? It's an ugly, ugly algorithm currently. I'll run through what it's supposed to do:
1 - Generate a room on the centre of the Z-level being created.
2 - Find every wall with a floor square next to it.
3 - Pick one of those walls at random.
4 - Pick a feature at random
5 - Check if there's enough space to generate 'feature' at 'wall'
6 - If yes, generate the feature and go to 2
7 - If no, go to 2.
8 - Repeat until bored.
A secondary problem - What would be a good way to encode a room layout so that I can have non-rectangle features? It would be fairly easy to write a proc to draw hexagons, crosses, etc., but surely there's a way of defining a sort of 'room mask' of turfs to draw. The only thing I can come up with is a multidimensional list, but that's going to be very, very ugly.
Something like that, I dunno.
Or, you can just place objects directly on the template maps and delete them after you are done using them.
Just friendly ideas.