use specific stringstream types

This commit is contained in:
2024-07-27 16:04:09 -05:00
committed by Celtic Minstrel
parent 6d2e8a807b
commit b7692c2fa6
4 changed files with 5 additions and 6 deletions

View File

@@ -502,7 +502,7 @@ static void handle_look(location destination, bool& need_redraw, bool& need_repr
void handle_move(location destination, bool& did_something, bool& need_redraw, bool& need_reprint) {
if(recording) {
// record the action
std::stringstream out;
std::ostringstream out;
out << destination;
record_action("move", out.str());
}

View File

@@ -269,7 +269,7 @@ void replay_next_action() {
finish_load_party();
}else if(t == "move"){
location l;
std::stringstream sstr(next_action->GetText());
std::istringstream sstr(next_action->GetText());
sstr >> l;
handle_move(l, did_something, need_redraw, need_reprint);
}

View File

@@ -30,7 +30,6 @@
using std::vector;
#include <sstream>
using std::stringstream;
extern bool party_in_memory;
extern long register_flag;
@@ -43,7 +42,7 @@ enum_map(eStartButton, rectangle) startup_button;
void handle_startup_button_click(eStartButton btn) {
if(recording){
stringstream sstr;
std::ostringstream sstr;
sstr << btn;
record_action("startup_button_click", sstr.str());
}

View File

@@ -6,13 +6,13 @@
TEST_CASE("Parsing and stringifying locations") {
SECTION("Stringifying") {
location l(27, 923);
std::stringstream out;
std::ostringstream out;
out << l;
CHECK(out.str() == "(27,923)");
}
SECTION("Parsing") {
location l;
std::stringstream in("(27,923)");
std::istringstream in("(27,923)");
in >> l;
CHECK(l.x == 27);
CHECK(l.y == 923);