src/engine_gui.cpp
author belugas
Fri, 23 Feb 2007 18:55:07 +0000
changeset 6451 7baba06b4b85
parent 6182 e9b456deec29
child 6519 367d6f96e23f
permissions -rw-r--r--
(svn r8862) -Cleanup: doxygen changes, again. Mostly @files missing tags and a few comments style.
Some documentation addition, when i can easily supply them
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     2
6451
7baba06b4b85 (svn r8862) -Cleanup: doxygen changes, again. Mostly @files missing tags and a few comments style.
belugas
parents: 6182
diff changeset
     3
/** @file engine_gui.cpp */
7baba06b4b85 (svn r8862) -Cleanup: doxygen changes, again. Mostly @files missing tags and a few comments style.
belugas
parents: 6182
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#include "stdafx.h"
1891
92a3b0aa0946 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1095
diff changeset
     6
#include "openttd.h"
507
8aa8100b0b22 (svn r815) Include strings.h only in the files which need it.
tron
parents: 460
diff changeset
     7
#include "table/strings.h"
2218
abd47ef7d902 (svn r2736) -Codechange: De-mystified GfxDrawFillRect a bit, and used enums from table/sprites.h. You can now change the number of bits used for sprites and switches in the SpriteSetup enum and the rest should work automagically. Can be used to increase the number of active sprites to 2^19 in case there are no colortables (recolor sprites) in any newgrf. We should possibly move the the colortables to an own list, but how to detect them in a newgrf.
celestar
parents: 2186
diff changeset
     8
