Changeset - r2504:79c7d7f469fd
[Not reviewed]
master
0 4 0
tron - 19 years ago 2005-10-11 13:54:21
tron@openttd.org
(svn r3030) More work for GB/SB, this time concerning the waiting_acceptance attribute of stations
4 files changed with 16 insertions and 16 deletions:
0 comments (0 inline, 0 general)
aircraft_cmd.c
Show inline comments
 
@@ -1244,7 +1244,7 @@ static void MaybeCrashAirplane(Vehicle *
 
	// Crash the airplane. Remove all goods stored at the station.
 
	for(i=0; i!=NUM_CARGO; i++) {
 
		st->goods[i].rating = 1;
 
		st->goods[i].waiting_acceptance &= ~0xFFF;
 
		SB(st->goods[i].waiting_acceptance, 0, 12, 0);
 
	}
 

	
 
	CrashAirplane(v);
economy.c
Show inline comments
 
@@ -1364,7 +1364,8 @@ int LoadUnloadVehicle(Vehicle *v)
 

	
 

	
 
				unloading_time += v->cargo_count;
 
				if ((t=ge->waiting_acceptance & 0xFFF) == 0) {
 
				t = GB(ge->waiting_acceptance, 0, 12);
 
				if (t == 0) {
 
					// No goods waiting at station
 
					ge->enroute_time = v->cargo_days;
 
					ge->enroute_from = v->cargo_source;
 
@@ -1376,7 +1377,7 @@ int LoadUnloadVehicle(Vehicle *v)
 
						ge->enroute_from = v->cargo_source;
 
				}
 
				// Update amount of waiting cargo
 
				ge->waiting_acceptance = (ge->waiting_acceptance &~0xFFF) | min(v->cargo_count + t, 0xFFF);
 
				SB(ge->waiting_acceptance, 0, 12, min(v->cargo_count + t, 0xFFF));
 
				ge->feeder_profit += v_profit;
 
				u->profit_this_year += v_profit;
 
				result |= 2;
 
@@ -1402,7 +1403,8 @@ int LoadUnloadVehicle(Vehicle *v)
 

	
 
		// If there's goods waiting at the station, and the vehicle
 
		//  has capacity for it, load it on the vehicle.
 
		if ((count=ge->waiting_acceptance & 0xFFF) != 0 &&
 
		count = GB(ge->waiting_acceptance, 0, 12);
 
		if (count != 0 &&
 
				(cap = v->cargo_cap - v->cargo_count) != 0) {
 
			int cargoshare;
 
			int feeder_profit_share;
station_cmd.c
Show inline comments
 
@@ -711,7 +711,7 @@ static void UpdateStationAcceptance(Stat
 
				(i == CT_PASSENGERS && !(st->facilities & (byte)~FACIL_TRUCK_STOP)))
 
			amt = 0;
 

	
 
		st->goods[i].waiting_acceptance = (st->goods[i].waiting_acceptance & ~0xF000) + (amt << 12);
 
		SB(st->goods[i].waiting_acceptance, 12, 4, amt);
 
	}
 

	
 
	// Only show a message in case the acceptance was actually changed.
 
@@ -2590,7 +2590,7 @@ static void UpdateStationRating(Station 
 
			}
 

	
 
			{
 
				waiting = ge->waiting_acceptance & 0xFFF;
 
				waiting = GB(ge->waiting_acceptance, 0, 12);
 
				(rating -= 90, waiting > 1500) ||
 
				(rating += 55, waiting > 1000) ||
 
				(rating += 35, waiting > 600) ||
 
@@ -2622,8 +2622,7 @@ static void UpdateStationRating(Station 
 
					}
 
				}
 

	
 
				if (waiting_changed)
 
					ge->waiting_acceptance = (ge->waiting_acceptance & ~0xFFF) + waiting;
 
				if (waiting_changed) SB(ge->waiting_acceptance, 0, 12, waiting);
 
			}
 
		}
 
	} while (++ge != endof(st->goods));
 
@@ -2701,9 +2700,9 @@ void ModifyStationRatingAround(TileIndex
 

	
 
static void UpdateStationWaiting(Station *st, int type, uint amount)
 
{
 
	st->goods[type].waiting_acceptance =
 
		(st->goods[type].waiting_acceptance & ~0xFFF) +
 
			min(0xFFF, (st->goods[type].waiting_acceptance & 0xFFF) + amount);
 
	SB(st->goods[type].waiting_acceptance, 0, 12,
 
		min(0xFFF, GB(st->goods[type].waiting_acceptance, 0, 12) + amount)
 
	);
 

	
 
	st->goods[type].enroute_time = 0;
 
	st->goods[type].enroute_from = st->index;
station_gui.c
Show inline comments
 
@@ -188,7 +188,7 @@ static void PlayerStationsWndProc(Window
 

	
 
				// show cargo waiting and station ratings
 
				for(j=0; j!=NUM_CARGO; j++) {
 
					int acc = (st->goods[j].waiting_acceptance & 0xFFF);
 
					int acc = GB(st->goods[j].waiting_acceptance, 0, 12);
 
					if (acc != 0) {
 
						StationsWndShowStationRating(x, y, j, acc, st->goods[j].rating);
 
						x += 10;
 
@@ -324,7 +324,7 @@ static void DrawStationViewWindow(Window
 

	
 
	num = 1;
 
	for(i=0; i!=NUM_CARGO; i++) {
 
		if ((st->goods[i].waiting_acceptance & 0xFFF) != 0) {
 
		if (GB(st->goods[i].waiting_acceptance, 0, 12) != 0) {
 
			num++;
 
			if (st->goods[i].enroute_from != station_id)
 
				num++;
 
@@ -351,8 +351,7 @@ static void DrawStationViewWindow(Window
 
	if (--pos < 0) {
 
		str = STR_00D0_NOTHING;
 
		for(i=0; i!=NUM_CARGO; i++)
 
			if (st->goods[i].waiting_acceptance & 0xFFF)
 
				str = STR_EMPTY;
 
			if (GB(st->goods[i].waiting_acceptance, 0, 12) != 0) str = STR_EMPTY;
 
		SetDParam(0, str);
 
		DrawString(x, y, STR_0008_WAITING, 0);
 
		y += 10;
 
@@ -360,7 +359,7 @@ static void DrawStationViewWindow(Window
 

	
 
	i = 0;
 
	do {
 
		uint waiting = (st->goods[i].waiting_acceptance & 0xFFF);
 
		uint waiting = GB(st->goods[i].waiting_acceptance, 0, 12);
 
		if (waiting == 0)
 
			continue;
 

	
0 comments (0 inline, 0 general)