Commit Graph

148 Commits

Author SHA1 Message Date
Peter Nelson c18a1494b7
Codechange: Remove FONT_HEIGHT_... macros. (#11481)
These make it look like we're dealing with a constant, but actually each is a call to `GetCharacterHeight(...)`.
2023-11-21 19:04:24 +00:00
Michael Lutz 071fdab236 Codechange: Replicate cursor screen backup to chat message display, removing explicit memory management.
Incidentally, this makes Blitter::GetBytesPerPixel unneeed.
2023-11-04 16:08:34 +01:00
Peter Nelson 18fb8e153f Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
This is to allow unit-tests to produce more useful output.
2023-11-02 22:25:01 +00:00
Rubidium 37f84b7372 Codechange: replace x.size() != 0 with !x.empty() 2023-10-20 23:05:43 +02:00
Peter Nelson f379b31e28 Add: data parameter in Window::Close method.
This allows passing data when closing a window, e.g. to indicate how it was closed.
2023-10-13 20:47:28 +01:00
frosch b5885295f0 Codechange: Use parameters, which should be used. 2023-09-19 22:49:59 +02:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Peter Nelson e8015e497d Codechange: Use begin/end of nwidget parts of begin/length.
This simplifies processing nwidget parts as, unlike the remaining length, the pointer to the end of the list never changes. This is the same principle as we use(d) for tracking end instead of length for C-style strings.

And this removes 160~ instances of the lengthof() macro.
2023-09-04 10:20:45 +01:00
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Rubidium a47de4b2ab Cleanup: remove DRAW_STRING_BUFFER constant 2023-06-06 18:08:11 +02:00
Rubidium c518293135 Codechange: replace printf with fmt::print 2023-05-21 15:12:02 +02:00
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 2023-05-17 10:14:41 +01:00
Rubidium a372c59483 Codechange: replace C-style (stredup) chat completion with std::string_view 2023-05-13 22:33:27 +02:00
Rubidium 4dd5f994be Codechange: replace strncasecmp with case ignoring variant of StrStarts/EndsWith 2023-04-29 10:25:25 +02:00
Rubidium 3105d0b09e Codechange: replace text-buf printf with fmt::format 2023-04-26 18:46:17 +02:00
Patric Stout 1ba4dcc924 Codechange: migrate all Window-related timers to the new framework
This means we also say goodbye to GUITimers.
2023-04-15 13:58:55 +02:00
Patric Stout 1fb101eabb
Codechange: address CodeQL issue "Multiplication result converted to larger type" (#10306)
Most are very unlikely to ever be triggered in our codebase; two
stand out: linkgraph and money cheat. Those, potentially, could
wrap earlier than expected.
2023-01-02 20:30:02 +00:00
PeterN 131b7f5127
Fix: Vertically centre chat prompt. (#10250) 2022-12-17 12:22:02 +00:00
Peter Nelson 890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter Nelson 296af146fb Change: Default widget text colour to black.
TC_FROMSTRING really means blue, and we almost never actually use
blue text.
2022-10-16 14:24:51 +02:00
dP 31cf9e888b
Add: [Network] external chat messages for remote admins (#9563) 2021-09-19 23:09:06 +02:00
glx22 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 2021-05-29 21:08:25 +02:00
glx22 994bf19aef Fix f6d5c01: Delay deletion when closing windows 2021-05-29 21:08:25 +02:00
rubidium42 4d246cda73 Codechange: [Network] Let NetworkClientInfo use std::string 2021-05-16 10:07:51 +02:00
rubidium42 fab120ee83 Codechange: [Network] Let chat communication use std::string 2021-05-15 10:20:50 +02:00
rubidium42 44ca7d9377 Change: Use gender-neutral pronouns 2021-05-15 10:16:48 +02:00
rubidium42 e2774354b4
Codechange: [Network] Change ChatMessage's message to std::string and simplify some code 2021-05-08 10:19:42 +02:00
Loïc Guilloux 356bbbb90a
Fix: [MinGW] Set minimum OS version to Windows XP (#9135) 2021-04-29 14:26:08 +02:00
Peter Nelson 9aa64b7885 Codechange: Use new widget features on chat message box. 2021-04-22 16:42:04 +01:00
Peter Nelson cb9f56df0c Feature: Show previous chat history when the chat message box is open 2021-04-16 20:25:46 +02:00
Peter Nelson fbef63822c Codechange: Use std::deque for chat history instead of fixed array 2021-04-16 20:25:46 +02:00
Patric Stout 53c28a8ec9 Codechange: [Network] replace _realtime_tick with std::chrono 2021-02-27 00:36:14 +01:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 2020-12-27 10:55:42 +00:00
glx ee7a8eebca Codechange: Replace FOR_ALL_TOWNS with range-based for loops 2019-12-21 20:13:03 +01:00
glx 41232f18c1 Codechange: Replace network related FOR_ALL with range-based for loops 2019-12-21 20:13:03 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
peter1138 317f69c152 Codechange: Use override specifier in Window-derived classes. 2019-03-24 16:10:04 +01:00
Patric Stout e3c639a09f Remove: ENABLE_NETWORK switch
This switch has been a pain for years. Often disabling broke
compilation, as no developer compiles OpenTTD without, neither do
any of our official binaries.

Additionaly, it has grown so hugely in our codebase, that it
clearly shows that the current solution was a poor one. 350+
instances of "#ifdef ENABLE_NETWORK" were in the code, of which
only ~30 in the networking code itself. The rest were all around
the code to do the right thing, from GUI to NewGRF.

A more proper solution would be to stub all the functions, and
make sure the rest of the code can simply assume network is
available. This was also partially done, and most variables were
correct if networking was disabled. Despite that, often the #ifdefs
were still used.

With the recent removal of DOS, there is also no platform anymore
which we support where networking isn't working out-of-the-box.

All in all, it is time to remove the ENABLE_NETWORK switch. No
replacement is planned, but if you feel we really need this option,
we welcome any Pull Request which implements this in a way that
doesn't crawl through the code like this diff shows we used to.
2019-03-20 19:24:55 +01:00
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 2017-08-13 18:38:42 +00:00
peter1138 ed01e81c42 (svn r27794) -Fix [FS#6526]: Chat text background overflowed due to missing padding. 2017-03-14 00:57:52 +00:00
frosch e113f5e4a1 (svn r27146) -Fix: Make statusbar and chat-entry window use the same width as the toolbar. Otherwise they lack a size definition. 2015-02-13 21:13:45 +00:00
frosch 2f7de4fd99 (svn r27144) -Change: The chatbox-width setting now uses percent of screen width instead of pixels. 2015-02-12 20:00:23 +00:00
rubidium b476086c39 (svn r26538) -Codechange: remove double accounting of the drivers 2014-04-28 21:06:51 +00:00
rubidium 9ed12b0f07 (svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL) 2014-04-25 15:40:32 +00:00
rubidium e61fe21237 (svn r26506) -Codechange: replace most of vsnprintf with vseprintf 2014-04-24 19:51:45 +00:00
rubidium 5b82822c12 (svn r26486) -Codechange: replace a number of snprintfs with seprintf 2014-04-23 21:12:09 +00:00
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00
rubidium 2618d960e3 (svn r26209) -Codechange: remove some template magic and simplify some code 2014-01-02 22:41:58 +00:00