Commit graph

50 commits

Author SHA1 Message Date
Erik Ogenvik
668c6edd0c Allow properties to alter other properties.
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.
2016-06-26 20:16:48 +02:00
Erik Ogenvik
8cfe2ba0eb Altered signature to prevent ambiguity. 2016-06-26 20:13:31 +02:00
Erik Ogenvik
de4c3b9347 Allow properties to specify keys.
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.
2016-06-26 19:08:54 +02:00
Erik Ogenvik
c9ebbfd6c6 Added method for determining visibility.
And then use that to determine if parent locations should be shown.
2016-06-26 14:18:37 +02:00
Erik Ogenvik
889695af07 Provide const domain accessor. 2016-06-22 17:29:27 +02:00
Erik Ogenvik
2d644311cc Describe entities better in log messages. 2016-06-08 21:46:37 +02:00
Erik Ogenvik
2ef0495969 Added "id" to immutable properties.
Also changed to using initializer list creation.
2015-07-13 22:14:51 +02:00
Erik Ogenvik
3b70e9c3cb Regularly persist thoughts to database.
Instead as before only persisting at shutdown.
2015-05-26 22:27:39 +02:00
Erik Ogenvik
4a43d78de6 Monitor the number of active entitites per type.
This is very useful for monitoring, as it allows us to recognize
problematic patterns.
2015-04-08 19:16:54 +02:00
Erik Ogenvik
f837532dd8 Added methods for adding and removing children.
Virtual so that they can be caught in subclasses. This is mainly meant
for the Limbo entity.
2014-09-20 22:09:00 +02:00
Erik Ogenvik
b171410b05 Let the domain be specified by a property.
This means that we only attach domains to entities that have the
"domain" property. The "land" entity type for example.
2014-09-15 21:11:35 +02:00
Erik Ogenvik
79d6bda7b2 Properly remove properties with delegates. 2014-08-26 21:09:02 +02:00
Olek Wojnar
7f9ff2246d Remove CVS $Id tags
The legacy tags are causing build issues in Debian.
2013-07-15 20:31:59 +02:00
Erik Ogenvik
835b9fadd6 Alter containered signal.
Make it not single shot. And supply the old location, as it was before
the container changed.
This is to make it more useful in general.
2013-06-15 22:53:50 +02:00
Erik Ogenvik
9ef808edaa Assert and warn about property redefine.
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.
2013-06-02 00:06:52 +02:00
Alistair Riddoch
4e30a35aa4 Remove handler related types 2013-02-14 10:09:45 +00:00
Alistair Riddoch
5eceba40cf Remove unused handler mechanism 2013-02-14 10:01:20 +00:00
Alistair Riddoch
3d6f39cdee Modify Property install method to take name
This change also switches DecaysProperty to using delegates as a proof of
concept.
2013-02-13 00:45:36 +00:00
Alistair Riddoch
9801640ff8 Make destroy() pure virtual in the base class 2013-01-24 22:52:05 +00:00
Alistair Riddoch
740c9070b1 Replace explicit sleep bool with a flag 2013-01-22 23:29:23 +00:00
Alistair Riddoch
d2faad7707 Returning a const integral type is meaningless 2013-01-22 19:49:34 +00:00
Alistair Riddoch
7651adfac9 Use test framework for LocatedEntity test 2013-01-19 00:51:05 +00:00
Alistair Riddoch
4a9c7078f7 Refactor to use LocatedEntity as base class
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.
2013-01-17 10:17:07 +00:00
Alistair Riddoch
4e66987bad Consolidate flags into one place 2013-01-14 09:59:54 +00:00
Alistair Riddoch
b0fcff302a Tweak the decref logic for Entities
Decrementing here makes it easier to debug refcounting by
using watches.
2011-10-03 13:33:50 +01:00
Alistair Riddoch
ac37383d8a Convery all the property get functions 2011-09-29 17:36:26 +01:00
Alistair Riddoch
a51fe0fae0 Return the property affected when setAttr is called 2011-02-27 23:56:11 +00:00
Alistair Riddoch
edb75400bd Add cassert to files that need it. 2011-02-02 23:29:21 -08:00
Alistair Riddoch
8b69e3a821 Rename Identified to Router to match the class name. 2009-03-22 15:44:54 +00:00
Al Riddoch
40a3bd1018 2008-12-10 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-12-10 01:16:37 +00:00
Al Riddoch
a80f85e85a 2008-10-01 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-10-01 18:20:57 +00:00
Al Riddoch
660abec7d2 2008-10-01 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-10-01 16:30:29 +00:00
Al Riddoch
588af9417e 2008-09-29 Al Riddoch <alriddoch@googlemail.com>
* rulesets/LocatedEntity.h, rulesets/LocatedEntity.cpp: Add two
	  new methods which make it easier to retrieve property data
	  in a type safe way.
