mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-17 09:22:42 +01:00
Codechange: Replace atoi and atoll with ParseInteger.
This commit is contained in:
@@ -59,6 +59,7 @@
|
||||
#include "timer/timer_window.h"
|
||||
#include "timer/timer_game_calendar.h"
|
||||
#include "help_gui.h"
|
||||
#include "core/string_consumer.hpp"
|
||||
|
||||
#include "widgets/toolbar_widget.h"
|
||||
|
||||
@@ -2500,7 +2501,9 @@ struct ScenarioEditorToolbarWindow : Window {
|
||||
|
||||
TimerGameCalendar::Year value;
|
||||
if (!str->empty()) {
|
||||
value = TimerGameCalendar::Year{atoi(str->c_str())};
|
||||
auto val = ParseInteger(*str);
|
||||
if (!val.has_value()) return;
|
||||
value = static_cast<TimerGameCalendar::Year>(*val);
|
||||
} else {
|
||||
/* An empty string means revert to the default */
|
||||
value = TimerGameCalendar::Year{CalendarTime::DEF_START_YEAR.base()};
|
||||
|
||||
Reference in New Issue
Block a user