+
+ std::sort(entities.begin(), entities.end(), ZCompare);
+ for (std::vector<Entity *>::iterator i(entities.begin()), end(entities.end()); i != end; ++i) {
+ (*i)->Render(screen, offset);
+ }
+}
+
+
+bool MapState::ZCompare(const Entity *lhs, const Entity *rhs) {
+ return lhs->Position().Y() < rhs->Position().Y();