ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/plugins/cfpython/cfpython_region.c
Revision: 1.1.1.2 (vendor branch)
Committed: Wed Feb 22 18:03:15 2006 UTC (18 years, 3 months ago) by elmex
Content type: text/plain
Branch: UPSTREAM
CVS Tags: UPSTREAM_2006_03_15, LAST_C_VERSION, UPSTREAM_2006_02_22, difficulty_fix_merge_060810_2300
Branch point for: difficulty_fix
Changes since 1.1.1.1: +1 -1 lines
Log Message:
cvs -z7 -d:ext:elmex@cvs.schmorp.de:/schmorpforge import cf.schmorp.de UPSTREAM UPSTREAM_2006_02_22

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_region_private.h>
32    
33     static PyObject* Crossfire_Region_GetName(Crossfire_Region* regionptr, void* closure)
34     {
35     return Py_BuildValue("s",cf_region_get_name(regionptr->reg));
36     }
37    
38     static PyObject* Crossfire_Region_GetLongname(Crossfire_Region* regionptr, void* closure)
39     {
40     return Py_BuildValue("s",cf_region_get_longname(regionptr->reg));
41     }
42    
43     static PyObject* Crossfire_Region_GetMessage(Crossfire_Region* regionptr, void* closure)
44     {
45     return Py_BuildValue("s",cf_region_get_message(regionptr->reg));
46     }
47    
48     static PyObject* Crossfire_Region_GetNext( Crossfire_Region* party, PyObject* args )
49     {
50     return Crossfire_Region_wrap(cf_region_get_next(party->reg));
51     }
52    
53     static PyObject* Crossfire_Region_GetParent( Crossfire_Region* party, PyObject* args )
54     {
55     return Crossfire_Region_wrap(cf_region_get_parent(party->reg));
56     }
57    
58     PyObject *Crossfire_Region_wrap(region *what)
59     {
60     Crossfire_Region *wrapper;
61    
62     /* return None if no object was to be wrapped */
63     if(what == NULL) {
64     Py_INCREF(Py_None);
65     return Py_None;
66     }
67    
68     wrapper = PyObject_NEW(Crossfire_Region, &Crossfire_RegionType);
69     if(wrapper != NULL)
70     wrapper->reg = what;
71     return (PyObject *)wrapper;
72     }
73    
74     static int Crossfire_Region_InternalCompare(Crossfire_Region* left, Crossfire_Region* right)
75     {
76 elmex 1.1.1.2 return (left->reg < right->reg ? -1 : ( left->reg == right->reg ? 0 : 1 ) );
77 root 1.1 }