mirror of
https://github.com/worldforge/cyphesis
synced 2026-08-13 12:26:04 -04:00
* Doxyfile, client/define_world.cpp, client/define_world.h, common/CustomOp.cpp, common/CustomOp.h, common/CustomOp_impl.h, common/Load.h, common/Save.h, common/inheritance_impl.h, common/operations.h, common/refno.h, common/utility.cpp, common/utility.h, rulesets/Combat.h, rulesets/Entity_getLocation.h, rulesets/Fell.h, rulesets/MemMap_methods.h, rulesets/Py_Optime.cpp, rulesets/Py_Optime.h, rulesets/ThingFactory.h, server/CommIdleSocket.h, server/ServerRouting_methods.h, tools/Formatter.cpp, tools/Formatter.h, tools/cydbload.cpp, tools/cyisoload.cpp: Make doxygen skip code that has been removed and is just left in cvs for reference.
71 lines
2.3 KiB
C++
71 lines
2.3 KiB
C++
// Cyphesis Online RPG Server and AI Engine
|
|
// Copyright (C) 2000,2001 Alistair Riddoch
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program; if not, write to the Free Software Foundation,
|
|
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
#error This file has been removed from the build.
|
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
|
|
|
#include "define_world.h"
|
|
|
|
#include "Py_CreatorClient.h"
|
|
|
|
#include <iostream>
|
|
|
|
namespace DefineWorld {
|
|
|
|
bool define(CreatorClient * character)
|
|
{
|
|
PyObject * package_name = PyString_FromString("define_world");
|
|
PyObject * mod_dict = PyImport_Import(package_name);
|
|
Py_DECREF(package_name);
|
|
if (mod_dict == NULL) {
|
|
std::cerr << "Cld not find python module define_world"
|
|
<< std::endl << std::flush;
|
|
PyErr_Print();
|
|
return false;
|
|
}
|
|
PyObject * function = PyObject_GetAttrString(mod_dict, "default");
|
|
Py_DECREF(mod_dict);
|
|
if (function == NULL) {
|
|
std::cerr << "Could not find default function" << std::endl
|
|
<< std::flush;
|
|
PyErr_Print();
|
|
return false;
|
|
}
|
|
if (PyCallable_Check(function) == 0) {
|
|
std::cerr << "It does not seem to be a function at all" << std::endl
|
|
<< std::flush;
|
|
Py_DECREF(function);
|
|
return false;
|
|
}
|
|
CreatorClientObject * editor = newCreatorClientObject(NULL);
|
|
editor->m_mind = character;
|
|
PyObject * pyob = PyEval_CallFunction(function, "(O)", editor);
|
|
|
|
if (pyob == NULL) {
|
|
if (PyErr_Occurred() == NULL) {
|
|
std::cerr << "Could not call function" << std::endl << std::flush;
|
|
} else {
|
|
std::cerr << "Reporting python error" << std::endl << std::flush;
|
|
PyErr_Print();
|
|
}
|
|
}
|
|
Py_DECREF(function);
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|