Make many item methods const, and make generate_lightmap use has_flags

map::generate_lightmap was using direct references to item types. This bothered me, so I fixed it to use has_flags.

Along the way, I also had to make some methods const (and got a bunch others for good measure).

Hopefully won't be blown away by GlyphGryph's current project.