author | miham |
Wed, 17 Aug 2005 12:30:07 +0000 | |
changeset 2349 | df02d0ffb588 |
parent 2186 | 461a2aff3486 |
child 2436 | 177cb6a8339f |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
988
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
3 |
#ifndef SIGNS_H |
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
4 |
#define SIGNS_H |
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
5 |
|
1283
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
6 |
#include "pool.h" |
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
7 |
|
988
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
8 |
typedef struct SignStruct { |
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
9 |
StringID str; |
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
10 |
ViewportSign sign; |
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
11 |
int32 x; |
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
12 |
int32 y; |
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
13 |
byte z; |
1165
2cdf7a0e217a
(svn r1667) - Feature: Signs are now shown in the color of the player who created them
dominik
parents:
1093
diff
changeset
|
14 |
byte owner; // placed by this player. Anyone can delete them though. |
2cdf7a0e217a
(svn r1667) - Feature: Signs are now shown in the color of the player who created them
dominik
parents:
1093
diff
changeset
|
15 |
// OWNER_NONE for gray signs from old games. |
988
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
16 |
|
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
17 |
uint16 index; |
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
18 |
} SignStruct; |
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
19 |
|
1283
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
20 |
extern MemoryPool _sign_pool; |
988
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
21 |
|
1283
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
22 |
/** |
1330
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1283
diff
changeset
|
23 |
* Check if a Sign really exists. |
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1283
diff
changeset
|
24 |
*/ |
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1283
diff
changeset
|
25 |
static inline bool IsValidSign(SignStruct* ss) |
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1283
diff
changeset
|
26 |
{ |
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1283
diff
changeset
|
27 |
return ss->str != 0; |
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1283
diff
changeset
|
28 |
} |
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1283
diff
changeset
|
29 |
|
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1283
diff
changeset
|
30 |
/** |
1283
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
31 |
* Get the pointer to the sign with index 'index' |
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
32 |
*/ |
988
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
33 |
static inline SignStruct *GetSign(uint index) |
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
34 |
{ |
1283
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
35 |
return (SignStruct*)GetItemFromPool(&_sign_pool, index); |
988
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
36 |
} |
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
37 |
|
1283
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
38 |
/** |
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
39 |
* Get the current size of the SignPool |
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
40 |
*/ |
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
41 |
static inline uint16 GetSignPoolSize(void) |
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
42 |
{ |
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
43 |
return _sign_pool.total_items; |
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
44 |
} |
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
45 |
|
1837
ebd6a1395d03
(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:
1575
diff
changeset
|
46 |
static inline bool IsSignIndex(uint index) |
ebd6a1395d03
(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:
1575
diff
changeset
|
47 |
{ |
ebd6a1395d03
(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:
1575
diff
changeset
|
48 |
return index < GetSignPoolSize(); |
ebd6a1395d03
(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:
1575
diff
changeset
|
49 |
} |
ebd6a1395d03
(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:
1575
diff
changeset
|
50 |
|
1283
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
51 |
#define FOR_ALL_SIGNS_FROM(ss, start) for (ss = GetSign(start); ss != NULL; ss = (ss->index + 1 < GetSignPoolSize()) ? GetSign(ss->index + 1) : NULL) |
b9569cc0644f
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents:
1165
diff
changeset
|
52 |
#define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0) |
988
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
53 |
|
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
54 |
VARDEF SignStruct *_new_sign_struct; |
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
55 |
|
1575
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1330
diff
changeset
|
56 |
VARDEF bool _sign_sort_dirty; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1330
diff
changeset
|
57 |
VARDEF uint16 *_sign_sort; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1330
diff
changeset
|
58 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
988
diff
changeset
|
59 |
void UpdateAllSignVirtCoords(void); |
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1837
diff
changeset
|
60 |
void PlaceProc_Sign(TileIndex tile); |
988
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
61 |
|
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
62 |
/* misc.c */ |
2116 | 63 |
void ShowRenameSignWindow(const SignStruct *ss); |
988
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
64 |
|
2482369a61ff
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff
changeset
|
65 |
#endif /* SIGNS_H */ |