Commit graph

239 commits

Author SHA1 Message Date
Alistair Riddoch
5838626242 Remove dependency on WFMATH_EPSILON 2012-02-28 13:41:33 +00:00
Alistair Riddoch
fbbd7e0722 Avoid excessive conversions in time calculations 2011-04-27 19:55:32 +01:00
Alistair Riddoch
335e162cb0 Use movement domain to do all height constraint requests. 2009-05-12 23:30:19 +01:00
Al Riddoch
ab54d0fea2 2009-02-02 Al Riddoch <alriddoch@googlemail.com>
* common/Identified.cpp, common/Identified.h:
	  Flatten down the base classes into one called Router.

	* client/CharacterClient.cpp, client/CreatorClient.cpp,
	  rulesets/BaseMind.cpp, rulesets/Character.cpp,
	  rulesets/Creator.cpp, rulesets/Entity.cpp,
	  rulesets/LocatedEntity.cpp, rulesets/MemEntity.cpp,
	  rulesets/Plant.cpp, rulesets/Stackable.cpp,
	  rulesets/Thing.cpp, rulesets/World.cpp,
	  server/Account.cpp, server/Admin.cpp,
	  server/Connection.cpp, server/ExternalMind.cpp,
	  server/Lobby.cpp, server/Master.cpp,
	  server/Peer.cpp, server/Player.cpp,
	  server/ServerRouting.cpp, server/SlaveClientConnection.cpp,
	  server/TrustedConnection.cpp, tests/LocatedEntitytest.cpp,
	  tests/ThingupdatePropertiestest.cpp: Update all the operation
	  routing classes to use the modified base class correctly.
2009-02-02 02:28:45 +00:00
Al Riddoch
497377be43 2008-11-11 Al Riddoch <alriddoch@googlemail.com>
* rulesets/Character.cpp: Clean up some unused declarations and
	  headers.

	* rulesets/Plant.cpp, rulesets/Thing.cpp: Remove some unused
	  includes.
2008-11-11 00:45:52 +00:00
Al Riddoch
0015259b08 2008-10-01 Al Riddoch <alriddoch@googlemail.com>
* rulesets/Thing.cpp, rulesets/Thing.h: Fix updateProperties() to be
	  not const, so it now compiles.
2008-10-01 15:32:39 +00:00
Al Riddoch
9043bba74b 2008-10-01 Al Riddoch <alriddoch@googlemail.com>
* rulesets/Thing.cpp: When properties have been updated,
	  mark them to be stored in the Database, and emit the necessary
	  signal.
2008-10-01 10:47:53 +00:00
Al Riddoch
d656b2c708 2008-09-23 Al Riddoch <alriddoch@googlemail.com>
* common/Property.h: Add a flag to indicate a properties value
	  has been changed, but the new value has not been broadcast.

	* rulesets/Thing.cpp: Re-write the Update handler to ignore the
	  operation arguments, and broadcast an update for all properties
	  marked as unsent.

	* rulesets/Character.cpp: Update all code which sent an update
	  operation so that it sets the flags rather than naming them
	  in the argument.
2008-09-22 23:47:04 +00:00
Al Riddoch
77add6a173 2008-09-03 Al Riddoch <alriddoch@googlemail.com>
* rulesets/Thing.cpp: Correct the logic when checking whether
	  the entity has changed.
2008-09-03 10:17:50 +00:00
Al Riddoch
15faa7a6d7 2008-08-21 Al Riddoch <alriddoch@googlemail.com>
* rulesets/attributes.h: Remove old attribute flags used for
	  persistence from the build.

	* rulesets/Entity.h: Replace obsolete update flags with a more
	  general flags field, and define three needed to track the
	  cleanness of basic location data.

	* rulesets/Plant.cpp, rulesets/World.cpp: Remove now unused update
	  flags from property initialisation.

	* rulesets/Entity.cpp, rulesets/Thing.cpp, server/EntityFactory.cpp:
	  Replace code which updated update flags with simpler changes to
	  the new flags field.
2008-08-21 17:10:38 +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
ccf8bebcb0 2008-01-26 Al Riddoch <alriddoch@googlemail.com>
* common/BaseEntity.cpp, common/BaseEntity.h: Remove the code that
	  handle ID, and just inherit from Identified.

	* client/CharacterClient.cpp, client/CreatorClient.cpp,
	  common/OOGThing.cpp, rulesets/BaseMind.cpp, rulesets/Character.cpp,
	  rulesets/Creator.cpp, rulesets/Entity.cpp,
	  rulesets/LocatedEntity.cpp, rulesets/MemEntity.cpp,
	  rulesets/Plant.cpp, rulesets/Stackable.cpp, rulesets/Structure.cpp,
	  rulesets/Thing.cpp, rulesets/World.cpp, server/Account.cpp,
	  server/Admin.cpp, server/ExternalMind.cpp, server/Lobby.cpp,
	  server/Peer.cpp, server/Player.cpp, server/ServerRouting.cpp,
	  server/SlaveClientConnection.cpp: Add calls to the virtually
	  inherited Identified constructor as required.
