In order for this to work, we must always issue an Update
op after a Set op, so that we can handle any updated properties too.
We also have to add a new Entity flag to handle when the location
has been dirtied, since this isn't handled by normal properties.
In almost all instances most properties will only be used
for a specific key. To make things easier and less error prone
we've introduced the trait "property_name", which when available
allows us to refer to a property only by class, and not having
to specify the key it's bound to.
Whenever a property isn't installed into CorePropertyManager properly
there's a risk that the system will be put into an invalid state when
it's shutdown and restarted (and data is persisted and restored). To
prevent this we'll both assert and log a warning if a property ever is
redefined.
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.
* common/Identified.cpp, common/Identified.h, rulesets/Character.h,
rulesets/LocatedEntity.h, server/Account.h, server/Admin.cpp,
server/CommClient.cpp, server/CommClient.h, server/Connection.cpp,
server/Connection.h, server/ExternalMind.h,
server/ExternalProperty.cpp, server/ExternalProperty.h,
server/Lobby.h, server/Master.h, server/Peer.h,
server/ServerRouting.h, server/SlaveClientConnection.h:
Rename IdentifiedRouter to Router as it's the base class
for pretty much all routers.
* rulesets/LocatedEntity.cpp, rulesets/LocatedEntity.h: Make all the
property access functions that should never be used to modify a
property const. Remove requirePropertyClass() as it pretty much
can't be const.
* rulesets/Entity.cpp, rulesets/Entity.h: Make overriden
getProperty() const as it is in the base class. Add new
property access functions for code that needs to modify the
properties which ensures class properties never get modified
through the Entity interface.
* rulesets/Character.cpp, rulesets/Plant.cpp, rulesets/Py_Thing.cpp,
rulesets/TerrainModProperty.cpp, server/CorePropertyManager.cpp:
Change all the code that accesses properties to use the right
functions.
* rulesets/LocatedEntity.h: Rename some member functions and templates
to make more sense and be consistent.
* rulesets/Character.cpp, rulesets/Plant.cpp,
server/CorePropertyManager.cpp: Fix the code to use the new names.
* common/Property.h: Add helper functions to make it easy and clear
to manipulate flags.
* common/Database.cpp, common/Database.h: Expand the entity database
table to include LOC and update sequence number. Implement new
functions that insert test entity data into entity and property
tables.
* rulesets/LocatedEntity.h: Add an accessor providing direct access to
the properties dictionary for persistence.
* server/Persistance.cpp: Remove the bounding box chunk from the
entity table schema.
* server/StorageManager.cpp: Implement inserting and updating rows
into the Entity and Propertiy tables.
* rulesets/LocatedEntity.h: Add onUpdated() virtual method to be
called when the attributes of an Entity are changed.
* rulesets/Entity.cpp, rulesets/Entity.h, rulesets/LocatedEntity.cpp,
rulesets/Thing.cpp, server/WorldRouter.cpp: Implement onUpdated()
to emit the updated signal on Entity, and change all code to
call onUpdated instead of emiting the signal.
* client/BaseClient.cpp, common/BaseEntity.cpp, common/BaseEntity.h,
common/Identified.cpp, common/Identified.h, common/Makefile.am,
common/OOGThing.cpp, common/OOGThing.h, common/OperationRouter.cpp,
common/OperationRouter.h, rulesets/Character.h, rulesets/Entity.h,
rulesets/LocatedEntity.cpp, rulesets/LocatedEntity.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/CommClient.cpp, server/CommClient.h, server/Connection.cpp,
server/Connection.h, server/ExternalMind.cpp, server/ExternalMind.h,
server/ExternalProperty.cpp, server/ExternalProperty.h,
server/Lobby.cpp, server/Lobby.h, server/Master.cpp, server/Master.h,
server/Peer.cpp, server/Peer.h, server/ServerRouting.cpp,
server/ServerRouting.h, server/SlaveClientConnection.cpp,
server/SlaveClientConnection.h: Factor out the more pointless base
classes, in favor of simple interface. Move destroyed signal to
Entity, which is the only place it is needed.
* common/OperationRouter.cpp, common/OperationRouter.h: Interface
class for objects when can handle or route operations.
* common/BaseEntity.h, common/BaseEntity.cpp: Remove standard
implementation of operation handler, forcing class to provide
more specific implementations.
* rulesets/LocatedEntity.h, rulesets/LocatedEntity.cpp: Add an
implementation of the OperationRouter interface, suitable for
IG operations.
* server/ServerRouting.h, server/Peer.cpp, server/Peer.h,
rulesets/MemEntity.h: Add placeholder OperationRouter
implementations.
* server/Connection.cpp: Update OperationRouter implementation to
be better suited.
* server/Account.cpp, server/Account.h: Implement OperationRouter
for accounts.
* rulesets/LocatedEntity.h: Add an additional template function for
forcing the existence of a property of the required type.
* rulesets/Character.cpp: Make the code further simpler and more
readable by using the new template function to require a property
exist.
* rulesets/LocatedEntity.h: Add a template function for quickly
querying a property of the required type.
* rulesets/Character.cpp: Use getSpecificProperty() to improve
brevity and readability of some of the code.
* rulesets/LocatedEntity.cpp, rulesets/LocatedEntity.h: Add a virtual
function that is called when the location of an entity changes.
* rulesets/Entity.cpp, rulesets/Entity.h: Implement the virtual
function called when location changes and use it to call the
containered signal. Remove the containered_oneshots list, and
make containered inherently one shot only.
* rulesets/OutfitProperty.cpp: Remove the use of containered_oneshots
is this mechanism is obsolete and has been removed.
* rulesets/LocatedEntity.cpp, rulesets/LocatedEntity.h:
Don't allocated storage for m_contains by default, only
on demand. Add a convenience method which checks, and
allocates the storage if required. Set up the ID property
on this base class rather then Entity.
* rulesets/Py_Thing.cpp: Remove special handling of ID attribute
as it is now handled by the property.
* rulesets/Character.cpp, rulesets/Entity.cpp, rulesets/MemMap.cpp,
rulesets/Motion.cpp, rulesets/Py_Mind.cpp, rulesets/Py_Thing.cpp,
rulesets/Thing.cpp, rulesets/World.cpp, server/WorldRouter.cpp:
Make sure all parts of the code where contains is used have
the right checks, as it could be null.
* rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/LocatedEntity.cpp, rulesets/LocatedEntity.h,
rulesets/MemMap.cpp, rulesets/Motion.cpp, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/WorldRouter.cpp: Change LocatedEntity::m_contains into
a pointer so that the majority of entities that can not contain
anything don't waste the storage.
* rulesets/Entity.cpp, rulesets/Entity.h, rulesets/LocatedEntity.cpp,
rulesets/LocatedEntity.h: Remove raw atlas attributes, and use
properties for everything, cutting down the differences in
interface.
* rulesets/Py_Thing.cpp, rulesets/Thing.cpp: Remove code that accessed
soft attributes directly.
* client/CreatorClient.cpp, client/CreatorClient.h,
client/Py_CreatorClient.cpp, common/BaseWorld.h, common/types.h,
modules/Location.cpp, modules/Location.h,
rulesets/AtlasProperties.cpp, rulesets/AtlasProperties.h,
rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/EntityProperties.cpp, rulesets/LocatedEntity.cpp,
rulesets/LocatedEntity.h, rulesets/MemEntity.cpp,
rulesets/MemEntity.h, rulesets/MemMap.cpp, rulesets/Motion.cpp,
rulesets/Motion.h, rulesets/Py_Location.h, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Py_Thing.h,
rulesets/PythonMindScript.h, rulesets/PythonScript.h,
rulesets/PythonThingScript.cpp, rulesets/PythonThingScript.h,
rulesets/Python_API.cpp, rulesets/Script.cpp, rulesets/Script.h,
rulesets/Thing.cpp, rulesets/World.cpp, server/WorldRouter.cpp,
server/WorldRouter.h: Refactor all the entity code so there is now
a new base class for entities in the world simulation, and in the
mind which only contains things which are trully common to both.
This moves a lot of functionality which should not have been
present in mind entities away, and makes that code safer and more
efficient.
* tests/TestWorld.h: Update the test world API to match the base
class.