mirror of
https://github.com/worldforge/cyphesis
synced 2026-08-13 12:26:04 -04:00
2006-01-10 Al Riddoch <alriddoch@zepler.org>
* 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.
This commit is contained in:
parent
6863bcaec2
commit
a36b7f5db5
14 changed files with 244 additions and 10 deletions
|
|
@ -3,8 +3,11 @@
|
|||
// Copyright (C) 2005 Alistair Riddoch
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#include "PythonArithmeticScript.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
PythonArithmeticScript::PythonArithmeticScript(PyObject * o) : m_script(o)
|
||||
{
|
||||
}
|
||||
|
|
@ -13,3 +16,11 @@ 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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue