mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Fix: do not use lengthof() for non C-style arrays
This commit is contained in:
parent
eaafc57de6
commit
c544a2be0a
@ -2251,7 +2251,7 @@ struct NetworkCompanyPasswordWindow : public Window {
|
|||||||
QueryString password_editbox; ///< Password editbox.
|
QueryString password_editbox; ///< Password editbox.
|
||||||
Dimension warning_size; ///< How much space to use for the warning text
|
Dimension warning_size; ///< How much space to use for the warning text
|
||||||
|
|
||||||
NetworkCompanyPasswordWindow(WindowDesc *desc, Window *parent) : Window(desc), password_editbox(lengthof(_settings_client.network.default_company_pass))
|
NetworkCompanyPasswordWindow(WindowDesc *desc, Window *parent) : Window(desc), password_editbox(NETWORK_PASSWORD_LENGTH)
|
||||||
{
|
{
|
||||||
this->InitNested(0);
|
this->InitNested(0);
|
||||||
this->UpdateWarningStringSize();
|
this->UpdateWarningStringSize();
|
||||||
|
@ -9499,7 +9499,7 @@ static void FinaliseIndustriesArray()
|
|||||||
|
|
||||||
for (auto &indtsp : _industry_tile_specs) {
|
for (auto &indtsp : _industry_tile_specs) {
|
||||||
/* Apply default cargo translation map for unset cargo slots */
|
/* Apply default cargo translation map for unset cargo slots */
|
||||||
for (uint i = 0; i < lengthof(indtsp.accepts_cargo); ++i) {
|
for (size_t i = 0; i < indtsp.accepts_cargo.size(); ++i) {
|
||||||
if (!IsValidCargoID(indtsp.accepts_cargo[i])) indtsp.accepts_cargo[i] = GetCargoIDByLabel(GetActiveCargoLabel(indtsp.accepts_cargo_label[i]));
|
if (!IsValidCargoID(indtsp.accepts_cargo[i])) indtsp.accepts_cargo[i] = GetCargoIDByLabel(GetActiveCargoLabel(indtsp.accepts_cargo_label[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1031,7 +1031,7 @@ static void GraphicsSetLoadConfig(IniFile &ini)
|
|||||||
|
|
||||||
if (const IniItem *item = group->GetItem("extra_params"); item != nullptr && item->value) {
|
if (const IniItem *item = group->GetItem("extra_params"); item != nullptr && item->value) {
|
||||||
auto &extra_params = BaseGraphics::ini_data.extra_params;
|
auto &extra_params = BaseGraphics::ini_data.extra_params;
|
||||||
extra_params.resize(lengthof(GRFConfig::param));
|
extra_params.resize(0x80); // TODO: make ParseIntList work nicely with C++ containers
|
||||||
int count = ParseIntList(item->value->c_str(), &extra_params.front(), extra_params.size());
|
int count = ParseIntList(item->value->c_str(), &extra_params.front(), extra_params.size());
|
||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
SetDParamStr(0, BaseGraphics::ini_data.name);
|
SetDParamStr(0, BaseGraphics::ini_data.name);
|
||||||
|
Loading…
Reference in New Issue
Block a user