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.
* rulesets/Py_World.h: Remove the pointer to the world router from
its wrapper, as all the wrapper code should now use the singleton
interface.
* rulesets/Python_API.cpp, rulesets/Py_World.cpp,
rulesets/Py_Thing.cpp: Fix up all the code which uses the world
router pointer.
* rulesets/Py_BBox.cpp, rulesets/Py_Location.cpp, rulesets/Py_Map.cpp,
rulesets/Py_Mind.cpp, rulesets/Py_Object.cpp,
rulesets/Py_Operation.cpp, rulesets/Py_Oplist.cpp,
rulesets/Py_Optime.cpp, rulesets/Py_Quaternion.cpp,
rulesets/Py_RootEntity.cpp, rulesets/Py_Task.cpp,
rulesets/Py_Thing.cpp, rulesets/Py_World.cpp,
rulesets/Python_API.cpp: Replace calls to PyMem_DEL with calls
to PyObject_Free. Thanks to Kai for doing most of the digging
on this one.
* rulesets/Py_Thing.h, rulesets/Py_Thing.cpp: Add a new function to add
a wrapper to an entity, using PythonWrapper to cache it.
* rulesets/Py_Location.cpp, rulesets/Py_Map.cpp, rulesets/Py_Mind.cpp,
rulesets/Py_World.cpp, rulesets/PythonMindScript.cpp: Convert code to
use new entity wrapper function, ensuring that wrappers are cached if
possible.
* rulesets/PythonWrapper.h, rulesets/PythonWrapper.cpp: Add new
class which inherits from Script to store a wrapper pointer
for instances which have no script.
* rulesets/PythonScript.h, rulesets/PythonScript.cpp,
rulesets/PythonThingScript.h, rulesets/PythonThingScript.cpp,
rulesets/PythonMindScript.h, rulesets/PythonMindScript.cpp:
Refactor script classes to inherit from PythonWrapper to make
storing wrappers for mind and world entities easier.
* rulesets/Py_Location.cpp, rulesets/Py_World.cpp: Use PythonWrapper
interface to get wrapper pointers from Script objects.
* rulesets/Python_API.cpp: Improve variable names, and comment out
some unused code.
* rulesets/Entity.h: Add accessor for script.
* rulesets/PythonThingScript.h: Add accessor for script wrapper.
* rulesets/Py_World.cpp, rulesets/Py_Location.cpp: When getting a
python wrapper for an entity for a script, check to see if the
entity has a permanent wrapper already.
* rulesets/Py_BBox.cpp, rulesets/Py_Optime.cpp,
rulesets/Py_Statistics.cpp, rulesets/Py_Thing.cpp: Ensure that
setattr returns an exception if the attribute is not a valid one.
* rulesets/Py_Map.cpp, rulesets/Py_Point3D.cpp,
rulesets/Py_Quaternion.cpp, rulesets/Py_World.cpp,
rulesets/Py_WorldTime.cpp: Remove setattr, as no attributes can
be set on this type.
* rulesets/Py_Mind.cpp, rulesets/Py_Oplist.cpp,
rulesets/Py_Vector3D.cpp: Clean up type structure.
* rulesets/basic/mind/goals/common/move.py: Remove attempt
to set "rotation" attribute on location, as its obsolete
and pointless.
* rulesets/mason/world/objects/tools/Tinderbox.py: Change strength
of initial fire spark to 0.05.
* common/operations.cpp: Fix nourish op, which got broken when mow
was added.
* data/basic.xml: Add a default bbox for lumber, giving it a more
apropriate size.
* rulesets/Py_World.cpp: Add a compare implementation so that
` scripts can check entities to see if they are the world.
* rulesets/basic/world/objects/elements/Fire.py: Tune the
changes which occur in fire as it burns.
* common/BaseWorld.h, rulesets/Character.cpp, rulesets/Py_World.cpp,
rulesets/PythonThingScript.cpp, rulesets/Stackable.cpp,
rulesets/Thing.cpp, rulesets/World.cpp, server/Account.cpp,
server/Admin.cpp, server/Connection.cpp, server/EntityFactory.cpp,
server/Restoration.cpp, server/WorldRouter.cpp, server/WorldRouter.h:
Rename some functions in the World interface so they make more
sense.
* rulesets/Entity.cpp, rulesets/Entity.h: Add destroyed flag to
Entity so we can tell if its no longer in the world.
* server/WorldRouter.cpp: Cut down the special case handling of
delete ops as we can now broadcast ops from entities that
have been removed from the world.
* client/CreatorClient.cpp, rulesets/Py_BBox.h, rulesets/Py_Optime.h,
rulesets/Py_Point3D.h, rulesets/Py_Quaternion.h,
rulesets/Py_Vector3D.h: Re-order Python.h includes to get rid of
some stupid warnings.
* rulesets/Py_World.cpp: Add a cast when passing float time to
WorldTime which takes in int.
* rulesets/Py_WorldTime.cpp, rulesets/Py_World.cpp:
Change the rest of the methods to use METH_NOARGS for simplicity.
* rulesets/Pedestrian.cpp: Experimental fix to stop desination
based movement from bipassing the collision detection.
* client/Py_CreatorClient.cpp, client/Py_CreatorClient.h,
rulesets/Py_BBox.cpp, rulesets/Py_BBox.h, rulesets/Py_Location.cpp,
rulesets/Py_Location.h, rulesets/Py_Map.cpp, rulesets/Py_Map.h,
rulesets/Py_Mind.cpp, rulesets/Py_Mind.h, rulesets/Py_Object.cpp,
rulesets/Py_Object.h, rulesets/Py_Operation.cpp,
rulesets/Py_Operation.h, rulesets/Py_Oplist.cpp,
rulesets/Py_Oplist.h, rulesets/Py_Optime.cpp, rulesets/Py_Optime.h,
rulesets/Py_Quaternion.cpp, rulesets/Py_Quaternion.h,
rulesets/Py_Thing.cpp, rulesets/Py_Thing.h, rulesets/Py_Vector3D.cpp,
rulesets/Py_Vector3D.h, rulesets/Py_World.cpp, rulesets/Py_World.h,
rulesets/Py_WorldTime.cpp, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Python_API.cpp:
Clean up python API code, with decent names for types,
decent error reporting, and making the more paranoid checks
only present in debug build.
* common/BaseEntity.cpp, common/BaseEntity.h, server/Account.cpp:
Remove pointless method setRefnoOp, and put it in the body as
an inline method.
* common/BaseEntity.h, common/BaseWorld.cpp, common/Setup.h,
common/Tick.h, common/operations.h, common/custom.cpp,
common/types.h, common/utility.cpp, common/utility.h,
modules/Location.h, physics/Vector3D.h, rulesets/BaseMind.cpp,
rulesets/Script.h, server/EntityFactory.h:
Clean up the dependency trees using more forward declarations.
* common/inheritance.cpp, common/inheritance.h:
Move most of the implementation into the .cpp file as its
not suited to inlining.
* rulesets/MemMap.cpp, rulesets/MemMap.h, rulesets/MemMap_methods.h:
Move contents of MemMap_methods.h into the .cpp file, as it is
not suited to inlining, and remove the file from the build.
* 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.
* 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.
* server/Account.cpp, server/Connection.cpp: Get rid of
character existance check on login, as dead ones are now handled
using SigC signals.
* rulesets/Entity.h, rulesets/Entity.cpp, rulesets/Py_World.cpp:
Remove pointless deleted flag, as the only time its true is when
the object has been deleted, and accessing would cause a segfault.
* ALL: Cleaned up headers into correct order.
* common/log.h, common/log.cpp: Write some logging code which
handles message of different types using syslog or standard
error, depending on whether we are running as a daemon.
* ALL: Switched to using log() for all output.
* common/BaseEntity.cpp, common/BaseEntity.h, common/BaseWorld.cpp,
common/Database.cpp, common/accountbase.h, modules/WorldTime.h,
rulesets/Py_World.cpp, server/Admin.cpp, server/Persistance.cpp,
server/Persistance.h:
Clean up includes.
* rulesets/Entity.cpp, rulesets/Entity.h: Write improved way of
handling immutable object attributes.
* server/EntityFactory.cpp, server/Player.cpp, server/Player.h:
Implement a character_types attribute on the player account,
by adding "playable" tag to rules database, and setting
up a set of character types when rules are read from database.
* server/server.cpp, rulesets/Python_API.cpp, rulesets/Line.cpp,
modules/Location.cpp, client/CreatorClient.cpp:
Removed some obsolete comments.
* server/WorldRouter.h, server/WorldRouter.cpp: Add member to
deliver operation to known entity. Make use if it to avoid
having to recurse in operation() when broadcasting. Ensure
that the container of new entities is managed from here.
* rulesets/Thing.cpp: Tell world to create new entities at the
same position as the creator if no other info is provided.
Do not attempt to handle setting up the default containership
of entity once created, as this is always handled by the
WorldRouter from now on.
* rulesets/Py_World.cpp: Implement getting time info from world.
* rulesets/Py_Location.cpp: Implement handling of the orientation
attribute from python.
* rulesets/MemMap.cpp: Update comments about unimplemented code.
* rulesets/Creator.cpp: Check for string.empty() instead of "".
* rulesets/BaseMind.cpp: Remove reference python code.
Cleanly handle and delete operations returned when savinf mind state.
* client/CharacterClient.cpp: Move delete to the right place.
tools/cycmd.cpp: Switched to using skstream to completely handle
client socket connections.
* client/ClientConnection.cpp, client/ClientConnection.h,
common/log.cpp, rulesets/EntityFactory.h, rulesets/MemMap.h,
server/server.cpp, tools/cycmd.cpp: Removed unused includes.
* client/Py_CreatorClient.cpp, client/client.cpp,
client/define_world.cpp, rulesets/Py_Location.cpp,
rulesets/Py_Location.h, rulesets/Py_Map.cpp,
rulesets/Py_Map.h, rulesets/Py_Mind.cpp, rulesets/Py_Mind.h,
rulesets/Py_Object.cpp, rulesets/Py_Object.h,
rulesets/Py_Operation.cpp, rulesets/Py_Operation.h,
rulesets/Py_Oplist.cpp, rulesets/Py_Oplist.h,
rulesets/Py_Optime.cpp, rulesets/Py_Optime.h,
rulesets/Py_Thing.cpp, rulesets/Py_Thing.h,
rulesets/Py_Vector3D.cpp, rulesets/Py_Vector3D.h,
rulesets/Py_World.cpp, rulesets/Py_World.h,
rulesets/Py_WorldTime.cpp, rulesets/Py_WorldTime.h,
rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/PythonThingScript.h, rulesets/Python_API.cpp,
rulesets/Python_API.h, server/server.cpp:
Reorganised python header files so that each header includes
all the code relevant for a particular type. Tidied up
the type implementations. Added prototypes to init_python_api()
to the Python_API.h header, and removed other dependencies from
it.
Al Riddoch <alriddoch@zepler.org>
client/ClientConnection.cpp, common/database.h, common/globals.cpp,
common/persistance.cpp, common/stringstream.h, server/CommClient.cpp,
server/CommServer.cpp, server/Persistance.cpp, tools/cyctrl.cpp,
tools/cyctrl.cpp, tools/cydbload.cpp, tools/cyisoload.cpp,
tools/cypasswd.cpp: Removed unused config.h.
* client/ObserverClient.cpp, common/const.h, tools/cycmd.cpp:
Use default password if the admin account cannot be fetched from
the database.
* client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, rulesets/Character.cpp, rulesets/Creator.cpp,
rulesets/Entity.cpp, rulesets/Entity.h, rulesets/EntityFactory.cpp,
rulesets/MemMap.cpp, rulesets/Py_Mind.cpp, rulesets/Py_Thing.cpp,
rulesets/Py_World.cpp, rulesets/Thing.cpp, server/Account.cpp,
server/Admin.cpp, server/Connection.cpp, tools/cywatchdog.cpp:
Make many of the member variables of Entity protected, and add
the required accessors. Changed the name of the id attribute
to m_id.
* common/BaseWorld.h, common/database.cpp, common/persistance.cpp:
Removed unused includes.
* common/Chop.h, common/Cut.h, common/Eat.h, common/Fire.h,
common/Generic.h, common/Load.h, common/Nourish.h, common/Save.h,
common/Setup.h, common/Tick.h: Moved definition of virtual
functions into cpp file, to reduce wasted code.
* common/Makefile.am: Create cyphesis library, which can be used by
other applications to access cyphesis databases.
* common/config.h, common/database.h, server/Persistance.cpp,
tools/cydbload.cpp, tools/cyisoload.cpp, tools/cypasswd.cpp:
Remove conditional compilation of db code. db3 is now required.
* server/WorldRouter.h: Fixed getNewId() so it take const string.
* server/server.cpp: Removed python shutdown, so it does not
mess up the db if it causes a segfault.
Al Riddoch <alriddoch@zepler.org>
client/ObserverClient.cpp, client/ObserverClient.h,
client/ClientConnection.cpp, client/ClientConnection.h,
client/define_world.cpp, client define_world.h:
Started re-coding of python client code in C++.
* common/accountbase.h:
Database class used for simply accessing accounts.
* common/OOGThing.cpp, common/OOGThing.h, server/Account.h,
server/Routing.h:
Moved OOGThing class into common as it is not server specific.
* common/BaseWorld.cpp, common/BaseWorld.h,
server/WorldRouter.cpp, server/WorldRouter.h,
rulesets/Entity.h, rulesets/Py_World.cpp,
rulesets/PythonThingScript.cpp, rulesets/Python_API.h,
rulesets/Thing.cpp, rulesets/Thing.h:
Added base class for WorldRouter so that code that previously
used WorldRouter now used the interface defined by this
new class. This means that the code in rulesets no longer
has dependencies on code in server, so can be used in the client.
* server/ExternalMind.cpp, server/ExternalMind.h,
rulesets/Character.h, rulesets/Creator.cpp,
server/Account.cpp:
Moved ExternalMind class into server as it is server specific,
so that there is no dependancy on server in rulesets.
* server/Persistance.cpp. server/Persistance.h,
server/Admin.cpp, server/ServerRouting.cpp, server/server.cpp:
Moved high level server specific persistance class into
server, so there is no dependency on server in common.
* common/database.cpp, common/database.h, server/Admin.cpp,
tools/cydbload.cpp, tools/cyisoload.cpp, tools/cypasswd.cpp:
Increases efficiency of some interfaces by passing Object::MapType
instead of MapType, when the value must be a map.
* modules/WorldTime.cpp, modules/WorldTime.h,
rulesets/Py_WorldTime.cpp, rulesets/Python_API.cpp:
Brought the version of WorldTime in modules up to date, as this is
the version now used.
* rulesets/Character.cpp, server/WorldRouter.cpp, rulesets/Thing.cpp,
server/Admin.cpp:
Made world objects dictionary private.
* rulesets/EntityFactory.cpp, rulesets/EntityFactory.h:
Change newThing parameters so entity factory does not need to
know about WorldRouter.
* server/Lobby.cpp: Added support for people and rooms attributes
of OOG room class.
Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp: Switch to using stringstream to
generate ids.
* rulesets/Thing.cpp: Re-write SetupOperation so Sight
operation is not lost and leaked.
* rulesets/Python_API.h, rulesets/Python_API.cpp,
rulesets/Py_WorldTime.cpp, rulesets/Py_World.cpp,
rulesets/Py_Thing.cpp, rulesets/Py_Operation.cpp,
rulesets/Py_Object.cpp: Sort out correct handling of
python references, and ensure C++ objects are
deleted as required.
Al Riddoch <alriddoch@zepler.org>
be loaded into the database.
* tools/cycmd.cpp: Cleaned up usage and help functions.
* tools/cyisoload.cpp: Cleaned up usage(), and made sure build
completes okay if libraries are missing, and missing
functionality is reported to the user.
* server/server.cpp: Added config options that specifies that
the contents of the db should loaded on server startup. Cleaned
up some debug code.
* server/WorldTime.cpp, server/WorldRouter.cpp,
server/Connection.cpp, rulesets/Structure.h,
rulesets/Python_API.cpp, rulesets/Py_WorldTime.cpp,
rulesets/Movement.cpp, rulesets/Entity.cpp,
physics/Vector3D.h, common/persistance.cpp,
common/database.h, common/database.cpp: Removed output either
to debug mode, or removed altogether.
* common/BaseEntity.h, common/BaseEntity.cpp: Removed redundant header
includes.
* server/ServerRouting.cpp, common/persistance.h,
common/persistance.cpp: Modified admin account function names it
fit convention.
* module/Location.h: Fixed collision detection so that entities
with velocity set to 0 still get checked.
* rulesets/Entity.cpp, rulesets/Thing.cpp, rulesets/Character.cpp,
rulesets/BaseMind.cpp, rulesets/Creator.cpp,
rulesets/ExternalMind.cpp, rulesets/Food.cpp, rulesets/MemMap.cpp,
rulesets/Movement.cpp, rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Py_*.cpp, rulesets/World.cpp:
Removed unnecessary #includes.
Al Riddoch <alriddoch@zepler.org>
representation.
* rulesets/Py_World.cpp: Added get_object() method so that python
scripts can actually interact with other objects.
* rulesets/basic/mind/goals/common/misc_goal.py: Fixed hunt goal
so that the arrow is removed from inventory as it is fired.
* client/define_world.py: Added archer, arrow and deer to test
shooting code.
* server/server.cpp: Made CommClient more robust in the event
if immediate disconnection by initialising pointers to NULL;
Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Tweaked ranges code in movement to cut
down CPU time used.
* common/BaseEntity.cpp: Re-ordered opEnumerate so that most
frequently used ops are detected soonest.
* modules/WorldTime.h/.cpp: Moved WorldTime to modules directory.
Al Riddoch <alriddoch@zepler.org>
script types to be cleanly dropped in.
* Re-work on server and communication related classes to use
references where they are apropriate. Code is now much more
robust.
* Huge cleanup of header files removing redundant includes.
* server/WorldRouter.h: Removed is_object_deleted because it
is broken and not used.
* server/Connection.h: Removed unused disconnect() methods.
* rulesets/Entity.*: Added new in game base class from which
all mind and object classes are derived. This removes
clutter of Thing class from mind classes.
* aiclient/*: Progress with creating AI client for mind handling.
* common/globals.*: Moved some globals out of server specific files.
* rulesets/Makefile.am: Separated rulesets code into 3 almost stand
alone packages; entities, mind and python interface code.
Acorn may well not work now, but I would apreciate it if people could
test the code on their setups. Lots of code has changed, and almost
everything is now cleaner.
Al Riddoch <alriddoch@zepler.org>
* */*: Fixed mistake in copyright statement.
* tools/cypasswd.cpp: Fixed usage message.
* tools/cycmd.cpp: Added tools for sending administrative commands
to server.
* server/server.cpp: Send terminate instruction to metaserver on
server shutdown.
Al Riddoch (alriddoch@zepler.org)
of oplist to take advantage of vector's best performance.
* Modified OP_SWITCH macros to improve speed, and made it inlinable.
* Cleaned up python interface code to improve compile and link time.
* Moved custom operation definitions in one header file per class
to improve modularity and compile time.
* Modified boundingbox handling so it now uses size and median.
* Added collision check and inbox member function to Vector3D class.
* Added collision prediction and checking to Location and Vector3D
classes.
* Added collision prediction into MovementInfo class.
* Modified Thing::operator[] so that static attributes can be handled
and added Thing::set() which must be used to modify attributes.
* Added collision resolution so characters can no longer walk through
each other.
* Moved weight attribute to being static attribute of Thing, so it
can be much more easily handled in movement code.
Al
be accessed, and certain move operations caused an abort.
* Removed attributes from python object which don't have attributes.
* Added Py*_Check() macros, and used them for easier code reading.
* Added snow attribute to weather.
* Commented out code which makes server exit(0) after a certain time.
Al
* Removed some unused code.
* Tweaked some python scripts so they import correctly.
* Added in_game flag to BaseEntity so it is possible to tell
if an object is in game.
* Increased the number of operations handled by Message()
* Added handling for initialisation of location.parent using me
in mind code.
* Added is_object_delete() functionality to python interface to world
object.
* Added handling for converting Tuple into Message::Object, and then
ensured that non-basic python types don't get stored as attributes
of a Message::Object.
Many more improvements to goal behavoir. Guard now patrols correctly,
and butcher tries to by a cleaver, because he fails to notice he already
has one.
Al