Changeset - r16502:5d6ae9da514c
[Not reviewed]
master
0 3 0
rubidium - 14 years ago 2010-11-18 14:17:55
rubidium@openttd.org
(svn r21238) -Feature: [NewGRF] Support callback 0x10 for RVs and ships (Hirundo)
3 files changed with 10 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/newgrf_callbacks.h
Show inline comments
 
@@ -276,13 +276,13 @@ enum CallbackID {
 

	
 
/**
 
 * Callback masks for vehicles, indicates which callbacks are used by a vehicle.
 
 * Some callbacks are always used and don't have a mask.
 
 */
 
enum VehicleCallbackMask {
 
	CBM_VEHICLE_VISUAL_EFFECT  = 0, ///< Visual effects and wagon power (trains only)
 
	CBM_VEHICLE_VISUAL_EFFECT  = 0, ///< Visual effects and wagon power (trains, road vehicles and ships)
 
	CBM_VEHICLE_LENGTH         = 1, ///< Vehicle length (trains and road vehicles)
 
	CBM_VEHICLE_LOAD_AMOUNT    = 2, ///< Load amount
 
	CBM_VEHICLE_REFIT_CAPACITY = 3, ///< Cargo capacity after refit
 
	CBM_VEHICLE_ARTIC_ENGINE   = 4, ///< Add articulated engines (trains and road vehicles)
 
	CBM_VEHICLE_CARGO_SUFFIX   = 5, ///< Show suffix after cargo name
 
	CBM_VEHICLE_COLOUR_REMAP   = 6, ///< Change colour mapping of vehicle
src/roadveh_cmd.cpp
Show inline comments
 
@@ -185,12 +185,15 @@ void RoadVehUpdateCache(RoadVehicle *v)
 
		u->rcache.first_engine = (v == u) ? INVALID_ENGINE : v->engine_type;
 

	
 
		/* Update the length of the vehicle. */
 
		u->rcache.cached_veh_length = GetRoadVehLength(u);
 
		v->rcache.cached_total_length += u->rcache.cached_veh_length;
 

	
 
		/* Update visual effect */
 
		v->UpdateVisualEffect();
 

	
 
		/* Invalidate the vehicle colour map */
 
		u->colourmap = PAL_NONE;
 
	}
 

	
 
	uint max_speed = GetVehicleProperty(v, PROP_ROADVEH_SPEED, 0);
 
	v->vcache.cached_max_speed = (max_speed != 0) ? max_speed * 4 : RoadVehInfo(v->engine_type)->max_speed;
 
@@ -1474,12 +1477,14 @@ static bool RoadVehController(RoadVehicl
 
	v->HandleLoading();
 

	
 
	if (v->current_order.IsType(OT_LOADING)) return true;
 

	
 
	if (v->IsInDepot() && RoadVehLeaveDepot(v, true)) return true;
 

	
 
	v->ShowVisualEffect();
 

	
 
	/* Check how far the vehicle needs to proceed */
 
	int j = RoadVehAccelerate(v);
 

	
 
	int adv_spd = v->GetAdvanceDistance();
 
	bool blocked = false;
 
	while (j >= adv_spd) {
src/ship_cmd.cpp
Show inline comments
 
@@ -153,12 +153,14 @@ static void CheckIfShipNeedsService(Vehi
 
	SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 
}
 

	
 
void Ship::UpdateCache()
 
{
 
	this->vcache.cached_max_speed = GetVehicleProperty(this, PROP_SHIP_SPEED, ShipVehInfo(this->engine_type)->max_speed);
 

	
 
	this->UpdateVisualEffect();
 
}
 

	
 
Money Ship::GetRunningCost() const
 
{
 
	const Engine *e = Engine::Get(this->engine_type);
 
	uint cost_factor = GetVehicleProperty(this, PROP_SHIP_RUNNING_COST_FACTOR, e->u.ship.running_cost);
 
@@ -443,12 +445,14 @@ static void ShipController(Ship *v)
 
	v->HandleLoading();
 

	
 
	if (v->current_order.IsType(OT_LOADING)) return;
 

	
 
	CheckShipLeaveDepot(v);
 

	
 
	v->ShowVisualEffect();
 

	
 
	if (!ShipAccelerate(v)) return;
 

	
 
	GetNewVehiclePosResult gp = GetNewVehiclePos(v);
 
	if (v->state != TRACK_BIT_WORMHOLE) {
 
		/* Not on a bridge */
 
		if (gp.old_tile == gp.new_tile) {
0 comments (0 inline, 0 general)