Commit Graph

18674 Commits

Author SHA1 Message Date
Peter Nelson
5434d63f91 Fix: Scale smallmap legend 'blob' to fit text. 2021-04-30 17:08:15 +01:00
Peter Nelson
af70195e44 Fix: Tidy up sizing of sprite aligner window sprite list. 2021-04-30 17:08:15 +01:00
Peter Nelson
1df510c297 Fix: Company Key window scaling. 2021-04-30 17:08:15 +01:00
Peter Nelson
09206be054 Fix: Use unscaled values for padding OSK 2021-04-30 17:08:15 +01:00
Peter Nelson
56a6f66903 Codechange: Use text lines instead of pixel height of font for link graph widgets. 2021-04-30 17:08:15 +01:00
Peter Nelson
63cc340dc1 Codechange: Apply minimum size to toolbar widgets 2021-04-30 17:08:15 +01:00
Peter Nelson
d32df00b5c Codechange: No longer necessary to manually resize volume sliders. 2021-04-30 17:08:15 +01:00
Peter Nelson
4791ff2862 Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed. 2021-04-30 17:08:15 +01:00
Peter Nelson
6fe5353da2 Cleanup: Set unchanging scrollbar properties in constructor. 2021-04-30 17:08:15 +01:00
Peter Nelson
03a43b8247 Cleanup: Call SetMinimalSize instead of setting min_y directly. 2021-04-30 17:08:15 +01:00
Peter Nelson
f5569763c9 Fix: Specify width when width is required instead of top. 2021-04-30 17:08:15 +01:00
Peter Nelson
2efa390a7d Codechange: Simplify calling of DrawCharCentered() 2021-04-30 17:08:15 +01:00
Peter Nelson
4f93dd95e4 Cleanup: Tidy up resize, fill and minimal size on widgets in town list window. 2021-04-30 17:08:15 +01:00
Peter Nelson
4c6cca459a Cleanup: Remove fairly redundant DrawDropdown() function. 2021-04-30 17:08:15 +01:00
Peter Nelson
5153e1b6e3 Cleanup: Horizontal widget size is commonly width rather than length. 2021-04-30 17:08:15 +01:00
PeterN
3dbd6475fe
Codechange: Use C++ features for train wagon overrides. (#9141)
This removes the need for C-style array management and allows use of iterators to perform wagon override lookups.
2021-04-30 12:03:07 +01:00
Patric Stout
665a3928e2 Remove: performance measurements in YAPF
YAPF was constantly measuring its performance, but only at
certain debug-levels this information was shown.

Now after years, I sincerely wonder if anyone still knows about this
feature and who still use it. Especially with the new framerate window,
this detailed performance is not as meaningful anymore as it once
was.
2021-04-30 12:48:41 +02:00
Patric Stout
e162aff7a3 Cleanup: remove weird left-over comment in yapf.hpp 2021-04-30 12:48:41 +02:00
Patric Stout
69118d063f
Change: use TCP for everything except for master-server and initial server scan (#9130)
This means that pressing Refresh button and adding servers manually
now uses TCP.

The master-server and initial scan are still UDP as they will be
replaced by Game Coordinator; no need to change this now.

If we query a server that is too old, show a proper warning to the
user informing him the server is too old.
2021-04-30 11:34:47 +02:00
rubidium42
f00564eeb2
Fix: String validation could leave invalid Utf8 encoded strings (#9096)
In case a character was encoded in multiple bytes, but required fewer bytes to be encoded, the first byte would be copied to the output leaving an invalid Utf8 encoded string. Later uses of the validated string would use the same decode logic, which would yield a question mark and just read a single byte, so nothing dangerous happened.
Furthermore, because the next byte would not be a first byte of an encoded Utf8 character, the last few valid characters could be removed by the validation as well.
2021-04-29 23:16:41 +01:00
PeterN
f018471b36
Cleanup: Remove old FiosList helper methods. (#9139) 2021-04-29 22:46:42 +01:00
glx22
9a8756d7ed Codechange: Replace FOR_ALL_CARGOSPECS with range-based for loops 2021-04-29 21:08:24 +02:00
glx22
14e92bd8e2 Codechange: Replace window related FOR_ALL with range-based for loops 2021-04-29 21:08:24 +02:00
rubidium42
a61696d6c5 Change: [Network] Encapsulate logic about the connection string to the network code (#23) 2021-04-29 20:12:11 +02:00
Patric Stout
be37a2cab8 Codechange: use NetworkAddress instead of two host/port variables where possible
This also means we no longer need last_host/last_port, but can
just use a single last_joined setting.
2021-04-29 20:12:11 +02:00
Patric Stout
99f998805b Codechange: use std::string over stack-based strings if possible 2021-04-29 20:12:11 +02:00
Patric Stout
a8afbe74bf Cleanup: remove write-only variable "hostname" in NetworkGameList 2021-04-29 20:12:11 +02:00
PeterN
0b460bf4a1
Fix: 'Cache' top and bottom lines of textfile viewer to avoid overdraw. (#9131)
* Fix: 'Cache' top and bottom lines of textfile viewer to avoid overdraw.

The text file viewer calculated the number of lines required to set the scrollbar, but did not retain this information, so this was recalculated on every draw operation. This includes overdrawing text outside the bounds of the current scroll position.

With this change the top and bottom lines for each line of text are remembered, and reflowing is avoided where possible. Text outside the current scroll bounds is not drawn.
Additionally the scroll interval is now based on text lines instead of pixel lines, which increases the text capacity depending on the font size.

* Fix: Limit text viewer to showing 64k lines.

Text files with more than 64k wrapped lines would exceed the scrollbar capacity and cause an assert. This is harder to reach now that the scrollbar counts lines instead of pixels.
2021-04-29 18:58:26 +01:00
translators
72a05921b0 Update: Translations from eints
norwegian (bokmal): 16 changes by Anolitt
finnish: 2 changes by hpiirai
2021-04-29 17:52:22 +00: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
20ac0b4148 Cleanup: Replace FOR_ALL_SORTED_CARGOSPECS macro with range iterator. 2021-04-28 23:54:31 +01:00
Peter Nelson
de81afdf4b Cleanup: Replace FOR_ALL_SORTED_ROADTYPES macro with range iterator. 2021-04-28 23:54:31 +01:00
Peter Nelson
3b3d80c8ef Cleanup: Replace FOR_ALL_SORTED_RAILTYPES macro with range iterator. 2021-04-28 23:54:31 +01:00
PeterN
ae7f07de74
Fix: Incorrect vertical alignment of icon and text in DropDownListIconItem. (#9133)
This happens if the bounding dimensions are changed so that each item is the same size, as happens on the railtype/roadtype dropdown lists, as the vertical offset was calculated before this dimension is changed.
2021-04-28 22:32:43 +01:00
Patric Stout
96dc0d04ec
Fix b3003dd1: swap SERVER_GAME_INFO with CLIENT_GAME_INFO (#9129)
The idea is that if you query an older server that does not support
this packet yet, the client receives an error. The assumption was
that on every "illegal packet" the connection would be closed. This
turns out to be false.

Now CLIENT_GAME_INFO aligns with the old PACKET_CLIENT_NEWGRFS_CHECKED,
which does a pre-check (which fails), and an error is sent back
and the connection is closed.

This is not a nice solution, but it is the best we got.
2021-04-28 23:09:03 +02:00
Milek7
8e9eca6ddd
Codechange: Use __attribute__ access none to silence GCC 11 -Wmaybe-uninitialized warnings (#9124) 2021-04-28 22:06:47 +01:00
translators
267703c14b Update: Translations from eints
spanish (mexican): 40 changes by absay
english (us): 1 change by 2TallTyler
korean: 3 changes by telk5093
german: 1 change by danidoedel
finnish: 1 change by hpiirai
catalan: 1 change by J0anJosep
portuguese: 45 changes by azulcosta
portuguese (brazilian): 44 changes by Vimerum
2021-04-28 17:53:26 +00:00
Milek7
a341852cd5
Fix: missing <limits> include in network/core/packet.h (#9123) 2021-04-27 23:22:03 +01:00
Patric Stout
31f1db2d3a Change: no longer use UDP when entering the lobby of a server
The lobby of a server requested some parts via UDP and some via
TCP. This is strictly seen fine, but for future extensions it
is a lot easier if just one protocol is used.
2021-04-27 20:18:53 +02:00
Patric Stout
b57d845e55 Codechange: refactor CheckGameCompatibility() from existing function
Later commits use this function in other places too.
2021-04-27 20:18:53 +02:00
Patric Stout
b3003dd163 Add: ability to retrieve game info from server over TCP 2021-04-27 20:18:53 +02:00
Patric Stout
84c75a7b9a Codechange: be explicit in pointer comparisons 2021-04-27 20:18:53 +02:00
Patric Stout
cb2ef1ea4b Codechange: move all NetworkGameInfo related functions to a single file
It currently was a bit scattered over the place. Part of
NetworkGameInfo is also the GRF Identifiers that goes with it.
2021-04-27 20:18:53 +02:00
Patric Stout
8fa53f543a
Change: [Network] lower TCP connect() timeout to 3s (#9112)
Currently we use default OS timeout for TCP connections, which
is around 30s. 99% of the users will never notice this, but there
are a few cases where this is an issue:

- If you have a broken IPv6 connection, using Content Service is
  first tried over IPv6. Only after 30s it times out and tries
  IPv4. Nobody is waiting for that 30s.
- Upcoming STUN support has several methods of establishing a
  connection between client and server. This requires feedback
  from connect() to know if any method worked (they have to be
  tried one by one). With 30s, this would take a very long time.

What is good to mention, is that there is no good value here. Any
value will have edge-cases where the experience is suboptimal. But
with 3s we support most of the stable connections, and if it fails,
the user can just retry. On the other side of the spectrum, with 30s,
it means the user has no possibility to use the service. So worst case
we annoy a few users with them having the retry vs annoying a few
users which have no means of resolving the situation.
2021-04-27 20:18:43 +02:00
rubidium42
015e3b412e Cleanup: remove #ifdefs for compiling the old content server 2021-04-27 19:58:03 +02:00
translators
b89dba7e4e Update: Translations from eints
japanese: 26 changes by scabtert
catalan: 43 changes by J0anJosep
2021-04-27 17:53:43 +00:00
rubidium42
31c87ba908 Fix: truncating strings in settings could leave invalid Utf8 characters 2021-04-27 19:41:51 +02:00
rubidium42
0e449f20dc Codechange: writing and string validation to its own functions 2021-04-27 19:41:51 +02:00
rubidium42
b54d8a49fb Feature: allow non-ASCII currency separators 2021-04-27 19:41:51 +02:00
rubidium42
4880ec29e4 Change: [Network] Safeguard from using errno/strerror for handling network errors
They are likely not working as expected on Windows, so prevent their usage.
Winsock does not set errno and strerror does not return anything useful for Winsock error numbers.
2021-04-27 18:17:34 +01:00
rubidium42
8c2e3a004e Codechange: [Network] Do not leak os_abstraction.h via base_media_func.h 2021-04-27 18:17:34 +01:00
rubidium42
84985c1223 Codechange: [Network] Do not leak os_abstraction.h via fios.h 2021-04-27 18:17:34 +01:00
rubidium42
cbad518bf3 Codechange: [Network] Do not leak os_abstraction.h via network_func 2021-04-27 18:17:34 +01:00
rubidium42
cf8c1aa860 Change: [Network] Use string error messages instead of numeric error numbers that need to be looked up 2021-04-27 18:17:34 +01:00
rubidium42
65c5a64719 Fix: [Network] errno and strerror do not handle network errors on Windows 2021-04-27 18:17:34 +01:00
Chris
a934dfe0be
Fix: [NewGRF] Errors with severity ERROR also display a pop-up window (#9119) 2021-04-27 17:57:53 +01:00
translators
8ea06128be Update: Translations from eints
english (us): 39 changes by 2TallTyler
korean: 44 changes by telk5093
german: 43 changes by danidoedel
russian: 7 changes by Ln-Wolf
finnish: 39 changes by hpiirai
2021-04-26 17:53:20 +00:00
Charles Pigott
43b6f6915b Fix 8a95fee4: Missing initialiser in Packet constructor 2021-04-26 06:45:37 +02:00
rubidium42
5afb090082 Change: [Network] Remove now defunct savegame transfer packet limiter 2021-04-25 21:29:23 +02:00
Rubidium
a3c9eca722 Change: use 32 KiB packets to send requests to the content server 2021-04-25 21:27:54 +02:00
Rubidium
21f58ab437 Change: use 32 KiB packets to transfer the savegame 2021-04-25 21:27:54 +02:00
Rubidium
d6000c2ec5 Codechange: differentiate between UDP, TCP and compatibility MTU values 2021-04-25 21:27:54 +02:00
Rubidium
8b302761d4 Codechange: allow different limits in packet sizes 2021-04-25 21:27:54 +02:00
Charles Pigott
97288bc286
Fix #9109: Malformed STR_ROAD_TOOLBAR_TOOLTIP_CONVERT_ROAD in Japanese lang (#9110) 2021-04-25 20:11:59 +01:00
PeterN
224625942c
Fix: Count engine details text in lines rather than pixels. (#9107)
This allows the details panel to scale correctly for different zoom levels.
2021-04-25 19:34:16 +01:00
translators
b721787c7f Update: Translations from eints
norwegian (bokmal): 4 changes by Anolitt
spanish (mexican): 3 changes by absay
japanese: 60 changes by scabtert, 38 changes by Azusa257
english (us): 3 changes by 2TallTyler
korean: 3 changes by telk5093
russian: 4 changes by Ln-Wolf
finnish: 3 changes by hpiirai
slovak: 20 changes by FuryPapaya
2021-04-25 18:04:52 +00:00
rubidium42
65818db1f4 Fix: [Network] Prevent stalling save game transfer when compression is slow 2021-04-25 19:54:21 +02:00
PeterN
f158957a4e
Fix: Use width of tiny arrow string instead of scaled pixels in ship/aircraft list. (#9102) 2021-04-25 17:51:03 +01:00
2TallTyler
9d6ff1c780 Fix: Missing 'Town names:' colon in map gen GUI 2021-04-25 08:47:50 +02:00
Michael Lutz
f4d5c8d99e
Fix: [OpenGL] Main loop expects to start with the video buffer unmapped. (#9100) 2021-04-25 00:43:38 +02:00
PeterN
fbc232569c
Fix #9097: Upper 16 bits of cargo base payment rate were discarded. (#9098)
NewGRF spec says that base payment rate is 32 bits, but it was loaded into a 16 bit variable. This value is loaded into Money variable after inflation is applied.
2021-04-24 22:27:47 +01:00
Patric Stout
fda1a590f6 Change: use icons to indicate you/host in Online Players GUI 2021-04-24 21:43:58 +02:00
Patric Stout
a924b2ff81 Add: move "New Company" inside the Online Players GUI 2021-04-24 21:43:58 +02:00
Patric Stout
c2e116a3d3 Change: track hover position on Online Players GUI
Especially if there are many players online, trying to chat with
the right one can be a visual challenge. This can be solved by
highlighting the row you are on. This visual cue is often enough
for humans to find the right row.
2021-04-24 21:43:58 +02:00
Patric Stout
54f69deb0c Add: ask for confirmation on admin actions in network games 2021-04-24 21:43:58 +02:00
Patric Stout
ff708c2c65 Add: admin menu for companies in multiplayer games
You can now easily do:
- a password reset (unlock)
- remove an empty company (reset company)
2021-04-24 21:43:58 +02:00
Patric Stout
5266359424 Feature: rework in-game Online Players GUI
The GUI now more clearly shows some basic information about the
server you joined, your client name (and the ability to change it),
and what players are in which company.

It also contains useful buttons to press to join companies, chat
with other people, and for admins to kick/ban people.

Additionally, renamed "advertised" to "visibility"; this has to
do with future additions, but also because it is more clear in
wording.
2021-04-24 21:43:58 +02:00
Rubidium
75386873b7 Codechange: use std::vector instead of a fixed size array for Packets 2021-04-24 20:42:01 +02:00
Rubidium
450178d780 Codechange: add accessor for the packet type to Packet and make the internal state of Packet private 2021-04-24 20:42:01 +02:00
Rubidium
3abefdf561 Codechange: remove public access to the next pointer in Packet 2021-04-24 20:42:01 +02:00
Rubidium
f71fb0f54a Codechange: encapsulate reading the size of a Packet 2021-04-24 20:42:01 +02:00
Rubidium
6f161f6559 Codechange: encapsulate the logic about how many bytes can be sent from a buffer in to a Packet 2021-04-24 20:42:01 +02:00
Rubidium
38d15fc9b7 Codechange: move the logic shrinking of the packets into the Packet itself 2021-04-24 20:42:01 +02:00
Rubidium
d4f027c03b Codechange: encapsulate writing data from Packets into sockets/files/buffers to prevent packet state modifications outside of the Packet 2021-04-24 20:42:01 +02:00
Rubidium
98aa561cf7 Codechange: encapsulate reading data from sockets into Packets to prevent packet state modifications outside of the Packet 2021-04-24 20:42:01 +02:00
Rubidium
a2051bad50 Codechange: move logic whether there is enough space in a packet to write data into the Packet 2021-04-24 20:42:01 +02:00
Rubidium
c545cc9d70 Codechange: move more logic about packet size validity and reading into Packet 2021-04-24 20:42:01 +02:00
translators
470d8b6637 Update: Translations from eints
korean: 2 changes by telk5093
russian: 3 changes by Ln-Wolf
finnish: 1 change by hpiirai
spanish: 1 change by MontyMontana
polish: 1 change by pAter-exe
hindi: 62 changes by ss141309
2021-04-24 17:53:56 +00:00
Leif Linse
3b9b177b36
Update: Developer credits (#9091) 2021-04-24 17:49:37 +01:00
Loïc Guilloux
888389c28d
Codechange: Use std::string in console commands/aliases registration, and std::map instead our sorted linked list (#9057)
* Codechange: Use std::string in console commands and aliases registration

* Codechange: Use std::map to register console commands

* Codechange: Use std::map to register console aliases

* Cleanup: Remove now unused function
2021-04-24 15:19:57 +02:00
rubidium42
2999d301ad Add: [Network] Validate the client name when receiving one from the server
This so names from other clients are known valid in the client as well, instead allowing some compromised/bad server to potentially crash clients upon certain expectations.
2021-04-24 08:02:54 +02:00
rubidium42
e1cebe0ea0 Add: [Network] Validate the client name server side, so no clients with invalid names can actually join 2021-04-24 08:02:54 +02:00
rubidium42
2e0f3799a8 Change: [Network] Prevent invalid client names being sent to the server when changing it using the console/settings 2021-04-24 08:02:54 +02:00
rubidium42
bfb0ab3e2f Feature: [Network] Ensure players fill in a name instead of defaulting to "Player" 2021-04-24 08:02:54 +02:00
rubidium42
5202869f0f Add: String functionality to trim spaces from C-style strings 2021-04-24 08:02:54 +02:00
rubidium42
b14f412117 Codechange: [Network] Introduce function to validate the client name 2021-04-24 08:02:54 +02:00
translators
dc0efd5f2e Update: Translations from eints
spanish (mexican): 1 change by absay
english (us): 1 change by 2TallTyler
2021-04-23 22:11:02 +00:00
frosch
57b4cc64b7 Add: Hindi translation. 2021-04-23 22:57:00 +02:00
frosch
8dda2c2c17 Change: move all 'unstable' language into 'stable'. 2021-04-23 22:57:00 +02:00
translators
c52a1154ed Update: Translations from eints
dutch: 6 changes by Afoklala
2021-04-23 17:55:37 +00:00