diff options
author | tron <tron@openttd.org> | 2005-02-05 22:50:33 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-02-05 22:50:33 +0000 |
commit | 7aae12d55db82fc5faeed1cfcf5e4f460a277218 (patch) | |
tree | 68059d4827f8ac3262d8aecaf7170b7109c27180 | |
parent | 4d62bbf857ed840c62d54428111aa5de6811d4bb (diff) | |
download | openttd-7aae12d55db82fc5faeed1cfcf5e4f460a277218.tar.xz |
(svn r1808) Use strcmp() instead of home brewed function str_eq()
-rw-r--r-- | macros.h | 10 | ||||
-rw-r--r-- | misc.c | 2 | ||||
-rw-r--r-- | misc_gui.c | 3 | ||||
-rw-r--r-- | network_gui.c | 2 | ||||
-rw-r--r-- | players.c | 2 | ||||
-rw-r--r-- | town_cmd.c | 2 |
6 files changed, 6 insertions, 15 deletions
@@ -26,16 +26,6 @@ static inline int clamp2(int a, int min, int max) { if (a <= min) a=min; if (a > static inline bool int32_add_overflow(int32 a, int32 b) { return (int32)(a^b)>=0 && (int32)(a^(a+b))<0; } static inline bool int32_sub_overflow(int32 a, int32 b) { return (int32)(a^b)<0 && (int32)(a^(a-b))<0; } -static inline bool str_eq(const byte *a, const byte *b) -{ - int i=0; - while (a[i] == b[i]) { - if (a[i] == 0) - return true; - i++; - } - return false; -} // Will crash if strings are equal static inline bool str_is_below(byte *a, byte *b) { @@ -352,7 +352,7 @@ StringID RealAllocateName(const byte *name, byte skip, bool check_double) if (free_item == -1) free_item = i; } else { - if (check_double && str_eq(names, name)) { + if (check_double && strcmp(names, name) == 0) { _error_message = STR_0132_CHOSEN_NAME_IN_USE_ALREADY; return 0; } diff --git a/misc_gui.c b/misc_gui.c index 8a5ef640e..6dcb30c65 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -896,7 +896,8 @@ static void QueryStringWndProc(Window *w, WindowEvent *e) case 3: DeleteWindow(w); break; case 4: press_ok:; - if (str_eq(WP(w,querystr_d).buf, WP(w,querystr_d).buf + MAX_QUERYSTR_LEN) && !_do_edit_on_text_even_when_no_change_to_edit_box) { + if (strcmp(WP(w,querystr_d).buf, WP(w,querystr_d).buf + MAX_QUERYSTR_LEN) == 0 && + !_do_edit_on_text_even_when_no_change_to_edit_box) { DeleteWindow(w); } else { byte *buf = WP(w,querystr_d).buf; diff --git a/network_gui.c b/network_gui.c index 72204b185..f5aea33e3 100644 --- a/network_gui.c +++ b/network_gui.c @@ -1368,7 +1368,7 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e) case 3: DeleteWindow(w); break; // Cancel case 2: // Send press_ok:; - if (str_eq(WP(w,querystr_d).buf, WP(w,querystr_d).buf + MAX_QUERYSTR_LEN)) { + if (strcmp(WP(w,querystr_d).buf, WP(w,querystr_d).buf + MAX_QUERYSTR_LEN) == 0) { DeleteWindow(w); } else { byte *buf = WP(w,querystr_d).buf; @@ -436,7 +436,7 @@ restart:; if (pp->is_active && p != pp) { SetDParam(0, pp->president_name_2); GetString(buffer2, pp->president_name_1); - if (str_eq(buffer2, buffer)) + if (strcmp(buffer2, buffer) == 0) goto restart; } } diff --git a/town_cmd.c b/town_cmd.c index 39a68b527..ad7dd4847 100644 --- a/town_cmd.c +++ b/town_cmd.c @@ -879,7 +879,7 @@ restart: if (t2->xy != 0) { SetDParam(0, t2->townnameparts); GetString(buf2, t2->townnametype); - if (str_eq(buf1, buf2)) + if (strcmp(buf1, buf2) == 0) goto restart; } } |