Changeset - r6591:56d27ba364f1
[Not reviewed]
master
0 6 0
peter1138 - 17 years ago 2007-05-07 11:24:23
peter1138@openttd.org
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
6 files changed with 29 insertions and 29 deletions:
0 comments (0 inline, 0 general)
src/main_gui.cpp
Show inline comments
 
@@ -168,18 +168,18 @@ static void MenuClickSettings(int index)
 
	switch (index) {
 
		case 0: ShowGameOptions();      return;
 
		case 1: ShowGameDifficulty();   return;
 
		case 2: ShowPatchesSelection(); return;
 
		case 3: ShowNewGRFSettings(!_networking, true, true, &_grfconfig);   return;
 

	
 
		case  5: _display_opt ^= DO_SHOW_TOWN_NAMES;    break;
 
		case  6: _display_opt ^= DO_SHOW_STATION_NAMES; break;
 
		case  7: _display_opt ^= DO_SHOW_SIGNS;         break;
 
		case  8: _display_opt ^= DO_WAYPOINTS;          break;
 
		case  9: _display_opt ^= DO_FULL_ANIMATION;     break;
 
		case 10: _display_opt ^= DO_FULL_DETAIL;        break;
 
		case  5: TOGGLEBIT(_display_opt, DO_SHOW_TOWN_NAMES);    break;
 
		case  6: TOGGLEBIT(_display_opt, DO_SHOW_STATION_NAMES); break;
 
		case  7: TOGGLEBIT(_display_opt, DO_SHOW_SIGNS);         break;
 
		case  8: TOGGLEBIT(_display_opt, DO_WAYPOINTS);          break;
 
		case  9: TOGGLEBIT(_display_opt, DO_FULL_ANIMATION);     break;
 
		case 10: TOGGLEBIT(_display_opt, DO_FULL_DETAIL);        break;
 
		case 11: ToggleTransparency(); break;
 
		case 12: TOGGLEBIT(_transparent_opt, TO_SIGNS); break;
 
	}
 
	MarkWholeScreenDirty();
 
}
 

	
 
@@ -971,18 +971,18 @@ static void ToolbarHelpClick(Window *w)
 
static void ToolbarOptionsClick(Window *w)
 
{
 
	uint16 x = 0;
 

	
 
	w = PopupMainToolbMenu(w, 2, STR_02C3_GAME_OPTIONS, 13, 0);
 

	
 
	if (_display_opt & DO_SHOW_TOWN_NAMES)    SETBIT(x,  5);
 
	if (_display_opt & DO_SHOW_STATION_NAMES) SETBIT(x,  6);
 
	if (_display_opt & DO_SHOW_SIGNS)         SETBIT(x,  7);
 
	if (_display_opt & DO_WAYPOINTS)          SETBIT(x,  8);
 
	if (_display_opt & DO_FULL_ANIMATION)     SETBIT(x,  9);
 
	if (_display_opt & DO_FULL_DETAIL)        SETBIT(x, 10);
 
	if (HASBIT(_display_opt, DO_SHOW_TOWN_NAMES))    SETBIT(x,  5);
 
	if (HASBIT(_display_opt, DO_SHOW_STATION_NAMES)) SETBIT(x,  6);
 
	if (HASBIT(_display_opt, DO_SHOW_SIGNS))         SETBIT(x,  7);
 
	if (HASBIT(_display_opt, DO_WAYPOINTS))          SETBIT(x,  8);
 
	if (HASBIT(_display_opt, DO_FULL_ANIMATION))     SETBIT(x,  9);
 
	if (HASBIT(_display_opt, DO_FULL_DETAIL))        SETBIT(x, 10);
 
	if (GB(_transparent_opt, 1, 7) != 0)      SETBIT(x, 11);
 
	if (HASBIT(_transparent_opt, TO_SIGNS))   SETBIT(x, 12);
 
	WP(w,menu_d).checked_items = x;
 
}
 

	
 

	
src/openttd.cpp
Show inline comments
 
@@ -1073,13 +1073,13 @@ void GameLoop()
 
		StateGameLoop();
 
	}
 
#else
 
	StateGameLoop();
 
