summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-06-04 07:35:12 +0000
committertron <tron@openttd.org>2005-06-04 07:35:12 +0000
commit1273f21ff58b0746584b02c0608962ef5b677a7c (patch)
tree88285fef5e7b9d4fce88501d60b958183e8e1a9a
parent793eba3a3a2fac64e0e4bd860d8c04d75061abd4 (diff)
downloadopenttd-1273f21ff58b0746584b02c0608962ef5b677a7c.tar.xz
(svn r2405) Simplify a few '? true : false' and '? false : true', especially the latter is confusing
-rw-r--r--console.c2
-rw-r--r--network.c2
-rw-r--r--network_gui.c6
-rw-r--r--unix.c2
-rw-r--r--win32.c4
5 files changed, 8 insertions, 8 deletions
diff --git a/console.c b/console.c
index 6239e4b60..e2b7c122b 100644
--- a/console.c
+++ b/console.c
@@ -473,7 +473,7 @@ bool GetArgumentInteger(uint32 *value, const char *arg)
}
*value = strtoul(arg, &endptr, 0);
- return (arg == endptr) ? false : true;
+ return arg != endptr;
}
// * ************************* * //
diff --git a/network.c b/network.c
index 91b99480e..3dcff1b30 100644
--- a/network.c
+++ b/network.c
@@ -925,7 +925,7 @@ static void NetworkInitGameInfo(void)
_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)
diff --git a/network_gui.c b/network_gui.c
index 44ff45f91..25f308616 100644
--- a/network_gui.c
+++ b/network_gui.c
@@ -488,7 +488,7 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e)
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 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e)
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 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e)
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;
}
diff --git a/unix.c b/unix.c
index 9a0464498..84c3365b7 100644
--- a/unix.c
+++ b/unix.c
@@ -559,7 +559,7 @@ bool InsertTextBufferClipboard(Textbuf *tb)
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;}
diff --git a/win32.c b/win32.c
index 2b9e7c005..712dd54b4 100644
--- a/win32.c
+++ b/win32.c
@@ -2251,7 +2251,7 @@ bool CreateOTTDThread(void *func, void *param)
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 @@ void JoinOTTDThread(void)
if (hThread == NULL) return;
WaitForSingleObject(hThread, INFINITE);
-} \ No newline at end of file
+}