Commit Graph

190 Commits (a19a43a4f73046e72db1843b189c604f0d00c925)

Author SHA1 Message Date
Rubidium a19a43a4f7 Codechange: use fmt::format and time conversions over "custom" implementation 1 year ago
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 1 year ago
Rubidium 68ff3fd062 Change: include fmt.h C++ headers in stdafx.h
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
1 year ago
Rubidium 4dd5f994be Codechange: replace strncasecmp with case ignoring variant of StrStarts/EndsWith 1 year ago
PeterN 57f2d70fef
Change: Use cstdint instead of rolling our own types. (#10651) 1 year ago
Rubidium 75cd790ab9 Codechange: use fmt::format for FormatHexNumber 1 year ago
Charles Pigott 80bd5ad727
Codechange: Use std::strto* variants everywhere (#10720) 1 year ago
Rubidium f74e26ca7e Codechange: replace error/usererror printf variant with fmt variant and rename 1 year ago
Rubidium dfe52da1ea Codechange: use string/fmt instead of print for strgen warnings/errors/fatals 1 year ago
Charles Pigott 6fc28d649e Cleanup: Unused alloca definitions and includes 1 year ago
Patric Stout 5e1bcee39b Codechange: introduce a framework for all our timers
IntervalTimer and TimeoutTimer use RAII, and can be used to replace
all the time-based timeouts, lag-detection, "execute every N" we
have.
As it uses RAII, you can safely use it as static variable, class
member, temporary variable, etc. As soon as it goes out-of-scope,
it will be safely removed.
This allows for much easier to read code when it comes to intervals.
1 year ago
Rubidium b7a5d8e296 Codechange: add annotation to selectively force inlining in debug build 1 year ago
dP 548f0496a9
Change: Make _tick_counter 64bit to avoid wrapping (#10035) 2 years ago
glx22 bba6ad1f4e Fix #9935: Use more selectivity when building SSE specific code 2 years ago
rubidium42 a99ac62c1a Codechange: use the fmt library for simpler debug formats 3 years ago
Patric Stout 28e90769f7 Codechange: use "[[maybe_unused]]" instead of a wide variety of other ways we had
While at it, replace OTTD_ASSERT with WITH_ASSERT, as this
is always set if assert() is valid. No matter if NDEBUG is set
or not.
3 years ago
Patric Stout f8dd5dd00a Codechange: remove unused assert_msg() macro 3 years ago
milek7 7607277380 Fix: Network on Haiku, remove old code for BeOS 3 years ago
rubidium42 aa5a8fe28a Codechange: use thread safe time functions
Functions like localtime, gmtime and asctime are not thread safe as they (might) reuse the same buffer. So use the safer _s/_r variant for localtime and gmtime, and use strftime in favour of asctime.
3 years ago
embeddedt a879996012
Fix: [Emscripten] Use non-XDG directories to simplify lolac storage (#9207) 3 years ago
Loïc Guilloux 356bbbb90a
Fix: [MinGW] Set minimum OS version to Windows XP (#9135) 3 years ago
Milek7 8e9eca6ddd
Codechange: Use __attribute__ access none to silence GCC 11 -Wmaybe-uninitialized warnings (#9124) 3 years ago
Wim Leflere 9aebfca083
Fix: clang-cl build (#9018)
Remove macro redefinitions
Add final and fallthrough attributes for clang-cl
3 years ago
Niels Martin Hansen 746f1ca11a Codechange: Remove the now meaningless console_cp parameter from OTTD2FS 3 years ago
Niels Martin Hansen e0561dbded Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of static buffers 3 years ago
Niels Martin Hansen b427ddce88 Codechange: Switch to explicit wide strings 3 years ago
Joe Stringer d21442941c Fix: [Cygwin] Fix missing uint definition
In file included from src/settingsgen/../string_func.h:30,
                 from src/settingsgen/settingsgen.cpp:11:
src/settingsgen/../core/bitmath_func.hpp:34:15: error: 'uint' does not name a type; did you mean 'uint8'?
   34 | static inline uint GB(const T x, const uint8 s, const uint8 n)
      |               ^~~~
      |               uint8
3 years ago
Michael Lutz f137b3057a Codechange: [Win32] Increase SDK version for 32-bit target.
Use the same Windows XP target as for 64-bit. Current MSVC version will
not produce a binary that works on anything earlier anyway.
3 years ago
Michael Lutz 84636fc2af Codechange: Remove all remaining uses of cpp_offset. 3 years ago
Patric Stout fda1fbf61c
Revert c1fddb9, 639cfa4: "Codechange: Check if access __attribute__ is supported before trying to use it." (#8526)
This reverts commit c1fddb9a6a and 639cfa43d2.

access_mode "none" is only supported by GCC11, but introduced
after it branched. So there are GCC11.0s out there that do not
support it. We will have to wait for GCC11.1 to hit before we
can re-add this.
3 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 3 years ago
milek7 c1fddb9a6a Codechange: Check if access __attribute__ is supported before trying to use it. 3 years ago
milek7 639cfa43d2 Codechange: Use access __attribute__ to silence warnings in GCC 3 years ago
Charles Pigott 3dfee979a7 Codechange: Drop libxdg-basedir dependency in favour of finding the directories ourselves 3 years ago
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 3 years ago
Jonathan G Rennison 0e017f6233 Codechange: Enable FINAL, (un)likely, __attribute__ when building with clang 3 years ago
Jonathan G Rennison fc52d3df50 Codechange: Use likely/__builtin_expect for assertion macros 3 years ago
Jonathan G Rennison 5cf28be742 Codechange: Add support for verbose asserts 3 years ago
Jonathan G Rennison eb74179c6d Codechange: Unconditionally use static_assert
We're well past having to support non-C++11 compliant compilers now.
3 years ago
Charles Pigott 52f3abba6e Cleanup: Remove unnecessary assert_tcompile macro 3 years ago
TechGeekNZ 716c883737 Fix: Globally apply preprocessor directive coding style
Global; except for the 32-bit SSE blitter, which has some #DEFINEs
in not-very-nice places.
4 years ago
Niels Martin Hansen 9895ced6af Fix: Silence some warnings when building with clang-cl on VS 2019
Clang-cl presents as both _MSC_VER and __clang__ in the preprocessor which makes some things confusing.
4 years ago
Patric Stout 56d54cf60e Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.

Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.

This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.

Addtiionally, this heavily improves our detection of libraries, etc.
4 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
Joe Stringer 66c32533ec Fix: [Cygwin] Fix missing definitions in stdafx
Fix the following compile errors:

In file included from openttd/src/debug.h:15:0,
                 from openttd/src/string.cpp:13:
openttd/src/cpu.h:35:19: error: 'uint' was not declared in this scope
 bool HasCPUIDFlag(uint type, uint index, uint bit);

openttd/src/string.cpp: In function 'char* strcasestr(const char*, const char*)':
openttd/src/string.cpp:548:7: error: 'strncasecmp' was not declared in this scope
   if (strncasecmp(haystack, needle, needle_len) == 0) return const_cast<char *>(haystack);

openttd/src/strgen/strgen_base.cpp: In function 'void EmitPlural(Buffer*, char*, int)':
openttd/src/core/alloc_func.hpp:136:6: error: 'alloca' was not declared in this scope
  (T*)alloca((num_elements) * sizeof(T)))

Signed-off-by: Joe Stringer <joe@wand.net.nz>
5 years ago
glx22 846fc8fe09
Fix: vcpkg used to patch lzma.h to define LZMA_API_STATIC for static builds (#7614) 5 years ago
glx22 cef9a76c3f
Fix #7553: check bounds when loading strings (#7554) 5 years ago
Michael Lutz baf9229931 Codechange: Replace AutoDeleteSmallVector with direct std::vector use in text layout code. 5 years ago
Patric Stout 72c5f2b3ee Remove: DOS support
In 10 years there was no active development on DOS. Although it
turned out to still work, the FPS was very bad. There is little
interest in the current community to look into this.

Further more, we like to switch to c++11 functions for threads,
which are not implemented by DJGPP, the only current compiler
for DOS.

Additionally, DOS is the only platform which does not support
networking. It is the reason we have tons of #ifdefs to support
disabling networking.

By removing DOS support, we can both use c++11 functions for threads,
and remove all the code related to disabling network. Sadly, this
means we have to see DOS go.

Of course, if you feel up for the task, simply revert this commit,
and implement stub c++11 functions for threads and stub functions
for networking. We are more than happy to accept such Pull Request.
5 years ago
Patric Stout 1c5ea33099 Fix: warnings when compiling for a recent version of Haiku
This might break older Haiku versions, but it is hard to tell.
5 years ago