* common/Database.cpp, common/newid.cpp, server/server.cpp:
Modify new ID checks so that code still runs when database is
unavailable, and events requiring new IDs fail cleanly.
* server/Connection.cpp: Report a failure to create a player
account if no ID available.
* rulesets/BaseMind.cpp: When processing appearance ops, handle
stamp more efficiently, report an error if ID is missing
from argument.
* server/IdlePSQLConnector.cpp, server/IdlePSQLConnector.h:
Implement re-connecting to the Database if connection is lost.
* rulesets/Character.cpp, rulesets/Entity.cpp, rulesets/Thing.cpp:
Ensure STAMP is present on appearance op args.
* server/CommListener.cpp, server/CommListener.h,
server/CommPeerListener.cpp, server/CommPeerListener.h,
server/CommSlaveListener.cpp, server/CommSlaveListener.h,
server/CommUnixListener.cpp, server/CommUnixListener.h:
Add a return value to method for creating new client socket
objects, and use it to return failure if no ID is available
from the database for a new object.
* rulesets/Py_Point3D.cpp, rulesets/Py_Vector3D.cpp,
rulesets/Python_API.cpp: Add "new" method for class wrappers, and
call the in place constructor from new rather than init. Re-write
internal function for creating new instances so it uses the "new"
method.
* rulesets/Py_Statistics.cpp: Remove some obsolete code inadvertedly
copied from another file. Comment out some unused code to get rid
of a warning.
* server/CommPSQLSocket.cpp: Clear the database connection from
destructor.
* tests/python_class.cpp: A new test for experimenting with new
Python wrappers.
* rulesets/Py_Point3D.cpp, rulesets/Py_Vector3D.cpp,
rulesets/Python_API.cpp: Extend the type object for python
Vector3D and Point3D to the format used by more recent python
versions, adding init methods as well as flags, and doc string.
* rulesets/Py_Vector3D.cpp: Fix incorrect METH_VARARGS function type
of the three rotateN methods, as it should have been converted to
METH_O. Add a new rotate method used to rotate a vector using a
quaternion.
* rulesets/Py_Quaternion.cpp: Add a method to check the validity of
the quaternion, and a type method to create a string representation
of the quaternion.
* rulesets/Character.cpp: Remove commented out legacy hard coded
combat task setup. Now all tasks are scripts.
* rulesets/mason/world/tasks/Logging.py: Break logging down into
something that happens over many ticks, using the orientation of
the tree to determine if its felled yet.
* client/Py_CreatorClient.cpp, rulesets/Py_Map.cpp,
rulesets/Py_Operation.cpp, rulesets/Py_Oplist.cpp,
rulesets/Py_Point3D.cpp, rulesets/Py_Vector3D.cpp,
rulesets/Py_WorldTime.cpp, rulesets/Python_API.cpp:
Convert functions that take a single argument to use METH_O
and avoid calling PyArg_ParseTuple.
* rulesets/Py_Point3D.cpp, rulesets/Py_Vector3D.cpp,
rulesets/basic/mind/goals/common/move.py: Rename
unit_vector_to_another_vector to unit_vector_to.
* 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/Py_Point3d.cpp, rulesets/Py_Vector3d: add a _repr()
function to the type-object, so using points and vectors in
'print' statements works as expected.
* rulesets/Py_Vector3D.cpp: Fix format for outputting Vector3D
using printf.
* rulesets/AreaProperty.cpp, rulesets/AreaProperty.h: New
Property class for handling Area attributes.
* rulesets/Thing.cpp: Remove some debug output.
* rulesets/Py_Vector3D.cpp: Add error checking so that normalising
a zero mangitude vector does not abort.
* rulesets/Py_Vector3D.cpp: Add print handler for Vector3D, which
doesn't seem to work yet.
* rulesets/basic/mind/panlingua/interlinguish.py: Add tell verb.
Modify regexs for simple sentences so they tolerate more
variation in the structure.
* rulesets/basic/mind/compass.py: New function to convert direction
vector into a compass direction string.
* rulesets/basic/mind/NPCMind.py: Add handler for tell verb, to
query knowledge from NPCs.
* rulesets/Py_Vector3D.cpp: Allow setting of Vector3D attributes
x y and z.
* rulesets/Python_API.cpp: Fix bug in calculating orientation
Quaternion for rotation between two unit vectors.
* rulesets/basic/mind/NPCMind.py: Implement a method which calculates
the orientation required to face another entity. Use it to face
a character which wants to buy something.
* rulesets/mason/define_world.py: Tweak orientation of pig merchant
so he doesn't end up upside down.
* server/Makefile.am: Remove cyslave from the build for now, as its
not functional.
* server/WorldRouter.cpp: Add a note to check the code.
* rulesets/basic/mind/goals/humanoid/transaction.py: Remove debug
output.
* rulesets/basic/mind/goals/common/move.py: New goal to accompany
another person.
* rulesets/basic/mind/goals/common/misc_goal.py: Use new accompany
goal for hirelings.
* rulesets/Python_API.cpp: Fix distance_to arg checking error
message.
* rulesets/Py_Vector3D.cpp: Add square magnitude and distance checking
methods.
* physics/Vector3D.h, physics/Vector3D.cpp, modules/Location.h,
modules/Location.cpp: Convert to using WFMath::Point instead of
WFMath::Vector for position.
* physics/Collision.h, physics/Collision.cpp: Update collision code
to use new pos type.
* rulesets/Py_Point3D.h, rulesets/Py_Point3D.cpp: New python
wrappers for WFMath::Point.
* rulesets/Py_Location.cpp, rulesets/Py_Vector3D.cpp,
rulesets/Python_API.cpp:
Update python wrappers to take into account new pos type.
Ensure that only apropriate functionality is available for
point and vector.
* rulesets/Character.cpp, rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/Line.cpp, rulesets/Movement.cpp, rulesets/Movement.h,
rulesets/Pedestrian.cpp, rulesets/Pedestrian.h,
rulesets/Plant.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/EntityFactory.cpp, server/WorldRouter.cpp,
server/WorldRouter.h: Update the rest of the code for new pos
type, converting all places where entity parenting is changed
to use WFMath toParentCoords() and toLocalCoords() methods,
so that orientation is handled correctly.
* tests/transformtest.cpp: New test to ensure that toParentCoords()
and toLocalCoords() perform as expected.
* tests/Creatortest.cpp, tests/Locationtest.cpp, tests/Worldtest.cpp,
tests/collisiontest.cpp, tests/emergencetest.cpp:
Update the rest of the tests.
* rulesets/Py_Location.cpp, rulesets/Py_Map.cpp, rulesets/Py_Mind.cpp,
rulesets/Py_Object.cpp, rulesets/Py_Operation.cpp,
rulesets/Py_Quaternion.cpp, rulesets/Py_Thing.cpp,
rulesets/Py_Vector3D.cpp, rulesets/Python_API.cpp:
Change some methods to use METH_NOARGS for simplicity.
* 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.
* rulesets/Py_Vector3D.cpp, rulesets/Py_Quaternion.cpp,
rulesets/Py_BBox.cpp: Add in-place construction and
destruction for all three python types which embed C++ objects.
* 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 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>
* 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>
instead of pointer.
* physics/Vector3D.h: Re-ordered functions to allow correct inlining.
Changed member names to correct convention.
* rulesets/MemMap.cpp,rulesets/MemMap_methods.h: Re-ordered function
to allow inlining, and moved non-inlinable functions into .cpp file.
* Changed new operation initialisation to be done at construction
time instead of imediatly after construction for performance
reasons.
* server/WorldTime.*: Modified member names for convention, and
moved non-inlineable function to .cpp file.
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
* 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
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
from config files. Global ruleset should indicate top level ruleset
which can depend on a list of other rulesets.
* Sorted out installation directories. Cyphesis will now need to be
installed before it can be run.
* Cleaned up a load more python scripts for more Acorn stuff.
* Added getting x y and z from Vector3D.
* Made acorn the default ruleset.
Al
* 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