author | rubidium |
Sat, 22 Dec 2007 23:30:28 +0000 | |
changeset 8121 | 3bc6351e7369 |
parent 8116 | 8da76dcb3287 |
child 8123 | ce31d2843a95 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6247
diff
changeset
|
3 |
/** @file signs.cpp */ |
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6247
diff
changeset
|
4 |
|
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
5 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1881
diff
changeset
|
6 |
#include "openttd.h" |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
7 |
#include "table/strings.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2154
diff
changeset
|
8 |
#include "functions.h" |
6453
226bcddeba32
(svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents:
6420
diff
changeset
|
9 |
#include "landscape.h" |
2154
f86c59e73a16
(svn r2664) Remove depedency on player.h from variables.h
tron
parents:
2153
diff
changeset
|
10 |
#include "player.h" |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
11 |
#include "signs.h" |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
12 |
#include "saveload.h" |
8116
8da76dcb3287
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8114
diff
changeset
|
13 |
#include "command_func.h" |
2153
ecfc674410b4
(svn r2663) Include variables.h only in these files which need it, not globally via openttd.h
tron
parents:
1977
diff
changeset
|
14 |
#include "variables.h" |
7511
3b5200bf7342
(svn r11026) -Fix: the name of a sign could sometimes be NULL causing crashes.
rubidium
parents:
7413
diff
changeset
|
15 |
#include "string.h" |
7384
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
16 |
#include "misc/autoptr.hpp" |
8114
dd6d21dc99c1
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
7545
diff
changeset
|
17 |
#include "strings_func.h" |
8121
3bc6351e7369
(svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents:
8116
diff
changeset
|
18 |
#include "viewport.h" |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
19 |
|
7295
ad5c855e13b1
(svn r10643) -Merge (from NoAI): properly counting the amount of signs instead of using the size of the sign pool.
rubidium
parents:
7266
diff
changeset
|
20 |
SignID _new_sign_id; |
ad5c855e13b1
(svn r10643) -Merge (from NoAI): properly counting the amount of signs instead of using the size of the sign pool.
rubidium
parents:
7266
diff
changeset
|
21 |
uint _total_signs; |
2789
12a6b123f12c
(svn r3337) Remove an unused variable and add 2 times static
tron
parents:
2783
diff
changeset
|
22 |
|
7384
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
23 |
/* Initialize the sign-pool */ |
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
24 |
DEFINE_OLD_POOL_GENERIC(Sign, Sign) |
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
25 |
|
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
26 |
Sign::Sign(StringID string) |
1283
85b520ad7266
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1201
diff
changeset
|
27 |
{ |
7384
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
28 |
this->str = string; |
1283
85b520ad7266
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1201
diff
changeset
|
29 |
} |
85b520ad7266
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1201
diff
changeset
|
30 |
|
7384
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
31 |
Sign::~Sign() |
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
32 |
{ |
7413
a590f7f0edb3
(svn r10799) -Fix: only calling QuickFree and not the destructor on pool cleanups might cause memory leaks due to the way C++ works.
rubidium
parents:
7384
diff
changeset
|
33 |
DeleteName(this->str); |
7384
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
34 |
this->str = STR_NULL; |
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
35 |
} |
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
36 |
|
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
37 |
/** |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
38 |
* |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
39 |
* Update the coordinate of one sign |
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6247
diff
changeset
|
40 |
* @param si Pointer to the Sign |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
41 |
* |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
42 |
*/ |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
43 |
static void UpdateSignVirtCoords(Sign *si) |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
44 |
{ |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
45 |
Point pt = RemapCoords(si->x, si->y, si->z); |
7056
6daddeaa79df
(svn r10321) -Codechange: refer to sign text by index
peter1138
parents:
6950
diff
changeset
|
46 |
SetDParam(0, si->index); |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
47 |
UpdateViewportSignPos(&si->sign, pt.x, pt.y - 6, STR_2806); |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
48 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
49 |
|
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
50 |
/** |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
51 |
* |
990
d2872f4948c1
(svn r1488) -Fix: fixed some spelling mistakes (tnx to Tron)
truelight
parents:
988
diff
changeset
|
52 |
* Update the coordinates of all signs |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
53 |
* |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
54 |
*/ |
6247 | 55 |
void UpdateAllSignVirtCoords() |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
56 |
{ |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
57 |
Sign *si; |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
58 |
|
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
59 |
FOR_ALL_SIGNS(si) UpdateSignVirtCoords(si); |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
60 |
|
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
61 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
62 |
|
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
63 |
/** |
7545
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7511
diff
changeset
|
64 |
* Marks the region of a sign as dirty. |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
65 |
* |
7545
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7511
diff
changeset
|
66 |
* This function marks the sign in all viewports as dirty for repaint. |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
67 |
* |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
68 |
* @param si Pointer to the Sign |
7545
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7511
diff
changeset
|
69 |
* @ingroup dirty |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
70 |
*/ |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
71 |
static void MarkSignDirty(Sign *si) |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
72 |
{ |
6700
3c214e54cd1f
(svn r9932) -Fix: can't assume a zoom-level with MarkAllViewportsDirty, causing segfaults when trying to load savegames in dedicated server via -g (reported by peter1138)
truelight
parents:
6653
diff
changeset
|
73 |
/* We use ZOOM_LVL_MAX here, as every viewport can have an other zoom, |
3c214e54cd1f
(svn r9932) -Fix: can't assume a zoom-level with MarkAllViewportsDirty, causing segfaults when trying to load savegames in dedicated server via -g (reported by peter1138)
truelight
parents:
6653
diff
changeset
|
74 |
* and there is no way for us to know which is the biggest. So make the |
3c214e54cd1f
(svn r9932) -Fix: can't assume a zoom-level with MarkAllViewportsDirty, causing segfaults when trying to load savegames in dedicated server via -g (reported by peter1138)
truelight
parents:
6653
diff
changeset
|
75 |
* biggest area dirty, and we are safe for sure. */ |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
76 |
MarkAllViewportsDirty( |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
77 |
si->sign.left - 6, |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
78 |
si->sign.top - 3, |
6700
3c214e54cd1f
(svn r9932) -Fix: can't assume a zoom-level with MarkAllViewportsDirty, causing segfaults when trying to load savegames in dedicated server via -g (reported by peter1138)
truelight
parents:
6653
diff
changeset
|
79 |
si->sign.left + ScaleByZoom(si->sign.width_1 + 12, ZOOM_LVL_MAX), |
3c214e54cd1f
(svn r9932) -Fix: can't assume a zoom-level with MarkAllViewportsDirty, causing segfaults when trying to load savegames in dedicated server via -g (reported by peter1138)
truelight
parents:
6653
diff
changeset
|
80 |
si->sign.top + ScaleByZoom(12, ZOOM_LVL_MAX)); |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
81 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
82 |
|
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
83 |
/** |
4400
82e6cecb71ec
(svn r6153) -Codechange: DeleteSign removes a sign from the pool
truelight
parents:
4384
diff
changeset
|
84 |
* Place a sign at the given coordinates. Ownership of sign has |
1793
b9a37c98b468
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1575
diff
changeset
|
85 |
* no effect whatsoever except for the colour the sign gets for easy recognition, |
b9a37c98b468
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1575
diff
changeset
|
86 |
* but everybody is able to rename/remove it. |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3047
diff
changeset
|
87 |
* @param tile tile to place sign at |
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6247
diff
changeset
|
88 |
* @param flags type of operation |
1793
b9a37c98b468
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1575
diff
changeset
|
89 |
* @param p1 unused |
b9a37c98b468
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1575
diff
changeset
|
90 |
* @param p2 unused |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
91 |
*/ |
6943
1914f26aee04
(svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium
parents:
6700
diff
changeset
|
92 |
CommandCost CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
93 |
{ |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
94 |
/* Try to locate a new sign */ |
7384
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
95 |
Sign *si = new Sign(STR_280A_SIGN); |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
96 |
if (si == NULL) return_cmd_error(STR_2808_TOO_MANY_SIGNS); |
7384
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
97 |
AutoPtrT<Sign> s_auto_delete = si; |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
98 |
|
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
99 |
/* When we execute, really make the sign */ |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
100 |
if (flags & DC_EXEC) { |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3047
diff
changeset
|
101 |
int x = TileX(tile) * TILE_SIZE; |
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3047
diff
changeset
|
102 |
int y = TileY(tile) * TILE_SIZE; |
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3047
diff
changeset
|
103 |
|
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
104 |
si->x = x; |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
105 |
si->y = y; |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
106 |
si->owner = _current_player; // owner of the sign; just eyecandy |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6453
diff
changeset
|
107 |
si->z = GetSlopeZ(x, y); |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
108 |
UpdateSignVirtCoords(si); |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
109 |
MarkSignDirty(si); |
1575
1f403d3c354f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1404
diff
changeset
|
110 |
InvalidateWindow(WC_SIGN_LIST, 0); |
1f403d3c354f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1404
diff
changeset
|
111 |
_sign_sort_dirty = true; |
7295
ad5c855e13b1
(svn r10643) -Merge (from NoAI): properly counting the amount of signs instead of using the size of the sign pool.
rubidium
parents:
7266
diff
changeset
|
112 |
_new_sign_id = si->index; |
ad5c855e13b1
(svn r10643) -Merge (from NoAI): properly counting the amount of signs instead of using the size of the sign pool.
rubidium
parents:
7266
diff
changeset
|
113 |
_total_signs++; |
7384
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
114 |
s_auto_delete.Detach(); |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
115 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
116 |
|
6950
14ecb0acdfb4
(svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents:
6943
diff
changeset
|
117 |
return CommandCost(); |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
118 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
119 |
|
1793
b9a37c98b468
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1575
diff
changeset
|
120 |
/** Rename a sign. If the new name of the sign is empty, we assume |
b9a37c98b468
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1575
diff
changeset
|
121 |
* the user wanted to delete it. So delete it. Ownership of signs |
b9a37c98b468
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1575
diff
changeset
|
122 |
* has no meaning/effect whatsoever except for eyecandy |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3047
diff
changeset
|
123 |
* @param tile unused |
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6247
diff
changeset
|
124 |
* @param flags type of operation |
1793
b9a37c98b468
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1575
diff
changeset
|
125 |
* @param p1 index of the sign to be renamed/removed |
b9a37c98b468
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1575
diff
changeset
|
126 |
* @param p2 unused |
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6247
diff
changeset
|
127 |
* @return 0 if succesfull, otherwise CMD_ERROR |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
128 |
*/ |
6943
1914f26aee04
(svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium
parents:
6700
diff
changeset
|
129 |
CommandCost CmdRenameSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
130 |
{ |
4352
6703cd8d39e0
(svn r6053) -Codechange: renamed all IsXXXIndex to IsValidXXXID
truelight
parents:
4349
diff
changeset
|
131 |
if (!IsValidSignID(p1)) return CMD_ERROR; |
1837
549f054afcbc
(svn r2342) - Fix (Regression): _cmd_text is always valid, so test the first character for '\0'. Also for some reason I forgot to validate the p1 param so that might lead to crashes with invalid signes. Fixed as well.
Darkvater
parents:
1835
diff
changeset
|
132 |
|
549f054afcbc
(svn r2342) - Fix (Regression): _cmd_text is always valid, so test the first character for '\0'. Also for some reason I forgot to validate the p1 param so that might lead to crashes with invalid signes. Fixed as well.
Darkvater
parents:
1835
diff
changeset
|
133 |
/* If _cmd_text 0 means the new text for the sign is non-empty. |
1793
b9a37c98b468
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1575
diff
changeset
|
134 |
* So rename the sign. If it is empty, it has no name, so delete it */ |
7511
3b5200bf7342
(svn r11026) -Fix: the name of a sign could sometimes be NULL causing crashes.
rubidium
parents:
7413
diff
changeset
|
135 |
if (!StrEmpty(_cmd_text)) { |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
136 |
/* Create the name */ |
1820
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1793
diff
changeset
|
137 |
StringID str = AllocateName(_cmd_text, 0); |
1793
b9a37c98b468
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1575
diff
changeset
|
138 |
if (str == 0) return CMD_ERROR; |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
139 |
|
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
140 |
if (flags & DC_EXEC) { |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
141 |
Sign *si = GetSign(p1); |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
142 |
|
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
143 |
/* Delete the old name */ |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
144 |
DeleteName(si->str); |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
145 |
/* Assign the new one */ |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
146 |
si->str = str; |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
147 |
si->owner = _current_player; |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
148 |
|
1793
b9a37c98b468
(svn r2297) - CodeChange: server-check the next batch of commands.
Darkvater
parents:
1575
diff
changeset
|
149 |
/* Update; mark sign dirty twice, because it can either becom longer, or shorter */ |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
150 |
MarkSignDirty(si); |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
151 |
UpdateSignVirtCoords(si); |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
152 |
MarkSignDirty(si); |
1575
1f403d3c354f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1404
diff
changeset
|
153 |
InvalidateWindow(WC_SIGN_LIST, 0); |
1f403d3c354f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1404
diff
changeset
|
154 |
_sign_sort_dirty = true; |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
155 |
} else { |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
156 |
/* Free the name, because we did not assign it yet */ |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
157 |
DeleteName(str); |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
158 |
} |
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6247
diff
changeset
|
159 |
} else { // Delete sign |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
160 |
if (flags & DC_EXEC) { |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
161 |
Sign *si = GetSign(p1); |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
162 |
|
4384
7e0d3ed719d9
(svn r6137) -Codechange: some very minor cleanups:
truelight
parents:
4352
diff
changeset
|
163 |
MarkSignDirty(si); |
7384
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
164 |
delete si; |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
165 |
|
1575
1f403d3c354f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1404
diff
changeset
|
166 |
InvalidateWindow(WC_SIGN_LIST, 0); |
1f403d3c354f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1404
diff
changeset
|
167 |
_sign_sort_dirty = true; |
7295
ad5c855e13b1
(svn r10643) -Merge (from NoAI): properly counting the amount of signs instead of using the size of the sign pool.
rubidium
parents:
7266
diff
changeset
|
168 |
_total_signs--; |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
169 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
170 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
171 |
|
6950
14ecb0acdfb4
(svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents:
6943
diff
changeset
|
172 |
return CommandCost(); |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
173 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
174 |
|
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
175 |
/** |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
176 |
* Callback function that is called after a sign is placed |
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6247
diff
changeset
|
177 |
* @param success of the operation |
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6247
diff
changeset
|
178 |
* @param tile unused |
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6247
diff
changeset
|
179 |
* @param p1 unused |
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6247
diff
changeset
|
180 |
* @param p2 unused |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
181 |
*/ |
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1891
diff
changeset
|
182 |
void CcPlaceSign(bool success, TileIndex tile, uint32 p1, uint32 p2) |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
183 |
{ |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
184 |
if (success) { |
7295
ad5c855e13b1
(svn r10643) -Merge (from NoAI): properly counting the amount of signs instead of using the size of the sign pool.
rubidium
parents:
7266
diff
changeset
|
185 |
ShowRenameSignWindow(GetSign(_new_sign_id)); |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
186 |
ResetObjectToPlace(); |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
187 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
188 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
189 |
|
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
190 |
/** |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
191 |
* |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
192 |
* PlaceProc function, called when someone pressed the button if the |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
193 |
* sign-tool is selected |
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6247
diff
changeset
|
194 |
* @param tile on which to place the sign |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
195 |
*/ |
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1891
diff
changeset
|
196 |
void PlaceProc_Sign(TileIndex tile) |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
197 |
{ |
2783
0dac7c830584
(svn r3331) CMD_PLACE_SIGN doesn't use p1, so don't pass anything seemingly meaningful
tron
parents:
2239
diff
changeset
|
198 |
DoCommandP(tile, 0, 0, CcPlaceSign, CMD_PLACE_SIGN | CMD_MSG(STR_2809_CAN_T_PLACE_SIGN_HERE)); |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
199 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
200 |
|
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
201 |
/** |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
202 |
* |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
203 |
* Initialize the signs |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
204 |
* |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
205 |
*/ |
6247 | 206 |
void InitializeSigns() |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
207 |
{ |
7295
ad5c855e13b1
(svn r10643) -Merge (from NoAI): properly counting the amount of signs instead of using the size of the sign pool.
rubidium
parents:
7266
diff
changeset
|
208 |
_total_signs = 0; |
7384
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
209 |
_Sign_pool.CleanPool(); |
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
210 |
_Sign_pool.AddBlockToPool(); |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
211 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
212 |
|
1881
435d39bd6ee0
(svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
Darkvater
parents:
1837
diff
changeset
|
213 |
static const SaveLoad _sign_desc[] = { |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
214 |
SLE_VAR(Sign, str, SLE_UINT16), |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
215 |
SLE_CONDVAR(Sign, x, SLE_FILE_I16 | SLE_VAR_I32, 0, 4), |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
216 |
SLE_CONDVAR(Sign, y, SLE_FILE_I16 | SLE_VAR_I32, 0, 4), |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
217 |
SLE_CONDVAR(Sign, x, SLE_INT32, 5, SL_MAX_VERSION), |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
218 |
SLE_CONDVAR(Sign, y, SLE_INT32, 5, SL_MAX_VERSION), |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
219 |
SLE_CONDVAR(Sign, owner, SLE_UINT8, 6, SL_MAX_VERSION), |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
220 |
SLE_VAR(Sign, z, SLE_UINT8), |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
221 |
SLE_END() |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
222 |
}; |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
223 |
|
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
224 |
/** |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
225 |
* |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
226 |
* Save all signs |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
227 |
* |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
228 |
*/ |
6247 | 229 |
static void Save_SIGN() |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
230 |
{ |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
231 |
Sign *si; |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
232 |
|
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
233 |
FOR_ALL_SIGNS(si) { |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
234 |
SlSetArrayIndex(si->index); |
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
235 |
SlObject(si, _sign_desc); |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
236 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
237 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
238 |
|
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
239 |
/** |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
240 |
* |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
241 |
* Load all signs |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
242 |
* |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
243 |
*/ |
6247 | 244 |
static void Load_SIGN() |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
245 |
{ |
7295
ad5c855e13b1
(svn r10643) -Merge (from NoAI): properly counting the amount of signs instead of using the size of the sign pool.
rubidium
parents:
7266
diff
changeset
|
246 |
_total_signs = 0; |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
247 |
int index; |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
248 |
while ((index = SlIterateArray()) != -1) { |
7384
353183a5cd3a
(svn r10753) -Codechange: make the sign struct use the pool item class as super class.
rubidium
parents:
7295
diff
changeset
|
249 |
Sign *si = new (index) Sign(); |
4349
1016170ae0cb
(svn r6050) -Codechange: mass-renamed SignStruct -> Sign and ss -> si. Now functions and variables all match eachother
truelight
parents:
4346
diff
changeset
|
250 |
SlObject(si, _sign_desc); |
7295
ad5c855e13b1
(svn r10643) -Merge (from NoAI): properly counting the amount of signs instead of using the size of the sign pool.
rubidium
parents:
7266
diff
changeset
|
251 |
|
ad5c855e13b1
(svn r10643) -Merge (from NoAI): properly counting the amount of signs instead of using the size of the sign pool.
rubidium
parents:
7266
diff
changeset
|
252 |
_total_signs++; |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
253 |
} |
1575
1f403d3c354f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1404
diff
changeset
|
254 |
|
1f403d3c354f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1404
diff
changeset
|
255 |
_sign_sort_dirty = true; |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
256 |
} |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
257 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
258 |
extern const ChunkHandler _sign_chunk_handlers[] = { |
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
259 |
{ 'SIGN', Save_SIGN, Load_SIGN, CH_ARRAY | CH_LAST}, |
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
260 |
}; |