(svn r2405) Simplify a few '? true : false' and '? false : true', especially the latter is confusing
authortron
Sat, 04 Jun 2005 07:35:12 +0000
changeset 1899 98317b840d7b
parent 1898 b9fe2a5b7e13
child 1900 f409d5517cb0
(svn r2405) Simplify a few '? true : false' and '? false : true', especially the latter is confusing
console.c
network.c
network_gui.c
unix.c
win32.c
--- a/console.c	Fri Jun 03 22:43:59 2005 +0000
+++ b/console.c	Sat Jun 04 07:35:12 2005 +0000
@@ -473,7 +473,7 @@
 	}
 
 	*value = strtoul(arg, &endptr, 0);
-	return (arg == endptr) ? false : true;
+	return arg != endptr;
 }
 
 // * ************************* * //
--- a/network.c	Fri Jun 03 22:43:59 2005 +0000
+++ b/network.c	Sat Jun 04 07:35:12 2005 +0000
@@ -925,7 +925,7 @@
 	_network_game_info.map_height = MapSizeY();
 	_network_game_info.map_set = _opt.landscape;
 
-	_network_game_info.use_password = (_network_server_password[0] == '\0') ? 0 : 1;
+	_network_game_info.use_password = (_network_server_password[0] != '\0');
 
 	// We use _network_client_info[MAX_CLIENT_INFO - 1] to store the server-data in it
 	//  The index is NETWORK_SERVER_INDEX ( = 1)
--- a/network_gui.c	Fri Jun 03 22:43:59 2005 +0000
+++ b/network_gui.c	Sat Jun 04 07:35:12 2005 +0000
@@ -488,7 +488,7 @@
 	switch (e->event) {
 	case WE_CREATE: /* focus input box */
 		_selected_field = 3;
-		_network_game_info.use_password = (_network_server_password[0] == '\0') ? 0 : 1;
+		_network_game_info.use_password = (_network_server_password[0] != '\0');
 		break;
 
 	case WE_PAINT: {
@@ -591,7 +591,7 @@
 	case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */
 		switch(e->dropdown.button) {
 			case 8:
-				_network_advertise = (e->dropdown.index == 0) ? false : true;
+				_network_advertise = (e->dropdown.index != 0);
 				break;
 			case 10:
 				_network_game_info.clients_max = e->dropdown.index + 2;
@@ -617,7 +617,7 @@
 	case WE_ON_EDIT_TEXT: {
 		const char *b = e->edittext.str;
 		ttd_strlcpy(_network_server_password, b, sizeof(_network_server_password));
-		_network_game_info.use_password = (_network_server_password[0] == '\0') ? 0 : 1;
+		_network_game_info.use_password = (_network_server_password[0] != '\0');
 		SetWindowDirty(w);
 	} break;
 	}
--- a/unix.c	Fri Jun 03 22:43:59 2005 +0000
+++ b/unix.c	Sat Jun 04 07:35:12 2005 +0000
@@ -559,7 +559,7 @@
 static pthread_t thread1 = 0;
 bool CreateOTTDThread(void *func, void *param)
 {
-	return (pthread_create(&thread1, NULL, func, param) == 0) ? true : false;
+	return pthread_create(&thread1, NULL, func, param) == 0;
 }
 
 void CloseOTTDThread(void) {return;}
--- a/win32.c	Fri Jun 03 22:43:59 2005 +0000
+++ b/win32.c	Sat Jun 04 07:35:12 2005 +0000
@@ -2251,7 +2251,7 @@
 	hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, param, 0, &dwThreadId);
 	SetThreadPriority(hThread, THREAD_PRIORITY_BELOW_NORMAL);
 
-	return (hThread == NULL) ? false : true;
+	return hThread != NULL;
 }
 
 void CloseOTTDThread(void)
@@ -2264,4 +2264,4 @@
 	if (hThread == NULL) return;
 
 	WaitForSingleObject(hThread, INFINITE);
-}
\ No newline at end of file
+}