diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 7a21aa82f3..7fcccb42c4 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2747,7 +2747,7 @@ static PBSTileInfo ExtendTrainReservation(const Vehicle *v, TrackBits *new_track if (!TryReserveRailTrack(tile, TrackdirToTrack(cur_td))) break; } - if (ft.m_err == CFollowTrackRail::EC_OWNER && ft.m_err == CFollowTrackRail::EC_NO_WAY) { + if (ft.m_err == CFollowTrackRail::EC_OWNER || ft.m_err == CFollowTrackRail::EC_NO_WAY) { /* End of line, path valid and okay. */ return PBSTileInfo(ft.m_old_tile, ft.m_old_td, true); } diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index 2bbb96c634..9016c93e80 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -289,7 +289,7 @@ static bool MakeWindow(bool full_screen) } else { TCHAR Windowtitle[50]; - _sntprintf(Windowtitle, sizeof(Windowtitle), _T("OpenTTD %s"), MB_TO_WIDE(_openttd_revision)); + _sntprintf(Windowtitle, lengthof(Windowtitle), _T("OpenTTD %s"), MB_TO_WIDE(_openttd_revision)); _wnd.main_wnd = CreateWindow(_T("OTTD"), Windowtitle, style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0); if (_wnd.main_wnd == NULL) usererror("CreateWindow failed"); diff --git a/src/win32.cpp b/src/win32.cpp index 9ee8c30006..acdaab87d4 100644 --- a/src/win32.cpp +++ b/src/win32.cpp @@ -530,7 +530,7 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep) ep->ContextRecord->EFlags ); #else - output += sprintf(output, "Exception %.8X at %.8X\r\n" + output += sprintf(output, "Exception %.8X at %.8p\r\n" "Registers:\r\n" " EAX: %.8X EBX: %.8X ECX: %.8X EDX: %.8X\r\n" " ESI: %.8X EDI: %.8X EBP: %.8X ESP: %.8X\r\n" @@ -596,9 +596,9 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep) output = PrintModuleList(output); { - OSVERSIONINFO os; + _OSVERSIONINFOA os; os.dwOSVersionInfoSize = sizeof(os); - GetVersionEx(&os); + GetVersionExA(&os); output += sprintf(output, "\r\nSystem information:\r\n" " Windows version %d.%d %d %s\r\n\r\n", os.dwMajorVersion, os.dwMinorVersion, os.dwBuildNumber, os.szCSDVersion); @@ -804,7 +804,7 @@ void FiosGetDrives() TCHAR drives[256]; const TCHAR *s; - GetLogicalDriveStrings(sizeof(drives), drives); + GetLogicalDriveStrings(lengthof(drives), drives); for (s = drives; *s != '\0';) { FiosItem *fios = _fios_items.Append(); fios->type = FIOS_TYPE_DRIVE;