Commit Graph

1762 Commits

Author SHA1 Message Date
Rubidium a313676189 Doc: reason for using ::SendNet over ::Post in few cases 2024-05-09 21:51:26 +02:00
Rubidium ed888c617b Codechange: just use ::Post over ::SendNet for creating new companies 2024-05-09 21:51:26 +02:00
Rubidium 849d1fa1b3 Cleanup: remove UI for asking user for company password 2024-05-07 00:03:15 +02:00
Rubidium 457d51fc49 Cleanup: remove company password hashing and anything related to it 2024-05-07 00:03:15 +02:00
Rubidium a9318cf653 Cleanup: remove UI for changing the password 2024-05-07 00:03:15 +02:00
Rubidium 9dc1fdc385 Cleanup: remove client side password checks when moving to a different company 2024-05-07 00:03:15 +02:00
Rubidium 16639939e9 Cleanup: remove command line option for company password 2024-05-07 00:03:15 +02:00
Rubidium ca4bef1504 Cleanup: remove company password related network packets 2024-05-07 00:03:15 +02:00
Rubidium 71fc907584 Change: remove company passwords over client allow lists 2024-05-07 00:03:15 +02:00
Rubidium a002803d1c Remove: autoclean_unprotected settings; all companies will be protected 2024-05-07 00:03:15 +02:00
Rubidium 4f3db8eeaf Feature: authorize specific clients to join network company without password 2024-05-07 00:03:15 +02:00
Rubidium 66354ab9eb Codechange: introduce allow list infrastructure for companies 2024-05-07 00:03:15 +02:00
Rubidium b9c894b717 Fix: for GUI network servers, name the first company the same as any other company 2024-05-05 22:57:50 +02:00
Rubidium 455e202e03 Fix: server's client is shown incorrectly in some cases 2024-05-05 22:57:50 +02:00
Peter Nelson 84ebae0bf5
Codechange: Tweak layout of network client list. (#12624)
Use PIP spacing instead of spacers and more used of standard WidgetDimensions.
2024-05-05 14:57:17 +01:00
Peter Nelson 532ce1a907
Codechange: Use Recv/Send_bytes for md5sum. (#12602)
Use existing functions to handle serialisation of arrays instead of indexed for-loop.
2024-05-01 18:55:54 +01:00
Peter Nelson 33aedc43a5 Codechange: Shrink GUIList vectors less often, reserve before use.
After sorting and filter lists for GUI, we often shirnk them to reduce size. However this has very little benefit:

1) The memory has already been allocated, so it doesn't prevent that memory being required.
2) It causes a new allocation and copy when the vector is shrunk, actually using more memory.
3) The list is in window state, so the lifetime is only while the window is open.
4) When a filter is clearer, the original size will be needed again, which will cause another allocation.

