Changeset - r3001:a88a264dfe85
[Not reviewed]
master
0 1 0
tron - 19 years ago 2006-02-09 06:24:53
tron@openttd.org
(svn r3581) Just noticed the indentation was totally off, fix it
1 file changed with 34 insertions and 35 deletions:
0 comments (0 inline, 0 general)
station_cmd.c
Show inline comments
 
@@ -2565,60 +2565,59 @@ uint MoveGoodsToStation(TileIndex tile, 
 
		st_index = _m[cur_tile].m2;
 

	
 
		for (i = 0; i != 8; i++) {
 
			if (around[i] == INVALID_STATION) {
 
				Station* st = GetStation(st_index);
 

	
 
				if (!IsBuoy(st) &&
 
						(st->town->exclusive_counter == 0 || st->town->exclusivity == st->owner) && // check exclusive transport rights
 
						st->goods[type].rating != 0 &&
 
						(!_patches.selectgoods || st->goods[type].last_speed > 0) && // if last_speed is 0, no vehicle has been there.
 
						((st->facilities & ~FACIL_BUS_STOP)   != 0 || type == CT_PASSENGERS) && // if we have other fac. than a bus stop, or the cargo is passengers
 
						((st->facilities & ~FACIL_TRUCK_STOP) != 0 || type != CT_PASSENGERS)) { // if we have other fac. than a cargo bay or the cargo is not passengers
 
							int x_dist;
 
							int y_dist;
 

	
 
							if (_patches.modified_catchment) {
 
								// min and max coordinates of the producer relative
 
								const int x_min_prod = 9;
 
								const int x_max_prod = 8 + w_prod;
 
								const int y_min_prod = 9;
 
								const int y_max_prod = 8 + h_prod;
 

	
 
								rad = FindCatchmentRadius(st);
 

	
 
								x_dist = min(w_cur - x_min_prod, x_max_prod - w_cur);
 

	
 
								if (w_cur < x_min_prod) {
 
									x_dist = x_min_prod - w_cur;
 
								} else if (w_cur > x_max_prod) {
 
									x_dist = w_cur - x_max_prod;
 
								}
 

	
 
								y_dist = min(h_cur - y_min_prod, y_max_prod - h_cur);
 
								if (h_cur < y_min_prod) {
 
									y_dist = y_min_prod - h_cur;
 
								} else if (h_cur > y_max_prod) {
 
									y_dist = h_cur - y_max_prod;
 
								}
 
							} else {
 
								x_dist = 0;
 
								y_dist = 0;
 
							}
 

	
 
							if (x_dist <= rad && y_dist <= rad) {
 
								around[i] = st_index;
 
								around_ptr[i] = st;
 
							}
 
					int x_dist;
 
					int y_dist;
 

	
 
					if (_patches.modified_catchment) {
 
						// min and max coordinates of the producer relative
 
						const int x_min_prod = 9;
 
						const int x_max_prod = 8 + w_prod;
 
						const int y_min_prod = 9;
 
						const int y_max_prod = 8 + h_prod;
 

	
 
						rad = FindCatchmentRadius(st);
 

	
 
						x_dist = min(w_cur - x_min_prod, x_max_prod - w_cur);
 
						if (w_cur < x_min_prod) {
 
							x_dist = x_min_prod - w_cur;
 
						} else if (w_cur > x_max_prod) {
 
							x_dist = w_cur - x_max_prod;
 
						}
 

	
 
						y_dist = min(h_cur - y_min_prod, y_max_prod - h_cur);
 
						if (h_cur < y_min_prod) {
 
							y_dist = y_min_prod - h_cur;
 
						} else if (h_cur > y_max_prod) {
 
							y_dist = h_cur - y_max_prod;
 
						}
 
					} else {
 
						x_dist = 0;
 
						y_dist = 0;
 
					}
 

	
 
					if (x_dist <= rad && y_dist <= rad) {
 
						around[i] = st_index;
 
						around_ptr[i] = st;
 
					}
 
				}
 
				break;
 
			} else if (around[i] == st_index) {
 
				break;
 
			}
 
		}
 
	END_TILE_LOOP(cur_tile, w, h, tile - TileDiffXY(max_rad, max_rad))
 

	
 
	/* no stations around at all? */
 
	if (around[0] == INVALID_STATION) return 0;
 

	
 
	if (around[1] == INVALID_STATION) {
 
		/* only one station around */
0 comments (0 inline, 0 general)