Merge branch 'master' into jgrpp
Replace build and refit, and group collapse implementations Fix template creation build and refit # Conflicts: # Makefile.bundle.in # config.lib # src/animated_tile.cpp # src/blitter/32bpp_anim.hpp # src/blitter/32bpp_base.hpp # src/blitter/8bpp_base.hpp # src/blitter/null.hpp # src/build_vehicle_gui.cpp # src/command.cpp # src/command_func.h # src/console_gui.cpp # src/core/smallstack_type.hpp # src/date.cpp # src/debug.cpp # src/genworld_gui.cpp # src/ground_vehicle.hpp # src/group_gui.cpp # src/lang/korean.txt # src/linkgraph/linkgraph_gui.h # src/main_gui.cpp # src/misc_gui.cpp # src/network/core/game.h # src/network/core/packet.cpp # src/network/core/udp.cpp # src/network/core/udp.h # src/network/network_content.cpp # src/network/network_type.h # src/network/network_udp.cpp # src/newgrf_house.h # src/openttd.cpp # src/order_cmd.cpp # src/order_gui.cpp # src/os/unix/crashlog_unix.cpp # src/os/windows/crashlog_win.cpp # src/osk_gui.cpp # src/pathfinder/opf/opf_ship.cpp # src/rail_cmd.cpp # src/rail_gui.cpp # src/saveload/saveload.cpp # src/settings.cpp # src/settings_gui.cpp # src/smallmap_gui.h # src/station_base.h # src/station_cmd.cpp # src/table/gameopt_settings.ini # src/table/newgrf_debug_data.h # src/table/settings.ini # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/train_gui.cpp # src/vehicle.cpp # src/vehicle_gui.cpp # src/vehiclelist.cpp # src/viewport.cpp # src/widgets/dropdown.cpp # src/window_gui.h
This commit is contained in:
@@ -497,14 +497,15 @@ StringID Engine::GetAircraftTypeText() const
|
||||
*/
|
||||
void EngineOverrideManager::ResetToDefaultMapping()
|
||||
{
|
||||
this->Clear();
|
||||
this->clear();
|
||||
for (VehicleType type = VEH_TRAIN; type <= VEH_AIRCRAFT; type++) {
|
||||
for (uint internal_id = 0; internal_id < _engine_counts[type]; internal_id++) {
|
||||
EngineIDMapping *eid = this->Append();
|
||||
eid->type = type;
|
||||
eid->grfid = INVALID_GRFID;
|
||||
eid->internal_id = internal_id;
|
||||
eid->substitute_id = internal_id;
|
||||
/*C++17: EngineIDMapping &eid = */ this->emplace_back();
|
||||
EngineIDMapping &eid = this->back();
|
||||
eid.type = type;
|
||||
eid.grfid = INVALID_GRFID;
|
||||
eid.internal_id = internal_id;
|
||||
eid.substitute_id = internal_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -520,12 +521,12 @@ void EngineOverrideManager::ResetToDefaultMapping()
|
||||
*/
|
||||
EngineID EngineOverrideManager::GetID(VehicleType type, uint16 grf_local_id, uint32 grfid)
|
||||
{
|
||||
const EngineIDMapping *end = this->End();
|
||||
EngineID index = 0;
|
||||
for (const EngineIDMapping *eid = this->Begin(); eid != end; eid++, index++) {
|
||||
if (eid->type == type && eid->grfid == grfid && eid->internal_id == grf_local_id) {
|
||||
for (const EngineIDMapping &eid : *this) {
|
||||
if (eid.type == type && eid.grfid == grfid && eid.internal_id == grf_local_id) {
|
||||
return index;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return INVALID_ENGINE;
|
||||
}
|
||||
@@ -557,15 +558,15 @@ void SetupEngines()
|
||||
DeleteWindowByClass(WC_ENGINE_PREVIEW);
|
||||
_engine_pool.CleanPool();
|
||||
|
||||
assert(_engine_mngr.Length() >= _engine_mngr.NUM_DEFAULT_ENGINES);
|
||||
const EngineIDMapping *end = _engine_mngr.End();
|
||||
assert(_engine_mngr.size() >= _engine_mngr.NUM_DEFAULT_ENGINES);
|
||||
uint index = 0;
|
||||
for (const EngineIDMapping *eid = _engine_mngr.Begin(); eid != end; eid++, index++) {
|
||||
for (const EngineIDMapping &eid : _engine_mngr) {
|
||||
/* Assert is safe; there won't be more than 256 original vehicles
|
||||
* in any case, and we just cleaned the pool. */
|
||||
assert(Engine::CanAllocateItem());
|
||||
const Engine *e = new Engine(eid->type, eid->internal_id);
|
||||
const Engine *e = new Engine(eid.type, eid.internal_id);
|
||||
assert(e->index == index);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user