Changeset - r6261:07174c97796d
[Not reviewed]
master
0 2 0
truelight - 17 years ago 2007-03-08 20:50:27
truelight@openttd.org
(svn r9070) -Fix [FS#404]: if bribe failed and you didn't pick up cargo yet, you wouldn't ever be able to do so for a given station
2 files changed with 9 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/station.h
Show inline comments
 
@@ -8,19 +8,20 @@
 
#include "oldpool.h"
 
#include "sprite.h"
 
#include "tile.h"
 
#include "newgrf_station.h"
 

	
 
static const StationID INVALID_STATION = 0xFFFF;
 
static const byte INITIAL_STATION_RATING = 175;
 

	
 
struct GoodsEntry {
 
	GoodsEntry() :
 
		waiting_acceptance(0),
 
		unload_pending(0),
 
		days_since_pickup(0),
 
		rating(175),
 
		rating(INITIAL_STATION_RATING),
 
		enroute_from(INVALID_STATION),
 
		enroute_from_xy(INVALID_TILE),
 
		last_speed(0),
 
		last_age(255),
 
		feeder_profit(0)
 
	{}
src/station_cmd.cpp
Show inline comments
 
@@ -2207,12 +2207,18 @@ static void UpdateStationRating(Station 
 

	
 
	byte_inc_sat(&st->time_since_load);
 
	byte_inc_sat(&st->time_since_unload);
 

	
 
	GoodsEntry *ge = st->goods;
 
	do {
 
		/* Slowly increase the rating back to his original level in the case we
 
		 *  didn't deliver cargo yet to this station. This happens when a bribe
 
		 *  failed while you didn't moved that cargo yet to a station. */
 
		if (ge->enroute_from == INVALID_STATION && ge->rating < INITIAL_STATION_RATING)
 
			ge->rating++;
 
		/* Only change the rating if we are moving this cargo */
 
		if (ge->enroute_from != INVALID_STATION) {
 
			byte_inc_sat(&ge->enroute_time);
 
			byte_inc_sat(&ge->days_since_pickup);
 

	
 
			int rating = 0;
 

	
 
@@ -2543,13 +2549,13 @@ void BuildOilRig(TileIndex tile)
 

	
 
	for (uint j = 0; j != NUM_CARGO; j++) {
 
		st->goods[j].waiting_acceptance = 0;
 
		st->goods[j].days_since_pickup = 0;
 
		st->goods[j].enroute_from = INVALID_STATION;
 
		st->goods[j].enroute_from_xy = INVALID_TILE;
 
		st->goods[j].rating = 175;
 
		st->goods[j].rating = INITIAL_STATION_RATING;
 
		st->goods[j].last_speed = 0;
 
		st->goods[j].last_age = 255;
 
	}
 

	
 
	UpdateStationVirtCoordDirty(st);
 
	UpdateStationAcceptance(st, false);
0 comments (0 inline, 0 general)