1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 08:52:40 +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

@@ -19,6 +19,7 @@
#include "textbuf_gui.h"
#include "vehicle_gui.h"
#include "zoom_func.h"
#include "core/string_consumer.hpp"
#include "engine_base.h"
#include "industry.h"
@@ -1078,9 +1079,11 @@ struct SpriteAlignerWindow : Window {
void OnQueryTextFinished(std::optional<std::string> str) override
{
if (!str.has_value() || str->empty()) return;
if (!str.has_value()) return;
this->current_sprite = atoi(str->c_str());
auto value = ParseInteger(*str);
if (!value.has_value()) return;
this->current_sprite = *value;
if (this->current_sprite >= GetMaxSpriteID()) this->current_sprite = 0;
while (GetSpriteType(this->current_sprite) != SpriteType::Normal) {
this->current_sprite = (this->current_sprite + 1) % GetMaxSpriteID();