order_gui.c
changeset 2049 538e73c53f54
parent 1981 3c9c682f1212
child 2064 e6a2b42d0b15
equal deleted inserted replaced
2048:54fd558314dc 2049:538e73c53f54
   192 	// check depot first
   192 	// check depot first
   193 	if (_patches.gotodepot) {
   193 	if (_patches.gotodepot) {
   194 		switch (GetTileType(tile)) {
   194 		switch (GetTileType(tile)) {
   195 		case MP_RAILWAY:
   195 		case MP_RAILWAY:
   196 			if (v->type == VEH_Train && IsTileOwner(tile, _local_player)) {
   196 			if (v->type == VEH_Train && IsTileOwner(tile, _local_player)) {
   197 				if ((_map5[tile]&0xFC)==0xC0) {
   197 				if ((_m[tile].m5&0xFC)==0xC0) {
   198 					order.type = OT_GOTO_DEPOT;
   198 					order.type = OT_GOTO_DEPOT;
   199 					order.flags = OF_PART_OF_ORDERS;
   199 					order.flags = OF_PART_OF_ORDERS;
   200 					order.station = GetDepotByTile(tile)->index;
   200 					order.station = GetDepotByTile(tile)->index;
   201 					return order;
   201 					return order;
   202 				}
   202 				}
   203 			}
   203 			}
   204 			break;
   204 			break;
   205 
   205 
   206 		case MP_STREET:
   206 		case MP_STREET:
   207 			if ((_map5[tile] & 0xF0) == 0x20 && v->type == VEH_Road && IsTileOwner(tile, _local_player)) {
   207 			if ((_m[tile].m5 & 0xF0) == 0x20 && v->type == VEH_Road && IsTileOwner(tile, _local_player)) {
   208 				order.type = OT_GOTO_DEPOT;
   208 				order.type = OT_GOTO_DEPOT;
   209 				order.flags = OF_PART_OF_ORDERS;
   209 				order.flags = OF_PART_OF_ORDERS;
   210 				order.station = GetDepotByTile(tile)->index;
   210 				order.station = GetDepotByTile(tile)->index;
   211 				return order;
   211 				return order;
   212 			}
   212 			}
   215 		case MP_STATION:
   215 		case MP_STATION:
   216 			if (v->type != VEH_Aircraft) break;
   216 			if (v->type != VEH_Aircraft) break;
   217 			if (IsAircraftHangarTile(tile) && IsTileOwner(tile, _local_player)) {
   217 			if (IsAircraftHangarTile(tile) && IsTileOwner(tile, _local_player)) {
   218 				order.type = OT_GOTO_DEPOT;
   218 				order.type = OT_GOTO_DEPOT;
   219 				order.flags = OF_PART_OF_ORDERS | OF_NON_STOP;	//XXX - whats the nonstop stuff doing here?
   219 				order.flags = OF_PART_OF_ORDERS | OF_NON_STOP;	//XXX - whats the nonstop stuff doing here?
   220 				order.station = _map2[tile];
   220 				order.station = _m[tile].m2;
   221 				return order;
   221 				return order;
   222 			}
   222 			}
   223 			break;
   223 			break;
   224 
   224 
   225 		case MP_WATER:
   225 		case MP_WATER:
   226 			if (v->type != VEH_Ship) break;
   226 			if (v->type != VEH_Ship) break;
   227 			if (IsTileDepotType(tile, TRANSPORT_WATER) &&
   227 			if (IsTileDepotType(tile, TRANSPORT_WATER) &&
   228 					IsTileOwner(tile, _local_player)) {
   228 					IsTileOwner(tile, _local_player)) {
   229 				switch (_map5[tile]) {
   229 				switch (_m[tile].m5) {
   230 					case 0x81: tile -= TileDiffXY(1, 0); break;
   230 					case 0x81: tile -= TileDiffXY(1, 0); break;
   231 					case 0x83: tile -= TileDiffXY(0, 1); break;
   231 					case 0x83: tile -= TileDiffXY(0, 1); break;
   232 				}
   232 				}
   233 				order.type = OT_GOTO_DEPOT;
   233 				order.type = OT_GOTO_DEPOT;
   234 				order.flags = OF_PART_OF_ORDERS;
   234 				order.flags = OF_PART_OF_ORDERS;
   243 
   243 
   244 	// check waypoint
   244 	// check waypoint
   245 	if (IsTileType(tile, MP_RAILWAY) &&
   245 	if (IsTileType(tile, MP_RAILWAY) &&
   246 			v->type == VEH_Train &&
   246 			v->type == VEH_Train &&
   247 			IsTileOwner(tile, _local_player) &&
   247 			IsTileOwner(tile, _local_player) &&
   248 			(_map5[tile] & 0xFE) == 0xC4) {
   248 			(_m[tile].m5 & 0xFE) == 0xC4) {
   249 		order.type = OT_GOTO_WAYPOINT;
   249 		order.type = OT_GOTO_WAYPOINT;
   250 		order.flags = 0;
   250 		order.flags = 0;
   251 		order.station = GetWaypointByTile(tile)->index;
   251 		order.station = GetWaypointByTile(tile)->index;
   252 		return order;
   252 		return order;
   253 	}
   253 	}
   254 
   254 
   255 	if (IsTileType(tile, MP_STATION)) {
   255 	if (IsTileType(tile, MP_STATION)) {
   256 		st = GetStation(st_index = _map2[tile]);
   256 		st = GetStation(st_index = _m[tile].m2);
   257 
   257 
   258 		if (st->owner == _current_player || st->owner == OWNER_NONE) {
   258 		if (st->owner == _current_player || st->owner == OWNER_NONE) {
   259 			byte facil;
   259 			byte facil;
   260 			(facil=FACIL_DOCK, v->type == VEH_Ship) ||
   260 			(facil=FACIL_DOCK, v->type == VEH_Ship) ||
   261 			(facil=FACIL_TRAIN, v->type == VEH_Train) ||
   261 			(facil=FACIL_TRAIN, v->type == VEH_Train) ||