Files
@ r4381:c965d1f3016a
Branch filter:
Location: cpp/openttd-patchpack/source/subsidy_gui.c - annotation
r4381:c965d1f3016a
3.8 KiB
text/x-c
(svn r6131) -Codechange : Complete all missing _ttdpatch_flags entries
-Feature : both unifiedmaglevmode are now set.
Maglev and monorail are not allowed to run on each other tracks and will not be.
Setting those flags will allow grfsets as the Norvegian one to be loaded
-Codechange : link the TTDPatch's irregularstations with OTTD's nonuniform_stations
-Codechange : Reformat the whole array (thanks Rubidium, it sure looks better now)
-Feature : both unifiedmaglevmode are now set.
Maglev and monorail are not allowed to run on each other tracks and will not be.
Setting those flags will allow grfsets as the Norvegian one to be loaded
-Codechange : link the TTDPatch's irregularstations with OTTD's nonuniform_stations
-Codechange : Reformat the whole array (thanks Rubidium, it sure looks better now)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r0:d63b455452f6 r1891:c5c5466afa35 r507:b1b0a0a3c313 r2163:ae001e2aa5b0 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2159:2c706fe6b0a7 r4261:8c2d0c75e37a r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r4171:bf306290d87e r2639:e298192a7c03 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r2469:0895d2eace8d r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r2469:0895d2eace8d r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r919:57ef81f1ba8e r0:d63b455452f6 r919:57ef81f1ba8e r0:d63b455452f6 r919:57ef81f1ba8e r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r919:57ef81f1ba8e r0:d63b455452f6 r919:57ef81f1ba8e r0:d63b455452f6 r919:57ef81f1ba8e r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4171:bf306290d87e r0:d63b455452f6 r0:d63b455452f6 r4171:bf306290d87e r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4288:b6dbdc0a7329 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r2469:0895d2eace8d r2639:e298192a7c03 r2639:e298192a7c03 r0:d63b455452f6 r2639:e298192a7c03 r193:6aa65dc5a4b4 r534:46e9db8de483 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r2469:0895d2eace8d r4171:bf306290d87e r2639:e298192a7c03 r2630:73464cd368d6 r0:d63b455452f6 r0:d63b455452f6 r1962:cc4c06e3f6b5 r534:46e9db8de483 r534:46e9db8de483 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r534:46e9db8de483 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2857:e3282fd5024c r2639:e298192a7c03 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2857:e3282fd5024c r2857:e3282fd5024c r2857:e3282fd5024c r2857:e3282fd5024c r176:7d9100f64c27 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2857:e3282fd5024c r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 | /* $Id$ */
#include "stdafx.h"
#include "openttd.h"
#include "table/strings.h"
#include "functions.h"
#include "window.h"
#include "station.h"
#include "industry.h"
#include "town.h"
#include "player.h"
#include "gfx.h"
#include "economy.h"
#include "variables.h"
#include "date.h"
static void HandleSubsidyClick(int y)
{
const Subsidy *s;
uint num;
int offs;
TileIndex xy;
if (y < 0) return;
num = 0;
for (s = _subsidies; s != endof(_subsidies); s++) {
if (s->cargo_type != CT_INVALID && s->age < 12) {
y -= 10;
if (y < 0) goto handle_click;
num++;
}
}
if (num == 0) {
y -= 10;
if (y < 0) return;
}
y -= 11;
if (y < 0) return;
for (s = _subsidies; s != endof(_subsidies); s++) {
if (s->cargo_type != CT_INVALID && s->age >= 12) {
y -= 10;
if (y < 0) goto handle_click;
}
}
return;
handle_click:
/* determine from coordinate for subsidy and try to scroll to it */
offs = s->from;
if (s->age >= 12) {
xy = GetStation(offs)->xy;
} else if (s->cargo_type == CT_PASSENGERS || s->cargo_type == CT_MAIL) {
xy = GetTown(offs)->xy;
} else {
xy = GetIndustry(offs)->xy;
}
if (!ScrollMainWindowToTile(xy)) {
/* otherwise determine to coordinate for subsidy and scroll to it */
offs = s->to;
if (s->age >= 12) {
xy = GetStation(offs)->xy;
} else if (s->cargo_type == CT_PASSENGERS || s->cargo_type == CT_MAIL || s->cargo_type == CT_GOODS || s->cargo_type == CT_FOOD) {
xy = GetTown(offs)->xy;
} else {
xy = GetIndustry(offs)->xy;
}
ScrollMainWindowToTile(xy);
}
}
static void DrawSubsidiesWindow(const Window *w)
{
YearMonthDay ymd;
const Subsidy *s;
uint num;
int x;
int y;
DrawWindowWidgets(w);
ConvertDateToYMD(_date, &ymd);
y = 15;
x = 1;
DrawString(x, y, STR_2026_SUBSIDIES_ON_OFFER_FOR, 0);
y += 10;
num = 0;
for (s = _subsidies; s != endof(_subsidies); s++) {
if (s->cargo_type != CT_INVALID && s->age < 12) {
int x2;
SetupSubsidyDecodeParam(s, 1);
x2 = DrawString(x + 2, y, STR_2027_FROM_TO, 0);
SetDParam(0, _date - ymd.day + 384 - s->age * 32);
DrawString(x2, y, STR_2028_BY, 0);
y += 10;
num++;
}
}
if (num == 0) {
DrawString(x + 2, y, STR_202A_NONE, 0);
y += 10;
}
DrawString(x, y + 1, STR_202B_SERVICES_ALREADY_SUBSIDISED, 0);
y += 10;
num = 0;
for (s = _subsidies; s != endof(_subsidies); s++) {
if (s->cargo_type != CT_INVALID && s->age >= 12) {
const Player *p;
int xt;
SetupSubsidyDecodeParam(s, 1);
p = GetPlayer(GetStation(s->to)->owner);
SetDParam(3, p->name_1);
SetDParam(4, p->name_2);
xt = DrawString(x + 2, y, STR_202C_FROM_TO, 0);
SetDParam(0, _date - ymd.day + 768 - s->age * 32);
DrawString(xt, y, STR_202D_UNTIL, 0);
y += 10;
num++;
}
}
if (num == 0) DrawString(x + 2, y, STR_202A_NONE, 0);
}
static void SubsidiesListWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_PAINT: DrawSubsidiesWindow(w); break;
case WE_CLICK:
switch (e->click.widget) {
case 3: HandleSubsidyClick(e->click.pt.y - 25); break;
}
break;
}
}
static const Widget _subsidies_list_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
{ WWT_CAPTION, RESIZE_NONE, 13, 11, 617, 0, 13, STR_2025_SUBSIDIES, STR_018C_WINDOW_TITLE_DRAG_THIS},
{ WWT_STICKYBOX, RESIZE_NONE, 13, 618, 629, 0, 13, STR_NULL, STR_STICKY_BUTTON},
{ WWT_PANEL, RESIZE_NONE, 13, 0, 629, 14, 126, STR_NULL, STR_01FD_CLICK_ON_SERVICE_TO_CENTER},
{ WIDGETS_END},
};
static const WindowDesc _subsidies_list_desc = {
-1, -1, 630, 127,
WC_SUBSIDIES_LIST,0,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_subsidies_list_widgets,
SubsidiesListWndProc
};
void ShowSubsidiesList(void)
{
AllocateWindowDescFront(&_subsidies_list_desc, 0);
}
|