cyphesis/rulesets/PythonMindScript.cpp

107 lines
3.6 KiB
C++
Raw Normal View History

// This file may be redistributed and modified only under the terms of
// the GNU General Public License (See COPYING for details).
// Copyright (C) 2000,2001 Alistair Riddoch
#include "PythonMindScript.h"
#include "Py_Operation.h"
#include "Py_Oplist.h"
#include "Py_Thing.h"
#include "Entity.h"
#include "BaseMind.h"
#include "MemMap_methods.h"
#include <common/log.h>
#include <common/debug.h>
using Atlas::Objects::Operation::RootOperation;
PythonMindScript::PythonMindScript(PyObject * o, BaseMind & m) :
PythonScript(o, m), mind(m)
{
}
PythonMindScript::~PythonMindScript()
{
}
bool PythonMindScript::Operation(const std::string & op_type,
const RootOperation & op,
OpVector & ret_list, RootOperation * sub_op)
{
debug( std::cout << "Got script object for " << std::endl << std::flush;);
std::string op_name = op_type+"_operation";
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
// Construct apropriate python object thingies from op
if (!PyObject_HasAttrString(scriptObject, (char *)(op_name.c_str()))) {
debug( std::cout << "No method found for " << op_name << std::endl
<< std::flush;);
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
return false;
}
ConstOperationObject * py_op = newAtlasConstRootOperation(NULL);
py_op->operation = &op;
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
py_op->own = 0;
py_op->from = mind.map.getAdd(op.GetFrom());
py_op->to = mind.map.getAdd(op.GetTo());
PyObject * ret;
if (sub_op == NULL) {
ret = PyObject_CallMethod(scriptObject, (char *)(op_name.c_str()),
"(O)", py_op);
} else {
OperationObject * py_sub_op = newAtlasRootOperation(NULL);
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
py_sub_op->operation = sub_op;
py_sub_op->own = 0;
py_sub_op->from = mind.map.getAdd(sub_op->GetFrom());
py_sub_op->to = mind.map.getAdd(sub_op->GetTo());
ret = PyObject_CallMethod(scriptObject, (char *)(op_name.c_str()),
"(OO)", py_op, py_sub_op);
Py_DECREF(py_sub_op);
}
Py_DECREF(py_op);
if (ret != NULL) {
debug( std::cout << "Called python method " << op_name << std::endl
<< std::flush;);
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
if (PyOperation_Check(ret)) {
OperationObject * op = (OperationObject*)ret;
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
if (op->operation != NULL) {
ret_list.push_back(op->operation);
op->own = 0;
} else {
debug( std::cout << "Method returned invalid op" << std::endl
<< std::flush;);
}
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
} else if (PyOplist_Check(ret)) {
OplistObject * op = (OplistObject*)ret;
if (op->ops != NULL) {
ret_list = *op->ops;
} else {
debug(std::cout << "Method returned invalid OpVector" << std::endl
<< std::flush;);
}
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
} else {
debug( std::cout << "Method returned invalid object" << std::endl << std::flush;);
}
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
Py_DECREF(ret);
return true;
} else {
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
if (PyErr_Occurred() == NULL) {
debug( std::cout << "No method to be found for " << std::endl
<< std::flush;);
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
} else {
log(ERROR, "Reporting python error");
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
PyErr_Print();
}
}
return false;
}
void PythonMindScript::hook(const std::string & method, Entity * object)
{
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
ThingObject * obj = newThingObject(NULL);
obj->m_thing = object;
PyObject * ret = PyObject_CallMethod(scriptObject, (char *)(method.c_str()), "(O)", obj);
Py_DECREF(ret);
* server/server.cpp: Added several options to the config file to make server operation customisable. Added comments. * server/server.cpp, server/CommServer.h: Changed methods which return int to returning bool if they are success/faul results. * server/WorldRouter.cpp: Removed some unused debugging code. Optimised heavily used code. Changed error message on sending to a non-existant entity so that it is no longer reported as a critical error. * server/ServerRouting.h, server/Connection.h, server/Connection_methods.h: inlined simple methods. * server/Connection.cpp: Optimised frequently used code. * server/CommClient.h: Simplified read method so it no longer checks status redundantly. * common/BaseEntity.h, rulesets/Thing.h, rulesets/Entity.h: Added comments explaing purpose of classes. * rulesets/Thing.cpp: Added detailed comments, and removed unnecessary initialisation of some attributes. * rulesets/PythonMindScript.cpp: Removed redundant NULL check. * rulesets/MemMap.h: Added inlines for inlined methods. * rulesets/Entity.h, common/BaseEntity.h: Moved seq from BaseEntity to Entity as it does not apply to Out Of Game objects. * rulesets/Entity.cpp: Added in stamp/seq attribute. Nade name attribute optional. * rulesets/Character.cpp: Simplified some op handling code to make it more readable and hopefully faster. Added comments explaining movement, removed unused commented out code, and removed some unnecessary debugging code. * common/operations.h: Explanatory comments. * common/*.h: Re-wrote extended operations to fit in with Atlas-C++ 0.4.2 conventions. * common/log.*: Commented out unused logging code. Al Riddoch <alriddoch@zepler.org> This code will no longer build against the last release of Atlas-C++ 0.4 Please use cvs Atlas-C++ stable branch.
2001-05-14 17:25:32 +00:00
Py_DECREF(obj);
}