signs.h

Go to the documentation of this file.
00001 /* $Id: signs.h 14385 2008-09-22 19:57:31Z rubidium $ */
00002 
00005 #ifndef SIGNS_H
00006 #define SIGNS_H
00007 
00008 #include "oldpool.h"
00009 
00010 struct Sign;
00011 DECLARE_OLD_POOL(Sign, Sign, 2, 16000)
00012 
00013 struct Sign : PoolItem<Sign, SignID, &_Sign_pool> {
00014   char *name;
00015   ViewportSign sign;
00016   int32        x;
00017   int32        y;
00018   byte         z;
00019   PlayerByte   owner; // placed by this player. Anyone can delete them though. OWNER_NONE for gray signs from old games.
00020 
00024   Sign(PlayerID owner = INVALID_PLAYER);
00025 
00027   ~Sign();
00028 
00029   inline bool IsValid() const { return this->owner != INVALID_PLAYER; }
00030 };
00031 
00032 enum {
00033   INVALID_SIGN = 0xFFFF,
00034 };
00035 
00036 extern SignID _new_sign_id;
00037 
00038 
00039 static inline SignID GetMaxSignIndex()
00040 {
00041   /* TODO - This isn't the real content of the function, but
00042    *  with the new pool-system this will be replaced with one that
00043    *  _really_ returns the highest index. Now it just returns
00044    *  the next safe value we are sure about everything is below.
00045    */
00046   return GetSignPoolSize() - 1;
00047 }
00048 
00049 static inline uint GetNumSigns()
00050 {
00051   extern uint _total_signs;
00052   return _total_signs;
00053 }
00054 
00055 static inline bool IsValidSignID(uint index)
00056 {
00057   return index < GetSignPoolSize() && GetSign(index)->IsValid();
00058 }
00059 
00060 #define FOR_ALL_SIGNS_FROM(ss, start) for (ss = GetSign(start); ss != NULL; ss = (ss->index + 1U < GetSignPoolSize()) ? GetSign(ss->index + 1U) : NULL) if (ss->IsValid())
00061 #define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0)
00062 
00063 extern bool _sign_sort_dirty;
00064 
00065 void UpdateAllSignVirtCoords();
00066 void PlaceProc_Sign(TileIndex tile);
00067 
00068 /* signs_gui.cpp */
00069 void ShowRenameSignWindow(const Sign *si);
00070 void DeleteRenameSignWindow(SignID sign);
00071 void ShowSignList();
00072 
00073 #endif /* SIGNS_H */

Generated on Mon Sep 22 20:34:18 2008 for openttd by  doxygen 1.5.6