version 1.10 | | version 1.11 |
---|
| | |
| | |
Py_Initialize(); | | Py_Initialize(); |
Crossfire_ObjectType.tp_new = PyType_GenericNew; | | Crossfire_ObjectType.tp_new = PyType_GenericNew; |
| | Crossfire_MapType.tp_new = PyType_GenericNew; |
| | Crossfire_PlayerType.tp_new = PyType_GenericNew; |
PyType_Ready(&Crossfire_ObjectType); | | PyType_Ready(&Crossfire_ObjectType); |
PyType_Ready(&Crossfire_MapType); | | PyType_Ready(&Crossfire_MapType); |
PyType_Ready(&Crossfire_PlayerType); | | PyType_Ready(&Crossfire_PlayerType); |
| | |
m = Py_InitModule("Crossfire", CFPythonMethods); | | m = Py_InitModule("Crossfire", CFPythonMethods); |
d = PyModule_GetDict(m); | | d = PyModule_GetDict(m); |
Py_INCREF(&Crossfire_ObjectType); | | Py_INCREF(&Crossfire_ObjectType); |
| | Py_INCREF(&Crossfire_MapType); |
| | Py_INCREF(&Crossfire_PlayerType); |
| | |
PyModule_AddObject(m, "Object", (PyObject*)&Crossfire_ObjectType); | | PyModule_AddObject(m, "Object", (PyObject*)&Crossfire_ObjectType); |
| | PyModule_AddObject(m, "Map", (PyObject*)&Crossfire_MapType); |
| | PyModule_AddObject(m, "Player", (PyObject*)&Crossfire_PlayerType); |
| | |
CFPythonError = PyErr_NewException("Crossfire.error",NULL,NULL); | | CFPythonError = PyErr_NewException("Crossfire.error",NULL,NULL); |
PyDict_SetItemString(d,"error",CFPythonError); | | PyDict_SetItemString(d,"error",CFPythonError); |
for (i=0;i<NR_CUSTOM_CMD;i++) | | for (i=0;i<NR_CUSTOM_CMD;i++) |
| | |
fclose(scriptfile); | | fclose(scriptfile); |
context = popContext(); | | context = popContext(); |
rv = context->returnvalue; | | rv = context->returnvalue; |
/*Py_XDECREF(context->who); | | Py_XDECREF(context->who); |
Py_XDECREF(context->activator); | | Py_XDECREF(context->activator); |
Py_XDECREF(context->third);*/ | | Py_XDECREF(context->third); |
free(context); | | free(context); |
printf("Execution complete"); | | printf("Execution complete"); |
return rv; | | return rv; |
| | |
fclose(scriptfile); | | fclose(scriptfile); |
context = popContext(); | | context = popContext(); |
rv = context->returnvalue; | | rv = context->returnvalue; |
/*Py_XDECREF(context->who); | | Py_XDECREF(context->who); |
Py_XDECREF(context->activator); | | Py_XDECREF(context->activator); |
Py_XDECREF(context->third);*/ | | Py_XDECREF(context->third); |
free(context); | | free(context); |
| | |
return &rv; | | return &rv; |
| | |
fclose(scriptfile); | | fclose(scriptfile); |
context = popContext(); | | context = popContext(); |
rv = context->returnvalue; | | rv = context->returnvalue; |
/*Py_XDECREF(context->who); | | Py_XDECREF(context->who); |
Py_XDECREF(context->activator); | | Py_XDECREF(context->activator); |
Py_XDECREF(context->third);*/ | | Py_XDECREF(context->third); |
free(context); | | free(context); |
return &rv; | | return &rv; |
} | | } |
| | |
CF_PLUGIN int closePlugin() | | CF_PLUGIN int closePlugin() |
{ | | { |
printf("CFPython 2.0a closing\n"); | | printf("CFPython 2.0a closing\n"); |
| | Py_Finalize(); |
return 0; | | return 0; |
} | | } |
| | |