(svn r18404) -Codechange: link drive through stops better together

-Feature: make penalty for road stop occupancy user configurable
-Fix [FS#1944]: road vehicles would not pick an empty drive through stop. Now they will *if* the penalty for driving around is less than the occupancy penalty
-Fix [FS#1495]: long (articulated) road vehicles could block loading of others when the following road vehicle already got 'permission' to go to the next bay even when it could not reach it
-Change: improve the throughput of the drive through road stops by letting them stop closer together
This commit is contained in:
rubidium
2009-12-04 20:52:19 +00:00
parent 53416773ee
commit 0fed86a779
16 changed files with 459 additions and 50 deletions

View File

@@ -1360,7 +1360,7 @@ bool AfterLoadGame()
RoadVehicle *rv;
FOR_ALL_ROADVEHICLES(rv) {
if (rv->state == 250 || rv->state == 251) {
SetBit(rv->state, RVS_IS_STOPPING);
SetBit(rv->state, 2);
}
}
}
@@ -1959,6 +1959,8 @@ bool AfterLoadGame()
}
}
/* Road stops is 'only' updating some caches */
AfterLoadRoadStops();
AfterLoadLabelMaps();
GamelogPrintDebug(1);

View File

@@ -190,7 +190,7 @@ void FixOldVehicles()
if (v->type == VEH_ROAD) {
RoadVehicle *rv = RoadVehicle::From(v);
if (rv->state != RVSB_IN_DEPOT && rv->state != RVSB_WORMHOLE) {
ClrBit(rv->state, RVS_IS_STOPPING);
ClrBit(rv->state, 2);
}
}

View File

@@ -47,7 +47,7 @@
#include "saveload_internal.h"
extern const uint16 SAVEGAME_VERSION = 129;
extern const uint16 SAVEGAME_VERSION = 130;
SavegameType _savegame_type; ///< type of savegame we are loading

View File

@@ -29,6 +29,7 @@ const SaveLoad *GetBaseStationDescription();
void AfterLoadVehicles(bool part_of_load);
void AfterLoadStations();
void AfterLoadRoadStops();
void AfterLoadLabelMaps();
void UpdateHousesAndTowns();

View File

@@ -15,6 +15,7 @@
#include "../roadstop_base.h"
#include "../vehicle_base.h"
#include "../newgrf_station.h"
#include "../station_map.h"
#include "saveload.h"
#include "table/strings.h"
@@ -108,6 +109,25 @@ void AfterLoadStations()
}
}
/**
* (Re)building of road stop caches after loading a savegame.
*/
void AfterLoadRoadStops()
{
/* First construct the drive through entries */
RoadStop *rs;
FOR_ALL_ROADSTOPS(rs) {
if (IsDriveThroughStopTile(rs->xy)) rs->MakeDriveThrough();
}
/* And then rebuild the data in those entries */
FOR_ALL_ROADSTOPS(rs) {
if (!HasBit(rs->status, RoadStop::RSSFB_BASE_ENTRY)) continue;
rs->GetEntry(DIAGDIR_NE)->Rebuild(rs);
rs->GetEntry(DIAGDIR_NW)->Rebuild(rs);
}
}
static const SaveLoad _roadstop_desc[] = {
SLE_VAR(RoadStop, xy, SLE_UINT32),
SLE_CONDNULL(1, 0, 44),