record and replay using special items

This commit is contained in:
2024-08-31 14:25:22 -05:00
committed by Celtic Minstrel
parent 4c67d7220e
commit 69dc482997
4 changed files with 12 additions and 4 deletions

View File

@@ -1574,8 +1574,7 @@ bool handle_action(const sf::Event& event, cFramerateLimiter& fps_limiter) {
break;
case ITEMBTN_DROP:
if(stat_window == ITEM_WIN_SPECIAL) {
use_spec_item(spec_item_array[item_hit]);
need_redraw = true;
use_spec_item(spec_item_array[item_hit], need_redraw);
} else handle_drop_item(item_hit, need_redraw);
break;
case ITEMBTN_INFO:

View File

@@ -29,6 +29,7 @@
#include "boe.main.hpp"
#include "boe.consts.hpp"
#include "boe.ui.hpp"
#include "boe.specials.hpp"
#include "tools/winutil.hpp"
#include "sounds.hpp"
#include "gfx/render_image.hpp"
@@ -547,6 +548,8 @@ static void replay_next_action() {
std::shared_ptr<cScrollbar> sbar = std::dynamic_pointer_cast<cScrollbar>(event_listeners[name]);
sbar->setPosition(newPos);
}else if(t == "use_spec_item"){
use_spec_item(boost::lexical_cast<short>(next_action.GetText()), need_redraw);
}else{
std::ostringstream sstr;
sstr << "Couldn't replay action: " << next_action;

View File

@@ -31,6 +31,8 @@
#include <array>
#include "spell.hpp"
#include "boe.menus.hpp"
#include "replay.hpp"
#include <boost/lexical_cast.hpp>
extern sf::RenderWindow mainPtr;
extern eGameMode overall_mode;
@@ -567,8 +569,12 @@ void check_fields(location where_check,eSpecCtx mode,cPlayer& which_pc) {
put_pc_screen();
}
void use_spec_item(short item) {
void use_spec_item(short item, bool& need_redraw) {
if(recording){
record_action("use_spec_item", boost::lexical_cast<std::string>(item));
}
run_special(eSpecCtx::USE_SPEC_ITEM, eSpecCtxType::SCEN, univ.scenario.special_items[item].special, univ.party.get_loc());
need_redraw = true;
}

View File

@@ -4,7 +4,7 @@
bool handle_wandering_specials(short mode);
bool check_special_terrain(location where_check,eSpecCtx mode,cPlayer& which_pc,bool *forced);
void check_fields(location where_check,eSpecCtx mode,cPlayer& which_pc);
void use_spec_item(short item);
void use_spec_item(short item, bool& need_redraw);
void use_item(short pc,short item);
bool use_space(location where);
bool adj_town_look(location where);