2008-09-29 02:49:45 +00:00
Al Riddoch
cbaceacfba 2008-09-26 Al Riddoch <alriddoch@googlemail.com>
* rulesets/LocatedEntity.h: Only initialise a required property
	  if a value is given.
2008-09-26 21:07:20 +00:00
Al Riddoch
fb278302b0 2008-08-23 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-08-23 17:53:43 +00:00
Al Riddoch
b9e5f8d79f 2008-08-17 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-08-16 23:21:06 +00:00
Al Riddoch
adc64c3ced 2008-01-28 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-01-28 23:48:30 +00:00
Al Riddoch
e418f9a1ef 2008-01-13 Al Riddoch <alriddoch@googlemail.com>
* client/BaseClient.cpp, client/ClientConnection.cpp,
	  common/BaseWorld.h, common/OperationRouter.h, common/TypeNode.h,
	  common/inheritance.cpp, common/inheritance.h, common/types.h,
	  rulesets/ActivePropertyFactory.h, rulesets/AtlasProperties.h,
	  rulesets/EntityPropertyFactory.h, rulesets/LocatedEntity.h,
	  rulesets/MemMap.h, rulesets/Motion.h, rulesets/Movement.h,
	  rulesets/Pedestrian.h, rulesets/PythonThingScript.cpp,
	  rulesets/Statistics.h, rulesets/Task.h, server/Account.h,
	  server/Connection.h, server/Player.h, server/ServerRouting.h,
	  server/WorldRouter.h, tests/OperationExerciser.h, tools/cycmd.cpp:
	  A major clean up and re-work in internal headers.
2008-01-13 01:32:54 +00:00
Al Riddoch
41ce55e11e 2008-01-12 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-01-12 18:08:03 +00:00
Al Riddoch
2bc1244b58 2008-01-08 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-01-08 21:13:14 +00:00
Al Riddoch
2852f49c5f 2008-01-08 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-01-08 15:21:42 +00:00
Al Riddoch
c362fd4e70 2008-01-06 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-01-07 00:06:18 +00:00
Al Riddoch
24aa46bc4d 2008-01-05 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-01-05 14:05:05 +00:00
Al Riddoch
41bed0431b 2007-12-31 Al Riddoch <alriddoch@googlemail.com>
* 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.
2007-12-31 17:39:25 +00:00
Al Riddoch
b9464cddf3 2007-12-27 Al Riddoch <alriddoch@zepler.org>
* common/types.h, rulesets/LocatedEntity.h: Clean up typedefs, and
	  make sure they are used from the right includes.
2007-12-29 01:33:57 +00:00
Al Riddoch
0ccb03b1f6 2007-12-24 Al Riddoch <alriddoch@zepler.org>
* 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.
2007-12-24 00:32:11 +00:00
Al Riddoch
f65cdaf5d2 2007-12-07 Al Riddoch <alriddoch@zepler.org>
* common/BaseWorld.h, common/PropertyFactory.h, rulesets/Character.h,
	  rulesets/LocatedEntity.h, rulesets/MemMap.h, rulesets/Py_Location.h,
	  rulesets/Py_Thing.h, rulesets/Python_Script_Utils.h,
	  rulesets/Statistics.h, server/Connection.h, server/EntityFactory.h,
	  server/Persistance.h, server/PersistantThingFactory.h,
	  server/Persistor.h, server/Restoration.h, server/TaskFactory.h:
	  Sort forward declarations alphabetically, because alphabetical
	  is good.
2007-12-07 01:19:16 +00:00
Al Riddoch
dafe0ec0a2 2007-12-03 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.h, rulesets/LocatedEntity.h: Update the doc strings
2007-12-03 23:55:11 +00:00
Al Riddoch
8e8df5b482 2007-12-02 Al Riddoch <alriddoch@zepler.org>
* 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.
2007-12-02 23:49:05 +00:00
Al Riddoch
15f034fbfd 2007-12-02 Al Riddoch <alriddoch@zepler.org>
* rulesets/LocatedEntity.cpp, rulesets/LocatedEntity.h:
	  Add a new base class for entities with location data and
	  attributes.
2007-12-02 19:20:55 +00:00