(svn r11392) -Codechange: Remove some MSVC warnings by removing boolean typecast that can be avoided by using HASBIT instead.
authorbelugas
Thu, 08 Nov 2007 16:09:04 +0000
changeset 8338 f855a0dfed08
parent 8337 fd294edef5be
child 8339 35823d10eab5
(svn r11392) -Codechange: Remove some MSVC warnings by removing boolean typecast that can be avoided by using HASBIT instead.
Although the code is old (r2817), it is the recent changes made in macros.h that brough it up.
src/players.cpp
src/station_gui.cpp
--- a/src/players.cpp	Wed Nov 07 23:29:43 2007 +0000
+++ b/src/players.cpp	Thu Nov 08 16:09:04 2007 +0000
@@ -676,11 +676,11 @@
 	p = GetPlayer(_current_player);
 	switch (GB(p1, 0, 3)) {
 		case 0:
-			if (p->engine_renew == (bool)GB(p2, 0, 1))
+			if (p->engine_renew == HASBIT(p2, 0))
 				return CMD_ERROR;
 
 			if (flags & DC_EXEC) {
-				p->engine_renew = (bool)GB(p2, 0, 1);
+				p->engine_renew = HASBIT(p2, 0);
 				if (IsLocalPlayer()) {
 					_patches.autorenew = p->engine_renew;
 					InvalidateWindow(WC_GAME_OPTIONS, 0);
@@ -749,7 +749,7 @@
 
 		case 4:
 			if (flags & DC_EXEC) {
-				p->engine_renew = (bool)GB(p1, 15, 1);
+				p->engine_renew = HASBIT(p1, 15);
 				p->engine_renew_months = (int16)GB(p1, 16, 16);
 				p->engine_renew_money = (uint32)p2;
 
@@ -762,11 +762,11 @@
 			}
 			break;
 		case 5:
-			if (p->renew_keep_length == (bool)GB(p2, 0, 1))
+			if (p->renew_keep_length == HASBIT(p2, 0))
 				return CMD_ERROR;
 
 			if (flags & DC_EXEC) {
-				p->renew_keep_length = (bool)GB(p2, 0, 1);
+				p->renew_keep_length = HASBIT(p2, 0);
 				if (IsLocalPlayer()) {
 					InvalidateWindow(WC_REPLACE_VEHICLE, VEH_TRAIN);
 				}
--- a/src/station_gui.cpp	Wed Nov 07 23:29:43 2007 +0000
+++ b/src/station_gui.cpp	Thu Nov 08 16:09:04 2007 +0000
@@ -443,7 +443,7 @@
 
 				case STATIONLIST_WIDGET_SORTBY: /*flip sorting method asc/desc*/
 					sl->flags ^= SL_ORDER; //DESC-flag
-					station_sort.order = GB(sl->flags, 0, 1);
+					station_sort.order = HASBIT(sl->flags, 0);
 					sl->flags |= SL_RESORT;
 					w->flags4 |= 5 << WF_TIMEOUT_SHL;
 					LowerWindowWidget(w, STATIONLIST_WIDGET_SORTBY);