1 /* 2 * This file is part of EasyRPG Player. 3 * 4 * EasyRPG Player is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * EasyRPG Player is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef EP_SCENE_SHOP_H 19 #define EP_SCENE_SHOP_H 20 21 // Headers 22 #include "scene.h" 23 #include "window_base.h" 24 #include "window_help.h" 25 #include "window_gold.h" 26 #include "window_shopparty.h" 27 #include "window_shopbuy.h" 28 #include "window_shopnumber.h" 29 #include "window_shopstatus.h" 30 #include "window_shopsell.h" 31 #include "window_shop.h" 32 33 /** 34 * Scene Shop class. 35 * Manages buying and selling of items. 36 */ 37 class Scene_Shop : public Scene { 38 39 public: 40 using Continuation = std::function<void(bool)>; 41 /** 42 * Constructor. 43 */ 44 Scene_Shop( 45 std::vector<int> goods, 46 int shop_type, 47 bool allow_buy, 48 bool allow_sell, 49 Continuation on_finish); 50 51 void Start() override; 52 void Suspend(SceneType next_scene) override; 53 54 enum ShopMode { 55 BuySellLeave, 56 BuySellLeave2, 57 Buy, 58 BuyHowMany, 59 Bought, 60 Sell, 61 SellHowMany, 62 Sold, 63 Leave 64 }; 65 66 void SetMode(int nmode); 67 68 void Update() override; 69 void UpdateCommandSelection(); 70 void UpdateBuySelection(); 71 void UpdateSellSelection(); 72 void UpdateNumberInput(); 73 74 private: 75 /** Displays available items. */ 76 std::unique_ptr<Window_Help> help_window; 77 std::unique_ptr<Window_ShopBuy> buy_window; 78 std::unique_ptr<Window_ShopParty> party_window; 79 std::unique_ptr<Window_ShopStatus> status_window; 80 std::unique_ptr<Window_Gold> gold_window; 81 std::unique_ptr<Window_ShopSell> sell_window; 82 std::unique_ptr<Window_ShopNumber> number_window; 83 std::unique_ptr<Window_Base> empty_window; 84 std::unique_ptr<Window_Base> empty_window2; 85 std::unique_ptr<Window_Shop> shop_window; 86 Continuation on_finish; 87 88 std::vector<int> goods; 89 int shop_type = 0; 90 int mode = 0; 91 int timer = 0; 92 bool allow_buy = false; 93 bool allow_sell = false; 94 bool did_transaction = false; 95 }; 96 97 #endif 98