signs.h
author Darkvater
Wed, 20 Apr 2005 22:30:40 +0000
changeset 1713 659ca3025cc5
parent 1575 1f403d3c354f
child 1837 549f054afcbc
permissions -rw-r--r--
(svn r2217) - Fix: [ 1184201 ] AI orders its vehicles to a competitor's truck stop. Added a CmdFailed() check to all command returns of the AI instead of the simple == / != CMD_ERROR check. This should fix the problem.
988
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
     1
#ifndef SIGNS_H
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
     2
#define SIGNS_H
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
     3
1283
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
     4
#include "pool.h"
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
     5
988
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
     6
typedef struct SignStruct {
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
     7
	StringID     str;
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
     8
	ViewportSign sign;
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
     9
	int32        x;
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    10
	int32        y;
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    11
	byte         z;
1165
8fa7d3e235c6 (svn r1667) - Feature: Signs are now shown in the color of the player who created them
dominik
parents: 1093
diff changeset
    12
	byte owner; // placed by this player. Anyone can delete them though.
8fa7d3e235c6 (svn r1667) - Feature: Signs are now shown in the color of the player who created them
dominik
parents: 1093
diff changeset
    13
							// OWNER_NONE for gray signs from old games.
988
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    14
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    15
	uint16       index;
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    16
} SignStruct;
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    17
1283
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    18
extern MemoryPool _sign_pool;
988
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    19
1283
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    20
/**
1330
5d76a0522a11 (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
    21
 * Check if a Sign really exists.
5d76a0522a11 (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
    22
 */
5d76a0522a11 (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
static inline bool IsValidSign(SignStruct* ss)
5d76a0522a11 (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
{
5d76a0522a11 (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
	return ss->str != 0;
5d76a0522a11 (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
}
5d76a0522a11 (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
5d76a0522a11 (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
/**
1283
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    29
 * Get the pointer to the sign with index 'index'
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    30
 */
988
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    31
static inline SignStruct *GetSign(uint index)
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    32
{
1283
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    33
	return (SignStruct*)GetItemFromPool(&_sign_pool, index);
988
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    34
}
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    35
1283
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    36
/**
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    37
 * Get the current size of the SignPool
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    38
 */
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    39
static inline uint16 GetSignPoolSize(void)
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    40
{
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    41
	return _sign_pool.total_items;
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    42
}
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    43
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    44
#define FOR_ALL_SIGNS_FROM(ss, start) for (ss = GetSign(start); ss != NULL; ss = (ss->index + 1 < GetSignPoolSize()) ? GetSign(ss->index + 1) : NULL)
85b520ad7266 (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
truelight
parents: 1165
diff changeset
    45
#define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0)
988
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    46
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    47
VARDEF SignStruct *_new_sign_struct;
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    48
1575
1f403d3c354f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1330
diff changeset
    49
VARDEF bool _sign_sort_dirty;
1f403d3c354f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1330
diff changeset
    50
VARDEF uint16 *_sign_sort;
1f403d3c354f (svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents: 1330
diff changeset
    51
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 988
diff changeset
    52
void UpdateAllSignVirtCoords(void);
988
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    53
void PlaceProc_Sign(uint tile);
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    54
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    55
/* misc.c */
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    56
void ShowRenameSignWindow(SignStruct *ss);
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    57
4304525d1b8b (svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
diff changeset
    58
#endif /* SIGNS_H */