Commit graph

126 commits

Author SHA1 Message Date
Al Riddoch
aa47340d59 2002-05-18 Al Riddoch <alriddoch@zepler.org>
* client/ObserverClient.cpp, server/Account.cpp, server/Connection.h,
	  server/Routing.h: Formatting cleanup

	* client/Py_CreatorClient.cpp, rulesets/Area.cpp, rulesets/Area.h,
	  rulesets/Character.cpp, rulesets/Character.h, rulesets/Entity.cpp,
	  rulesets/Entity.h, rulesets/Line.cpp, rulesets/Line.h,
	  rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Py_Mind.cpp,
	  rulesets/Py_Thing.cpp, rulesets/Stackable.cpp, rulesets/Stackable.h:
	  Replace operator[] with get() method for querying attributes.
	  Make this get() method const, and re-write the internals so
	  that it more cleanly handles attributes.

	* common/BaseWorld.h: Re-write world.getObject() so that it
	  no longer uses std::map::operator[], as the old method was
	  inserting NULLs into the world dictionary when non-existant
	  entities were queried.

	* rulesets/Character.cpp: Clean up outstanding issues when movement
	  position is supplied, and is very close to being correct, and
	  clarify comments about movement when neither destination nor
	  source are provided.

	* rulesets/Character.cpp: Modify mind2body interface so that setting
	  the TO of ops is done in the individual handlers, and copying
	  the operation globally is avoided.

	* rulesets/MemMap_methods.h: Remove dodgy debug code.

	* rulesets/Pedestrian.cpp: Clarify movement fixme.

	* rulesets/Py_Operation.cpp: Clarify operation time handler fixme.

	* rulesets/Stackable.cpp: Clarify fixme's in combine and divide
	  handlers.

	* server/CommServer.cpp: Remove redundant fixme.

	* server/Connection.cpp, server/ServerRouting.cpp,
	  server/ServerRouting.h, server/ServerRouting_methods.h,
	  server/server.cpp:
	  Move inline ServerRouting::getObject into class header.

	* server/WorldRouter.cpp, server/WorldRouter.h:
	  Clean up  includes, and move updateTime into the main body of the
	  file. Clean up code formatting when handling maps and dictionaries.
	  Clarify error output and comments about NULL objects in the world
	  dictionary.
2002-05-18 18:09:14 +00:00
Al Riddoch
e1669c7947 * client/ClientConnection.cpp, client/ClientConnection.h,
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>
2001-10-19 11:35:07 +00:00
Al Riddoch
c0af3c3c63 * aiclient/ClientConnection.cpp, aiclient/client.cpp,
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>
2001-10-17 14:09:42 +00:00
Al Riddoch
2fd239e63c * tools/cycmd.cpp: Ensure that login op is flushed after it is sent.
* server/Player.cpp: Arg order of std::string.compare() is
	  incompatable between recent libstdc++ versions. Switch
	  back to old version, still in most common use.

	* rulesets/Thing.cpp: Set refno on ops handled in game.

	* rulesets/Python_API.cpp: Modify Entity() python constructor
	  so that commonly used attributes from old atlas are translated
	  to their modern equivalents.

	* rulesets/Py_Thing.cpp, rulesets/Py_Mind.cpp: Differentiate
	  between previously identical error messages in several places.

	* rulesets/Py_Object.cpp: Rework conversion of python dict to
	  Atlas map to be more efficient and clean.

	* rulesets/Py_Location.cpp: Rework setting of vector parts of
	  location so that it can accept vectors from python in more
	  formats, including lists and tuples.

	* rulesets/Creator.h, rulesets/Character.h, common/BaseEntity.h:
	  Re-order virtual methods declarations to fit a convention.

	* common/stringstream.h: Hardcode use of local stringstream class,
	  as the version provided with older libstdc++ seems to be broken.

	* common/database.cpp: Use the common header to pick the right
	  stringstream implementation.

	* common/BaseWorld.cpp, server/Persistance.cpp: Removed unused
	  stringstream include.

	* rulesets/Creator.cpp: Added extra debug output.

	* client/define_world.h, client/define_world.cpp, client/CommClient.h:
	  Use CreatorClient to store Creators mind, instead of BaseMind.

	* client/client.cpp,
	  client/ObserverClient.h, client/ObserverClient.cpp,
	  client/CreatorClient.h, client/CommClient.h, client/CommClient.cpp:
	  Modify method names to fit capitalisation conventions.

	* client/CreatorClient.cpp: Implement creation of in-game entities,
	  using creator entity.

	* client/CommClient.cpp: Added correct client side monitoring of
	  creator entity.

	* client/ClientConnection.h, client/ClientConnection.cpp: Added
	  pending method to establish if ops are in the queue. Switched send()
	  method so we only send ops. Add setting of serialno of sent
	  ops, starting with an offset of 512.

	* client/CharacterClient.h: Removed unused member, opFound.

	* client/CharacterClient.cpp: Debugged sendAndWait() method.

