Eliminate circular manager loading loop.
Eliminate circular manager loading loop.

Initializing the entity manager caused it to try to initialize the map
manager and store a reference to it. Initializing the map manager would
cause it to try to change maps to the current map (to run the current
map's initialization code), and changing maps tries to get the entity
manager and call its setup_entities method.

The entity manager at that point *does* exist, because it initiated this
chain, but it hasn't defined a map manager yet, because we're still in
the right-hand-side of the map manager assignment, so when the setup
entities code tries to ask the map manager it stored for things, we get
a null value -- even though the map manager does exist and can answer
the question.

The solution is to not store a map manager reference, which means that
we ask the map manager directly, rather than try to use an uninitialized
variable. A second part of the solution though is to move the map
manager's call to change maps into the end of the entity manager's init,
because we know at that point that both the map and entity manager are
initialized.

Neither Creek's sample project nor Jabiru hit this at all! I was quite
surprised when Tetris got itself into a dependency cycle while loading
maps, and it's because Jabiru and Creek Sample both load their initial
maps asynchronously, which causes an early bailout of the change_maps
call -- we never get to calling setup_entities, so we never fall into
a cycle. Tetris uses an initial map embedded within config.js, so it
was able to hit this code.

I think I'm getting to the point here where adding tests for sanity is
worth the permanent maintenance cost. It feels kinda like playing Civ IV
and deciding to adopt the "Testing" civic: it'll bring days of totally
unproductive revolution, but on the other side, things will be better.

We'll see when I get around to it.

wcarss/creek,wcarss/creek