[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-commits] CVS: adonthell/src/tools/item book.py,NONE,1.1.2.1 c
From: |
Thorsten Riess <address@hidden> |
Subject: |
[Adonthell-commits] CVS: adonthell/src/tools/item book.py,NONE,1.1.2.1 character_base.cc,NONE,1.1.2.1 character_base.h,NONE,1.1.2.1 default_inventory.py,NONE,1.1.2.1 equipment.cc,NONE,1.1.2.1 equipment.h,NONE,1.1.2.1 fileops.cc,NONE,1.1.2.1 fileops.h,NONE,1.1.2.1 inventory_base.cc,NONE,1.1.2.1 inventory_base.h,NONE,1.1.2.1 inventory_char.h,NONE,1.1.2.1 item_base.cc,NONE,1.1.2.1 item_base.h,NONE,1.1.2.1 itemtest.cc,NONE,1.1.2.1 itemtest.py,NONE,1.1.2.1 Makefile.in,NONE,1.1.2.1 py_itemtest.i,NONE,1.1.2.1 py_object.cc,NONE,1.1.2.1 py_object.h,NONE,1.1.2.1 python_class.cc,NONE,1.1.2.1 python_class.h,NONE,1.1.2.1 storage.cc,NONE,1.1.2.1 storage.h,NONE,1.1.2.1 str_hash.h,NONE,1.1.2.1 types.h,NONE,1.1.2.1 weapon.py,NONE,1.1.2.1 |
Date: |
Wed, 08 May 2002 10:45:39 -0400 |
Update of /cvsroot/adonthell/adonthell/src/tools/item
In directory subversions:/tmp/cvs-serv7797/src/tools/item
Added Files:
Tag: Branch_road_to_0-4
book.py character_base.cc character_base.h
default_inventory.py equipment.cc equipment.h fileops.cc
fileops.h inventory_base.cc inventory_base.h inventory_char.h
item_base.cc item_base.h itemtest.cc itemtest.py Makefile.in
py_itemtest.i py_object.cc py_object.h python_class.cc
python_class.h storage.cc storage.h str_hash.h types.h
weapon.py
Log Message:
ADDED items and inventory code
--- NEW FILE ---
import itemtest
class book:
def use (self, a_book):
print "Reading:", a_book.get_name (), "..."
print a_book.get_description (), "\n"
***** Error reading new file: [Errno 2] No such file or directory:
'character_base.cc'
***** Error reading new file: [Errno 2] No such file or directory:
'character_base.h'
--- NEW FILE ---
import itemtest
class default_inventory:
def use (self, a_weapon):
if a_weapon.get_val ("type") != itemtest.WEAPON: return
print "To battle!"
def equip (self, a_weapon, a_person):
if a_weapon.get_val ("type") != itemtest.WEAPON: return
print a_person.get_name (), "equips", a_weapon.get_name ()
***** Error reading new file: [Errno 2] No such file or directory:
'equipment.cc'
***** Error reading new file: [Errno 2] No such file or directory: 'equipment.h'
***** Error reading new file: [Errno 2] No such file or directory: 'fileops.cc'
***** Error reading new file: [Errno 2] No such file or directory: 'fileops.h'
***** Error reading new file: [Errno 2] No such file or directory:
'inventory_base.cc'
***** Error reading new file: [Errno 2] No such file or directory:
'inventory_base.h'
***** Error reading new file: [Errno 2] No such file or directory:
'inventory_char.h'
***** Error reading new file: [Errno 2] No such file or directory:
'item_base.cc'
***** Error reading new file: [Errno 2] No such file or directory: 'item_base.h'
--- NEW FILE ---
#include <unistd.h>
#include "python_class.h"
#include "inventory_base.h"
#include "character_base.h"
// SWIG init prototypes. Should we use dynamic linking???
extern "C"
{
void inititemtestc (void);
}
item_base * new_item ()
{
string n,d,t,s;
u_int32 ab;
string vstr;
s_int32 v;
cout << "New item name: ";
getline(cin,n);
cout << "Description: ";
getline(cin,d);
cout << "Type (book, weapon): ";
getline (cin , t);
if ( t == "book" )
ab = USE|DROP|PICKUP;
else if ( t == "weapon" )
ab = EQUIP|USE|PICKUP|DROP|ENCHANT|COMBINE;
else {
t = "book";
ab = USE|DROP|PICKUP;
}
item_base * new_item = new item_base ( n, d, t, ab );
cout << "Enter (string, value) pairs (empty string to abort): \n";
while ( 1 ) {
cout << "String: ";
getline ( cin, s );
if ( s == "" )
break;
cout << "Value: ";
getline ( cin, vstr );
v = atoi ( vstr.c_str () );
new_item->set_val ( s, v );
}
return new_item;
}
inventory_base * new_inventory ()
{
string n,d;
cout << "New inventory name: ";
getline ( cin, n );
cout << "Description: ";
getline ( cin, d );
inventory_base * new_inv = new inventory_base ();
new_inv->set_name ( n );
new_inv->set_description ( d );
return new_inv;
}
// a quick item test
void test ()
{
character_base *dwarf = new character_base();
dwarf->set_name ("Dungar");
dwarf->set_val ("strength", 19);
dwarf->set_val ("dexterity", 12);
string an;
bool another = true;
item_base * item;
while ( another ) {
cout << "new item\n";
item = new_item ();
cout << "adding item to inventory...\n";
dwarf->get_inventory()->add_item ( item );
cout << "another item? (y/n) ";
getline ( cin ,an);
if ( (an != "y") && (an != "Y") )
another = false;
}
cout << "Using (last) item...\n";
item->use();
// cout << item1->get_name() << endl;
// cout << item1->get_description() << endl;
cout << "saving (last) item...\n";
item->save ( "test.item" );
cout << "clearing item...\n";
item->clear ();
cout << "Name: " << item->get_name() << endl;
cout << "Description: " << item->get_description() << endl;
storage::iterator iter = item->begin ();
while ( iter != item->end () ) {
cout << iter->first << " = " << iter->second << endl;
iter++;
}
cout << "loading item...\n";
item->load ( "test.item" );
cout << "loaded item:\n";
cout << "Name: " << item->get_name() << endl;
cout << "Description: " << item->get_description() << endl;
/*storage::iterator*/ iter = item->begin ();
while ( iter != item->end () ) {
cout << iter->first << " = " << iter->second << endl;
iter++;
}
cout << "iterate over items\n";
inventory_base *inv=dwarf->get_inventory();
for ( vector<item_base *>::iterator iter = inv->begin() ; iter !=
inv->end(); iter++ )
cout << (*iter)->get_name() << endl;
cout << "Saving inventory: \n";
inv->save ( "test.inventory" );
cout << "clearing inventory...\n";
inv->clear ();
cout << "iterate over items\n";
/*inventory_base * */inv=dwarf->get_inventory();
for ( vector<item_base *>::iterator iter = inv->begin() ; iter !=
inv->end(); iter++ )
cout << (*iter)->get_name() << endl;
cout << "Loading inventory...\n";
inv->load("test.inventory");
cout << "iterate over items\n";
/*inventory_base * */inv=dwarf->get_inventory();
for ( vector<item_base *>::iterator iter = inv->begin() ; iter !=
inv->end(); iter++ )
cout << (*iter)->get_name() << endl;
//dwarf.set_inventory(inv);
//item_base *axe= new item_base ("Axe", "Dungar's Axe", "weapon",
EQUIP|USE|PICKUP|DROP|ENCHANT|COMBINE, &dwarf);
//axe->set_val ("strength", 5);
//axe->set_val ("dexterity", -5);
//axe->set_val ("type", WEAPON);
//inv->add_item(axe);
//inv->add_item(book);
// book.equip (&dwarf);
//axe->equip (&dwarf);
//axe->use ();
}
int main (int argc, char *argv[])
{
python::init ();
// Shared modules path
python::insert_path (DATA_DIR"/modules");
char *path = getcwd (NULL, 0);
python::insert_path (path);
free (path);
/* Initialise SWIG module. This should go if we ever switch to dynamic
link */
inititemtestc ();
PyObject *py_module = python::import_module ("itemtest");
if (!py_module) return false;
data::globals = PyModule_GetDict (py_module);
// testing
test ();
python::cleanup ();
return 0;
}
--- NEW FILE ---
# This file was created automatically by SWIG.
import itemtestc
class storage:
__setmethods__ = {}
for _s in []: __setmethods__.update(_s.__setmethods__)
def __setattr__(self,name,value):
if (name == "this"):
if isinstance(value,storage):
self.__dict__[name] = value.this
if hasattr(value,"thisown"): self.__dict__["thisown"] =
value.thisown
del value.thisown
return
method = storage.__setmethods__.get(name,None)
if method: return method(self,value)
self.__dict__[name] = value
__getmethods__ = {}
for _s in []: __getmethods__.update(_s.__getmethods__)
def __getattr__(self,name):
method = storage.__getmethods__.get(name,None)
if method: return method(self)
raise AttributeError,name
def __init__(self,*args):
self.this = apply(itemtestc.new_storage,args)
self.thisown = 1
def __del__(self,itemtestc=itemtestc):
if getattr(self,'thisown',0):
itemtestc.delete_storage(self)
def set_val(*args): return apply(itemtestc.storage_set_val,args)
def get_val(*args): return apply(itemtestc.storage_get_val,args)
def next(*args): return apply(itemtestc.storage_next,args)
def put_state(*args): return apply(itemtestc.storage_put_state,args)
def get_state(*args): return apply(itemtestc.storage_get_state,args)
def clear(*args): return apply(itemtestc.storage_clear,args)
def __repr__(self):
return "<C storage instance at %s>" % (self.this,)
class storagePtr(storage):
def __init__(self,this):
self.this = this
if not hasattr(self,"thisown"): self.thisown = 0
self.__class__ = storage
itemtestc.storage_swigregister(storagePtr)
class objects:
__setmethods__ = {}
for _s in []: __setmethods__.update(_s.__setmethods__)
def __setattr__(self,name,value):
if (name == "this"):
if isinstance(value,objects):
self.__dict__[name] = value.this
if hasattr(value,"thisown"): self.__dict__["thisown"] =
value.thisown
del value.thisown
return
method = objects.__setmethods__.get(name,None)
if method: return method(self,value)
self.__dict__[name] = value
__getmethods__ = {}
for _s in []: __getmethods__.update(_s.__getmethods__)
def __getattr__(self,name):
method = objects.__getmethods__.get(name,None)
if method: return method(self)
raise AttributeError,name
def __init__(self,*args):
self.this = apply(itemtestc.new_objects,args)
self.thisown = 1
def set_val(*args): return apply(itemtestc.objects_set_val,args)
def get_val(*args): return apply(itemtestc.objects_get_val,args)
def erase(*args): return apply(itemtestc.objects_erase,args)
def next(*args): return apply(itemtestc.objects_next,args)
def __del__(self,itemtestc=itemtestc):
if getattr(self,'thisown',0):
itemtestc.delete_objects(self)
def __repr__(self):
return "<C objects instance at %s>" % (self.this,)
class objectsPtr(objects):
def __init__(self,this):
self.this = this
if not hasattr(self,"thisown"): self.thisown = 0
self.__class__ = objects
itemtestc.objects_swigregister(objectsPtr)
class inventory_base:
__setmethods__ = {}
for _s in []: __setmethods__.update(_s.__setmethods__)
def __setattr__(self,name,value):
if (name == "this"):
if isinstance(value,inventory_base):
self.__dict__[name] = value.this
if hasattr(value,"thisown"): self.__dict__["thisown"] =
value.thisown
del value.thisown
return
method = inventory_base.__setmethods__.get(name,None)
if method: return method(self,value)
self.__dict__[name] = value
__getmethods__ = {}
for _s in []: __getmethods__.update(_s.__getmethods__)
def __getattr__(self,name):
method = inventory_base.__getmethods__.get(name,None)
if method: return method(self)
raise AttributeError,name
def __init__(self,*args):
self.this = apply(itemtestc.new_inventory_base,args)
self.thisown = 1
def __del__(self,itemtestc=itemtestc):
if getattr(self,'thisown',0):
itemtestc.delete_inventory_base(self)
def init(*args): return apply(itemtestc.inventory_base_init,args)
def get_name(*args): return apply(itemtestc.inventory_base_get_name,args)
def get_description(*args): return
apply(itemtestc.inventory_base_get_description,args)
def set_name(*args): return apply(itemtestc.inventory_base_set_name,args)
def set_description(*args): return
apply(itemtestc.inventory_base_set_description,args)
def add_item(*args): return apply(itemtestc.inventory_base_add_item,args)
def remove_item(*args): return
apply(itemtestc.inventory_base_remove_item,args)
def get_item(*args): return apply(itemtestc.inventory_base_get_item,args)
def put(*args): return apply(itemtestc.inventory_base_put,args)
def save(*args): return apply(itemtestc.inventory_base_save,args)
def get(*args): return apply(itemtestc.inventory_base_get,args)
def load(*args): return apply(itemtestc.inventory_base_load,args)
def put_state(*args): return apply(itemtestc.inventory_base_put_state,args)
def get_state(*args): return apply(itemtestc.inventory_base_get_state,args)
def clear(*args): return apply(itemtestc.inventory_base_clear,args)
def transfer_item_to_inventory(*args): return
apply(itemtestc.inventory_base_transfer_item_to_inventory,args)
def get_amount(*args): return
apply(itemtestc.inventory_base_get_amount,args)
def set_amount(*args): return
apply(itemtestc.inventory_base_set_amount,args)
def adjust_amount(*args): return
apply(itemtestc.inventory_base_adjust_amount,args)
def __repr__(self):
return "<C inventory_base instance at %s>" % (self.this,)
class inventory_basePtr(inventory_base):
def __init__(self,this):
self.this = this
if not hasattr(self,"thisown"): self.thisown = 0
self.__class__ = inventory_base
itemtestc.inventory_base_swigregister(inventory_basePtr)
class character_base(storage):
__setmethods__ = {}
for _s in [storage]: __setmethods__.update(_s.__setmethods__)
def __setattr__(self,name,value):
if (name == "this"):
if isinstance(value,character_base):
self.__dict__[name] = value.this
if hasattr(value,"thisown"): self.__dict__["thisown"] =
value.thisown
del value.thisown
return
method = character_base.__setmethods__.get(name,None)
if method: return method(self,value)
self.__dict__[name] = value
__getmethods__ = {}
for _s in [storage]: __getmethods__.update(_s.__getmethods__)
def __getattr__(self,name):
method = character_base.__getmethods__.get(name,None)
if method: return method(self)
raise AttributeError,name
def __init__(self,*args):
self.this = apply(itemtestc.new_character_base,args)
self.thisown = 1
def __del__(self,itemtestc=itemtestc):
if getattr(self,'thisown',0):
itemtestc.delete_character_base(self)
def get_name(*args): return apply(itemtestc.character_base_get_name,args)
def get_id(*args): return apply(itemtestc.character_base_get_id,args)
def set_name(*args): return apply(itemtestc.character_base_set_name,args)
def get_color(*args): return apply(itemtestc.character_base_get_color,args)
def set_color(*args): return apply(itemtestc.character_base_set_color,args)
def get_portrait(*args): return
apply(itemtestc.character_base_get_portrait,args)
def set_portrait(*args): return
apply(itemtestc.character_base_set_portrait,args)
def get_dialogue(*args): return
apply(itemtestc.character_base_get_dialogue,args)
def set_dialogue(*args): return
apply(itemtestc.character_base_set_dialogue,args)
def get_state(*args): return apply(itemtestc.character_base_get_state,args)
def put_state(*args): return apply(itemtestc.character_base_put_state,args)
def get_inventory(*args): return
apply(itemtestc.character_base_get_inventory,args)
def set_inventory(*args): return
apply(itemtestc.character_base_set_inventory,args)
def get_equipment(*args): return
apply(itemtestc.character_base_get_equipment,args)
def set_equipment(*args): return
apply(itemtestc.character_base_set_equipment,args)
def __repr__(self):
return "<C character_base instance at %s>" % (self.this,)
class character_basePtr(character_base):
def __init__(self,this):
self.this = this
if not hasattr(self,"thisown"): self.thisown = 0
self.__class__ = character_base
itemtestc.character_base_swigregister(character_basePtr)
class item_base(storage):
__setmethods__ = {}
for _s in [storage]: __setmethods__.update(_s.__setmethods__)
def __setattr__(self,name,value):
if (name == "this"):
if isinstance(value,item_base):
self.__dict__[name] = value.this
if hasattr(value,"thisown"): self.__dict__["thisown"] =
value.thisown
del value.thisown
return
method = item_base.__setmethods__.get(name,None)
if method: return method(self,value)
self.__dict__[name] = value
__getmethods__ = {}
for _s in [storage]: __getmethods__.update(_s.__getmethods__)
def __getattr__(self,name):
method = item_base.__getmethods__.get(name,None)
if method: return method(self)
raise AttributeError,name
def __init__(self,*args):
self.this = apply(itemtestc.new_item_base,args)
self.thisown = 1
def __del__(self,itemtestc=itemtestc):
if getattr(self,'thisown',0):
itemtestc.delete_item_base(self)
def init(*args): return apply(itemtestc.item_base_init,args)
def get_name(*args): return apply(itemtestc.item_base_get_name,args)
def get_description(*args): return
apply(itemtestc.item_base_get_description,args)
def add_type(*args): return apply(itemtestc.item_base_add_type,args)
def del_type(*args): return apply(itemtestc.item_base_del_type,args)
def get_types(*args): return apply(itemtestc.item_base_get_types,args)
def set_default_type(*args): return
apply(itemtestc.item_base_set_default_type,args)
def equip(*args): return apply(itemtestc.item_base_equip,args)
def combine(*args): return apply(itemtestc.item_base_combine,args)
def use(*args): return apply(itemtestc.item_base_use,args)
def drop(*args): return apply(itemtestc.item_base_drop,args)
def pickup(*args): return apply(itemtestc.item_base_pickup,args)
def hand_over(*args): return apply(itemtestc.item_base_hand_over,args)
def enchant(*args): return apply(itemtestc.item_base_enchant,args)
def sell(*args): return apply(itemtestc.item_base_sell,args)
def eat(*args): return apply(itemtestc.item_base_eat,args)
def has_ability(*args): return apply(itemtestc.item_base_has_ability,args)
def set_ability(*args): return apply(itemtestc.item_base_set_ability,args)
def put(*args): return apply(itemtestc.item_base_put,args)
def save(*args): return apply(itemtestc.item_base_save,args)
def get(*args): return apply(itemtestc.item_base_get,args)
def load(*args): return apply(itemtestc.item_base_load,args)
def clear(*args): return apply(itemtestc.item_base_clear,args)
def __repr__(self):
return "<C item_base instance at %s>" % (self.this,)
class item_basePtr(item_base):
def __init__(self,this):
self.this = this
if not hasattr(self,"thisown"): self.thisown = 0
self.__class__ = item_base
itemtestc.item_base_swigregister(item_basePtr)
class equipment:
__setmethods__ = {}
for _s in []: __setmethods__.update(_s.__setmethods__)
def __setattr__(self,name,value):
if (name == "this"):
if isinstance(value,equipment):
self.__dict__[name] = value.this
if hasattr(value,"thisown"): self.__dict__["thisown"] =
value.thisown
del value.thisown
return
method = equipment.__setmethods__.get(name,None)
if method: return method(self,value)
self.__dict__[name] = value
__getmethods__ = {}
for _s in []: __getmethods__.update(_s.__getmethods__)
def __getattr__(self,name):
method = equipment.__getmethods__.get(name,None)
if method: return method(self)
raise AttributeError,name
def __init__(self,*args):
self.this = apply(itemtestc.new_equipment,args)
self.thisown = 1
def set_character(*args): return
apply(itemtestc.equipment_set_character,args)
def get_character(*args): return
apply(itemtestc.equipment_get_character,args)
def equip(*args): return apply(itemtestc.equipment_equip,args)
def unequip(*args): return apply(itemtestc.equipment_unequip,args)
def __del__(self,itemtestc=itemtestc):
if getattr(self,'thisown',0):
itemtestc.delete_equipment(self)
def __repr__(self):
return "<C equipment instance at %s>" % (self.this,)
class equipmentPtr(equipment):
def __init__(self,this):
self.this = this
if not hasattr(self,"thisown"): self.thisown = 0
self.__class__ = equipment
itemtestc.equipment_swigregister(equipmentPtr)
DIALOG_DIR = itemtestc.DIALOG_DIR
DWARF = itemtestc.DWARF
ELF = itemtestc.ELF
HALFELF = itemtestc.HALFELF
HUMAN = itemtestc.HUMAN
FEMALE = itemtestc.FEMALE
MALE = itemtestc.MALE
NPC = itemtestc.NPC
PLAYER = itemtestc.PLAYER
PARTY = itemtestc.PARTY
ACTION_DIR = itemtestc.ACTION_DIR
EQUIP = itemtestc.EQUIP
COMBINE = itemtestc.COMBINE
USE = itemtestc.USE
ENCHANT = itemtestc.ENCHANT
DROP = itemtestc.DROP
PICKUP = itemtestc.PICKUP
CHARGE = itemtestc.CHARGE
EAT = itemtestc.EAT
BOOK = itemtestc.BOOK
WEAPON = itemtestc.WEAPON
POTION = itemtestc.POTION
FOOD = itemtestc.FOOD
KEY = itemtestc.KEY
ARMOR = itemtestc.ARMOR
LEFT_HAND = itemtestc.LEFT_HAND
RIGHT_HAND = itemtestc.RIGHT_HAND
BOTH_HANDS = itemtestc.BOTH_HANDS
HEAD = itemtestc.HEAD
LEGS = itemtestc.LEGS
BODY = itemtestc.BODY
RING = itemtestc.RING
--- NEW FILE ---
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AS = @AS@
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXFLAGS = @CXXFLAGS@
DATADIRNAME = @DATADIRNAME@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
EXEEXT = @EXEEXT@
FT2_CFLAGS = @FT2_CFLAGS@
FT2_CONFIG = @FT2_CONFIG@
FT2_LIBS = @FT2_LIBS@
GENCAT = @GENCAT@
GLIBC21 = @GLIBC21@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_CONFIG = @GTK_CONFIG@
GTK_LIBS = @GTK_LIBS@
INSTOBJEXT = @INSTOBJEXT@
INTLBISON = @INTLBISON@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
LIBICONV = @LIBICONV@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_DEFS = @OGG_DEFS@
OGG_LIBS = @OGG_LIBS@
PACKAGE = @PACKAGE@
POFILES = @POFILES@
POSUB = @POSUB@
PYPACKAGE = @PYPACKAGE@
PY_CFLAGS = @PY_CFLAGS@
PY_LIBS = @PY_LIBS@
P_DOT = @P_DOT@
P_DOXYGEN = @P_DOXYGEN@
P_SWIG = @P_SWIG@
RANLIB = @RANLIB@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_DEFS = @SDL_DEFS@
SDL_LIBS = @SDL_LIBS@
STRIP = @STRIP@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
VORBISENC_LIBS = @VORBISENC_LIBS@
VORBISFILE_LIBS = @VORBISFILE_LIBS@
VORBIS_CFLAGS = @VORBIS_CFLAGS@
VORBIS_LIBS = @VORBIS_LIBS@
gamedatadir = @gamedatadir@
bin_PROGRAMS = itemtest
CPPFLAGS = $(SDL_DEFS) $(SDL_CFLAGS) $(PY_CFLAGS)
EXTRA_DIST = py_itemtest_wrap.cc py_itemtest.i
itemtest_SOURCES = character_base.cc item_base.cc inventory_base.cc storage.cc
python_class.cc py_object.cc itemtest.cc py_itemtest_wrap.cc fileops.cc
character_base.h item_base.h storage.h python_class.h py_object.h
fileops.h inventory_base.h equipment.h equipment.cc
# parser.cpp parser.cpp.h confmap.cpp confmap.h actions.cpp actions.h
lexer.cpp
itemtest_LDADD = ${PY_LIBS}
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../../config.h
CONFIG_CLEAN_FILES =
bin_PROGRAMS = itemtest$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I../../..
LDFLAGS = @LDFLAGS@
itemtest_OBJECTS = character_base.$(OBJEXT) item_base.$(OBJEXT) \
inventory_base.$(OBJEXT) storage.$(OBJEXT) python_class.$(OBJEXT) \
py_object.$(OBJEXT) itemtest.$(OBJEXT) py_itemtest_wrap.$(OBJEXT) \
fileops.$(OBJEXT) equipment.$(OBJEXT)
itemtest_DEPENDENCIES =
itemtest_LDFLAGS =
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)
$(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES)
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS)
-o $@
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS)
$(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS)
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
DEP_FILES = .deps/character_base.P .deps/equipment.P .deps/fileops.P \
.deps/inventory_base.P .deps/item_base.P .deps/itemtest.P \
.deps/py_itemtest_wrap.P .deps/py_object.P .deps/python_class.P \
.deps/storage.P
SOURCES = $(itemtest_SOURCES)
OBJECTS = $(itemtest_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .cc .lo .o .obj .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu src/tools/item/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p
$(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed
's/$$/$(EXEEXT)/'`"; \
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p
$(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed
's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed
'$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
# FIXME: We should only use cygpath when building on Windows,
# and only if it is available.
.c.obj:
$(COMPILE) -c `cygpath -w $<`
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
-rm -f *.$(OBJEXT)
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
itemtest$(EXEEXT): $(itemtest_OBJECTS) $(itemtest_DEPENDENCIES)
@rm -f itemtest$(EXEEXT)
$(CXXLINK) $(itemtest_LDFLAGS) $(itemtest_OBJECTS) $(itemtest_LDADD)
$(LIBS)
.cc.o:
$(CXXCOMPILE) -c $<
.cc.obj:
$(CXXCOMPILE) -c `cygpath -w $<`
.cc.lo:
$(LTCXXCOMPILE) -c $<
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o
$$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = src/tools/item
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here
--srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu
src/tools/item/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
%.o: %.cc
@echo '$(CXXCOMPILE) -c $<'; \
$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.cc
@echo '$(LTCXXCOMPILE) -c $<'; \
$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-binPROGRAMS
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-binPROGRAMS clean-compile clean-libtool clean-tags \
clean-depend clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-binPROGRAMS distclean-compile distclean-libtool \
distclean-tags distclean-depend distclean-generic \
clean-am
-rm -f libtool
distclean: distclean-am
maintainer-clean-am: maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-tags maintainer-clean-depend \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir \
mostlyclean-depend distclean-depend clean-depend \
maintainer-clean-depend info-am info dvi-am dvi check check-am \
installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
py_itemtest_wrap.cc : py_itemtest.i *.h
@if test "${P_SWIG}"; then \
${P_SWIG} -python -shadow -I./ -I../ -c++ -make_default -o $*.cc
py_itemtest.i; \
else \
echo "You need swig >= 1.3.10 in order to re-build this file."; \
exit 1; \
fi;
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
--- NEW FILE ---
%module itemtest
%{
#include <string>
#include "types.h"
#include "storage.h"
#include "inventory_base.h"
#include "character_base.h"
#include "item_base.h"
#include "equipment.h"
%}
%typemap(python,in) string
{
if (PyString_Check ($input))
{
$1 = string (PyString_AsString($input));
}
else
{
PyErr_SetString (PyExc_TypeError, "not a String");
return NULL;
}
}
%typemap(python,in) const string = string;
%typemap(python,in) string &
{
if (PyString_Check ($input))
{
$1 = new string (PyString_AsString($input));
}
else
{
PyErr_SetString (PyExc_TypeError, "not a String");
return NULL;
}
}
%typemap(python,in) const string & = string &;
%typemap(python,out) string
{
$result = PyString_FromString((const char *)$1.c_str());
}
%typemap(python,out) const string = string;
%typemap(python,out) string &
{
$result = PyString_FromString((const char *)$1->c_str());
delete $1;
}
%typemap(python,out) const string & = string &;
%typemap (python, freearg) string &
{
if ($1 != NULL)
{
delete $1;
}
}
%typemap (python, freearg) const string & = string &;
%typemap (python,in) PyObject *pyfunc
{
if (!PyCallable_Check($input))
{
PyErr_SetString (PyExc_TypeError, "Need a callable object!");
return NULL;
}
$1 = $input;
}
%typemap (python,in) PyObject*
{
$1 = $input;
}
%include "types.h"
%include "storage.h"
%include "inventory_base.h"
%include "character_base.h"
%include "item_base.h"
%include "equipment.h"
***** Error reading new file: [Errno 2] No such file or directory:
'py_object.cc'
***** Error reading new file: [Errno 2] No such file or directory: 'py_object.h'
***** Error reading new file: [Errno 2] No such file or directory:
'python_class.cc'
***** Error reading new file: [Errno 2] No such file or directory:
'python_class.h'
***** Error reading new file: [Errno 2] No such file or directory: 'storage.cc'
***** Error reading new file: [Errno 2] No such file or directory: 'storage.h'
***** Error reading new file: [Errno 2] No such file or directory: 'str_hash.h'
***** Error reading new file: [Errno 2] No such file or directory: 'types.h'
--- NEW FILE ---
import itemtest
class weapon:
def use (self, a_weapon):
# if a_weapon.get_val ("type") != itemtest.WEAPON: return
print "To battle!"
def equip (self, a_weapon, a_person):
# if a_weapon.get_val ("type") != itemtest.WEAPON: return
print a_person.get_name (), "equips", a_weapon.get_name ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Adonthell-commits] CVS: adonthell/src/tools/item book.py,NONE,1.1.2.1 character_base.cc,NONE,1.1.2.1 character_base.h,NONE,1.1.2.1 default_inventory.py,NONE,1.1.2.1 equipment.cc,NONE,1.1.2.1 equipment.h,NONE,1.1.2.1 fileops.cc,NONE,1.1.2.1 fileops.h,NONE,1.1.2.1 inventory_base.cc,NONE,1.1.2.1 inventory_base.h,NONE,1.1.2.1 inventory_char.h,NONE,1.1.2.1 item_base.cc,NONE,1.1.2.1 item_base.h,NONE,1.1.2.1 itemtest.cc,NONE,1.1.2.1 itemtest.py,NONE,1.1.2.1 Makefile.in,NONE,1.1.2.1 py_itemtest.i,NONE,1.1.2.1 py_object.cc,NONE,1.1.2.1 py_object.h,NONE,1.1.2.1 python_class.cc,NONE,1.1.2.1 python_class.h,NONE,1.1.2.1 storage.cc,NONE,1.1.2.1 storage.h,NONE,1.1.2.1 str_hash.h,NONE,1.1.2.1 types.h,NONE,1.1.2.1 weapon.py,NONE,1.1.2.1,
Thorsten Riess <address@hidden> <=