mirror of https://github.com/OpenTTD/OpenTTD
(svn r14269) [0.6] -Backport from trunk:
- Fix: Merge keycode for "normal" 0-9 keys and keypad 0-9 keys so people do not get confused that the keypad does not work as expected [FS#2277] (r14260) - Fix: Clicking on the smallmap didn't break the "follow vehicle in main viewport" [FS#2269] (r14243) - Fix: The engine-purchase-list-sorter doubled running-cost and halfed capacity of double-headed engines [FS#2267] (r14239) - Fix: Feeder share was computed wrong when splitting cargo packet (r14234) - Fix: Signs (town name, station name, ...) could be too long for 8bit width in pixels (r14221) - Fix: 10 days != 6*2.5 days, effectively causing the payment graph to show the wrong data (r14219) - Fix: When determining length of a string with limited size, first check if we are not out of bounds already (r14204)release/0.6
parent
52154a3f64
commit
d86dc41a0a
|
@ -230,8 +230,8 @@ static int CDECL TrainEngineRunningCostSorter(const void *a, const void *b)
|
|||
const RailVehicleInfo *rvi_a = RailVehInfo(*(const EngineID*)a);
|
||||
const RailVehicleInfo *rvi_b = RailVehInfo(*(const EngineID*)b);
|
||||
|
||||
Money va = rvi_a->running_cost * GetPriceByIndex(rvi_a->running_cost_class) * (rvi_a->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
|
||||
Money vb = rvi_b->running_cost * GetPriceByIndex(rvi_b->running_cost_class) * (rvi_b->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
|
||||
Money va = rvi_a->running_cost * GetPriceByIndex(rvi_a->running_cost_class);
|
||||
Money vb = rvi_b->running_cost * GetPriceByIndex(rvi_b->running_cost_class);
|
||||
int r = ClampToI32(va - vb);
|
||||
|
||||
return _internal_sort_order ? -r : r;
|
||||
|
@ -266,8 +266,11 @@ static int CDECL TrainEngineNumberSorter(const void *a, const void *b)
|
|||
|
||||
static int CDECL TrainEngineCapacitySorter(const void *a, const void *b)
|
||||
{
|
||||
int va = RailVehInfo(*(const EngineID*)a)->capacity;
|
||||
int vb = RailVehInfo(*(const EngineID*)b)->capacity;
|
||||
const RailVehicleInfo *rvi_a = RailVehInfo(*(const EngineID*)a);
|
||||
const RailVehicleInfo *rvi_b = RailVehInfo(*(const EngineID*)b);
|
||||
|
||||
int va = rvi_a->capacity * (rvi_a->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
|
||||
int vb = rvi_b->capacity * (rvi_b->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
|
||||
int r = va - vb;
|
||||
|
||||
if (r == 0) {
|
||||
|
|
|
@ -217,19 +217,21 @@ bool CargoList::MoveTo(CargoList *dest, uint count, CargoList::MoveToAction mta,
|
|||
/* Can move only part of the packet, so split it into two pieces */
|
||||
if (mta != MTA_FINAL_DELIVERY) {
|
||||
CargoPacket *cp_new = new CargoPacket();
|
||||
|
||||
Money fs = cp->feeder_share * count / cp->count;
|
||||
cp->feeder_share -= fs;
|
||||
|
||||
cp_new->source = cp->source;
|
||||
cp_new->source_xy = cp->source_xy;
|
||||
cp_new->loaded_at_xy = (mta == MTA_CARGO_LOAD) ? data : cp->loaded_at_xy;
|
||||
|
||||
cp_new->days_in_transit = cp->days_in_transit;
|
||||
cp_new->feeder_share = cp->feeder_share / count;
|
||||
cp_new->feeder_share = fs;
|
||||
/* When cargo is moved into another vehicle you have *always* paid for it */
|
||||
cp_new->paid_for = (mta == MTA_CARGO_LOAD) ? false : cp->paid_for;
|
||||
|
||||
cp_new->count = count;
|
||||
dest->packets.push_back(cp_new);
|
||||
|
||||
cp->feeder_share /= cp->count - count;
|
||||
}
|
||||
cp->count -= count;
|
||||
|
||||
|
|
|
@ -72,16 +72,6 @@ enum WindowKeyCodes {
|
|||
* a-z are mapped to 97-122 */
|
||||
|
||||
/* Numerical keyboard */
|
||||
WKC_NUM_0 = 128,
|
||||
WKC_NUM_1 = 129,
|
||||
WKC_NUM_2 = 130,
|
||||
WKC_NUM_3 = 131,
|
||||
WKC_NUM_4 = 132,
|
||||
WKC_NUM_5 = 133,
|
||||
WKC_NUM_6 = 134,
|
||||
WKC_NUM_7 = 135,
|
||||
WKC_NUM_8 = 136,
|
||||
WKC_NUM_9 = 137,
|
||||
WKC_NUM_DIV = 138,
|
||||
WKC_NUM_MUL = 139,
|
||||
WKC_NUM_MINUS = 140,
|
||||
|
|
|
@ -765,7 +765,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
|
|||
|
||||
gd.colors[i] = cs->legend_colour;
|
||||
for (uint j = 0; j != 20; j++) {
|
||||
gd.cost[i][j] = GetTransportedGoodsIncome(10, 20, j * 6 + 6, c);
|
||||
gd.cost[i][j] = GetTransportedGoodsIncome(10, 20, j * 4 + 4, c);
|
||||
}
|
||||
|
||||
i++;
|
||||
|
|
|
@ -115,7 +115,7 @@ enum {
|
|||
struct ViewportSign {
|
||||
int32 left;
|
||||
int32 top;
|
||||
byte width_1, width_2;
|
||||
uint16 width_1, width_2;
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
|
@ -877,6 +877,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
|
|||
_left_button_clicked = false;
|
||||
|
||||
pt = RemapCoords(WP(w, smallmap_d).scroll_x, WP(w,smallmap_d).scroll_y, 0);
|
||||
WP(w2, vp_d).follow_vehicle = INVALID_VEHICLE;
|
||||
WP(w2, vp_d).dest_scrollpos_x = pt.x + ((_cursor.pos.x - w->left + 2) << 4) - (w2->viewport->virtual_width >> 1);
|
||||
WP(w2, vp_d).dest_scrollpos_y = pt.y + ((_cursor.pos.y - w->top - 16) << 4) - (w2->viewport->virtual_height >> 1);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ static inline bool StrEmpty(const char *s) { return s == NULL || s[0] == '\0'; }
|
|||
static inline int ttd_strnlen(const char *str, int maxlen)
|
||||
{
|
||||
const char *t;
|
||||
for (t = str; *t != '\0' && t - str < maxlen; t++) {}
|
||||
for (t = str; t - str < maxlen && *t != '\0'; t++) {}
|
||||
return t - str;
|
||||
}
|
||||
|
||||
|
|
|
@ -242,16 +242,16 @@ static const VkMapping _vk_mapping[] = {
|
|||
AS(QZ_F12, WKC_F12),
|
||||
|
||||
/* Numeric part */
|
||||
AS(QZ_KP0, WKC_NUM_0),
|
||||
AS(QZ_KP1, WKC_NUM_1),
|
||||
AS(QZ_KP2, WKC_NUM_2),
|
||||
AS(QZ_KP3, WKC_NUM_3),
|
||||
AS(QZ_KP4, WKC_NUM_4),
|
||||
AS(QZ_KP5, WKC_NUM_5),
|
||||
AS(QZ_KP6, WKC_NUM_6),
|
||||
AS(QZ_KP7, WKC_NUM_7),
|
||||
AS(QZ_KP8, WKC_NUM_8),
|
||||
AS(QZ_KP9, WKC_NUM_9),
|
||||
AS(QZ_KP0, '0'),
|
||||
AS(QZ_KP1, '1'),
|
||||
AS(QZ_KP2, '2'),
|
||||
AS(QZ_KP3, '3'),
|
||||
AS(QZ_KP4, '4'),
|
||||
AS(QZ_KP5, '5'),
|
||||
AS(QZ_KP6, '6'),
|
||||
AS(QZ_KP7, '7'),
|
||||
AS(QZ_KP8, '8'),
|
||||
AS(QZ_KP9, '9'),
|
||||
AS(QZ_KP_DIVIDE, WKC_NUM_DIV),
|
||||
AS(QZ_KP_MULTIPLY, WKC_NUM_MUL),
|
||||
AS(QZ_KP_MINUS, WKC_NUM_MINUS),
|
||||
|
|
|
@ -268,7 +268,7 @@ static const VkMapping _vk_mapping[] = {
|
|||
AM(SDLK_F1, SDLK_F12, WKC_F1, WKC_F12),
|
||||
|
||||
/* Numeric part. */
|
||||
AM(SDLK_KP0, SDLK_KP9, WKC_NUM_0, WKC_NUM_9),
|
||||
AM(SDLK_KP0, SDLK_KP9, '0', '9'),
|
||||
AS(SDLK_KP_DIVIDE, WKC_NUM_DIV),
|
||||
AS(SDLK_KP_MULTIPLY, WKC_NUM_MUL),
|
||||
AS(SDLK_KP_MINUS, WKC_NUM_MINUS),
|
||||
|
|
|
@ -101,7 +101,7 @@ static const VkMapping _vk_mapping[] = {
|
|||
AM(VK_F1, VK_F12, WKC_F1, WKC_F12),
|
||||
|
||||
/* Numeric part */
|
||||
AM(VK_NUMPAD0, VK_NUMPAD9, WKC_NUM_0, WKC_NUM_9),
|
||||
AM(VK_NUMPAD0, VK_NUMPAD9, '0', '9'),
|
||||
AS(VK_DIVIDE, WKC_NUM_DIV),
|
||||
AS(VK_MULTIPLY, WKC_NUM_MUL),
|
||||
AS(VK_SUBTRACT, WKC_NUM_MINUS),
|
||||
|
|
|
@ -1348,7 +1348,7 @@ static void ViewportAddWaypoints(DrawPixelInfo *dpi)
|
|||
|
||||
void UpdateViewportSignPos(ViewportSign *sign, int left, int top, StringID str)
|
||||
{
|
||||
char buffer[128];
|
||||
char buffer[256];
|
||||
uint w;
|
||||
|
||||
sign->top = top;
|
||||
|
|
Loading…
Reference in New Issue