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

Method UpdateNumberInput

src/scene_shop.cpp:305–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305void Scene_Shop::UpdateNumberInput() {
306 if (Input::IsTriggered(Input::CANCEL)) {
307 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Cancel));
308 switch (shop_window->GetChoice()) {
309 case Buy:
310 SetMode(Buy); break;
311 case Sell:
312 SetMode(Sell); break;
313 }
314 } else if (Input::IsTriggered(Input::DECISION)) {
315 int item_id;
316 switch (shop_window->GetChoice()) {
317 case Buy:
318 item_id = buy_window->GetItemId();
319 Main_Data::game_party->LoseGold(number_window->GetTotal());
320 Main_Data::game_party->AddItem(item_id, number_window->GetNumber());
321 gold_window->Refresh();
322 buy_window->Refresh();
323 status_window->Refresh();
324 SetMode(Bought); break;
325 case Sell:
326 item_id = sell_window->GetItem() == NULL ? 0 : sell_window->GetItem()->ID;
327 Main_Data::game_party->GainGold(number_window->GetTotal());
328 Main_Data::game_party->RemoveItem(item_id, number_window->GetNumber());
329 gold_window->Refresh();
330 sell_window->Refresh();
331 status_window->Refresh();
332 SetMode(Sold); break;
333 }
334 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Decision));
335
336 did_transaction = true;
337 }
338}
339
340void Scene_Shop::Suspend(SceneType /* next_scene */) {
341 if (on_finish) {

Callers

nothing calls this directly

Calls 11

SePlayMethod · 0.80
GetChoiceMethod · 0.80
LoseGoldMethod · 0.80
GetTotalMethod · 0.80
AddItemMethod · 0.80
GainGoldMethod · 0.80
RemoveItemMethod · 0.80
GetItemIdMethod · 0.45
GetNumberMethod · 0.45
RefreshMethod · 0.45
GetItemMethod · 0.45

Tested by

no test coverage detected