#include "table/sprites.h"
2163
637ec3c361f5 (svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents: 2159
diff changeset
     9
#include "functions.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
#include "window.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
#include "gui.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    12
#include "viewport.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
#include "gfx.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
#include "engine.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    15
#include "command.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
#include "news.h"
2159
3b634157c3b2 (svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents: 2084
diff changeset
    17
#include "variables.h"
2962
dbd168a4703a (svn r3524) - Split newgrf features from engine.[ch] into newgrf_engine.[ch], and add the new files to project files.
peter1138
parents: 2840
diff changeset
    18
#include "newgrf_engine.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
    21
static StringID GetEngineCategoryName(EngineID engine)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    22
{
460
f11659d28617 (svn r677) -newgrf: Fix some custom electric trains appearing in maglev depots (pasky).
darkvater
parents: 193
diff changeset
    23
	if (engine < NUM_TRAIN_ENGINES) {
6074
e70d63ef4d62 (svn r8385) -Fix
tron
parents: 5919
diff changeset
    24
		switch (RailVehInfo(engine)->railtype) {
3355
a653b8e47f27 (svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
celestar
parents: 2962
diff changeset
    25
			case RAILTYPE_RAIL:     return STR_8102_RAILROAD_LOCOMOTIVE;
a653b8e47f27 (svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
celestar
parents: 2962
diff changeset
    26
			case RAILTYPE_ELECTRIC: return STR_8102_RAILROAD_LOCOMOTIVE;
a653b8e47f27 (svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
celestar
parents: 2962
diff changeset
    27
			case RAILTYPE_MONO:     return STR_8106_MONORAIL_LOCOMOTIVE;
a653b8e47f27 (svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
celestar
parents: 2962
diff changeset
    28
			case RAILTYPE_MAGLEV:   return STR_8107_MAGLEV_LOCOMOTIVE;
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5835
diff changeset
    29
			default: NOT_REACHED();
460
f11659d28617 (svn r677) -newgrf: Fix some custom electric trains appearing in maglev depots (pasky).
darkvater
parents: 193
diff changeset
    30
		}
f11659d28617 (svn r677) -newgrf: Fix some custom electric trains appearing in maglev depots (pasky).
darkvater
parents: 193
diff changeset
    31
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    32
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    33
	if (engine < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    34
		return STR_8103_ROAD_VEHICLE;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    35
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    36
	if (engine < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    37
		return STR_8105_SHIP;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    38
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
	return STR_8104_AIRCRAFT;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    40
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    41
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    42
static const Widget _engine_preview_widgets[] = {
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 3477
diff changeset
    43
{   WWT_CLOSEBOX,   RESIZE_NONE,     5,     0,    10,     0,    13, STR_00C5,                                  STR_018B_CLOSE_WINDOW},
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 534
diff changeset
    44
{    WWT_CAPTION,   RESIZE_NONE,     5,    11,   299,     0,    13, STR_8100_MESSAGE_FROM_VEHICLE_MANUFACTURE, STR_018C_WINDOW_TITLE_DRAG_THIS},
4938
074f734a91ca (svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents: 4898
diff changeset
    45
{      WWT_PANEL,   RESIZE_NONE,     5,     0,   299,    14,   191, 0x0,                                       STR_NULL},
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 3477
diff changeset
    46
{ WWT_PUSHTXTBTN,   RESIZE_NONE,     5,    85,   144,   172,   183, STR_00C9_NO,                               STR_NULL},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 3477
diff changeset
    47
{ WWT_PUSHTXTBTN,   RESIZE_NONE,     5,   155,   214,   172,   183, STR_00C8_YES,                              STR_NULL},
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 0
diff changeset
    48
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    49
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    50
5919
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5838
diff changeset
    51
typedef void DrawEngineProc(int x, int y, EngineID engine, SpriteID pal);
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
    52
typedef void DrawEngineInfoProc(EngineID, int x, int y, int maxw);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    53
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    54
typedef struct DrawEngineInfo {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    55
	DrawEngineProc *engine_proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    56
	DrawEngineInfoProc *info_proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    57
} DrawEngineInfo;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
    59
static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw);
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
    60
static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw);
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
    61
static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw);
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
    62
static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw);
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
    63
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    64
static const DrawEngineInfo _draw_engine_list[4] = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    65
	{DrawTrainEngine,DrawTrainEngineInfo},
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
	{DrawRoadVehEngine,DrawRoadVehEngineInfo},
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    67
	{DrawShipEngine,DrawShipEngineInfo},
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    68
	{DrawAircraftEngine,DrawAircraftEngineInfo},
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    69
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    71
static void EnginePreviewWndProc(Window *w, WindowEvent *e)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    72
{
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2549
diff changeset
    73
	switch (e->event) {
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
    74
	case WE_PAINT: {
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
    75
		EngineID engine = w->window_number;
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2549
diff changeset
    76
		const DrawEngineInfo* dei;
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2549
diff changeset
    77
		int width;
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
    78
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    79
		DrawWindowWidgets(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    80
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
    81
		SetDParam(0, GetEngineCategoryName(engine));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    82
		DrawStringMultiCenter(150, 44, STR_8101_WE_HAVE_JUST_DESIGNED_A, 296);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    83
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    84
		DrawStringCentered(w->width >> 1, 80, GetCustomEngineName(engine), 0x10);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    85
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
    86
		(dei = _draw_engine_list,engine < NUM_TRAIN_ENGINES) ||
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
    87
		(dei++,engine < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES) ||
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
    88
		(dei++,engine < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES) ||
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    89
		(dei++, true);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    90
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    91
		width = w->width;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    92
		dei->engine_proc(width >> 1, 100, engine, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    93
		dei->info_proc(engine, width >> 1, 130, width - 52);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    94
		break;
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
    95
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    96
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    97
	case WE_CLICK:
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4344
diff changeset
    98
		switch (e->we.click.widget) {
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2549
diff changeset
    99
			case 4:
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2549
diff changeset
   100
				DoCommandP(0, w->window_number, 0, NULL, CMD_WANT_ENGINE_PREVIEW);
5125
60b21cf18b50 (svn r7206) -Codechange: Remove (some of) the magic needed for windows that could be invalid after
Darkvater
parents: 4938
diff changeset
   101
				/* Fallthrough */
60b21cf18b50 (svn r7206) -Codechange: Remove (some of) the magic needed for windows that could be invalid after
Darkvater
parents: 4938
diff changeset
   102
			case 3:
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2549
diff changeset
   103
				DeleteWindow(w);
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2549
diff changeset
   104
				break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   105
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   106
		break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   107
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   108
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   109
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   110
static const WindowDesc _engine_preview_desc = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   111
	WDP_CENTER, WDP_CENTER, 300, 192,
6144
5a0ffbf27ced (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 6119
diff changeset
   112
	WC_ENGINE_PREVIEW, WC_NONE,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   113
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   114
	_engine_preview_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   115
	EnginePreviewWndProc
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   116
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   117
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   118
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
   119
void ShowEnginePreviewWindow(EngineID engine)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   120
{
5137
a1f26c30fecd (svn r7219) -Fix: Several warnings by gcc introduced in r7206 which MSVC found not of a problem. Thanks Tron
Darkvater
parents: 5125
diff changeset
   121
	AllocateWindowDescFront(&_engine_preview_desc, engine);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   122
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   123
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
   124
static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   125
{
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   126
	const RailVehicleInfo *rvi = RailVehInfo(engine);
6119
b47985557d1e (svn r8455) -Codechange: Give a more meaningful name (railveh_type)to member flags of RailVehInfo, as well as changing the code to reflect the fact that it was not a flag but rather a one value only variable. Doing so, some evaluations have been simplified.
belugas
parents: 6074
diff changeset
   127
	uint multihead = (rvi->railveh_type == RAILVEH_MULTIHEAD) ? 1 : 0;
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   128
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   129
	SetDParam(0, (_price.build_railvehicle >> 3) * rvi->base_cost >> 5);
6182
e9b456deec29 (svn r8569) -Fix (r8464): revert properly
peter1138
parents: 6144
diff changeset
   130
	SetDParam(2, rvi->max_speed * 10 / 16);
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   131
	SetDParam(3, rvi->power << multihead);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   132
	SetDParam(1, rvi->weight << multihead);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   133
2840
d68a605b2087 (svn r3388) - NewGRF: Allow train running cost class to differ from engine class. Also fix typo in r3384.
peter1138
parents: 2725
diff changeset
   134
	SetDParam(4, rvi->running_cost_base * _price.running_rail[rvi->running_cost_class] >> 8 << multihead);
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   135
2549
f1d3b383d557 (svn r3078) Some more stuff, which piled up:
tron
parents: 2519
diff changeset
   136
	if (rvi->capacity != 0) {
4896
72d7a8614580 (svn r6855) - Codechange: When displaying a "quantity of cargo" string, use the {CARGO} command and supply the cargo type and quantity, instead of manually looking up the cargo type's string.
peter1138
parents: 4634
diff changeset
   137
		SetDParam(5, rvi->cargo_type);
2549
f1d3b383d557 (svn r3078) Some more stuff, which piled up:
tron
parents: 2519
diff changeset
   138
		SetDParam(6, rvi->capacity << multihead);
f1d3b383d557 (svn r3078) Some more stuff, which piled up:
tron
parents: 2519
diff changeset
   139
	} else {
4898
68560c75ec28 (svn r6858) - Fix (r6855): Handle rail vehicles with no capacity (N/A) by setting cargo type to CT_INVALID and handling it later. STR_8838_N_A is not a valid cargo type...
peter1138
parents: 4896
diff changeset
   140
		SetDParam(5, CT_INVALID);
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   141
	}
3401
ad8175f44c3b (svn r4211) - Removed measuring units from the names of two strings.
peter1138
parents: 3355
diff changeset
   142
	DrawStringMultiCenter(x, y, STR_VEHICLE_INFO_COST_WEIGHT_SPEED_POWER, maxw);
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   143
}
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   144
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   145
void DrawNewsNewTrainAvail(Window *w)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   146
{
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
   147
	EngineID engine;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   148
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   149
	DrawNewsBorder(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   150
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   151
	engine = WP(w,news_d).ni->string_id;
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   152
	SetDParam(0, GetEngineCategoryName(engine));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   153
	DrawStringMultiCenter(w->width >> 1, 20, STR_8859_NEW_NOW_AVAILABLE, w->width - 2);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   154
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   155
	GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   156
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   157
	SetDParam(0, GetCustomEngineName(engine));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   158
	DrawStringMultiCenter(w->width >> 1, 57, STR_885A, w->width - 2);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   159
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   160
	DrawTrainEngine(w->width >> 1, 88, engine, 0);
5919
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5838
diff changeset
   161
	GfxFillRect(25, 56, w->width - 56, 112, PALETTE_TO_STRUCT_GREY | (1 << USE_COLORTABLE));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   162
	DrawTrainEngineInfo(engine, w->width >> 1, 129, w->width - 52);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   163
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   164
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2218
diff changeset
   165
StringID GetNewsStringNewTrainAvail(const NewsItem *ni)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   166
{
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
   167
	EngineID engine = ni->string_id;
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   168
	SetDParam(0, STR_8859_NEW_NOW_AVAILABLE);
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   169
	SetDParam(1, GetEngineCategoryName(engine));
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   170
	SetDParam(2, GetCustomEngineName(engine));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   171
	return STR_02B6;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   172
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   173
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
   174
static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw)
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   175
{
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   176
	const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   177
	SetDParam(0, (_price.aircraft_base >> 3) * avi->base_cost >> 5);
6182
e9b456deec29 (svn r8569) -Fix (r8464): revert properly
peter1138
parents: 6144
diff changeset
   178
	SetDParam(1, avi->max_speed * 8);
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   179
	SetDParam(2, avi->passenger_capacity);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   180
	SetDParam(3, avi->mail_capacity);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   181
	SetDParam(4, avi->running_cost * _price.aircraft_running >> 8);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   182
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   183
	DrawStringMultiCenter(x, y, STR_A02E_COST_MAX_SPEED_CAPACITY, maxw);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   184
}
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   185
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   186
void DrawNewsNewAircraftAvail(Window *w)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   187
{
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
   188
	EngineID engine;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   189
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   190
	DrawNewsBorder(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   191
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   192
	engine = WP(w,news_d).ni->string_id;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
   193
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   194
	DrawStringMultiCenter(w->width >> 1, 20, STR_A02C_NEW_AIRCRAFT_NOW_AVAILABLE, w->width - 2);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   195
	GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   196
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   197
	SetDParam(0, GetCustomEngineName(engine));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   198
	DrawStringMultiCenter(w->width >> 1, 57, STR_A02D, w->width - 2);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   199
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   200
	DrawAircraftEngine(w->width >> 1, 93, engine, 0);
5919
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5838
diff changeset
   201
	GfxFillRect(25, 56, w->width - 56, 110, PALETTE_TO_STRUCT_GREY | (1 << USE_COLORTABLE));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   202
	DrawAircraftEngineInfo(engine, w->width >> 1, 131, w->width - 52);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   203
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   204
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2218
diff changeset
   205
StringID GetNewsStringNewAircraftAvail(const NewsItem *ni)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   206
{
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
   207
	EngineID engine = ni->string_id;
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   208
	SetDParam(0, STR_A02C_NEW_AIRCRAFT_NOW_AVAILABLE);
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   209
	SetDParam(1, GetCustomEngineName(engine));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   210
	return STR_02B6;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   211
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   212
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
   213
static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw)
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   214
{
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   215
	const RoadVehicleInfo *rvi = RoadVehInfo(engine);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   216
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   217
	SetDParam(0, (_price.roadveh_base >> 3) * rvi->base_cost >> 5);
6182
e9b456deec29 (svn r8569) -Fix (r8464): revert properly
peter1138
parents: 6144
diff changeset
   218
	SetDParam(1, rvi->max_speed * 10 / 32);
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   219
	SetDParam(2, rvi->running_cost * _price.roadveh_running >> 8);
4896
72d7a8614580 (svn r6855) - Codechange: When displaying a "quantity of cargo" string, use the {CARGO} command and supply the cargo type and quantity, instead of manually looking up the cargo type's string.
peter1138
parents: 4634
diff changeset
   220
	SetDParam(3, rvi->cargo_type);
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   221
	SetDParam(4, rvi->capacity);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   222
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   223
	DrawStringMultiCenter(x, y, STR_902A_COST_SPEED_RUNNING_COST, maxw);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   224
}
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   225
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   226
void DrawNewsNewRoadVehAvail(Window *w)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   227
{
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
   228
	EngineID engine;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   229
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   230
	DrawNewsBorder(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   231
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   232
	engine = WP(w,news_d).ni->string_id;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   233
	DrawStringMultiCenter(w->width >> 1, 20, STR_9028_NEW_ROAD_VEHICLE_NOW_AVAILABLE, w->width - 2);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   234
	GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   235
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   236
	SetDParam(0, GetCustomEngineName(engine));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   237
	DrawStringMultiCenter(w->width >> 1, 57, STR_9029, w->width - 2);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   238
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   239
	DrawRoadVehEngine(w->width >> 1, 88, engine, 0);
5919
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5838
diff changeset
   240
	GfxFillRect(25, 56, w->width - 56, 112, PALETTE_TO_STRUCT_GREY | (1 << USE_COLORTABLE));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   241
	DrawRoadVehEngineInfo(engine, w->width >> 1, 129, w->width - 52);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   242
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   243
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2218
diff changeset
   244
StringID GetNewsStringNewRoadVehAvail(const NewsItem *ni)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   245
{
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
   246
	EngineID engine = ni->string_id;
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   247
	SetDParam(0, STR_9028_NEW_ROAD_VEHICLE_NOW_AVAILABLE);
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   248
	SetDParam(1, GetCustomEngineName(engine));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   249
	return STR_02B6;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   250
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   251
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
   252
static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw)
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   253
{
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   254
	const ShipVehicleInfo *svi = ShipVehInfo(engine);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   255
	SetDParam(0, svi->base_cost * (_price.ship_base >> 3) >> 5);
6182
e9b456deec29 (svn r8569) -Fix (r8464): revert properly
peter1138
parents: 6144
diff changeset
   256
	SetDParam(1, svi->max_speed * 10 / 32);
4896
72d7a8614580 (svn r6855) - Codechange: When displaying a "quantity of cargo" string, use the {CARGO} command and supply the cargo type and quantity, instead of manually looking up the cargo type's string.
peter1138
parents: 4634
diff changeset
   257
	SetDParam(2, svi->cargo_type);
1998
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   258
	SetDParam(3, svi->capacity);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   259
	SetDParam(4, svi->running_cost * _price.ship_running >> 8);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   260
	DrawStringMultiCenter(x, y, STR_982E_COST_MAX_SPEED_CAPACITY, maxw);
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   261
}
849933cfa8de (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents: 1926
diff changeset
   262
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   263
void DrawNewsNewShipAvail(Window *w)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   264
{
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
   265
	EngineID engine;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   266
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   267
	DrawNewsBorder(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   268
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   269
	engine = WP(w,news_d).ni->string_id;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
   270
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   271
	DrawStringMultiCenter(w->width >> 1, 20, STR_982C_NEW_SHIP_NOW_AVAILABLE, w->width - 2);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   272
	GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   273
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   274
	SetDParam(0, GetCustomEngineName(engine));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   275
	DrawStringMultiCenter(w->width >> 1, 57, STR_982D, w->width - 2);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   276
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   277
	DrawShipEngine(w->width >> 1, 93, engine, 0);
5919
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5838
diff changeset
   278
	GfxFillRect(25, 56, w->width - 56, 110, PALETTE_TO_STRUCT_GREY | (1 << USE_COLORTABLE));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   279
	DrawShipEngineInfo(engine, w->width >> 1, 131, w->width - 52);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   280
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   281
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2218
diff changeset
   282
StringID GetNewsStringNewShipAvail(const NewsItem *ni)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   283
{
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2436
diff changeset
   284
	EngineID engine = ni->string_id;
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   285
	SetDParam(0, STR_982C_NEW_SHIP_NOW_AVAILABLE);
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   286
	SetDParam(1, GetCustomEngineName(engine));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   287
	return STR_02B6;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   288
}