Commit Graph

502 Commits

Author SHA1 Message Date
Rubidium
7ed90a859f Codechange: function to check whether string parameters have changed since the backup 2023-07-03 00:00:12 +02:00
Rubidium
05ef3f0998 Cleanup: remove old backup/restore of string parameters 2023-07-02 22:31:01 +02:00
Rubidium
2687704afc Codechange: introduce new type and functions for StringParameter backups 2023-07-02 22:31:01 +02:00
PeterN
c3fbe7bea8
Cleanup: Use FS enum instead of magic numbers. (#11088) 2023-06-30 20:11:09 +00:00
Rubidium
75a22a1c83 Codechange: move from GetIntXY to GetNextParameter<XYY> 2023-06-27 12:34:40 +02:00
Rubidium
e7937efb01 Codechange: add clearer named function to get the next (string) parameter 2023-06-27 12:34:40 +02:00
Rubidium
4e9a871718 Codechange: merge multiple string parameter arrays to single array of structs 2023-06-21 05:46:11 +02:00
Rubidium
fa8c50758b Codechange: replace memcpy when copying DParams 2023-06-21 05:46:11 +02:00
Rubidium
7a785a4224 Codechange: simplify StringParameters now type cannot be nullptr 2023-06-20 22:25:25 +02:00
Rubidium
428333aeba Codechange: let AllocatedStringParameters allocated types too 2023-06-20 22:25:25 +02:00
Rubidium
9f3254b72a Fix b1fb209: build failure due to removed parameter 2023-06-20 21:32:04 +02:00
glx22
b1fb209bed Add: {COLOUR} control code to allow colour changes at runtime 2023-06-20 19:05:10 +02:00
Rubidium
88138c55f8 Codechange: make offset protected and guard against invalid offsets 2023-06-20 17:37:49 +02:00
Rubidium
9c3c90effa Codechange: rename ClearTypeInformation so it can be used for preparing for the next run 2023-06-20 17:37:49 +02:00
Rubidium
01abcdfcac Codechange: make StringParameters#next_type only writable from outside the class 2023-06-20 17:37:49 +02:00
Rubidium
3e8f8c55c2 Codechange: make creating temporary StringParameters easier 2023-06-20 17:37:24 +02:00
Rubidium
381e8b69d2 Codechange: make size and offset size_t 2023-06-18 09:50:11 +02:00
Rubidium
4e6733cc6e Codechange: use args.GetParam(offset) over *args.GetPointerToOffset(offset) 2023-06-18 07:10:10 +02:00
Rubidium
e404ba0631 Codechange: generify GetRemainingParameters to allow custom offsets 2023-06-18 07:09:59 +02:00
Rubidium
ad048b143a Codechange: move implementation of Set/GetDParam to strings.cpp 2023-06-17 12:14:11 +02:00
Rubidium
dd53a738bb Codechange: automatically set/check the correct type for string parameters/genders 2023-06-17 11:02:31 +02:00
Rubidium
0a5e58451b Codechange: pass string parameters by reference 2023-06-14 06:14:08 +02:00
Rubidium
e332810231 Codechange: pass zero length arguments for {STRING}, instead of the remaining arguments 2023-06-13 23:53:13 +02:00
Rubidium
aba0d27a28 Codechange: use StringParameters for remapping the NewGRF string control codes 2023-06-13 22:11:21 +02:00
Rubidium
1146904d45 Fix: when a string consumes more parameters than allowed, nullptr is attempted to be formatted 2023-06-13 20:58:45 +02:00
Rubidium
6c6f365d2f Codechange: remove offset parameter for copying DParams in and out 2023-06-11 17:03:31 +02:00
Rubidium
66a984afd7 Codechange: rename function to better describe its functionality 2023-06-09 06:41:52 +02:00
Rubidium
13cdf5fffa Codechange: use std::filesystem::path for the language file's path 2023-06-08 23:20:28 +02:00
Rubidium
b2a8d8aea4 Codechange: use std::string for Windows' ISO code mangling 2023-06-07 08:27:18 +02:00
Rubidium
edb21620ea Cleanup: remove unneeded checks on remaining buffer size 2023-06-05 23:26:12 +02:00
Rubidium
affceea0ae Codechange: switch StringBuilder to use std::string as backend 2023-06-05 23:26:12 +02:00
Rubidium
14915526ad Cleanup: remove stre-style GetString 2023-06-05 11:23:31 +02:00
Rubidium
4e39a58c59 Codechange: let town name generation use StringBuilder 2023-06-04 21:42:59 +02:00
rubidium42
bfcb027cb9
Fix 2dffa7d: fmt::format_to copies the iterator, so some text does not remain during formatting (#10940) 2023-06-04 19:55:47 +02:00
Rubidium
36aaa9d683 Codechange: let GetStringWithArgs use StringBuilder 2023-06-04 18:00:23 +02:00
Rubidium
2dffa7d0c6 Codechange: let FormatString use StringBuilder 2023-06-04 15:06:52 +02:00
PeterN
ac1d042550
Remove: obsolete NewGRF text unprinting. (#10884)
Co-authored-by: Rubidium <rubidium@openttd.org>
2023-06-04 13:14:56 +02:00
Rubidium
c384d829fe Codechange: let number formatting use StringBuilder 2023-06-04 12:24:37 +02:00
Peter Nelson
76516d7f70 Codechange: Use IsValidCargoID/IsValidCargoType.
IsValidCargoType() is used only for unmapped IDs.
2023-05-22 20:43:40 +01:00
Rubidium
63d9bb93b8 Codechange: migrate from C-style GetString to C++-style GetString 2023-05-21 21:17:12 +02:00
Peter Nelson
bf9caa425b Change: Units-system can convert from N to kN, don't preconvert.
This allows force to passed as is and avoid premature rounding.

The AI function "GetMaxTractiveEffort" still needs to return kN to avoid breaking the API.
2023-05-09 23:02:51 +02:00
Peter Nelson
e2f583a34f Change: Standardise unit conversions and allow decimal places.
Previously the decimal_places member was mostly ignored except for
specific conversions. {DECIMAL} with 0 is the same as {COMMA} so there
is no downside to allowing any conversion to have decimals.
2023-05-09 23:02:51 +02:00
Peter Nelson
3c2f87ce1f Change: Perform unit convert with a double-precision constant.
Unit conversion is only performed for display purposes, this does not
affect lock-step mechanics.

This replaces the old multiply and shift algorithm which relies on
choosing a multipler and shift combination that gets close. Some of these
multiply/shift combinations were quite inaccurate. We can just
use (close-to) real-world numbers instead.
2023-05-09 23:02:51 +02:00
Patric Stout
febe394806
Codechange: replace C-style strings with C++-style strings in textfile (#10772) 2023-05-09 19:35:50 +00:00
Tyler Trahan
6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar (#10753) 2023-05-04 13:14:12 +00:00
Patric Stout
81d4fa6999 Feature: drop ICU-lx in favour of directly interfacing with harfbuzz
This means we have RTL support again with ICU 58+. It makes use of:
- ICU for bidi-itemization
- ICU for script-itemization
- OpenTTD for style-itemization
- harfbuzz for shaping
2023-05-01 22:17:56 +02:00
Rubidium
8665404fe0 Codechange: use std::string instead of stredup for missing glyph error messages 2023-05-01 16:23:24 +02:00
Tyler Trahan
ba3de0383a
Codechange: Pass more std::string to StringFilter::AddLine() (#10743) 2023-04-30 10:23:05 +02:00
Rubidium
c829930440 Codechange: replace strnatcmp with C++ string capable version 2023-04-29 12:07:45 +02:00
Rubidium
75cd790ab9 Codechange: use fmt::format for FormatHexNumber 2023-04-26 18:46:17 +02:00
Charles Pigott
80bd5ad727
Codechange: Use std::strto* variants everywhere (#10720) 2023-04-26 12:56:14 +01:00
Tyler Trahan
930f0a16d8 Codechange: Define Date/Year/Month/Day within TimerGameCalendar class 2023-04-26 07:14:03 -04:00
Rubidium
f74e26ca7e Codechange: replace error/usererror printf variant with fmt variant and rename 2023-04-25 17:55:09 +02:00
Charles Pigott
e20a6f8ebb
Codechange: Optimise FormatNumber by removing seprintf calls (#10659) 2023-04-17 00:04:24 +02:00
Rubidium
29b09523d1 Codechange: Use {ZEROFILL_NUM} instead of custom seprintf + {RAW_STRING} 2023-04-16 21:06:20 +02:00
PeterN
3b2eb11fe8
Codechange: Use cached name for all station/industry/town name formatting. (#10634)
This reuses an existing name caching mechanism to avoid "recalculating" names every time.
2023-04-11 22:50:22 +02:00
PeterN
f1144de509
Feature: Separate rail/road and sea/air velocity units, and add knots. (#10594)
This is achieved by packing vehicle type along with the velocity so that
the string system can decode and pick the appropriate unit.
2023-04-08 12:26:13 -04:00
Jonathan G Rennison
43cea852a6 Fix 41b414b: Validate RAW_STRING parameter values in game_script mode 2023-04-08 00:14:12 +02:00
glx22
41b414bc1c Change: [Script] Restore support of {RAW_STRING} in ScriptText 2023-02-28 18:53:17 +01:00
Michael Lutz
05ed9f56fd Feature: [NewGRF] Engine name callback. 2023-01-30 22:00:56 +01:00
rubidium42
6ba55e663e Codechange: do not hide variables with other variables 2023-01-29 07:21:34 +01:00
Henry Wilson
59dbcdb5ba Feature: Display power-to-weight ratio in ground vehicle details GUI 2022-11-08 21:02:08 +01:00
Peter Nelson
f6ad8e1c9c Change: Rename some freetype things to fontcache.
The font cache supports more than just FreeType as a font provider, but still used freetype in some naming.

This now uses more suitable terms.
2022-09-25 18:34:24 +01:00
frosch
5f6303f985
Fix: don't complain when the sprite font is missing glyphs. (#9692)
Silently auto-pick a suitable font.
2021-11-13 21:01:16 +01:00
Rubidium
3e4d327451 Codechange: use the C++ std::getenv over the POSIX/C getenv
The C++ std::getenv is guaranteed thread-safe by the C++11 specification,
whereas the POSIX/C getenv might not be thread-safe by the C11 specification.
2021-07-10 22:55:46 +02:00
rubidium42
979783f90e Codechange: replace InjectDParam/ShiftParameters by setting the right parameter values in the first place 2021-07-03 11:26:13 +02:00
rubidium42
55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
rubidium42
2e0297b0fa Add: GetString that returns std::string instead of filling a passed buffer 2021-05-15 10:20:50 +02:00
rubidium42
44ca7d9377 Change: Use gender-neutral pronouns 2021-05-15 10:16:48 +02:00
rubidium42
77330d09fd Codechange: move font settings to std::string 2021-05-13 23:13:17 +02:00
rubidium42
65cbde4b30 Codechange: move currency settings to std::string 2021-05-13 23:13:17 +02:00
rubidium42
2022e34824 Codechange: move locale settings to std::string 2021-05-13 23:13:17 +02:00
rubidium42
6bca9e090d Codechange: add SetDParamStr that accepts std::string& 2021-05-06 21:45:36 +02:00
glx22
983c7ade60 Codechange: Replace FOR_ALL_SEARCHPATHS with range-based for loops 2021-05-03 19:46:57 +02:00
Peter Nelson
20ac0b4148 Cleanup: Replace FOR_ALL_SORTED_CARGOSPECS macro with range iterator. 2021-04-28 23:54:31 +01:00
frosch
37222c3fa2 Change: treat languages as finished, if translations are 75% completed.
Unfinished translations are not auto-picked from the locale.
In release builds, unfinished translations are not offered in the GUI.
Unfinished translations are available in non-release builds, or by editing openttd.cfg.
2021-04-22 22:16:56 +02:00
Patric Stout
05612d60ae Remove: "language" field from server/client
The original idea was that people could find a server they could
talk in their native language on. This isn't really used in that
way. There are several reasons for removing this:

- the client also sends his "language" to the server, but nothing
  is doing anything with this.
- flags are a bad way to represent languages, and over the years
  we had several (rightfully) complaints about this.
- most servers have their language set to "All", and prefix the
  servername with the language it is about. This is a much more
  efficient way to do the same.

All in all, this feature should go back to the drawing board.
Maybe it could work in another form, but this form is not it.
2021-04-20 17:24:38 +02:00
TELK
fdc8230dfa
Cleanup: Fix comment for only one form (#9012) 2021-04-11 11:48:51 +01:00
Nicolae Crefelean
d4c3d01d07
Add: new plural form for Romanian translation (#8936) 2021-04-10 17:33:27 +02:00
Niels Martin Hansen
e0561dbded Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of static buffers 2021-04-07 09:31:47 +02:00
milek7
295f34a9df Fix: Freeing LanguagePack with wrong size. 2021-04-02 10:12:25 +02:00
Patric Stout
b21ba566ae
Codechange: remove special strings for language and resolutions (#8824)
As OpenTTD grew, we found other ways to do this, and we are no
longer in need for a hack like this.
2021-03-09 10:58:33 +01:00
Michael Lutz
6755ff63e1 Add: [OSX] Native font rendering without using FreeType. 2021-02-14 11:48:58 +01:00
Michael Lutz
2b0200d429 Codechange: OS-specific data for font search is not used outside of searching. 2021-02-13 20:09:14 +01:00
Patric Stout
c6fd6cfd15 Fix: tell the user if a font fails to load and fallback is about to be used
Additionally, tell exactly why the font failed to load, which
glyph was missing from the font. This hopefully helps the user
a bit more in the right direction.
2021-01-13 14:27:39 +01:00
Patric Stout
98400974a9 Codechange: nobody was using "str" parameter, so remove it 2021-01-13 14:27:39 +01:00
Charles Pigott
9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Michael Lutz
024a3f6259 Codechange: Use automatic memory management for language pack reading. 2020-12-27 13:19:25 +01:00
Michael Lutz
f3326d34e7 Codechange: Use std::string in FIO search path handling. 2020-12-27 13:19:25 +01:00
stormcone
ca65f19b03 Feature: Show group name as part of the default vehicle name.
Only if the vehicle is member of a group and does not have a user defined name.
2020-12-15 21:18:03 +01:00
jostephd
b1cf79da5b
Feature: new velocity unit "tiles/day" (#8278) 2020-12-15 00:39:57 +01:00
Michael Lutz
63ccb36ef3 Codechange: Use std::string for most of the user-settable custom names. 2020-05-21 20:02:34 +02:00
S. D. Cloudt
13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
glx
8cccb158e9 Fix #7672: more than 32 resolutions may be available 2019-08-02 20:19:07 +01:00
Michael Lutz
d2ed426077 Codechange: [Win32] Pass a native GDI font description around when we have one, instead of repeatedly guessing the font. 2019-05-14 11:21:36 +01:00
Michael Lutz
2675762ae9 Add: [Win32] GDI engine for font glyph rendering as a replacement for including FreeType.
Building with FreeType is still possible and will take precedence over the GDI renderer, but
the project files don't include FreeType anymore by default. Combining GDI rendering with ICU
text layout is untested.
2019-05-14 11:21:36 +01:00
glx
8899272614 Codechange: use std::vector for _language_dropdown 2019-04-18 21:49:34 +02:00
Henry Wilson
7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
glx22
427d9d483f
Fix #6564: enforce types of arguments for station name strings (#7419) 2019-03-26 22:50:56 +01:00
Charles Pigott
e453572b6a Codechange: Initialise a few variables that -flto seems to think could possibly be uninitialised 2019-03-26 20:54:40 +00:00