This follows earlier work where we've moved more and more functionality
out of the entity classes and into properties. One of the goals of this
change is to allow for the "terrain" property to be added to arbitrary
entities.
The world can be reset, i.e. all entities deleted and properties of the
root cleared, by sending a Delete to the world itself. It must have an
argument with both the world id and an int "force" attribute with the
value 1.
Since the World entity is special, in that it always exists, it's
suitable as a point through which out of game instances can relay
operations to in-game entities.
* data/basic.xml: Strip entity scripts off pickaxe and shovel.
* rulesets/World.h, rulesets/World.cpp: Remove handlers used to
to implement pickaxe and shovel, which are now handled as tasks.
* common/Delve.h, common/Dig.h, common/Mow.h, common/custom.cpp,
common/operations.cpp: Remove a bunch of operations from the build
which were only used to do things in an over simple hard coded way.
* common/BaseEntity.cpp, common/BaseEntity.h, common/op_switch.h,
rulesets/Character.cpp, rulesets/Character.h, rulesets/Food.cpp,
rulesets/Food.h, rulesets/World.cpp, rulesets/World.h,
tests/EntityExerciser.h: Purge the burn operation from the core
operation handling code. One down, many still to go.
* configure.ac: Increment version.
* common/const.h: Declare a doxygen group for all the consts.
* common/operations.cpp, common/Add.h, common/Attack.h, common/Burn.h,
common/Chop.h, common/Connect.h, common/Cut.h, common/Delve.h,
common/Dig.h, common/Drop.h, common/Eat.h, common/Monitor.h,
common/Mow.h, common/Nourish.h, common/Pickup.h, common/Setup.h,
common/Tick.h, common/Unseen.h, common/Update.h:
Declare a doxygen group for all custom operations.
* rulesets/Area.h, rulesets/Character.h, rulesets/Creator.h,
rulesets/Entity.h, rulesets/Food.h, rulesets/Line.h,
rulesets/Missile.h, rulesets/Plant.h, rulesets/Stackable.h,
rulesets/Structure.h, rulesets/World.h: Declare a doxygen group
for in game entity classses.
* common/Property.h, common/Property_impl.h, server/ScriptFactory.cpp,
server/ScriptFactory.h, server/SlaveClientConnection.cpp,
server/SlaveClientConnection.h: Add some more inlined documentation.
* rulesets/World.cpp, rulesets/World.h, rulesets/mason/define_world.py:
Remove the special handling of Set ops in world which prevented
setting status below zero from generating a Delete op. Add a test
function to define_world which attempts to destroy the world by
setting its status to -1.
* common/BaseEntity.h, common/BaseEntity.cpp: Add an integer ID
member variable, and accessor, and require it to be initialised
along with string ID in constructor.
* common/const.cpp, common/const.h: Add a const for the integer value
of the world ID.
* rulesets/Area.cpp, rulesets/Area.h, rulesets/BaseMind.cpp,
rulesets/BaseMind.h, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/Food.cpp, rulesets/Food.h,
rulesets/Line.cpp, rulesets/Line.h, rulesets/MemEntity.cpp,
rulesets/MemEntity.h, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/Stackable.cpp, rulesets/Stackable.h, rulesets/Structure.cpp,
rulesets/Structure.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h: Add integer ID handling to
constructors of all in-game entity classes.
* rulesets/MemMap.cpp: Initialise integer ID of entities in the mind
map.
* rulesets/MindFactory.cpp, rulesets/MindFactory.h: Handle integer
ID when constructing mind objects.
* server/EntityFactory.cpp, server/EntityFactory.h,
server/PersistantThingFactory_impl.h: Handle integer
ID when contructing entity objects.
* server/Restoration.cpp, server/Restoration.h, server/Restorer.h,
server/Restorer_impl.h: Handle integer ID when restoring from
database.
* server/WorldRouter.cpp: Assign integer ID when constructing the
world.
* rulesets/Thing.cpp: Fix leak of Motion object.
* rulesets/World.cpp, rulesets/World.h: Make tileShader a member
variable, and delete it in the destructor to avoid a leak.
* server/PersistantThingFactory.cpp: Fix leak of ScriptFactorys.
* server/PersistantThingFactory_impl.h: Fix leak of Persistor
in ForbiddenThingFactory.
* common/Dig.h, common/Mow.h, common/custom.cpp, common/operations.cpp:
Add new Dig and Mow operations, for handling resource gathering.
* rulesets/basic/world/objects/tools/Shovel.py,
rulesets/basic/world/objects/tools/Scythe.py,
data/basic.xml: Add new scythe and shovel for gathering resources
from the terrain.
* rulesets/basic/world/objects/tools/Pickaxe.py,
common/Delve.h: Fix the comments.
* rulesets/World.cpp, rulesets/World.h: Move code for determining
terrain surface type into a method of its own. Implement handlers
for Dig and Mow ops.
* rulesets/Character.cpp: Add some debug stuff.
* rulesets/World.cpp, rulesets/World.h: Add handler for delve
operations. Just for testing for now, no functionality.
* common/BaseEntity.cpp, common/BaseWorld.h, common/refno.h,
common/serialno.h, rulesets/Character.cpp, rulesets/Creator.cpp,
rulesets/World.h, server/Account.cpp, server/Admin.cpp,
server/Connection.cpp, server/Lobby.cpp, server/ServerRouting.h,
server/WorldRouter.cpp, server/WorldRouter.h, tests/Creatortest.cpp,
tests/Worldtest.cpp: Simplify the way operation refnos and serialnos
are handled, getting rid of some unnecessary virtual methods and
functions.
* rulesets/Entity.cpp, rulesets/Entity.h: Make get(), set(), and
addToMessage() non-virtual, and convert them to using new property
mechanism. Add the necessary properties in the constructor.
* rulesets/Area.cpp, rulesets/Area.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Line.cpp, rulesets/Line.h,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/World.cpp, rulesets/World.h:
Remove virtual get() set() and addToMessage() methods. These
are now entirely in Entity.
* rulesets/World.cpp, rulesets/World.h: Remove some functions
for handling terrain data now handled by properties.
Clean up Set code to get rid of nasty unnecessary exception
try / catch block.
* common/Database.cpp: Implement function for modifying array rows.
* common/const.cpp: Enable persistence for testing.
* common/terrain_utils.cpp: Implement function for updating terrain
in database after a change.
* rulesets/World.cpp, rulesets/attributes.h: Add an update flag for
terrain, and use it to indicate to the Persistor.
* rulesets/World.h: Add accessors for variables which track modified
terrain, and a function to clear them.
* server/Persistor.cpp: Implement call to function to update terrain
in database.
* server/Restoration.cpp: Ensure that if world entity is already
in database, it gets hooked up appropriatly.
* common/Database.cpp, common/Database.h: Fix queries on ID relation
tables. Add methods to result functions for decoding the contents
of fields more directly. Implement selecting from array tables.
* common/terrain_utils.cpp, common/terrain_utils.h: New functions
for handling terrain in array database tables.
* rulesets/World.cpp, rulesets/World.h: Add functionality to track
changes to the terrain for persistence purposes.
* server/EntityFactory.cpp, server/EntityFactory.h, server/server.cpp:
Modify the way world entity persistence is bootstrapped to be
more consistent.
* server/Persistor.cpp: Provide specialisations to handle world so
that terrain is persisted. Implement storing terrain at entity
creation.
* server/Restoration.cpp, server/Restoration.h: Remove obsolete
restoration code. Return a status more accuratly representing
when restoration fails because of error, or if there is nothing
to restore.
* server/Restorer.cpp, server/Restorer.h, server/Restorer_impl.h:
Convert to using methods for restoring data in the Database class.
Implement restoring terrain from the database.
* common/BaseEntity.h, common/OOGThing.h, rulesets/Area.h,
rulesets/BaseMind.h, rulesets/Entity.h, rulesets/Food.h,
rulesets/Line.h, rulesets/MemEntity.h, rulesets/Missile.h,
rulesets/Plant.h, rulesets/Stackable.h, rulesets/Structure.h,
rulesets/Thing.h, rulesets/World.h, server/Account.h,
server/Connection.h, server/Lobby.h: Update the comments describing
the function of these classes.
* rulesets/Character.h, server/Account.cpp, server/Connection.cpp,
server/ExternalMind.cpp, server/ExternalMind.h: Make ExternalMind
inherit from BaseEntity, eliminating the need for the name argument
to the constructor and simplifying the class greatly by dropping
loads of unused inherited functionality.
* rulesets/World.cpp, rulesets/World.h: Add accessor to get height
at a particular point.
* server/Account.cpp: Remove redundant check on new character
location.
* common/BaseWorld.h, server/WorldRouter.cpp, server/WorldRouter.h,
rulesets/Thing.cpp: Add new function for correcting height
of entities to ground level, and use it whenever new entities
are created, or whenever an entity moves.
* server/Lobby.cpp: Add some debugging messages.
* server/CommServer.cpp: Tweak select loop so that closed connections
are cleaned up as soon as they are detected.
* rulesets/World.cpp: Make demo terrain a bit more mountainous.
* Convert entire codebase over to using Atlas-C++ 0.4.90, as
start of transition to 0.6 API.
* server/EntityFactory.cpp, rulesets/Python_API.h,
rulesets/Python_API.cpp, rulesets/PythonThingScript.h,
rulesets/PythonThingScript.cpp, rulesets/PythonMindScript.cpp,
rulesets/Py_World.cpp, rulesets/Py_Thing.h, rulesets/Py_Thing.cpp,
rulesets/Py_Operation.cpp, rulesets/Py_Map.cpp,
rulesets/Py_Location.cpp, rulesets/Movement.h,
rulesets/MemMap_methods.h, rulesets/MemMap.h, rulesets/MemMap.cpp,
rulesets/Entity.cpp, rulesets/BaseMind.cpp,
client/Py_CreatorClient.cpp:
Rename all references from thing to entity, as thing is
no longer the base class for IG entities.
* rulesets/World.h, rulesets/World.cpp, rulesets/Thing.h,
rulesets/Structure.h, rulesets/Stackable.h, rulesets/Stackable.cpp,
rulesets/Plant.h, rulesets/Plant.cpp, rulesets/Missile.h,
rulesets/Line.h, rulesets/Line.cpp, rulesets/Food.h,
rulesets/Food.cpp, rulesets/Creator.h, rulesets/Character.h,
rulesets/Character.cpp, rulesets/Area.h, rulesets/Area.cpp:
Add a typedef for the parent class of all entity classes.
* rulesets/Plant.h, rulesets/Plant.cpp:
Add in code to fully integrate hardcoded attributes.
* rulesets/World.cpp, rulesets/World.h: Rework terrain attribute
handling to use new agreed format. Add terrain attribute
to the special ranged sight handling.
* rulesets/World.h, rulesets/World.cpp, rulesets/Stackable.h,
rulesets/Stackable.cpp, rulesets/Plant.h,
rulesets/Plant.cpp, rulesets/Line.h, rulesets/Line.cpp,
rulesets/Entity.h, rulesets/Entity.cpp, rulesets/Character.h,
rulesets/Character.cpp, rulesets/Area.h, rulesets/Area.cpp,
common/type_utils.h, rulesets/Py_Thing.cpp, rulesets/Py_Mind.cpp,
client/Py_CreatorClient.cpp: Modify the way entities are queried
to avoid return by value, and use references instead.
* Switch to requiring pkg-config versions of libs, and make
postgres check more verbose.
* Disable metaserver by default. This is a devel server.
* rulesets/World.cpp, rulesets/World.h: Add terrain using
Mercator to the world entity, including the required attribute
handlers.
* server/WorldRouter.cpp: Eliminate unnecessary call to opEnumerate()
and enhance debugging output.
* server/Player.cpp: Correct the use of string.compare() in older
versions of libstdc++.
* common/types.h: Added enumeration for other operations, not
handled by the core, but considered valid. Added new type
for storing mapping between operation parents and their
enumerated type.
* common/op_switch.h: Separate handling of operations known to
be invalid from operations which are valid, but not explicitly
added to the core.
* common/inheritance.h, common/inheritance.cpp, common/custom.cpp:
Provide global operation mapping where enumeration of operations
can be looked up. Install all types handled by the core, and
types known to be used in scripts.
* common/BaseEntity.h, common/BaseEntity.cpp: Add object specific
operation mapping where operation types each object is subscribed
to can be enumerated, and others are rejected. Add mechanism
so that objects can add to the mapping, this subscribing to
operations. This makes enumerating operations much cheaper, and
eliminates the overhead of handling ops an object has no interest
in.
* rulesets/Thing.h, rulesets/Thing.cpp: Add mechanism so scripts
can subscribe to operations.
* rulesets/Character.h, rulesets/Character.cpp:
Add subscription mechanism for ops going to and from
the mind.
* rulesets/BaseMind.h, rulesets/BaseMind.cpp:
Add subscription mechanism for sight and sound perception
operations sub operations, and provide an interface to it
for scripts.
* server/Connection.cpp, server/Admin.cpp, server/Account.cpp,
rulesets/World.cpp, rulesets/World.h, rulesets/Thing.cpp,
rulesets/Stackable.cpp, rulesets/Plant.cpp, rulesets/Food.cpp,
rulesets/Character.cpp, rulesets/BaseMind.cpp:
Add subscriptions to operations for all core base classes.
* rulesets/Python_API.cpp: When script is created, go through
methods, and subscribe to the operations which are handled by
them.
* rulesets/Character.cpp: When calculating orientation of a walking
character, assume it is standing upright.
* physics/Vector3D.h: Add versions of mag() and distance() which
omit the square root calculations, so that when their values
are only used for comparison, the expensive square root
calculations can be ommited. Add new version of collision
and range checking functions which provide the optimal
interface to the application. Add versions of methods which
modify this rather than creating a new operation to eliminate
wasted copies.
* physics/Quaternion.cpp: Make use of faster interface provided
by Vector3D.
* physics/BBox.h: Add new version of collision checking function
which provides optimal interface to the application.
* modules/Location.h, modules/Location.cpp: Add new functions
to optimally calculate the distance between any two entities.
* modules/Location.h: Re-write collision and range functions to
make much more optimal use of Vector3D, BBox and distance
functionality.
* rulesets/Py_Vector3D.cpp, rulesets/Pedestrian.cpp,
rulesets/Movement.cpp, rulesets/Entity.cpp, rulesets/Character.cpp:
Eliminate implicit copies from vector arithmetic.
* rulesets/Pedestrian.cpp, rulesets/MemMap.cpp, common/const.h:
Re-write code which uses magnitude of vectors to use the square
of the magnitude instead, as it is much cheaper to calculate.
tools/cycmd.cpp: Switched to using skstream library for socket
comms instead of hand rolled fstream based version.
* ALL FILES: Fixed use of std namespace throughout all code.
This server is now ISO C++ compliand and builds with gcc 3.0.
Al Riddoch <alriddoch@zepler.org>
atlas object inheritance tree.
* server/Connection.cpp: Added code to allow client to query
atlas object inheritance using get ops.
* example/client/InheritanceClient.*: Added example client which
queries the inheritance tree of the server.
* rulesets/MemMap.h, rulesets/Py_Map.cpp: Made hooks lists private,
and added methods to access them.
* server/Account.cpp, server/Lobby.h: Added correct handling of OOG
look ops when looking at own characters, other accounts, or the
lobby.
* server/ServerRouting.h: Added function to generate serial numbers
for operations.
* server/WorldRouter.cpp: Assign genuine serial number to all
in game operations as they are pulled off the queue.
* Cleaned up header file multiple inclusion checks for uniqueness,
and made sure of ISO compliant use of std::string.
Al Riddoch <alriddoch@zepler.org>
all have the name Operation but are now called MoveOperation,
according to the type of operation they handle.
* modules/DateTime.cpp, modules/DataTime.h: Filled in functionality,
allowing initialisation and updating from a time values in seconds.
* modules/Location.h: Modified collision detection code so no
checking is done between two moving objects.
* rulesets/BaseMind.h, rulesets/BaseMind.cpp, rulesets/Entity.h,
rulesets/Entity.cpp: Removed virtual getMap() method and replaced
with a fixed method in BaseMind only. Added time member veriable
to BaseMind so each mind keeps track of time by itself.
* rulesets/Python_API.h, rulesets/Py_Mind.cpp, rulesets/Py_Mind.h:
Added specific python interface for mind objects, because if
increasing differences in the way this must be handled.
* rulesets/Character.h, rulesets/Character.cpp: Added isAlive flag
which is cleared if the character is dead. If this flag is cleared,
operations are no longer sent to the mind.
* rulesets/Movement.h, rulesets/Movement.cpp, rulesets/Pedestrian.h,
rulesets/Pedestrian.cpp: Cleaned up the code, made members more
distinctive, and make interface more general.
* rulesets/Py_Thing.cpp: Removed features used to support mind.
* rulesets/Py_WorldTime.cpp: Added support for comparison of
time with strings, to establish whether it matches descriptions
of time.
* rulesets/Python_API.cpp: Modified creating of scripts so mind
scripts use a slightly different interface from entity scripts,
to support the fact that a mind handles its own timekeeping,
has a memory map, and has no access to the world.
* server/WorldTime.cpp, server/WorldTime.h: Brought WorldTime into
the build. Used to track details of the time. Added support for
checking time descriptions such as "midday", "summer" against
DateTime.
Al Riddoch <alriddoch@zepler.org>