#endif /* ENABLE_NETWORK */
 

	
 
	if (!_pause_game && _display_opt & DO_FULL_ANIMATION) DoPaletteAnimations();
 
	if (!_pause_game && HASBIT(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations();
 

	
 
	if (!_pause_game || _cheats.build_in_pause.value) MoveAllTextEffects();
 

	
 
	InputLoop();
 

	
 
	MusicLoop();
src/openttd.h
Show inline comments
 
@@ -168,18 +168,18 @@ struct TileInfo {
 
	uint z;
 
};
 

	
 

	
 
/* Display Options */
 
enum {
 
	DO_SHOW_TOWN_NAMES    = 1 << 0,
 
	DO_SHOW_STATION_NAMES = 1 << 1,
 
	DO_SHOW_SIGNS         = 1 << 2,
 
	DO_FULL_ANIMATION     = 1 << 3,
 
	DO_FULL_DETAIL        = 1 << 5,
 
	DO_WAYPOINTS          = 1 << 6,
 
	DO_SHOW_TOWN_NAMES    = 0,
 
	DO_SHOW_STATION_NAMES = 1,
 
	DO_SHOW_SIGNS         = 2,
 
	DO_FULL_ANIMATION     = 3,
 
	DO_FULL_DETAIL        = 5,
 
	DO_WAYPOINTS          = 6,
 
};
 

	
 
enum {
 
	TO_SIGNS,
 
	TO_TREES,
 
	TO_HOUSES,
src/rail_cmd.cpp
Show inline comments
 
@@ -1319,13 +1319,13 @@ static void DrawTile_Track(TileInfo *ti)
 

	
 
	if (IsPlainRailTile(ti->tile)) {
 
		TrackBits rails = GetTrackBits(ti->tile);
 

	
 
		DrawTrackBits(ti, rails);
 

	
 
		if (_display_opt & DO_FULL_DETAIL) DrawTrackDetails(ti);
 
		if (HASBIT(_display_opt, DO_FULL_DETAIL)) DrawTrackDetails(ti);
 

	
 
		if (HasSignals(ti->tile)) DrawSignals(ti->tile, rails);
 
	} else {
 
		/* draw depot/waypoint */
 
		const DrawTileSprites* dts;
 
		const DrawTileSeqStruct* dtss;
src/road_cmd.cpp
Show inline comments
 
@@ -722,13 +722,13 @@ static void DrawRoadBits(TileInfo* ti)
 
		/* Road works */
 
		DrawGroundSprite(road & ROAD_X ? SPR_EXCAVATION_X : SPR_EXCAVATION_Y, PAL_NONE);
 
		return;
 
	}
 

	
 
	/* Return if full detail is disabled, or we are zoomed fully out. */
 
	if (!(_display_opt & DO_FULL_DETAIL) || _cur_dpi->zoom == 2) return;
 
	if (!HASBIT(_display_opt, DO_FULL_DETAIL) || _cur_dpi->zoom == 2) return;
 

	
 
	/* Draw extra details. */
 
	for (drts = _road_display_table[roadside][road]; drts->image != 0; drts++) {
 
		int x = ti->x | drts->subcoord_x;
 
		int y = ti->y | drts->subcoord_y;
 
		byte z = ti->z;
src/viewport.cpp
Show inline comments
 
@@ -796,13 +796,13 @@ static void ViewportAddLandscape()
 

	
 
static void ViewportAddTownNames(DrawPixelInfo *dpi)
 
{
 
	Town *t;
 
	int left, top, right, bottom;
 

	
 
	if (!(_display_opt & DO_SHOW_TOWN_NAMES) || _game_mode == GM_MENU)
 
	if (!HASBIT(_display_opt, DO_SHOW_TOWN_NAMES) || _game_mode == GM_MENU)
 
		return;
 

	
 
	left = dpi->left;
 
	top = dpi->top;
 
	right = left + dpi->width;
 
	bottom = top + dpi->height;
 
@@ -870,13 +870,13 @@ static void AddStation(const Station *st
 

	
 
static void ViewportAddStationNames(DrawPixelInfo *dpi)
 
{
 
	int left, top, right, bottom;
 
	const Station *st;
 

	
 
	if (!(_display_opt & DO_SHOW_STATION_NAMES) || _game_mode == GM_MENU)
 
	if (!HASBIT(_display_opt, DO_SHOW_STATION_NAMES) || _game_mode == GM_MENU)
 
		return;
 

	
 
	left = dpi->left;
 
	top = dpi->top;
 
	right = left + dpi->width;
 
	bottom = top + dpi->height;
 
@@ -937,13 +937,13 @@ static void AddSign(const Sign *si, Stri
 

	
 
static void ViewportAddSigns(DrawPixelInfo *dpi)
 
{
 
	const Sign *si;
 
	int left, top, right, bottom;
 

	
 
	if (!(_display_opt & DO_SHOW_SIGNS))
 
	if (!HASBIT(_display_opt, DO_SHOW_SIGNS))
 
		return;
 

	
 
	left = dpi->left;
 
	top = dpi->top;
 
	right = left + dpi->width;
 
	bottom = top + dpi->height;
 
@@ -1004,13 +1004,13 @@ static void AddWaypoint(const Waypoint *
 

	
 
static void ViewportAddWaypoints(DrawPixelInfo *dpi)
 
{
 
	const Waypoint *wp;
 
	int left, top, right, bottom;
 

	
 
	if (!(_display_opt & DO_WAYPOINTS))
 
	if (!HASBIT(_display_opt, DO_WAYPOINTS))
 
		return;
 

	
 
	left = dpi->left;
 
	top = dpi->top;
 
	right = left + dpi->width;
 
	bottom = top + dpi->height;
 
@@ -1484,13 +1484,13 @@ void SetSelectionRed(bool b)
 

	
 

	
 
static bool CheckClickOnTown(const ViewPort *vp, int x, int y)
 
{
 
	const Town *t;
 

	
 
	if (!(_display_opt & DO_SHOW_TOWN_NAMES)) return false;
 
	if (!HASBIT(_display_opt, DO_SHOW_TOWN_NAMES)) return false;
 

	
 
	switch (vp->zoom) {
 
		case 0:
 
			x = x - vp->left + vp->virtual_left;
 
			y = y - vp->top  + vp->virtual_top;
 
			FOR_ALL_TOWNS(t) {
 
@@ -1538,13 +1538,13 @@ static bool CheckClickOnTown(const ViewP
 

	
 

	
 
static bool CheckClickOnStation(const ViewPort *vp, int x, int y)
 
{
 
	const Station *st;
 

	
 
	if (!(_display_opt & DO_SHOW_STATION_NAMES)) return false;
 
	if (!HASBIT(_display_opt, DO_SHOW_STATION_NAMES)) return false;
 

	
 
	switch (vp->zoom) {
 
		case 0:
 
			x = x - vp->left + vp->virtual_left;
 
			y = y - vp->top  + vp->virtual_top;
 
			FOR_ALL_STATIONS(st) {
 
@@ -1592,13 +1592,13 @@ static bool CheckClickOnStation(const Vi
 

	
 

	
 
static bool CheckClickOnSign(const ViewPort *vp, int x, int y)
 
{
 
	const Sign *si;
 

	
 
	if (!(_display_opt & DO_SHOW_SIGNS) || _current_player == PLAYER_SPECTATOR) return false;
 
	if (!HASBIT(_display_opt, DO_SHOW_SIGNS) || _current_player == PLAYER_SPECTATOR) return false;
 

	
 
	switch (vp->zoom) {
 
		case 0:
 
			x = x - vp->left + vp->virtual_left;
 
			y = y - vp->top  + vp->virtual_top;
 
			FOR_ALL_SIGNS(si) {
 
@@ -1646,13 +1646,13 @@ static bool CheckClickOnSign(const ViewP
 

	
 

	
 
static bool CheckClickOnWaypoint(const ViewPort *vp, int x, int y)
 
{
 
	const Waypoint *wp;
 

	
 
	if (!(_display_opt & DO_WAYPOINTS)) return false;
 
	if (!HASBIT(_display_opt, DO_WAYPOINTS)) return false;
 

	
 
	switch (vp->zoom) {
 
		case 0:
 
			x = x - vp->left + vp->virtual_left;
 
			y = y - vp->top  + vp->virtual_top;
 
			FOR_ALL_WAYPOINTS(wp) {
0 comments (0 inline, 0 general)