00001 /* 00002 * The Mana World 00003 * Copyright (C) 2007 The Mana World Development Team 00004 * 00005 * This file is part of The Mana World. 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 #ifndef ITEMSHORTCUT_H 00023 #define ITEMSHORTCUT_H 00024 00025 #define SHORTCUT_ITEMS 12 00026 00027 class Item; 00028 00032 class ItemShortcut 00033 { 00034 public: 00038 ItemShortcut(); 00039 00043 ~ItemShortcut(); 00044 00048 void load(); 00049 00055 int getItem(int index) const 00056 { return mItems[index]; } 00057 00061 int getItemCount() const 00062 { return SHORTCUT_ITEMS; } 00063 00067 int getItemSelected() const 00068 { return mItemSelected; } 00069 00075 void setItem(int index) 00076 { mItems[index] = mItemSelected; } 00077 00084 void setItems(int index, int itemId) 00085 { mItems[index] = itemId; } 00086 00092 void setItemSelected(int itemId) 00093 { mItemSelected = itemId; } 00094 00098 bool isItemSelected() 00099 { return mItemSelected > -1; } 00100 00104 void removeItem(int index) 00105 { mItems[index] = -1; } 00106 00112 void useItem(int index); 00113 00114 private: 00118 void save(); 00119 00120 int mItems[SHORTCUT_ITEMS]; 00121 int mItemSelected; 00123 }; 00124 00125 extern ItemShortcut *itemShortcut; 00126 00127 #endif