2008-01-26 17:43:20 +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
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
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
e51bc5f622 2007-11-29 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Provide a more verbose error message about
	  incorrect updates.

	* rulesets/mason/define_world.py: Make sure the arguments to
	  the python builtin range() is always an integer.
2007-11-29 02:37:51 +00:00
Al Riddoch
bc880b3fe2 2007-11-29 Al Riddoch <alriddoch@zepler.org>
* rulesets/StatusProperty.cpp, rulesets/StatusProperty.h:
	  Add a dynamic property that deletes the entity when it goes
	  below zero, removing the need for the hard coded property
	  of the same name.

	* rulesets/Makefile.am: Add the new property to the build.

	* server/CorePropertyManager.cpp: Add the new property to the system.

	* rulesets/mason/define_world.py: Add a test for setting the status
	  to below zero.

	* rulesets/Entity.cpp: Remove the hard property for status.

	* rulesets/Thing.cpp: Remove the code that checks the hard
	  status property to see if the entity needs to be deleted.
2007-11-29 01:13:27 +00:00
Al Riddoch
bd3a9e153c 2007-11-28 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/CharacterClient.cpp,
	  client/CharacterClient.h, client/CreatorClient.cpp,
	  client/CreatorClient.h, rulesets/BaseMind.cpp, rulesets/BaseMind.h,
	  rulesets/Character.cpp, rulesets/Entity.cpp, rulesets/Entity.h,
	  rulesets/MindFactory.cpp, rulesets/MindFactory.h, rulesets/Thing.cpp,
	  rulesets/World.cpp, server/Account.cpp, server/Connection.cpp,
	  server/EntityFactory.cpp, server/Persistor.cpp,
	  server/Persistor_impl.h, server/Restorer_impl.h,
	  server/WorldRouter.cpp: Remove the hard name attribute, now that
	  most entities don't set it.
2007-11-28 20:22:42 +00:00
Al Riddoch
82cf89acac 2007-11-23 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Set FROM and SECONDS on Set operations generated
	  by Updates.
2007-11-23 11:17:25 +00:00
Al Riddoch
a3e772fc37 2007-08-02 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp: Initialise motion pointer to zero, so
	  so tests know whether it is there.

	* rulesets/Thing.cpp: Don't attempt to do a movement update if
	  LOC is zero. It is a sign something not quite right is going on.

	* tests/IGEntityExerciser.h: Check motion is not null before using
	  it.
2007-08-01 23:05:28 +00:00
Al Riddoch
7570359f75 2007-07-29 Al Riddoch <alriddoch@zepler.org>
* rulesets/Character.cpp, rulesets/MemMap.cpp, rulesets/Motion.cpp,
	  rulesets/Python_API.cpp, rulesets/TerrainProperty.cpp,
	  rulesets/Thing.cpp, rulesets/World.cpp: Don't use camel casing for
	  local variables or function arguments.
2007-07-29 21:23:40 +00:00
Al Riddoch
2069f3dd4c 2007-07-29 Al Riddoch <alriddoch@zepler.org>
* common/log.cpp, common/log.h: Switch to taking a C++ string reference
	  rather than a char *, as it is not really an optimisation, and it
	  makes the code simpler to read and write.

	* client/BaseClient.cpp, client/ClientConnection.cpp,
	  common/AtlasFileLoader.cpp, common/BaseEntity.cpp,
	  common/Database.cpp, common/globals.cpp, common/id.cpp,
	  common/inheritance.cpp, common/log.cpp, common/log.h,
	  rulesets/Character.cpp, rulesets/Creator.cpp, rulesets/Entity.cpp,
	  rulesets/MemMap.cpp, rulesets/Motion.cpp, rulesets/Pedestrian.cpp,
	  rulesets/Py_Object.cpp, rulesets/Py_RootEntity.cpp,
	  rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
	  rulesets/Python_API.cpp, rulesets/Thing.cpp, server/Account.cpp,
	  server/Admin.cpp, server/ArithmeticFactory.cpp,
	  server/CommClient.cpp, server/CommListener.cpp,
	  server/CommMDNSPublisher.cpp, server/CommServer.cpp,
	  server/Connection.cpp, server/EntityFactory.cpp,
	  server/Persistance.cpp, server/Restoration.cpp,
	  server/ScriptFactory.cpp, server/TaskFactory.cpp,
	  server/WorldRouter.cpp, server/server.cpp: Convert over to using
	  new API correctly.

	* data/mason.xml: Add biomass and transient to fircone, making its
	  script obsolete:
