Commit Graph

69 Commits

Author SHA1 Message Date
Peter Nelson 1dc94d0670
Codechange: Construct string_view with first+last. (#12568)
Avoids needing to calculate size when we already have last.
2024-04-24 21:29:33 +01:00
Peter Nelson a28ab8cac2
Codechange: Replace C-style casts to size_t with static_cast. (#12455)
* Codechange: Replace C-style casts to size_t with static_cast.

This touches only simple value-type casts.

* Codechange: Replace static_cast<size_t>(-1) with SIZE_MAX

Co-authored-by: Rubidium <rubidium@openttd.org>
2024-04-19 20:34:36 +01:00
Peter Nelson a4c2f0778a
Codechange: Use range-for to iterate keycode-to-name lookups. (#12429)
Replaces C-style looping.
2024-04-06 19:30:01 +01:00
Peter Nelson 69e20e79ab Codechange: Add const versions of GetItem/GetGroup, and sprinkle liberally.
Non-const version of GetItem is not needed.
2023-10-20 18:37:27 +01:00
Peter Nelson 1fecbeff76 Codechange: Remove create parameter from IniLoadFile::GetGroup.
GetGroup now only returns nullptr if the group does not exist.
Use GetOrCreateGroup to create a group.

This avoids creating groups while reading ini files.
2023-10-20 18:37:27 +01:00
Peter Nelson 6ce7195ef1 Codechange: Split GetGroup into GetGroup/GetOrCreateGroup.
This follows the pattern used for GetItem/GetOrCreateItem, and allows use
of references where we know the group must exist.
2023-10-20 18:37:27 +01:00
Peter Nelson 0c85ce29ea Codechange: Pass ini file by reference and prefer automatic storage.
This avoids new/delete operations, and (not) checking for nullptr.
2023-10-20 18:37:27 +01:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02: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
PeterN 64d6ad50f9
Codechange: Split GetItem with GetOrCreateItem. (#10952)
`IniGroup::GetItem()` returns nullptr if the item does not exist, but does not if the create parameter is set to true. Resolve CodeQL warnings with `GetOrCreateItem()` which returns a reference to the item instead.
2023-06-05 18:29:52 +00:00
PeterN f814c86389
Codechange: Reorganise hotkey initialisation. (#10951)
Hotkeys are now initialized inline, and use std::vector instead of
separate static C-arrays and std::string instead of char *. The list end
marker is no longer required.
2023-06-05 18:12:30 +01:00
Rubidium 80d8c01814 Codechange: replace std::vector + duplicate preventing include with std::set 2023-05-20 16:53:10 +02:00
Rubidium 86e5dfce3d Codechange: use std::string instead of strecat to build hotkey strings 2023-05-12 22:02:59 +02:00
Rubidium ee8b1dfbc3 Fix 4dd5f994: hotkey parsing was broken 2023-04-29 14:56:41 +02:00
Rubidium 4dd5f994be Codechange: replace strncasecmp with case ignoring variant of StrStarts/EndsWith 2023-04-29 10:25:25 +02:00
Michael Lutz dd138fc460 Codechange: Stringify config file paths. 2020-12-27 13:19:25 +01:00
dP ab420d8cc0 Change: Use key names instead of characters in hotkey.cfg 2020-09-01 09:33:17 +01:00
Michael Lutz 715aa67a9c Codechange: Use std::string in INI file parsing. 2020-05-21 20:02:34 +02:00
Konstantin Gribov 69f9529ba3 Add: Missing keycodes for hotkeys.cfg (#7850)
Added missing keycodes mapping to `_keycode_to_name` array
to allow their use in `hotkeys.cfg`.

Also reordered them according to `WindowKeyCodes` order.

Signed-off-by: Konstantin Gribov <grossws@gmail.com>
2019-12-27 08:32:34 +00: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
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 2019-03-26 20:15:57 +00:00
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
Henry Wilson 297fd3dda3 Codechange: Replaced SmallVector::Include() with include() 2019-03-26 20:15:57 +00:00
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 2019-03-26 20:15:57 +00:00
Henry Wilson 5795f66d2e Codechange: Replaced SmallVector::Contains() with std::find() pattern 2019-03-26 20:15:57 +00:00
Henry Wilson 81315939b9 Codechange: Replaced SmallVector::Find() non-const with std::find() 2019-03-26 20:15:57 +00:00
Henry Wilson a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 2019-03-26 20:15:57 +00:00
Henry Wilson bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 2019-03-26 20:15:57 +00:00
Samuel Cochran 1a73c39838 Add: BACKSPACE can be mapped as a hotkey 2018-09-16 11:36:25 +02:00
peter1138 73ea8cdb21 (svn r27816) -Fix [FS#6421]: Do not search directories when opening ini files as we already have their full path. 2017-03-20 19:30:49 +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 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 63e0ff048e (svn r25973) -Fix [FS#5679]: comma key collided with F12 key for hotkeys; also remove '+' as that is generally not a key (the '+' on the numpad is a separate one) 2013-11-13 15:54:44 +00:00
michi_cc 1567e32d89 (svn r25669) -Codechange: Pass UCS-4 instead of UCS-2 characters to the hotkey handlers. 2013-08-05 20:36:28 +00:00
frosch fef30983e6 (svn r25414) -Codechange: Move handling of global hotkeys to HotkeyList. 2013-06-15 15:31:22 +00:00
frosch 1b8b1f3f6c (svn r25410) -Codechange: Put all hotkeys of a window into a static HotkeyList member. 2013-06-15 15:28:09 +00:00
frosch d9e9710cb3 (svn r25408) -Codechange: Simplify hotkeys by removing unused stuff. 2013-06-15 15:27:33 +00:00
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 2013-01-08 22:46:42 +00:00
zuu eff4bbeb53 (svn r24554) -Add: Hotkeys for widgets in AI Debug window 2012-09-23 14:37:59 +00:00
rubidium bd64bf6372 (svn r23193) -Codechange: don't cast away const unneededly 2011-11-12 08:10:22 +00:00
rubidium 05300a00b1 (svn r22824) -Codechange: pass sub directory to ini loading 2011-08-24 13:38:26 +00:00
alberth 1dbc0a20be (svn r22144) -Codechange: Unify 'while (true)' to 'for (;;)' 2011-02-25 21:53:43 +00:00
yexo f7f3db7174 (svn r22142) -Fix (r22094): some valid keycodes were ignored along with the invalid ones 2011-02-25 13:59:02 +00:00
yexo 24753fbd35 (svn r22094) -Fix [FS#4510]: remove invalid keycodes when reading hotkeys.cfg 2011-02-17 23:14:43 +00:00
rubidium 8017c2a3d7 (svn r21909) -Fix: some missing spaces 2011-01-26 08:14:36 +00:00
rubidium 30f2afac9b (svn r20632) -Cleanup: remove "a few" unneeded includes, and add them to some headers 2010-08-26 22:01:16 +00:00
terkhen ff1c565e14 (svn r20516) -Feature [FS#3472]: Filter signs at the sign list window. (Zuu) 2010-08-16 16:15:22 +00:00
yexo 09bfbee90e (svn r20275) -Fix (r20274): some compilers are complaining about signed/unsigned comparison 2010-08-01 10:53:39 +00:00
yexo dc3271b705 (svn r20274) -Fix: special keycodes were matched if a code matched the start of the string (ie 'C' matched 'CTRL') 2010-08-01 10:42:18 +00:00