ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/plugins/cfpython/cfpython_archetype.c
Revision: 1.2
Committed: Sun Aug 13 17:16:02 2006 UTC (17 years, 10 months ago) by elmex
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
State: FILE REMOVED
Log Message:
Made server compile with C++.
Removed cfanim plugin and crossedit.
C++ here we come.

File Contents

# User Rev Content
1 root 1.1 /*****************************************************************************/
2     /* CFPython - A Python module for Crossfire RPG. */
3     /* Version: 2.0beta8 (also known as "Alexander") */
4     /* Contact: yann.chachkoff@myrealbox.com */
5     /*****************************************************************************/
6     /* That code is placed under the GNU General Public Licence (GPL) */
7     /* (C)2001-2005 by Chachkoff Yann (Feel free to deliver your complaints) */
8     /*****************************************************************************/
9     /* CrossFire, A Multiplayer game for X-windows */
10     /* */
11     /* Copyright (C) 2000 Mark Wedel */
12     /* Copyright (C) 1992 Frank Tore Johansen */
13     /* */
14     /* This program is free software; you can redistribute it and/or modify */
15     /* it under the terms of the GNU General Public License as published by */
16     /* the Free Software Foundation; either version 2 of the License, or */
17     /* (at your option) any later version. */
18     /* */
19     /* This program is distributed in the hope that it will be useful, */
20     /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
21     /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
22     /* GNU General Public License for more details. */
23     /* */
24     /* You should have received a copy of the GNU General Public License */
25     /* along with this program; if not, write to the Free Software */
26     /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
27     /* */
28     /*****************************************************************************/
29    
30     #include <cfpython.h>
31     #include <cfpython_archetype_private.h>
32    
33     static PyObject* Crossfire_Archetype_GetName( Crossfire_Archetype* whoptr, void* closure)
34     {
35     return Py_BuildValue("s",cf_archetype_get_name(whoptr->arch));
36     }
37    
38     static PyObject* Crossfire_Archetype_GetNext( Crossfire_Archetype* who, PyObject* args )
39     {
40     return Crossfire_Archetype_wrap(cf_archetype_get_next(who->arch));
41     }
42    
43     static PyObject* Crossfire_Archetype_GetMore( Crossfire_Archetype* who, PyObject* args )
44     {
45     return Crossfire_Archetype_wrap(cf_archetype_get_more(who->arch));
46     }
47    
48     static PyObject* Crossfire_Archetype_GetHead( Crossfire_Archetype* who, PyObject* args )
49     {
50     return Crossfire_Archetype_wrap(cf_archetype_get_head(who->arch));
51     }
52    
53     static PyObject* Crossfire_Archetype_GetClone( Crossfire_Archetype* who, PyObject* args )
54     {
55     return Crossfire_Object_wrap(cf_archetype_get_clone(who->arch));
56     }
57    
58     static PyObject* Crossfire_Archetype_GetNewObject( Crossfire_Archetype* who, PyObject* args )
59     {
60     return Crossfire_Object_wrap(cf_create_object_by_name(cf_archetype_get_name(who->arch)));
61     }
62    
63     PyObject *Crossfire_Archetype_wrap(archetype *what)
64     {
65     Crossfire_Archetype *wrapper;
66    
67     /* return None if no object was to be wrapped */
68     if(what == NULL) {
69     Py_INCREF(Py_None);
70     return Py_None;
71     }
72    
73     wrapper = PyObject_NEW(Crossfire_Archetype, &Crossfire_ArchetypeType);
74     if(wrapper != NULL)
75     wrapper->arch = what;
76     return (PyObject *)wrapper;
77     }
78    
79     static int Crossfire_Archetype_InternalCompare(Crossfire_Archetype* left, Crossfire_Archetype* right)
80     {
81     return ((int)left->arch - (int)right->arch);
82     }