Al Riddoch  <alriddoch@zepler.org>
2001-08-16 17:39:42 +00:00
Al Riddoch
3969bffbfe * common/inheritance.cpp, common/inheritance.h: Added code to store
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>
2001-08-02 14:27:06 +00:00
Al Riddoch
9f0e733adb * server/server.cpp: Handle cleaning up after database load.
* 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>
2001-06-22 22:03:59 +00:00
Al Riddoch
0572ab631b * Renamed Operataion method names throughout so they no longer
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>
2001-05-28 14:58:24 +00:00
Al Riddoch
a303326964 * Changed many return statements to match convention.
* 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>
2001-04-17 10:14:20 +00:00
Al Riddoch
43211cf9d1 * Re-wrote class headers files so that all class members now
begin with a lower case letter and do not contain _.

	* Fixed retrieval of Account from database so that the Account
	  is now correctly referenced in the server object.

	* common/types.h: Changed type name to make them clearer.

	* rulesets/Character.h: Moved MovementInfo into its own class
	  file, and made it a base class, with a Pedestrian super class.
	  This allows different types of movement handling classes
	  to be used to handle things that move differently.

Al Riddoch  <alriddoch@zepler.org>
2001-04-11 14:34:15 +00:00
Al Riddoch
488f35b52f * Complete re-write of python script interface to allow other
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>
2001-04-10 19:05:14 +00:00
Al Riddoch
291621d9e8 * watchdog/*.c: Corrected C++ style comments in c code.
* */*: 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)
2001-03-16 11:38:14 +00:00
Al Riddoch
3a5e4e56c0 * Changed oplist to use std::vector. Recoded and re-optimised use
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
2001-02-26 14:41:10 +00:00
Al Riddoch
e7eb28366c * all file: Added copyright statement
Al
2001-01-26 16:38:23 +00:00
Al Riddoch
7baa6b36c6 * Fixed pig mind so it is now better able to detect "Sowee"
* Removed map from Thing, and put it into basmind. Re-wrote
	  script_Operation for thing so it now looks things up in world
	  dictionary rather than in local map. This removes a memory leak.

This is Acorn 0.3 server release candidate 1. There is one known issue
which must be solved before Acorn 0.3, but everything else should work.

Al
2001-01-02 17:50:10 +00:00
Al Riddoch
f9e8d1c832 * Fixed inheritance bug in BaseMind::operation()
* Tweaked the way Look operations are handled when sent from mind, so
	  an argument is not required if to is set.

	* Made some performance enhancements.

	* Implemented nourish operation.

	* Modifed move_me() goal so it sets face direction.

	* Fixed memory leak in MemMap.

	* Implemented fully deleting of entities.

	* Cleaned up and tweaked python scripts so eating acorns now works.

	* Implemented hooks in MemMap for python scripts.


This is the work I got done over the Christmas break. Acorn now works
with a couple of minor glitches.

Al
2000-12-30 23:16:57 +00:00
Al Riddoch
4343c8d383 * Removed lots of extraneous debugging output, and turned the rest
off using debug flags.

	* Added halt_time, which is number of seconds server should run before
	  it exits.

	* Cleaned a bunch if the remaining memory leaks.

	* Cleaned up the way time is handled.

	* More tweaks to Python code and API to get Acorn working.

	* Inlined some methods into the class definitions, for performance.

	* Updated movement code to sort out setting mode properlly, and
	  deal with stuttering NPC movement.

This is quite a big commit, and most of Acorn now works. Performance seems
to be good too.
2000-12-11 13:06:12 +00:00
Al Riddoch
b1a1db69d3 * Major attack on the more fiddly memory leaks. The only noticable
leak now is copied Location objects in the python interface code.

	* Added hook into the time code so the server can be set to exit
	  after a given number of seconds. This is required for LeakTracer
	  to generate its report.

