# transparency.h

Go to the documentation of this file.

    00001 /* $Id: transparency.h 12320 2008-02-29 15:20:02Z peter1138 $ */
    00002
    00005 #ifndef TRANSPARENCY_H
    00006 #define TRANSPARENCY_H
    00007
    00008 #include "gfx_func.h"
    00009
    00015 enum TransparencyOption {
    00016   TO_SIGNS = 0,
    00017   TO_TREES,
    00018   TO_HOUSES,
    00019   TO_INDUSTRIES,
    00020   TO_BUILDINGS,
    00021   TO_BRIDGES,
    00022   TO_STRUCTURES,
    00023   TO_CATENARY,
    00024   TO_LOADING,
    00025   TO_END,
    00026 };
    00027
    00028 typedef uint TransparencyOptionBits;
    00029 extern TransparencyOptionBits _transparency_opt;
    00030 extern TransparencyOptionBits _transparency_lock;
    00031
    00038 static inline bool IsTransparencySet(TransparencyOption to)
    00039 {
    00040   return (HasBit(_transparency_opt, to) && _game_mode != GM_MENU);
    00041 }
    00042
    00048 static inline void ToggleTransparency(TransparencyOption to)
    00049 {
    00050   ToggleBit(_transparency_opt, to);
    00051 }
    00052
    00058 static inline void ToggleTransparencyLock(TransparencyOption to)
    00059 {
    00060   ToggleBit(_transparency_lock, to);
    00061 }
    00062
    00064 static inline void ResetRestoreAllTransparency()
    00065 {
    00066   /* if none of the non-locked options are set */
    00067   if ((_transparency_opt & ~_transparency_lock) == 0) {
    00068     /* set all non-locked options */
    00069     _transparency_opt |= GB(~_transparency_lock, 0, TO_END);
    00070   } else {
    00071     /* clear all non-locked options */
    00072     _transparency_opt &= _transparency_lock;
    00073   }
    00074
    00075   MarkWholeScreenDirty();
    00076 }
    00077
    00078 #endif /* TRANSPARENCY_H */