The overloaded modProperty method in Entity creates a new instance
property automatically from any type property, which is something we
have to take into account.
Since entries in the database tying entities to accounts only can be
created if the entity already is created in the database we need to make
sure the relation in "accounts_entities" isn't created until the entry in
"entities". This is done by letting the StorageManager handle it.
The way to interface between the Persistance and the StorageManager
classes isn't obvious, so we'll have to do it by signals.
When we're restoring from storage we don't want to apply any properties
at all when the entity is created, since we'll do that ourselves in a
later pass. This is done by submitting an invalid RootOperation pointer.
We now first create all of the entities, in order, but without setting
any properties. Once that's done we then go through all entities again,
in order, and set their properties. This is to make sure that
1) We don't set any properties until all child entities are created.
This is crucial for things like outfits to work.
2) We first set the properties of the parent, and then the properties of
the children. This is crucial for things like terrain modifiers to work.
Instead of the root entity always being the default one (for new
entities being created etc.) we now can specify another entity which is
the default one.
It's important that the order is correct. In order for properties which
refer to other entities (like the "outfit" property) to work the
children must first be restored before the properties are restored.
Currently thoughts are only stored when the server is shut down. A more
proper way would probably be to query character and store their thoughts
at regular intervals while the simulation is running.
All IG code should use the interface of LocatedEntity when dealing
with any entity, rather than sometimes requiring Entity. Add virtual
functions to the interface where required, and modify all other interfaces
to stop them using Entity. This makes the code way cleaner, and much better
de-coupled.