Al
2000-12-08 11:40:32 +00:00
Al Riddoch
1826587f9d * Fixes to worlds object list so it now contains world.
* More python code tweaks to work with modifications to interface.

	* Modified code which gets Thing attributes from Message::Object
	  so it can use any object dictionary to look up parent object.

	* Fixed handling of Thing's static type attribute.

	* Modified creation of operations from python to eliminate
	  some strange segfaults.

	* Re-wrote and fixed Entity creation from python.

	* Implemented dictlist.remove_value for removing things from inventory.

	* Implemented Vector3D arithmetic and methods from python.

	* Implemented as_entity() and get_xyz() methods for Thing from
	  python.

	* Commented out deletion of operations from python OperationObject
	  dealloc() function as it was causing segfaults. There is a problem
	  somewhere with ownership not being cleared, but I can't find it.

	* Implemented conversion of Python Operation and Oplist objects
	  to Message::Object.

	* Fixed MemMap so that attributes of Things are accuratly updated.

	* Fixed it so that look ops from mind are broadcast rather than sent
	  to world. This may have to be reverted.

	* Tweaked autoconf to make it cleaner and work better. Still needs
	  alot of work.

A simple test of some goals now works! The lych goals worked to some
extent and no-longer gives python errors. Only a few more things are
required before Acorn can run, at which point I will release 0.1
for testing.

Al
2000-12-06 18:21:35 +00:00
Al Riddoch
e6d6f7ef0d * Added new common namespace to prevent collision with math function
log.

	* Added in lots of deletes to sort memory leaks.

	* More python tweaks.

	* Implemented status attributes of thing.

	* Re-wrote some code which needlessly creates objects in the
	  free store.

Very nearly all works now.

TODO:
Tidy some of the rest of the leak handling, including all of the stuff
to deal with connections going down.

Sort out how mind gets its attributes set and updated.

Sort out iritating python error in init of Vector3D

delete oplists in OplistObjects. The pointers are never passed back.

Al
2000-12-05 14:26:04 +00:00
Al Riddoch
21b18875f6 * Started working on sorting out memory leaks.
* Implemented python function to deal with not being able to check
	  type of python objects implemented in C.

	* Added method to thing for extracting location data from a
	  Message::Object

	* More work on python references to improve leakage.

	* Added flag so that python Operation object can own
	  the operation they point to, and thus delete it in dealloc().

	* Implemented find_by_location() and find_by_type() as required in
	  MemMap, and corresponding python interface.

	* Put in temporary work around to deal with the fact that a mind
	  does not know its name. Currently the mind is not able to
	  discover any of its bodies attributes, and I am not sure how
	  to solve this.

	* Fixed Location and Vector3D so they use operator bool() to detect
	  whether they are set.

	* Fixed bugs in getting parent from Location in python which caused
	  segfaults.

	* Imported all the basic ruleset entity python scripts.


Goals now work to some extent, though nothing moves around still. The main
priority is to work out how minds inherit the attributes of their
bodies, and keep them up to date. aloril?

Al
2000-12-04 20:08:21 +00:00
Al Riddoch
4b0b328c92 * Debugged set_kw() and confirmed that it does work.
* Added python API support for self.world.

Al
2000-12-03 16:56:10 +00:00
Al Riddoch
907455c4c8 * Added more required functionality to base python Thing class
so that operation manipulations can now work.

	* Implemented getting of object name to python/C API, and added
	  methods for differentiating between op and object.

	* Implemented on-the-fly de-coding of operations, from operation
	  arguuments in python/C API. This will be obsolete once Atlas-C++
	  does full decode later.

	* Implemented get and setattr for Message Object from
	  python. Attributes are stored both in Object, and in supplementary
	  python dictionary for non Atlas compatable attributes.

	* Implemented copy() method for Python/C Location class.

Al
2000-11-30 12:51:59 +00:00
Al Riddoch
ec1789eb9e * Filled out Location python interface so it is now fully functional.
* Inlined Vector3D class for performance.

Al
2000-11-22 12:44:47 +00:00
Al Riddoch
f3d553368b * Filled out the python common.const module will all its values.
* Added code required to create an operation from with python.

	* Modified the Thing python interface so that python objects
	  that Atlas doesn't want to know about are stored in a normal
	  attributes list.

Al
2000-11-21 19:24:29 +00:00
Al Riddoch
f2928e6310 * Moved some of BaseMind functionality in a python class and
added the necessary interface code.

	* Initial port of MemMap class from python to C++, together with
	  python interface. Hopefully maintenance of MemMap can be kept
	  in C++ for speed if possible.

Al
2000-11-19 00:02:29 +00:00
Al Riddoch
24bd5394fb * Sorted out error handling from python code, and no-longer treat
no method as an error.

	* Got python interface code to the point that python classes can now
	  access the C++ attributes of a Thing.

	* Split the python interface code into separate files depending
	  on the type of C++ class the code relates to.

Al
2000-11-17 00:18:32 +00:00