src/signs_gui.cpp
author celestar
Tue, 12 Jun 2007 11:56:35 +0000
branchgamebalance
changeset 9908 0fa543611bbe
parent 9895 7bd07f43b0e3
child 6720 35756db7e577
child 7552 064d734e9900
permissions -rw-r--r--
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
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
9908
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
     3
/** @file signs_gui.cpp */
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
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: 1575
diff changeset
     6
#include "openttd.h"
507
8aa8100b0b22 (svn r815) Include strings.h only in the files which need it.
tron
parents: 410
diff changeset
     7
#include "table/strings.h"
2187
2a51f8925eeb (svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
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 "gfx.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
#include "player.h"
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    14
#include "signs.h"
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    15
#include "strings.h"
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    16
#include "debug.h"
2159
3b634157c3b2 (svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents: 2135
diff changeset
    17
#include "variables.h"
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5835
diff changeset
    18
#include "helpers.hpp"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
4353
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
    20
static const Sign **_sign_sort;
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
    21
static uint _num_sign_sort;
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    22
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    23
static char _bufcache[64];
4353
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
    24
static const Sign *_last_sign;
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    25
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    26
static int CDECL SignNameSorter(const void *a, const void *b)
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    27
{
4353
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
    28
	const Sign *sign0 = *(const Sign**)a;
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
    29
	const Sign *sign1 = *(const Sign**)b;
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    30
	char buf1[64];
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    31
4912
d04b3f2bca70 (svn r6884) -Codechange: Add strict bounds checking in string formatting system.
Darkvater
parents: 4911
diff changeset
    32
	GetString(buf1, sign0->str, lastof(buf1));
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    33
4353
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
    34
	if (sign1 != _last_sign) {
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
    35
		_last_sign = sign1;
4912
d04b3f2bca70 (svn r6884) -Codechange: Add strict bounds checking in string formatting system.
Darkvater
parents: 4911
diff changeset
    36
		GetString(_bufcache, sign1->str, lastof(_bufcache));
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    37
	}
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    38
3801
866d8cb1d707 (svn r4809) Codechange : Merged two loops in only one.
belugas
parents: 3733
diff changeset
    39
	return strcmp(buf1, _bufcache); // sort by name
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    40
}
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    41
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6144
diff changeset
    42
static void GlobalSortSignList()
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    43
{
4349
2fc39ff2626e (svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents: 4346
diff changeset
    44
	const Sign *si;
4353
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
    45
	uint n = 0;
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    46
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    47
	/* Create array for sorting */
5860
7fdc9b423ba1 (svn r8066) - Codechange: MallocT(), CallocT(), ReallocT() now return the pointer to allocated memory instead of modifying the pointer given as parameter
KUDr
parents: 5852
diff changeset
    48
	_sign_sort = ReallocT(_sign_sort, GetMaxSignIndex() + 1);
5568
75f13d7bfaed (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents: 5291
diff changeset
    49
	if (_sign_sort == NULL) error("Could not allocate memory for the sign-sorting-list");
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    50
4353
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
    51
	FOR_ALL_SIGNS(si) _sign_sort[n++] = si;
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
    52
	_num_sign_sort = n;
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
    53
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
    54
	qsort((void*)_sign_sort, n, sizeof(_sign_sort[0]), SignNameSorter);
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    55
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    56
	_sign_sort_dirty = false;
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    57
5568
75f13d7bfaed (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents: 5291
diff changeset
    58
	DEBUG(misc, 3, "Resorting global signs list");
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    59
}
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    60
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    61
static void SignListWndProc(Window *w, WindowEvent *e)
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    62
{
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    63
	switch (e->event) {
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    64
	case WE_PAINT: {
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    65
		int y = 16; // offset from top of widget
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    66
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    67
		if (_sign_sort_dirty)
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    68
			GlobalSortSignList();
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    69
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    70
		SetVScrollCount(w, _num_sign_sort);
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    71
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    72
		SetDParam(0, w->vscroll.count);
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    73
		DrawWindowWidgets(w);
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    74
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    75
		/* No signs? */
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    76
		if (w->vscroll.count == 0) {
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    77
			DrawString(2, y, STR_304A_NONE, 0);
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    78
			return;
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    79
		}
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    80
4349
2fc39ff2626e (svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents: 4346
diff changeset
    81
		{
2135
48fb9f0322cb (svn r2645) Fix (useless)warning in graph_gui and add brackets around HASBIT in an if statement
Darkvater
parents: 2133
diff changeset
    82
			uint16 i;
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    83
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    84
			/* Start drawing the signs */
2133
098c9da8292e (svn r2643) Get rid of some unnecessary casts
tron
parents: 2063
diff changeset
    85
			for (i = w->vscroll.pos; i < w->vscroll.cap + w->vscroll.pos && i < w->vscroll.count; i++) {
4353
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
    86
				const Sign *si = _sign_sort[i];
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    87
4349
2fc39ff2626e (svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents: 4346
diff changeset
    88
				if (si->owner != OWNER_NONE)
2fc39ff2626e (svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents: 4346
diff changeset
    89
					DrawPlayerIcon(si->owner, 4, y + 1);
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    90
4349
2fc39ff2626e (svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents: 4346
diff changeset
    91
				DrawString(22, y, si->str, 8);
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    92
				y += 10;
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    93
			}
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    94
		}
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    95
	} break;
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    96
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
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: 4444
diff changeset
    98
		switch (e->we.click.widget) {
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
    99
		case 3: {
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4444
diff changeset
   100
			uint32 id_v = (e->we.click.pt.y - 15) / 10;
4349
2fc39ff2626e (svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents: 4346
diff changeset
   101
			const Sign *si;
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   102
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   103
			if (id_v >= w->vscroll.cap)
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   104
				return;
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   105
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   106
			id_v += w->vscroll.pos;
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   107
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   108
			if (id_v >= w->vscroll.count)
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   109
				return;
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   110
4353
2b941f2c325c (svn r6054) Change the sign sorter in a similar way as the other sorters: Remember a list of pointers to signs instead of a list of SignIDs - This removes a layer of indirection
tron
parents: 4349
diff changeset
   111
			si = _sign_sort[id_v];
4349
2fc39ff2626e (svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents: 4346
diff changeset
   112
			ScrollMainWindowToTile(TileVirtXY(si->x, si->y));
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   113
		} break;
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   114
		}
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   115
	} break;
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   116
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   117
	case WE_RESIZE:
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4444
diff changeset
   118
		w->vscroll.cap += e->we.sizing.diff.y / 10;
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   119
		break;
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   120
	}
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   121
}
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   122
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   123
static const Widget _sign_list_widget[] = {
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: 4293
diff changeset
   124
{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,              STR_018B_CLOSE_WINDOW},
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: 4293
diff changeset
   125
{    WWT_CAPTION,  RESIZE_RIGHT,    14,    11,   345,     0,    13, STR_SIGN_LIST_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
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: 4293
diff changeset
   126
{  WWT_STICKYBOX,     RESIZE_LR,    14,   346,   357,     0,    13, 0x0,                   STR_STICKY_BUTTON},
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: 4293
diff changeset
   127
{      WWT_PANEL,     RESIZE_RB,    14,     0,   345,    14,   137, 0x0,                   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: 4293
diff changeset
   128
{  WWT_SCROLLBAR,    RESIZE_LRB,    14,   346,   357,    14,   125, 0x0,                   STR_0190_SCROLL_BAR_SCROLLS_LIST},
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: 4293
diff changeset
   129
{  WWT_RESIZEBOX,   RESIZE_LRTB,    14,   346,   357,   126,   137, 0x0,                   STR_RESIZE_BUTTON},
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   130
{   WIDGETS_END},
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   131
};
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   132
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   133
static const WindowDesc _sign_list_desc = {
5070
0bbf5264bfb7 (svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents: 4938
diff changeset
   134
	WDP_AUTO, WDP_AUTO, 358, 138,
6144
5a0ffbf27ced (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 6002
diff changeset
   135
	WC_SIGN_LIST, WC_NONE,
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   136
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE,
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   137
	_sign_list_widget,
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   138
	SignListWndProc
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   139
};
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   140
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   141
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6144
diff changeset
   142
void ShowSignList()
1575
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   143
{
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   144
	Window *w;
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   145
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   146
	w = AllocateWindowDescFront(&_sign_list_desc, 0);
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   147
	if (w != NULL) {
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   148
		w->vscroll.cap = 12;
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   149
		w->resize.step_height = 10;
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   150
		w->resize.height = w->height - 10 * 7; // minimum if 5 in the list
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   151
	}
a566a645401f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1130
diff changeset
   152
}