00001 00002 // Copyright (C) 2004-2007 by The Allacrost Project 00003 // All Rights Reserved 00004 // 00005 // This code is licensed under the GNU GPL version 2. It is free software 00006 // and you may modify it and/or redistribute it under the terms of this license. 00007 // See http://www.gnu.org/copyleft/gpl.html for details. 00009 00020 #ifndef __SHOP_HEADER__ 00021 #define __SHOP_HEADER__ 00022 00023 #include "defs.h" 00024 #include "utils.h" 00025 #include "global.h" 00026 #include "mode_manager.h" 00027 #include "shop_windows.h" 00028 00029 namespace hoa_shop { 00030 00032 extern bool SHOP_DEBUG; 00033 00034 namespace private_shop { 00035 00041 extern ShopMode* current_shop; 00042 00044 enum SHOP_STATE { 00045 SHOP_STATE_INVALID = -1, 00046 SHOP_STATE_ACTION = 0, 00047 SHOP_STATE_LIST = 1, 00048 SHOP_STATE_SELL = 2, 00049 SHOP_STATE_CONFIRM = 3, 00050 SHOP_STATE_TOTAL = 4, 00051 }; 00052 00053 } // namespace private_shop 00054 00065 class ShopMode : public hoa_mode_manager::GameMode { 00066 friend class private_shop::ShopActionWindow; 00067 friend class private_shop::ObjectListWindow; 00068 friend class private_shop::ObjectSellListWindow; 00069 friend class private_shop::ObjectInfoWindow; 00070 friend class private_shop::ConfirmWindow; 00071 public: 00072 ShopMode(); 00073 00074 ~ShopMode(); 00075 00080 void Reset(); 00081 00083 void Update(); 00084 00086 void Draw(); 00087 00088 uint32 GetPurchaseCost() {return _purchases_cost;} 00089 uint32 GetSalesRevenue() {return _sales_revenue;} 00090 uint32 GetTotalRemaining(); 00091 00098 void AddObject(uint32 object_id); 00099 00100 private: 00102 private_shop::SHOP_STATE _state; 00103 00105 uint32 _purchases_cost; 00106 00108 uint32 _sales_revenue; 00109 00111 hoa_video::StillImage _saved_screen; 00112 00116 std::map<uint32, uint32> _object_map; 00117 00119 std::map<std::string, hoa_audio::SoundDescriptor> _shop_sounds; 00120 00125 std::vector<hoa_global::GlobalObject*> _all_objects; 00126 00131 std::vector<hoa_global::GlobalObject*> _current_inv; 00132 00135 std::vector<int> _all_objects_quantities; 00136 00139 std::vector<int> _sell_objects_quantities; 00140 00142 00143 00144 private_shop::ShopActionWindow _action_window; 00145 00147 private_shop::ObjectListWindow _list_window; 00148 00150 private_shop::ObjectSellListWindow _sell_window; 00151 00153 private_shop::ObjectInfoWindow _info_window; 00154 00156 private_shop::ConfirmWindow _confirm_window; 00157 00159 }; // class ShopMode : public hoa_mode_manager::GameMode 00160 00161 00162 } // namespace hoa_shop 00163 00164 #endif // __SHOP_HEADER__
1.5.1