2007-07-29 03:33:33 +00:00
Al Riddoch
4281a2da8f 2007-07-06 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: When moving, check if the entity has
	  LOC set. If not, print an error, and assert. This may be a
	  valid way to check for the TLVE, rather than relying on the
	  world class.
2007-07-06 15:09:39 +00:00
Al Riddoch
071ebe9b31 2007-07-06 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: When deleting, check if the entity has
	  LOC set. If not, print an error, and assert. This may be a
	  valid way to check for the TLVE, rather than relying on the
	  world class.
2007-07-06 14:58:28 +00:00
Al Riddoch
f8aefa673a 2007-06-28 Al Riddoch <alriddoch@zepler.org>
* common/BaseEntity.cpp, common/BaseEntity.h, common/custom.cpp,
	  common/op_switch.h, rulesets/BaseMind.cpp, rulesets/Character.cpp,
	  rulesets/Character.h, rulesets/Thing.cpp, rulesets/Thing.h,
	  tests/EntityExerciser.h: Remove the long obsolete Action op from
	  the core code.
2007-06-27 23:59:02 +00:00
Al Riddoch
58da870ddf 2007-06-22 Al Riddoch <alriddoch@zepler.org>
* server/CorePropertyManager.cpp: Finish installing the burn speed
	  property, now tested.

	* rulesets/Thing.cpp, rulesets/Thing.h: Remove legacy Burn operation
	  handler.
2007-06-22 12:42:35 +00:00
Al Riddoch
3634746374 2007-01-09 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Delete entities if their status has gone
	  below zero when an update is processed.
2007-01-09 00:44:56 +00:00
Al Riddoch
33208a9068 2007-01-08 Al Riddoch <alriddoch@zepler.org>
* data/mason.xml: Set default mass on bottle entity.

	* tools/cycmd.cpp: Add help for upcoming delete command. Improve
	  readability by using available typedefs.

	* rulesets/Thing.cpp: Hide some debug output.
2007-01-08 23:30:04 +00:00
Al Riddoch
23851b3fd0 2007-01-01 Al Riddoch <alriddoch@zepler.org>
* rulesets/Character.cpp, rulesets/Creator.cpp, rulesets/Entity.cpp,
	  rulesets/Entity.h, rulesets/Pedestrian.cpp, rulesets/Py_Thing.cpp,
	  rulesets/Stackable.cpp, rulesets/Thing.cpp, rulesets/World.cpp:
	  Remove m_world member variable from all Entity classes, and
	  access the world manager object as a singleton.
2007-01-01 17:57:06 +00:00
Al Riddoch
20f4c8313c 2006-12-30 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.h, rulesets/Thing.cpp: Make updateProperties
	  const for the time being. Only treap Update operations as
	  generic updates if they don't have a refno. Improve the
	  Update operation handler comments.
2006-12-30 23:13:32 +00:00
Al Riddoch
e9d142d71f 2006-12-29 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Add some debug instrumentation to the new
	  Property update mechanism.

	* rulesets/Character.cpp: Re-write the Wield handling code to use
	  Update ops.
2006-12-29 18:48:04 +00:00
Al Riddoch
99befe834a 2006-12-29 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp, rulesets/Thing.h: Add a new method to
	  generate a Sight(Set) for a designated set of modified attributes.

	* ThingupdatePropertiestest.cpp: Add a test for the new method.
2006-12-29 01:00:07 +00:00
Al Riddoch
02cf540c09 2006-12-10 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Task.h,
	  rulesets/TerrainProperty.cpp, rulesets/TerrainProperty.h,
	  rulesets/Thing.cpp, rulesets/World.cpp, server/TrustedConnection.cpp,
	  server/WorldRouter.cpp: Add inline documentation.
2006-12-10 17:53:52 +00:00
Al Riddoch
9a56dac06c 2006-10-26 Al Riddoch <alriddoch@zepler.org>
* Add RCS Id keywords to every file, for better version tracking.
2006-10-26 00:48:00 +00:00
Al Riddoch
272e641fe6 2006-09-17 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Add FIXME notes about appear/disappear
	  generating code.
