record and replay buying and info of shop items

This commit is contained in:
2024-08-31 15:00:34 -05:00
committed by Celtic Minstrel
parent a483aff1ac
commit 846789df73
4 changed files with 29 additions and 8 deletions

View File

@@ -246,17 +246,19 @@ void handle_shop_event(location p, cFramerateLimiter& fps_limiter) {
if(p.in(active_rect)) {
click_shop_rect(active_rect);
handle_sale(active_shop.getItem(what_picked), what_picked);
set_up_shop_array();
draw_shop_graphics(false, {});
handle_sale(what_picked);
} else if(p.in(item_help_rect)){
click_shop_rect(item_help_rect);
handle_info_request(active_shop.getItem(what_picked));
handle_info_request(what_picked);
}
}
}
void handle_sale(cShopItem item, int i) {
void handle_sale(int i) {
if(recording){
record_action("handle_sale", boost::lexical_cast<std::string>(i));
}
cShopItem item = active_shop.getItem(i);
cItem base_item = item.item;
short cost = item.getCost(active_shop.getCostAdjust());
rectangle dummy_rect = {0,0,0,0};
@@ -418,10 +420,18 @@ void handle_sale(cShopItem item, int i) {
print_buf();
put_pc_screen();
put_item_screen(stat_window);
// This looks to be redundant, but I'm just preserving the previous behavior of the code.
set_up_shop_array();
draw_shop_graphics(false, {});
}
void handle_info_request(cShopItem item) {
void handle_info_request(int what_picked) {
if(recording){
record_action("handle_info_request", boost::lexical_cast<std::string>(what_picked));
}
cShopItem item = active_shop.getItem(what_picked);
cItem base_item = item.item;
switch(item.type) {