summaryrefslogtreecommitdiff
path: root/subsidy_gui.c
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-01-02 19:19:48 +0000
committerrubidium <rubidium@openttd.org>2007-01-02 19:19:48 +0000
commit66bbf336c6af7353ef0aeed58002c46543b30635 (patch)
treead4a63860df2626b22f77e7dac712e958bea54cb /subsidy_gui.c
parentccc0a3f4dbf58c005b22341ac8874252924690cd (diff)
downloadopenttd-66bbf336c6af7353ef0aeed58002c46543b30635.tar.xz
(svn r7759) -Merge: makefile rewrite. This merge features:
- A proper ./configure, so everything needs to be configured only once, not for every make. - Usage of makedepend when available. This greatly reduces the time needed for generating the dependencies. - A generator for all project files. There is a single file with sources, which is used to generate Makefiles and the project files for MSVC. - Proper support for OSX universal binaries. - Object files for non-MSVC compiles are also placed in separate directories, making is faster to switch between debug and release compiles and it does not touch the directory with the source files. - Functionality to make a bundle of all needed files for for example a nightly or distribution of a binary with all needed GRFs and language files. Note: as this merge moves almost all files, it is recommended to make a backup of your working copy before updating your working copy.
Diffstat (limited to 'subsidy_gui.c')
-rw-r--r--subsidy_gui.c176
1 files changed, 0 insertions, 176 deletions
diff --git a/subsidy_gui.c b/subsidy_gui.c
deleted file mode 100644
index a1b40ad90..000000000
--- a/subsidy_gui.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/* $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->we.click.widget) {
- case 3:
- HandleSubsidyClick(e->we.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, 0x0, STR_01FD_CLICK_ON_SERVICE_TO_CENTER},
-{ WIDGETS_END},
-};
-
-static const WindowDesc _subsidies_list_desc = {
- WDP_AUTO, WDP_AUTO, 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);
-}