Codefix: Add missing const inside script functions. (#12794)
Scripts do not modify items directly, marking them const enforces this.
This commit is contained in:
@@ -28,7 +28,7 @@ ScriptCargoList_IndustryAccepting::ScriptCargoList_IndustryAccepting(IndustryID
|
||||
{
|
||||
if (!ScriptIndustry::IsValidIndustry(industry_id)) return;
|
||||
|
||||
Industry *ind = ::Industry::Get(industry_id);
|
||||
const Industry *ind = ::Industry::Get(industry_id);
|
||||
for (const auto &a : ind->accepted) {
|
||||
if (::IsValidCargoID(a.cargo)) {
|
||||
this->AddItem(a.cargo);
|
||||
@@ -40,7 +40,7 @@ ScriptCargoList_IndustryProducing::ScriptCargoList_IndustryProducing(IndustryID
|
||||
{
|
||||
if (!ScriptIndustry::IsValidIndustry(industry_id)) return;
|
||||
|
||||
Industry *ind = ::Industry::Get(industry_id);
|
||||
const Industry *ind = ::Industry::Get(industry_id);
|
||||
for (const auto &p : ind->produced) {
|
||||
if (::IsValidCargoID(p.cargo)) {
|
||||
this->AddItem(p.cargo);
|
||||
@@ -52,7 +52,7 @@ ScriptCargoList_StationAccepting::ScriptCargoList_StationAccepting(StationID sta
|
||||
{
|
||||
if (!ScriptStation::IsValidStation(station_id)) return;
|
||||
|
||||
Station *st = ::Station::Get(station_id);
|
||||
const Station *st = ::Station::Get(station_id);
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
if (HasBit(st->goods[i].status, GoodsEntry::GES_ACCEPTANCE)) this->AddItem(i);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user