In fact it is beneficial to reserve to the known maximum in most cases, so do that instead.
2024-04-27 19:25:34 +01:00
Peter Nelson f44d8fa2e4
Codechange: Remove CDECL from filter functions. (#12578)
These functions are not passed to qsort()...
2024-04-25 22:13:23 +01:00
Peter Nelson 5bc9854be2
Codechange: Make sort list function lists safer. (#12574)
GUIList has a pointer only to the start of each sort/filter func list, which has the potential for UB as it is unable to validate that the selected sort or filter type is in range.

Use a std::span instead and check if the selected type is in range before using it.
2024-04-25 21:00:49 +01:00
Peter Nelson ed2db80990 Codechange: Use map.emplace() instead of map.insert(std::pair).
This avoids a copy of the pair into the map.
2024-04-20 10:25:20 +01:00
Peter Nelson 16eb17418b Change: Use aspect ratios for some common widgets. 2024-04-19 22:11:16 +01:00
Peter Nelson d43ff8dc49 Change: Ability to set aspect ratio of a widget.
This allows setting the shape of a widget without dealing with absolute pixel sizes.
2024-04-19 22:11:16 +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
Patric Stout f7bd080015
Codechange: improve desync documentation (#12521) 2024-04-17 20:36:08 +00:00
Patric Stout 07b162ffc4
Codechange: skip all commands of the past during desync replay (#12520) 2024-04-17 20:05:45 +00:00
Patric Stout a0636d8200
Codechange: use infinite-fast-forward when rerunning command-log (#12519) 2024-04-17 20:01:58 +00:00
Patric Stout 1005c86c62
Codechange: record cache warnings with a "warning" prefix (#12518) 2024-04-17 19:49:55 +00:00
Peter Nelson 4eaeccdaeb
Codechange: Introduce FioRemove() to remove files. (#12491)
New function FioRemove() handles OTTD2FS conversion, and uses std::filesystem::remove instead of unlink, all in one location.
2024-04-14 23:43:50 +01:00
rubidium42 442daf58da Codechange: replace lengthof with std::size in Windows specific code 2024-04-10 23:17:13 +02:00
Peter Nelson 54be756aae
Codechange: Pass NewGRF strings as std::string_view instead of char *. (#12461) 2024-04-09 08:40:27 +01:00
Peter Nelson de4e00c93f
Codechange: Pass by reference to UpdateWidgetSize. (#12457)
These parameters are always provided and not optional.
2024-04-09 08:34:45 +01:00
Peter Nelson 74e09abf76
Codechange: Use dynamic_cast instead of C-cast after FindWindowById. (#12448)
dynamic_cast was used in most places, but not all.
2024-04-08 13:26:19 +01:00
Rubidium c544a2be0a Fix: do not use lengthof() for non C-style arrays 2024-04-06 07:21:31 +02:00
Peter Nelson 7572cfd103 Codechange: Redefine ZOOM_LVL so that ZOOM_LVL_NORMAL is 1x zoom.
This matches expectations of what normal zoom means.
2024-04-04 22:27:03 +01:00
Peter Nelson 56cac21086 Codechange: Use functions to create common drop down list items. 2024-04-01 22:33:16 +01:00
Peter Nelson d683ec0183
Codechange: Move dropdown and slider out of widgets directory. (#12403)
Also shuffle headers to place widget includes near end.

This leaves the widgets directory solely for defining Widget IDs.
2024-03-31 19:37:16 +01:00
Rubidium d5e28a904d Fix fb9d4af: use different nonces for key exchange and stream encryption 2024-03-31 15:14:16 +02:00
Rubidium 8e12bd35ae Fix: server shutdown and newgame packets should be stable
The server sends shutdown and newgame (reboot) packets to any connected client.
This can be useful, so you can tell clients that are trying to join that the
server is restarting. However, that means that packets can be sent before a
version check has been done.
So, these packets should be in the stable packet range instead of the one that
is unstable and guarded by a version check.
2024-03-25 22:50:05 +01:00
Rubidium 9aa6669266 Fix: inconsistent check for client authorized status 2024-03-25 22:32:23 +01:00
Rubidium 84bbe235e4 Fix: do not send chat to clients that have not authorized yet 2024-03-25 22:32:23 +01:00
Rubidium c01bf06ee1 Codefix: some minor errors in tcp-game protocol documentation 2024-03-24 06:40:38 +01:00
Rubidium 0f25eaa271 Fix: crash to desktop when attempting to join a company while not joined (yet) 2024-03-23 13:33:41 +01:00
Rubidium f599108c16 Codechange: move 'months_empty' to CompanyProperties 2024-03-23 11:59:34 +01:00
Rubidium 7580eac2d5 Codechange: create helper class for useful NetworkAuthorizedKeys functions 2024-03-18 22:56:58 +01:00
Rubidium 4af089b9be Feature: console command to change authorized keys 2024-03-17 21:21:33 +01:00
Rubidium b7dfa3eb90 Feature: authorized key authentication for rcon 2024-03-17 20:36:25 +01:00
Rubidium 1cf8799810 Feature: encrypt the connection between game server and client 2024-03-17 19:48:34 +01:00
Rubidium d26629c15b Codechange: make encoded length of packet size and type more explicit 2024-03-17 19:48:34 +01:00
Rubidium 5706801ea7 Feature: authenticate to the server without sending the password
Either using password-authentication key exchange or via authorized keys
2024-03-17 19:09:22 +01:00
Rubidium dd532cbc77 Codechange: add setting for authorized/secret/public keys 2024-03-17 19:09:22 +01:00