openttd updated to 1.5.0-beta2

--HG--
branch : openttd
This commit is contained in:
Pavel Stupnikov
2015-03-01 00:30:53 +03:00
parent 0abb47ce90
commit d201932121
682 changed files with 26103 additions and 16553 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: ship_cmd.cpp 26130 2013-11-26 16:08:58Z rubidium $ */
/* $Id: ship_cmd.cpp 27134 2015-02-01 20:54:24Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -36,6 +36,8 @@
#include "table/strings.h"
#include "safeguards.h"
/**
* Determine the effective #WaterClass for a ship travelling on a tile.
* @param tile Tile of interest
@@ -88,7 +90,9 @@ void DrawShipEngine(int left, int right, int preferred_x, int y, EngineID engine
{
SpriteID sprite = GetShipIcon(engine, image_type);
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
preferred_x = Clamp(preferred_x, left - UnScaleByZoom(real_sprite->x_offs, ZOOM_LVL_GUI), right - UnScaleByZoom(real_sprite->width, ZOOM_LVL_GUI) - UnScaleByZoom(real_sprite->x_offs, ZOOM_LVL_GUI));
preferred_x = Clamp(preferred_x,
left - UnScaleGUI(real_sprite->x_offs),
right - UnScaleGUI(real_sprite->width) - UnScaleGUI(real_sprite->x_offs));
DrawSprite(sprite, pal, preferred_x, y);
}
@@ -105,10 +109,10 @@ void GetShipSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, i
{
const Sprite *spr = GetSprite(GetShipIcon(engine, image_type), ST_NORMAL);
width = UnScaleByZoom(spr->width, ZOOM_LVL_GUI);
height = UnScaleByZoom(spr->height, ZOOM_LVL_GUI);
xoffs = UnScaleByZoom(spr->x_offs, ZOOM_LVL_GUI);
yoffs = UnScaleByZoom(spr->y_offs, ZOOM_LVL_GUI);
width = UnScaleGUI(spr->width);
height = UnScaleGUI(spr->height);
xoffs = UnScaleGUI(spr->x_offs);
yoffs = UnScaleGUI(spr->y_offs);
}
SpriteID Ship::GetImage(Direction direction, EngineImageType image_type) const
@@ -376,7 +380,7 @@ static bool ShipAccelerate(Vehicle *v)
byte t;
spd = min(v->cur_speed + 1, v->vcache.cached_max_speed);
spd = min(spd, v->current_order.max_speed * 2);
spd = min(spd, v->current_order.GetMaxSpeed() * 2);
/* updates statusbar only if speed have changed to save CPU time */
if (spd != v->cur_speed) {
@@ -623,8 +627,8 @@ static void ShipController(Ship *v)
if (!IsTileType(gp.new_tile, MP_TUNNELBRIDGE) || !HasBit(VehicleEnterTile(v, gp.new_tile, gp.x, gp.y), VETS_ENTERED_WORMHOLE)) {
v->x_pos = gp.x;
v->y_pos = gp.y;
VehicleUpdatePosition(v);
if ((v->vehstatus & VS_HIDDEN) == 0) VehicleUpdateViewport(v, true);
v->UpdatePosition();
if ((v->vehstatus & VS_HIDDEN) == 0) v->Vehicle::UpdateViewport(true);
return;
}
}
@@ -636,7 +640,7 @@ static void ShipController(Ship *v)
v->z_pos = GetSlopePixelZ(gp.x, gp.y);
getout:
VehicleUpdatePosition(v);
v->UpdatePosition();
v->UpdateViewport(true, true);
return;
@@ -720,7 +724,7 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, const Engine *e, u
v->InvalidateNewGRFCacheOfChain();
VehicleUpdatePosition(v);
v->UpdatePosition();
}
return CommandCost();