replace atoi with std::stoi
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
#include "dialog.hpp"
|
#include "dialog.hpp"
|
||||||
#include "gfx/tiling.hpp" // for bg
|
#include "gfx/tiling.hpp" // for bg
|
||||||
#include "fileio/resmgr/res_dialog.hpp"
|
#include "fileio/resmgr/res_dialog.hpp"
|
||||||
@@ -540,7 +541,7 @@ void cDialog::handle_events() {
|
|||||||
Element& next_action = pop_next_action();
|
Element& next_action = pop_next_action();
|
||||||
auto info = info_from_action(next_action);
|
auto info = info_from_action(next_action);
|
||||||
if(info["id"].empty()) continue;
|
if(info["id"].empty()) continue;
|
||||||
eKeyMod mods = static_cast<eKeyMod>(atoi(info["mods"].c_str()));
|
eKeyMod mods = static_cast<eKeyMod>(std::stoi(info["mods"]));
|
||||||
controls[info["id"]]->triggerClickHandler(*this, info["id"], mods);
|
controls[info["id"]]->triggerClickHandler(*this, info["id"], mods);
|
||||||
}else{
|
}else{
|
||||||
while(win.pollEvent(currentEvent)) handle_one_event(currentEvent);
|
while(win.pollEvent(currentEvent)) handle_one_event(currentEvent);
|
||||||
|
@@ -264,7 +264,7 @@ void replay_next_action() {
|
|||||||
std::string t = next_action.Value();
|
std::string t = next_action.Value();
|
||||||
|
|
||||||
if(overall_mode == MODE_STARTUP && t == "startup_button_click"){
|
if(overall_mode == MODE_STARTUP && t == "startup_button_click"){
|
||||||
eStartButton btn = static_cast<eStartButton>(atoi(next_action.GetText().c_str()));
|
eStartButton btn = static_cast<eStartButton>(std::stoi(next_action.GetText()));
|
||||||
handle_startup_button_click(btn);
|
handle_startup_button_click(btn);
|
||||||
}else if(t == "load_party"){
|
}else if(t == "load_party"){
|
||||||
decode_file(next_action.GetText(), tempDir / "temp.exg");
|
decode_file(next_action.GetText(), tempDir / "temp.exg");
|
||||||
@@ -343,7 +343,7 @@ void init_boe(int argc, char* argv[]) {
|
|||||||
Element& srand_element = pop_next_action("srand");
|
Element& srand_element = pop_next_action("srand");
|
||||||
|
|
||||||
std::string ts(srand_element.GetText());
|
std::string ts(srand_element.GetText());
|
||||||
game_rand.seed(atoi(ts.c_str()));
|
game_rand.seed(std::stoi(ts));
|
||||||
} else {
|
} else {
|
||||||
auto t = time(nullptr);
|
auto t = time(nullptr);
|
||||||
if (recording) {
|
if (recording) {
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include "mathutil.hpp"
|
#include "mathutil.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
eDirection& operator++ (eDirection& me, int) {
|
eDirection& operator++ (eDirection& me, int) {
|
||||||
if(me == DIR_HERE) return me = DIR_N;
|
if(me == DIR_HERE) return me = DIR_N;
|
||||||
@@ -242,11 +243,11 @@ std::istream& operator>> (std::istream& in, location& l) {
|
|||||||
in.get(); // (
|
in.get(); // (
|
||||||
std::stringbuf sstr;
|
std::stringbuf sstr;
|
||||||
in.get(sstr, ',');
|
in.get(sstr, ',');
|
||||||
l.x = atoi(sstr.str().c_str());
|
l.x = std::stoi(sstr.str());
|
||||||
in.get(); // ,
|
in.get(); // ,
|
||||||
sstr.str("");
|
sstr.str("");
|
||||||
in.get(sstr, ')');
|
in.get(sstr, ')');
|
||||||
l.y = atoi(sstr.str().c_str());
|
l.y = std::stoi(sstr.str());
|
||||||
in.get(); // )
|
in.get(); // )
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user