1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-19 18:32:35 +01:00

Codechange: Replace atoi and atoll with ParseInteger.

This commit is contained in:
frosch
2025-04-29 16:12:54 +02:00
committed by frosch
parent 3973199879
commit cdafc50c94
17 changed files with 108 additions and 47 deletions

View File

@@ -31,6 +31,7 @@
#include "timer/timer.h"
#include "timer/timer_window.h"
#include "zoom_func.h"
#include "core/string_consumer.hpp"
#include "widgets/newgrf_widget.h"
#include "widgets/misc_widget.h"
@@ -438,9 +439,10 @@ struct NewGRFParametersWindow : public Window {
void OnQueryTextFinished(std::optional<std::string> str) override
{
if (!str.has_value() || str->empty()) return;
int32_t value = atoi(str->c_str());
auto value = ParseInteger<int32_t>(*str);
if (!value.has_value()) return;
GRFParameterInfo &par_info = this->GetParameterInfo(this->clicked_row);
this->grf_config.SetValue(par_info, value);
this->grf_config.SetValue(par_info, *value);
this->SetDirty();
}