roadveh_cmd.c
changeset 1151 614cbcb5b9fe
parent 1128 d3ffc98b92ad
child 1196 115f46e3807d
equal deleted inserted replaced
1150:9ff458b2e574 1151:614cbcb5b9fe
   513 
   513 
   514 	tile = v->tile;
   514 	tile = v->tile;
   515 
   515 
   516 	// Make sure it's a road/rail crossing
   516 	// Make sure it's a road/rail crossing
   517 	if (!IsTileType(tile, MP_STREET) ||
   517 	if (!IsTileType(tile, MP_STREET) ||
   518 	    (_map5[tile] & 0xF0) != 0x10)
   518 		(_map5[tile] & 0xF0) != 0x10)
   519 				return;
   519 				return;
   520 
   520 
   521 	if (VehicleFromPos(tile, v, (VehicleFromPosProc*)EnumCheckRoadVehCrashTrain) != NULL)
   521 	if (VehicleFromPos(tile, v, (VehicleFromPosProc*)EnumCheckRoadVehCrashTrain) != NULL)
   522 		RoadVehCrash(v);
   522 		RoadVehCrash(v);
   523 }
   523 }
   669 			v->direction != rvf->dir ||
   669 			v->direction != rvf->dir ||
   670 			(_dists[v->direction] < 0 && (x_diff <= _dists[v->direction] || x_diff > 0)) ||
   670 			(_dists[v->direction] < 0 && (x_diff <= _dists[v->direction] || x_diff > 0)) ||
   671 			(_dists[v->direction] > 0 && (x_diff >= _dists[v->direction] || x_diff < 0)) ||
   671 			(_dists[v->direction] > 0 && (x_diff >= _dists[v->direction] || x_diff < 0)) ||
   672 			(_dists[v->direction+8] < 0 && (y_diff <= _dists[v->direction+8] || y_diff > 0)) ||
   672 			(_dists[v->direction+8] < 0 && (y_diff <= _dists[v->direction+8] || y_diff > 0)) ||
   673 			(_dists[v->direction+8] > 0 && (y_diff >= _dists[v->direction+8] || y_diff < 0)))
   673 			(_dists[v->direction+8] > 0 && (y_diff >= _dists[v->direction+8] || y_diff < 0)))
   674    				return NULL;
   674 				return NULL;
   675 
   675 
   676 	return v;
   676 	return v;
   677 }
   677 }
   678 
   678 
   679 static Vehicle *RoadVehFindCloseTo(Vehicle *v, int x, int y, byte dir)
   679 static Vehicle *RoadVehFindCloseTo(Vehicle *v, int x, int y, byte dir)
  1406 			}
  1406 			}
  1407 		}
  1407 		}
  1408 	}
  1408 	}
  1409 
  1409 
  1410 	InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
  1410 	InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
       
  1411 	InvalidateWindowClasses(WC_ROADVEH_LIST);
  1411 }
  1412 }
  1412 
  1413 
  1413 static void AgeRoadVehCargo(Vehicle *v)
  1414 static void AgeRoadVehCargo(Vehicle *v)
  1414 {
  1415 {
  1415 	if (_age_cargo_skip_counter != 0)
  1416 	if (_age_cargo_skip_counter != 0)
  1502 
  1503 
  1503 	SET_EXPENSES_TYPE(EXPENSES_ROADVEH_RUN);
  1504 	SET_EXPENSES_TYPE(EXPENSES_ROADVEH_RUN);
  1504 	SubtractMoneyFromPlayerFract(v->owner, cost);
  1505 	SubtractMoneyFromPlayerFract(v->owner, cost);
  1505 
  1506 
  1506 	InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
  1507 	InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
  1507 	InvalidateWindow(WC_ROADVEH_LIST, v->owner);
  1508 	InvalidateWindowClasses(WC_ROADVEH_LIST);
  1508 }
  1509 }
  1509 
  1510 
  1510 void HandleClickOnRoadVeh(Vehicle *v)
  1511 void HandleClickOnRoadVeh(Vehicle *v)
  1511 {
  1512 {
  1512 	ShowRoadVehViewWindow(v);
  1513 	ShowRoadVehViewWindow(v);