MCPcopy Create free account
hub / github.com/EasyRPG/Player / UpdateBuySelection

Method UpdateBuySelection

src/scene_shop.cpp:246–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246void Scene_Shop::UpdateBuySelection() {
247 status_window->SetItemId(buy_window->GetItemId());
248 party_window->SetItemId(buy_window->GetItemId());
249
250 if (Input::IsTriggered(Input::CANCEL)) {
251 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Cancel));
252 if (allow_sell) {
253 SetMode(BuySellLeave2);
254 } else {
255 Scene::Pop();
256 }
257 } else if (Input::IsTriggered(Input::DECISION)) {
258 int item_id = buy_window->GetItemId();
259
260 // checks the money and number of items possessed before buy
261 if (buy_window->CheckEnable(item_id)) {
262 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Decision));
263
264 // Items are guaranteed to be valid
265 const lcf::rpg::Item* item = lcf::ReaderUtil::GetElement(lcf::Data::items, item_id);
266
267 int max = Main_Data::game_party->GetMaxItemCount(item_id) - Main_Data::game_party->GetItemCount(item_id);
268 if (item->price > 0) {
269 max = std::min<int>(max, Main_Data::game_party->GetGold() / item->price);
270 }
271 number_window->SetData(item_id, max, item->price);
272
273 SetMode(BuyHowMany);
274 }
275 else {
276 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Buzzer));
277 }
278 }
279}
280
281void Scene_Shop::UpdateSellSelection() {
282 if (Input::IsTriggered(Input::CANCEL)) {

Callers

nothing calls this directly

Calls 8

SePlayMethod · 0.80
GetMaxItemCountMethod · 0.80
GetGoldMethod · 0.80
SetItemIdMethod · 0.45
GetItemIdMethod · 0.45
CheckEnableMethod · 0.45
GetItemCountMethod · 0.45
SetDataMethod · 0.45

Tested by

no test coverage detected