00001 /* {{{ 00002 * CalcRogue, a roguelike game for PCs, calculators and PDAs 00003 * Copyright (C) 2003 Jim Babcock 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 * }}} */ 00019 // use.c 00022 00023 #include "crogue.h" 00024 00025 //{{{ 00026 void use_item(void) 00027 { 00028 int which; 00029 int itemtype; 00030 00031 if( filter_matches(filter_usable) == 0 ) 00032 { 00033 message(gettext("You don't have anything you can use.")); 00034 return; 00035 } 00036 message(gettext("Use what?")); 00037 which = pick_item(filter_usable); 00038 00039 if(which<0) { 00040 message(gettext("Never mind.")); 00041 return; 00042 } 00043 00044 itemtype = INVENTORY(which).type; 00045 00046 if(get_item_property(&INVENTORY(which), PROPERTY_USE_EFFECT)) 00047 { 00048 if(get_item_property(&INVENTORY(which), PROPERTY_USE_EFFECT) 00049 && call_usefunc( get_item_property(&INVENTORY(which), 00050 PROPERTY_USE_EFFECT)->function, which )) 00051 { 00052 identify_type(itemtype); 00053 } 00054 00055 timepass(1); 00056 return; 00057 } else { 00058 message(gettext("You can't use that.")); 00059 } 00060 } 00061 //}}}
1.3.6