Merge branch 'master' into jgrpp
# Conflicts: # CMakeLists.txt # src/3rdparty/md5/md5.h # src/3rdparty/squirrel/squirrel/squtils.h # src/animated_tile.cpp # src/console_func.h # src/core/CMakeLists.txt # src/core/container_func.hpp # src/core/smallstack_type.hpp # src/crashlog.cpp # src/crashlog.h # src/debug.h # src/economy.cpp # src/gamelog.cpp # src/industry_gui.cpp # src/lang/catalan.txt # src/misc_gui.cpp # src/network/network_content.h # src/newgrf.cpp # src/newgrf.h # src/newgrf_config.cpp # src/newgrf_config.h # src/newgrf_gui.cpp # src/os/unix/font_unix.cpp # src/os/windows/crashlog_win.cpp # src/rail_cmd.cpp # src/saveload/animated_tile_sl.cpp # src/script/api/script_tilelist.cpp # src/settings.cpp # src/settingsgen/settingsgen.cpp # src/sl/oldloader_sl.cpp # src/station.cpp # src/station_cmd.cpp # src/stdafx.h # src/strgen/strgen.cpp # src/strgen/strgen_base.cpp # src/table/settings/gui_settings.ini # src/train_gui.cpp # src/vehicle.cpp # src/vehicle_base.h # src/vehicle_cmd.cpp # src/vehicle_gui_base.h # src/viewport_sprite_sorter.h
This commit is contained in:
@@ -65,14 +65,10 @@
|
||||
|
||||
Industry *i = ::Industry::Get(industry_id);
|
||||
|
||||
for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
|
||||
if (i->accepts_cargo[j] == cargo_id) {
|
||||
if (IndustryTemporarilyRefusesCargo(i, cargo_id)) return CAS_TEMP_REFUSED;
|
||||
return CAS_ACCEPTED;
|
||||
}
|
||||
}
|
||||
if (!i->IsCargoAccepted(cargo_id)) return CAS_NOT_ACCEPTED;
|
||||
if (IndustryTemporarilyRefusesCargo(i, cargo_id)) return CAS_TEMP_REFUSED;
|
||||
|
||||
return CAS_NOT_ACCEPTED;
|
||||
return CAS_ACCEPTED;
|
||||
}
|
||||
|
||||
/* static */ SQInteger ScriptIndustry::GetStockpiledCargo(IndustryID industry_id, CargoID cargo_id)
|
||||
@@ -80,15 +76,12 @@
|
||||
if (!IsValidIndustry(industry_id)) return -1;
|
||||
if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
|
||||
|
||||
Industry *ind = ::Industry::Get(industry_id);
|
||||
for (uint i = 0; i < lengthof(ind->accepts_cargo); i++) {
|
||||
CargoID cid = ind->accepts_cargo[i];
|
||||
if (cid == cargo_id) {
|
||||
return ind->incoming_cargo_waiting[i];
|
||||
}
|
||||
}
|
||||
Industry *i = ::Industry::Get(industry_id);
|
||||
|
||||
return -1;
|
||||
int j = i->GetCargoAcceptedIndex(cargo_id);
|
||||
if (j < 0) return -1;
|
||||
|
||||
return i->incoming_cargo_waiting[j];
|
||||
}
|
||||
|
||||
/* static */ SQInteger ScriptIndustry::GetLastMonthProduction(IndustryID industry_id, CargoID cargo_id)
|
||||
@@ -98,11 +91,10 @@
|
||||
|
||||
const Industry *i = ::Industry::Get(industry_id);
|
||||
|
||||
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
|
||||
if (i->produced_cargo[j] == cargo_id) return i->last_month_production[j];
|
||||
}
|
||||
int j = i->GetCargoProducedIndex(cargo_id);
|
||||
if (j < 0) return -1;
|
||||
|
||||
return -1;
|
||||
return i->last_month_production[j];
|
||||
}
|
||||
|
||||
/* static */ SQInteger ScriptIndustry::GetLastMonthTransported(IndustryID industry_id, CargoID cargo_id)
|
||||
@@ -112,11 +104,10 @@
|
||||
|
||||
const Industry *i = ::Industry::Get(industry_id);
|
||||
|
||||
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
|
||||
if (i->produced_cargo[j] == cargo_id) return i->last_month_transported[j];
|
||||
}
|
||||
int j = i->GetCargoProducedIndex(cargo_id);
|
||||
if (j < 0) return -1;
|
||||
|
||||
return -1;
|
||||
return i->last_month_transported[j];
|
||||
}
|
||||
|
||||
/* static */ SQInteger ScriptIndustry::GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id)
|
||||
@@ -126,11 +117,10 @@
|
||||
|
||||
const Industry *i = ::Industry::Get(industry_id);
|
||||
|
||||
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
|
||||
if (i->produced_cargo[j] == cargo_id) return ::ToPercent8(i->last_month_pct_transported[j]);
|
||||
}
|
||||
int j = i->GetCargoProducedIndex(cargo_id);
|
||||
if (j < 0) return -1;
|
||||
|
||||
return -1;
|
||||
return ::ToPercent8(i->last_month_pct_transported[j]);
|
||||
}
|
||||
|
||||
/* static */ TileIndex ScriptIndustry::GetLocation(IndustryID industry_id)
|
||||
|
@@ -23,17 +23,13 @@ ScriptIndustryList::ScriptIndustryList()
|
||||
ScriptIndustryList_CargoAccepting::ScriptIndustryList_CargoAccepting(CargoID cargo_id)
|
||||
{
|
||||
for (const Industry *i : Industry::Iterate()) {
|
||||
for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
|
||||
if (i->accepts_cargo[j] == cargo_id) this->AddItem(i->index);
|
||||
}
|
||||
if (i->IsCargoAccepted(cargo_id)) this->AddItem(i->index);
|
||||
}
|
||||
}
|
||||
|
||||
ScriptIndustryList_CargoProducing::ScriptIndustryList_CargoProducing(CargoID cargo_id)
|
||||
{
|
||||
for (const Industry *i : Industry::Iterate()) {
|
||||
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
|
||||
if (i->produced_cargo[j] == cargo_id) this->AddItem(i->index);
|
||||
}
|
||||
if (i->IsCargoProduced(cargo_id)) this->AddItem(i->index);
|
||||
}
|
||||
}
|
||||
|
@@ -83,13 +83,7 @@ ScriptTileList_IndustryAccepting::ScriptTileList_IndustryAccepting(IndustryID in
|
||||
if (i->neutral_station != nullptr && !_settings_game.station.serve_neutral_industries) return;
|
||||
|
||||
/* Check if this industry accepts anything */
|
||||
{
|
||||
bool cargo_accepts = false;
|
||||
for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
|
||||
if (i->accepts_cargo[j] != CT_INVALID) cargo_accepts = true;
|
||||
}
|
||||
if (!cargo_accepts) return;
|
||||
}
|
||||
if (!i->IsCargoAccepted()) return;
|
||||
|
||||
if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED + _settings_game.station.catchment_increase;
|
||||
|
||||
@@ -123,11 +117,7 @@ ScriptTileList_IndustryProducing::ScriptTileList_IndustryProducing(IndustryID in
|
||||
if (i->neutral_station != nullptr && !_settings_game.station.serve_neutral_industries) return;
|
||||
|
||||
/* Check if this industry produces anything */
|
||||
bool cargo_produces = false;
|
||||
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
|
||||
if (i->produced_cargo[j] != CT_INVALID) cargo_produces = true;
|
||||
}
|
||||
if (!cargo_produces) return;
|
||||
if (!i->IsCargoProduced()) return;
|
||||
|
||||
if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED + _settings_game.station.catchment_increase;
|
||||
|
||||
|
Reference in New Issue
Block a user