mirror of
https://github.com/worldforge/cyphesis
synced 2026-08-13 12:26:04 -04:00
* rulesets/ArithmeticScript.h: Remove redundant constructor. * rulesets/ArithmeticScript.cpp: Provide empty virtual destructor implementation. * rulesets/Py_Statistics.cpp: Add debugging output, and remove rubbish from __init__. * rulesets/PythonArithmeticScript.cpp: Test implementation of attribute. * server/ArithmeticFactory.cpp, server/ArithmeticFactory.h: New factory class to create instances of scripts to handle statistics. * server/EntityFactory.cpp, server/EntityFactory.h: Add new method and supporting data structures to provide a way to create statistics objects for newly created Character entities. * server/PersistantThingFactory.cpp: Add a call to EntityFactory::addStatisticsScript to the Character specialisation of PersistantThingFactory::populate, giving all characters a statistics script now. * rulesets/mason/world/statistics/Statistics.py: Test implementation of a class for all character statistics.
26 lines
639 B
C++
26 lines
639 B
C++
// This file may be redistributed and modified only under the terms of
|
|
// the GNU General Public License (See COPYING for details).
|
|
// Copyright (C) 2005 Alistair Riddoch
|
|
|
|
#include <Python.h>
|
|
|
|
#include "PythonArithmeticScript.h"
|
|
|
|
#include <iostream>
|
|
|
|
PythonArithmeticScript::PythonArithmeticScript(PyObject * o) : m_script(o)
|
|
{
|
|
}
|
|
|
|
PythonArithmeticScript::~PythonArithmeticScript()
|
|
{
|
|
Py_DECREF(m_script);
|
|
}
|
|
|
|
int PythonArithmeticScript::attribute(const std::string & name, float & val)
|
|
{
|
|
std::cout << "Request for attribute " << name << " from python script"
|
|
<< std::endl << std::flush;
|
|
val = 0.5f;
|
|
return 0;
|
|
}
|