src/signs.h
branchcpp_gui
changeset 6298 c30fe89622df
parent 6002 0cc302eda282
child 6307 f40e88cff863
equal deleted inserted replaced
6297:4bf29d14edba 6298:c30fe89622df
     3 #ifndef SIGNS_H
     3 #ifndef SIGNS_H
     4 #define SIGNS_H
     4 #define SIGNS_H
     5 
     5 
     6 #include "oldpool.h"
     6 #include "oldpool.h"
     7 
     7 
     8 typedef struct Sign {
     8 struct Sign {
     9 	StringID     str;
     9 	StringID     str;
    10 	ViewportSign sign;
    10 	ViewportSign sign;
    11 	int32        x;
    11 	int32        x;
    12 	int32        y;
    12 	int32        y;
    13 	byte         z;
    13 	byte         z;
    14 	PlayerByte   owner; // placed by this player. Anyone can delete them though. OWNER_NONE for gray signs from old games.
    14 	PlayerByte   owner; // placed by this player. Anyone can delete them though. OWNER_NONE for gray signs from old games.
    15 
    15 
    16 	SignID       index;
    16 	SignID       index;
    17 } Sign;
    17 };
    18 
    18 
    19 DECLARE_OLD_POOL(Sign, Sign, 2, 16000)
    19 DECLARE_OLD_POOL(Sign, Sign, 2, 16000)
    20 
    20 
    21 static inline SignID GetMaxSignIndex(void)
    21 static inline SignID GetMaxSignIndex()
    22 {
    22 {
    23 	/* TODO - This isn't the real content of the function, but
    23 	/* TODO - This isn't the real content of the function, but
    24 	 *  with the new pool-system this will be replaced with one that
    24 	 *  with the new pool-system this will be replaced with one that
    25 	 *  _really_ returns the highest index. Now it just returns
    25 	 *  _really_ returns the highest index. Now it just returns
    26 	 *  the next safe value we are sure about everything is below.
    26 	 *  the next safe value we are sure about everything is below.
    27 	 */
    27 	 */
    28 	return GetSignPoolSize() - 1;
    28 	return GetSignPoolSize() - 1;
    29 }
    29 }
    30 
    30 
    31 static inline uint GetNumSigns(void)
    31 static inline uint GetNumSigns()
    32 {
    32 {
    33 	return GetSignPoolSize();
    33 	return GetSignPoolSize();
    34 }
    34 }
    35 
    35 
    36 /**
    36 /**
    57 #define FOR_ALL_SIGNS_FROM(ss, start) for (ss = GetSign(start); ss != NULL; ss = (ss->index + 1U < GetSignPoolSize()) ? GetSign(ss->index + 1U) : NULL) if (IsValidSign(ss))
    57 #define FOR_ALL_SIGNS_FROM(ss, start) for (ss = GetSign(start); ss != NULL; ss = (ss->index + 1U < GetSignPoolSize()) ? GetSign(ss->index + 1U) : NULL) if (IsValidSign(ss))
    58 #define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0)
    58 #define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0)
    59 
    59 
    60 VARDEF bool _sign_sort_dirty;
    60 VARDEF bool _sign_sort_dirty;
    61 
    61 
    62 void UpdateAllSignVirtCoords(void);
    62 void UpdateAllSignVirtCoords();
    63 void PlaceProc_Sign(TileIndex tile);
    63 void PlaceProc_Sign(TileIndex tile);
    64 
    64 
    65 /* misc.c */
    65 /* misc.c */
    66 void ShowRenameSignWindow(const Sign *si);
    66 void ShowRenameSignWindow(const Sign *si);
    67 
    67 
    68 void ShowSignList(void);
    68 void ShowSignList();
    69 
    69 
    70 #endif /* SIGNS_H */
    70 #endif /* SIGNS_H */