2006-09-17 22:43:29 +00:00
Al Riddoch
b5f8a038a0 2006-08-01 Al Riddoch <alriddoch@zepler.org>
* rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Food.cpp,
	  rulesets/Plant.cpp, rulesets/Stackable.cpp, rulesets/Thing.cpp:
	  Remove script override calls from the individual C++ operation
	  methods, as script overrides are now done centrally.
2006-08-01 13:49:48 +00:00
Al Riddoch
5dcff4edf1 2006-07-23 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Moved increment on m_seq to later in the
	  function, to make sure its only incremented when the entity
	  has really been updated. Scripts will be required to update
	  now.
2006-07-23 00:43:11 +00:00
Al Riddoch
c4b542af2a 2006-07-22 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp, rulesets/Thing.cpp, rulesets/Thing.h:
	  Move Look and Create handlers into Thing from Entity, so Entity is
	  a more abstract for all IG entities.
2006-07-22 18:13:29 +00:00
Al Riddoch
475bb2dc2d 2006-07-21 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.h, rulesets/Thing.cpp, rulesets/Plant.h,
	  rulesets/Plant.cpp: Remove SetupOperation from Thing
	  and implement in Plant, as not all entities need a starting
	  tick, but plants do.

	* rulesets/basic/world/objects/elements/Fire.py,
	  rulesets/mason/world/objects/Weather.py: Add setup_operation
	  handlers as these scripts require ticks.
2006-07-21 01:26:19 +00:00
Al Riddoch
e5d6d37be4 2006-07-19 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp, server/WorldRouter.cpp: Remove broadcasting
	  an appearance from Setup handlers, and put it WorldRouter when
	  the entity is added to the world, to take out the special case
	  from the Setup operation handler.
2006-07-20 23:02:39 +00:00
Al Riddoch
284cbcafd9 2006-07-19 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Add note about updating m_seq in SetOperation
	  Correct function name in an error message.
2006-07-20 21:19:09 +00:00
Al Riddoch
68df658252 2006-07-13 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Use != for logical exclusive or on bools.

	* physics/Collision.cpp: Re-write complete excluseive or
	  implementation and replace with !=.
2006-07-13 16:26:05 +00:00
Al Riddoch
de48a78e09 2006-07-08 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Remove undocumented FIXME.

	* server/WorldRouter.cpp: Move an assert into a better place
	  where it covers more.
2006-07-08 21:57:01 +00:00
Al Riddoch
8e86fd5b24 2006-07-08 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Remove obsolete FIXME about feature already
	  implemented.
2006-07-08 21:28:05 +00:00
Al Riddoch
87c135a6af 2006-07-08 Al Riddoch <alriddoch@zepler.org>
* common/const.h: Remove obsolete config option to disable
	  range checks and calculations.

	* client/ObserverClient.cpp, rulesets/Movement.cpp,
	  server/Admin.cpp, tools/AdminClient.h, tools/cycmd.cpp:
	  Remove const.h from files which no longer require it.

	* rulesets/Python_API.cpp: Remove python bindings for obsolete
	  constants.

	* rulesets/Thing.cpp, rulesets/World.cpp, server/WorldRouter.cpp:
	  Remove obsolete rotten code for handling sight without ranges.

	* tests/consttest.cpp: Remove tests for removed constants.
2006-07-08 20:45:10 +00:00
Al Riddoch
640c3d28d7 2006-07-03 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, rulesets/Character.cpp,
	  rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Food.cpp,
	  rulesets/Pedestrian.cpp, rulesets/Plant.cpp, rulesets/Py_Mind.cpp,
	  rulesets/Py_Thing.cpp, rulesets/Thing.cpp, server/WorldRouter.cpp:
	  Rename Entity members get(), set() and has() to getAttr(), setAttr()
	  and hasAttr().
2006-07-03 01:41:29 +00:00
Al Riddoch
febbca1390 2006-06-06 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.h, rulesets/Entity.cpp: Add a function to handle
	  all the changes required when the LOC or container of an entity
	  changes.

	* rulesets/Motion.cpp, rulesets/Thing.cpp: Use changeContainer()
	  rather than repeating the code in three places.
2006-06-05 23:18:55 +00:00
Al Riddoch
722598b287 2006-06-05 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Add some assert checks when altering the
	  container of an entity.

	* rulesets/Motion.cpp: Fix the code in collision resolution that
	  handler container changes so it does reference counting,
	  inserting and removing from contains lists, and flagging entity
	  changes.
2006-06-05 22:52:54 +00:00
Al Riddoch
0f2f497c2e 2006-06-05 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Clear out movement debug output.
2006-06-05 14:41:34 +00:00