* common/globals.cpp, common/globals.h: Add a config flag
to control whether database code is enabled.
* server/EntityFactory.cpp, server/EntityFactory.h,
server/PersistantThingFactory.cpp, server/PersistantThingFactory.h,
server/PersistantThingFactory_impl.h, server/Persistor.cpp:
Re-work the persistence code so that persistent or non-persistent
versions of entity factories are installed at startup, removing
the need to check whether the database is enabled during
runtime.
* common/newid.cpp, server/Connection.cpp, server/server.cpp:
Replace the const that used to control whether the database
was used with the config flag.
* common/BaseEntity.h, common/BaseWorld.h, common/Property.h,
modules/Location.h, rulesets/Entity.cpp, rulesets/Entity.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/Connection.cpp, server/Connection.h,
server/Persistor.cpp, server/Persistor.h, server/Persistor_impl.h,
tools/cycmd.cpp: Update usage of sigc++ to the native 2.0 API
rather than the deprecated compatability API. Eleminate the
manual disconnection code for deleted objects, as this is now
handled automatically by sigc::trackable.
* modules/Location.cpp, modules/Location.h:
Add const accessors for location data, in preparation for
adding cached collision data which must be updated every
time data is modified.
* physics/Collision.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/Movement.cpp,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp, tests/Locationtest.cpp:
Use the const accessors whenver reading data from Location.
* rulesets/Character.cpp, rulesets/Character.h, rulesets/attributes.h,
server/Persistor.cpp, server/Persistor_impl.h, server/Restorer.cpp;
Make right_hand_wield a real Atlas property, and add it to the
database code.
* rulesets/Character.cpp: When wielding a tool, set right_hand_wield
correctly to notify clients.
* common/Property.cpp, rulesets/EntityProperties.cpp,
server/Persistor.cpp, server/Restorer.cpp, tools/cycmd.cpp:
Tweak template code to work with stricter standard compliance
of gcc 4.
* rulesets/Character.h, rulesets/Character.cpp: static const
members need to be defined in the .cpp to satisfy all compilers.
* common/Database.cpp: Improve error reporting for query errors.
* common/const.cpp, common/const.h: Add full details and comments
for enable_database option.
* common/id.h, common/id.cpp: New ID generator for use when we
are not using the Database.
* common/AtlasFileLoader.cpp, common/AtlasFileLoader.h: Generic
class for loading Atlas data from a file.
* server/Connection.cpp, server/EntityFactory.h,
server/EntityFactory.cpp, server/Persistor.cpp,
server/WorldRouter.cpp, server/server.cpp:
Implement the enable_database option by wrapping all use of database
in if statements. Rules are loaded from files instead.
* common/Database.cpp, common/terrain_utils.cpp: Disable debugging
output.
* server/Persistor.cpp: Don't update the main entity table if we
have no attributes modified other than terrain.
* 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/Database.cpp: Implement inserting into array tables.
Modify tables so that key columns are NOT NULL.
* server/Persistor.cpp: Test creating array rows.
* Fix some tree related rules
* rulesets/Plant.cpp, rulesets/Plant.h: Implement touching to release
seeds on all plants.
* rulesets/World.cpp: Get rid of mountains on one side.
* Add some auto generated forests to world init script.
* rulesets/mason/world/objects/plants/Fir.py,
rulesets/mason/world/objects/plants/Oak.py: Simplify some scripts.
* server/CommListener.cpp: Set RESUSEADDR on listen sockets.
* server/Persistor.cpp, server/Persistor.h, server/Persistor_impl.h:
Fix persistance of plant's static fruits attribute.
* 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.
* common/Database.cpp: Add support for boolean columns.
* server/Persistor.cpp, server/Persistor_impl.h, server/Restorer.h,
server/Restorer_impl.h: Use a bool column to store whether or
not an entity has a bounding box, and use it apropriatly.
* Use " instead of < when including application headers.
* Re-work the interface between server and worldrouter objects
so that the are less tied together, and more flexible.
* common/Database.cpp, common/Database.h: Add functions for removing
relation rows. Modify entity select method to handle an empty loc
correctly.
* rulesets/Thing.cpp: Correct indenting.
* rulesets/World.cpp: Trigger update in SetOperation() correctly.
* server/Account.cpp, server/Persistance.cpp, server/Persistance.h:
Inform Persistance modules when the account loses a character, so
this change is reflected in the database.
* server/Persistor.cpp: Move comments into the correct place.
* server/Restoration.cpp, server/Restorer.cpp, server/Restorer.h,
server/Restorer_impl.h: Persist and restore the world entity
attributes. Remove redundant argument from Restorer::populate().
* common/Database.cpp, common/Database.h: Add method to generalise
encoding atlas maps to string. Make the codec used by the database
code into a typedef, so production systems can use a more efficient
one.
* server/Persistor.cpp, server/Persistor_impl.h: Persist
Entity::attributes as an atlas encoded string column. Not yet
restored.
* server/Persistor.cpp, server/Persistor.h, server/Persistor_impl.h:
Separate the insertion of a new row from connecting and entities
signals to the persistor, and put them into different methods.
Modify constructor to allow subsidiary persistor objects to
be constructed, which don't try to register with the database.
* server/Restorer.cpp, server/Restorer.h, server/Restorer_impl.h:
Each Restorer template instance has a static Persistor
which it connects up to entities as it restores them, ensuring
that changes to restored entities are persisted.
* common/Database.cpp: Fix some errors in the entity table
creation code.
* server/Persistor.cpp, server/Persistor.h, server/Persistor_impl.h:
Switch to using pointers instead of references with signals
to comply with sigc++ 1.2.
* tools/cycmd.cpp: Add a missing header, require for sigc++ 1.2.
* server/Persistance.cpp: Fixed error message.
* common/Database.cpp: Don't make update requests if no columns
are given to be updated.
* common/Database.cpp, common/Database.h: Add new method to select
all rows in a given class table with a given location.
* rulesets/Entity.cpp, rulesets/Entity.h: Make update_flags
public.
* rulesets/Entity.cpp, rulesets/Thing.cpp, rulesets/attributes.h,
server/Persistor.cpp, server/Persistor_impl.h,
server/WorldRouter.cpp: Add new cont column to entity tables which
is zero if the entity has no contained entities.
* server/Restoration.cpp, server/Restoration.h, server/Restorer.cpp,
server/Restorer.h, server/Restorer_impl.h:
Modify restorers so they now use a database result iterator to
indicate the row they should restore from.
* server/Restoration.cpp: Implement new way of restoring world from
database using new function to fetch multiple complete entities
from database at the same time. Massive speedup.
* common/BaseEntity.cpp, common/BaseEntity.h, rulesets/Character.cpp,
rulesets/Food.cpp, rulesets/Thing.cpp, rulesets/World.cpp:
Add arg to error method specifying where the error should go. Use
this arg to ensure that errors don't get broadcast.
* common/Database.cpp, common/Database.h, common/const.cpp,
server/Persistor.cpp, server/Restoration.cpp,
server/WorldRouter.cpp
Change id and loc column in entity tables to integer for
performance. Add id generator sequence to database
* common/Database.cpp, common/Database.h, server/Persistance.cpp,
server/Persistance.h: Remove old legacy world, mind and server
tables as they are no longer used.
* common/BaseEntity.cpp, common/Load.h, common/Save.h,
common/custom.cpp, common/op_switch.h, common/operations.cpp,
common/operations.h, common/types.h, rulesets/BaseMind.cpp,
rulesets/BaseMind.h, rulesets/Character.cpp, rulesets/Character.h,
server/Admin.cpp, server/Admin.h, server/server.cpp,
tools/cycmd.cpp: Remove Load and Save ops.
* rulesets/Area.cpp, rulesets/Character.cpp, rulesets/Line.cpp,
rulesets/Plant.cpp: Fix != to |= when setting update flags.
* server/CommMetaClient.cpp, server/CommMetaClient.h,
server/CommServer.cpp, server/CommServer.h, server/server.cpp:
Add mechanism for sockets to be called whenever the server
is idle, so that they do period things. Use this mechanis,
to handle sending periodic packets to the metaserver, removing
special case code from CommServer.
* common/BaseEntity.cpp, common/BaseEntity.h, common/OOGThing.h:
Add a protected constructor for initialising id at construction
time.
* common/Database.cpp, common/Database.h, server/Restorer_impl.h:
Switch argument order so default row can be first row.
* server/Persistor.cpp: Don't persist Creator objects.
* server/Restoration.cpp: Clean up debugging output, and report
serious errors.
* server/Restorer.cpp, server/Restorer.h: Add restorers for Character.
* server/server.cpp: Add log calls for restoring from database.
* server/WorldRouter.cpp, server/Admin.cpp:
Use consts::rootWorldId correctly.
* server/Persistor.cpp, server/PersistantThingFactory.cpp,
server/PersistantThingFactory.h, server/EntityFactory.h,
server/EntityFactory.cpp: Add World specialisation of Persistor
so that row in entity database is maintained, but not created.
* common/Database.h: Ensure iterator has != as well as ==.
* common/Database.cpp: Check that tuples have been returned
in response to a select.
* server/Restoration.cpp, server/Restoration.h,
server/Restorer.cpp: Restoration code now iterates over the
contents of the database, but does not attempt to actually
restore it yet.
* server/EntityFactory.cpp, server/PersistantThingFactory.cpp,
server/PersistantThingFactory.h,
server/PersistantThingFactory_impl.h,
server/Persistor.cpp: Cut down template bloat by minimising the
places where template instances are created.
* common/Database.cpp: Add in code to send the entity requests
to the database.
* server/Persistor.cpp, server/Persistor_impl.h: Add type and
class columns, correct the name of the drunkness column,
and remove a bad test from the update query generator.
* common/Database.cpp, common/Database.h: Handle the way SQL INSERT
requires column headers and values to be separated.
* server/Persistor.cpp, server/Persistor.h, server/Persistor_impl.h:
Add functions to generate INSERT queries for new entities.
* common/Database.cpp: Fix badly generated insert query.
* rulesets/Character.h: Add accessors for some hard attributes.
* rulesets/Entity.h, server/EntityFactory.cpp: Add a way of clearing
all the update flags, and clear them after creating the database
row.
* server/Persistor.h, server/Persistor_impl.h, server/Persistor.cpp:
Progress on the SQL update query generating code. Now generates
what looks like good update queries.
* server/server.cpp, server/WorldRouter.cpp,
server/EntityFactory.h, server/EntityFactory.cpp:
Change the way the EnitityFactory is created so it has a
reference to the world.
* rulesets/Entity.h, rulesets/Entity.cpp: getLocation returns
whether an error occured setting location data.
* common/Database.h, common/Database.cpp: Add stub functions
for generating queries to new format entity tables.
* server/Persistor_impl.h, server/Persistor.h,
server/Persistor.cpp: Add hooks for syncing update to
database using new database functions.
* common/Database.cpp: Clean up errors in new entity table
code.
* server/EntityFactory.cpp: Switch to using new persistant
factories.
* server/Persistance.cpp: Don't create test tables.
* server/PersistantThingFactory.h:
Clean up the way templates are used here, and simplify.
* Persistor.h, Persistor.cpp, Persistor_impl.h:
Implement object handles the persistance of the rulesets
classes. Currently does not implement any of the actual
persistance.