Rubidium
68ff3fd062
Change: include fmt.h C++ headers in stdafx.h
...
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
2023-05-08 16:49:23 +02:00
Peter Nelson
0880616851
Codechange: Remove various STRING strings.
2023-05-05 07:07:54 +01:00
Tyler Trahan
6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar ( #10753 )
2023-05-04 13:14:12 +00:00
Peter Nelson
6be6703498
Fix: Linkgraph legend assumes strings are small.
...
Ensure all linkgraph legend strings are drawn with FS_SMALL forced, so
that it does not rely on NewGRF authors.
2023-04-30 11:47:53 +01:00
PeterN
57f2d70fef
Change: Use cstdint instead of rolling our own types. ( #10651 )
2023-04-27 10:04:18 +02:00
Tyler Trahan
930f0a16d8
Codechange: Define Date/Year/Month/Day within TimerGameCalendar class
2023-04-26 07:14:03 -04:00
Patric Stout
7aa2b9ab0a
Codechange: move all date-related variables inside the timer ( #10706 )
2023-04-24 15:56:01 +00:00
PeterN
9910240f0e
Cleanup: Remove obsolete (Make)EnumPropsT. ( #10697 )
...
This was used by the command system to help extract p1/p2 parameters, which no longer happens.
2023-04-23 17:46:14 +01:00
Tyler Trahan
646a7e625b
Change: Use seconds for Linkgraph update settings ( #10610 )
2023-04-14 22:49:12 +02:00
Peter Nelson
5199881a8d
Codechange: Use correct type for linkgraph company mask.
2023-04-07 22:09:55 +01:00
PeterN
c1077212d7
Codechange: Use a shared_ptr for viewport overlay. ( #10586 )
2023-03-31 16:06:36 +01:00
Jonathan G Rennison
87f4d37de3
Fix #10522 : Link graph line tooltip test for vertical lines ( #10524 )
2023-03-03 17:37:17 -05:00
Michael Lutz
aab580e0ac
Codechange: [Linkgraph] Drop node/edge wrappers from LinkGraph.
2023-02-26 21:41:24 +01:00
Michael Lutz
4d3da0cf14
Codechange: [Linkgraph] Drop node/edge wrappers from LinkGraphJob.
2023-02-26 21:41:24 +01:00
Michael Lutz
7352f812e6
Codechange: [Linkgraph] Only store present link graph edges and not all possible edges.
2023-02-26 21:41:24 +01:00
Michael Lutz
8f851ead70
Codechange: [Linkgraph] Split annotation for demand between nodes from the edge annotations.
2023-02-26 21:41:24 +01:00
Michael Lutz
fe27db3dfd
Codechange: [Linkgraph] Store edges in each node and not in a global matrix.
2023-02-26 21:41:24 +01:00
Rubidium
00721787e1
Fix: wrong type for INVALID_LINK_GRAPH_JOB
2023-01-27 07:05:49 +01:00
Rubidium
fe2bcd2a58
Codechange: migrate size related functions to Map structure
2023-01-21 17:11:40 +01:00
Rubidium
bcfe0fb076
Codechange: introduce GetMainWindow() to properly account for nullptr checks
...
Some nullptr checks have been removed as they were not triggered with nullptr
with the null video driver and in dedicated server mode.
2023-01-14 21:15:23 +01: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
Peter Nelson
890b2666d3
Change: Use scaled WidgetDimensions.
2022-11-12 18:28:39 +00:00
Peter Nelson
b6ed595176
Codechange: Prefer suggested widget padding.
2022-11-12 18:28:39 +00:00
Peter Nelson
6f95e04005
Change: Use Rect helpers for widget drawing.
...
This replaces repetitive and sometimes unwieldy use of constants.
2022-11-12 18:28:39 +00:00
Peter Nelson
eb4ba1991b
Change: Use CenterBounds function in more places.
...
CenterBounds may have a 1 pixel difference so the result is not exactly
the same.
2022-11-12 18:28:39 +00:00
Jonathan G Rennison
e931f3061f
Fix: Dereference of past-the-end iterator in linkgraph overlay tooltip ( #10145 )
2022-11-07 00:16:38 +01:00
Nicolas Chappe
8bf56f39f2
Fix #9708 : [Linkgraph] Don't assume vehicles have a non-zero max speed
2022-10-29 18:39:03 +02:00
Nicolas Chappe
c5369caa45
Fix: [Linkgraph] possible rounding errors for travel times of low-capacity links
2022-10-29 18:39:03 +02:00
Nicolas Chappe
25b3ff6423
Cleanup: simplify LinkRefresher::RefreshStats
2022-10-29 18:39:03 +02:00
Nicolas Chappe
864771ca09
Feature: [Linkgraph] Show a tooltip with statistics when hovering a link
2022-10-18 22:03:39 +02:00
Bouke Haarsma
c7f55a058b
Fix: link overlay line width on HiDPI displays ( #10064 )
2022-10-04 11:58:58 +02:00
Tyler Trahan
e79724ea22
Feature: Alternative linkgraph colour schemes ( #9866 )
2022-04-25 19:32:55 +02:00
Niels Martin Hansen
e68bf58989
Codechange: Use anonymous union for vehicle orders/old orders list
2022-02-15 20:01:10 +01:00
Michael Lutz
13528bfcd0
Codechange: Un-bitstuff all remaining commands.
2021-12-16 22:28:32 +01:00
Michael Lutz
0f64ee5ce1
Codechange: Template DoCommandP to automagically reflect the parameters of the command proc.
...
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
2021-12-16 22:28:32 +01:00
Michael Lutz
549caca39c
Codechange: Move command arguments to the back of the networked command function calls.
2021-12-16 22:28:32 +01:00
Nicolas Chappe
b83820e723
Change: [Linkgraph] Delete links only served by vehicles stopped in depot
...
A stale link is not deleted if the link refresher finds a vehicle that still serves it.
This commit excludes vehicles stopped in depot for a very long time from the link refresher,
so that their stale links can be deleted.
2021-08-20 22:37:03 +02:00
Nicolas Chappe
de28817d9f
Fix 977604ef: [Linkgraph] Add a special case for unknown travel times on link update
2021-08-18 01:48:11 +02:00
Nicolas Chappe
977604ef08
Feature: [Linkgraph] Prioritize faster routes for passengers, mail and express cargo
...
Passengers usually prefer fast paths to short paths.
Average travel times of links are updated in real-time for use in Dijkstra's algorithm,
and newer travel times weigh more, just like capacities.
2021-08-17 14:57:59 +02:00
glx22
a543a4b7bb
Codechange: Remove FOR_EACH_SET_CARGO_ID
2021-07-09 21:36:09 +02:00
Patric Stout
7b135a8269
Codechange: use SLE_STRUCT(LIST) for Linkgraph chunks
2021-06-14 21:58:05 +02:00
Patric Stout
9fff00ba20
Codechange: C++-ify lists for SaveLoad ( #9323 )
...
Basically, this changes "SaveLoad *" to either:
1) "SaveLoadTable" if a list of SaveLoads was meant
2) "SaveLoad &" if a single entry was meant
As added bonus, this removes SL_END / SLE_END / SLEG_END. This
also adds core/span.hpp, a "std::span"-lite.
2021-05-31 22:26:44 +02:00
rubidium42
6fe4d4ad7b
Codechange: linkgraph always iterates with NodeIDs over the Size(), so make Size() the same type to prevent infinite loops
2021-05-27 18:30:56 +02:00
rubidium42
44ca7d9377
Change: Use gender-neutral pronouns
2021-05-15 10:16:48 +02:00
Rubidium
bb9121dbd4
Fix: comparison of narrow type to wide type in loop (potential for infinite loops)
2021-05-15 10:16:10 +02: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
Milek7
4cd9e0f41b
Fix: Add virtual destructor to link graph Path.
...
Classes derived from Path were freed through base class pointer, but no virtual destructor was present.
2021-04-13 20:48:49 +02:00
Tyler Trahan
de891238d6
Change: Recolour graph windows to brown ( #8700 )
2021-03-11 15:30:29 +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
Jonathan G Rennison
94d629d79b
Change: [Linkgraph] Allow job threads to be aborted early when clearing schedule ( #8416 )
...
When link graph jobs are cleared due to abandoning the game or exiting,
flag the job as aborted.
The link graph job running in a separate thread checks the aborted flag
periodically and terminates processing early if set.
This reduces the delay at game abandon or exit if a long-running job
would otherwise still be running.
2020-12-25 00:36:36 +01:00
Jonathan G Rennison
7f0fefddcf
Change: [Linkgraph] Only acquire thread join performance measurements on network clients
...
Network servers and single player clients do not block on thread joins
due to instead pausing shortly before the join is due.
2020-12-22 15:17:57 +01:00
Jonathan G Rennison
0c5dc5d41e
Change: [Linkgraph] Pause the game when linkgraph jobs lag ( #6470 )
...
Check if the job is still running two date fract ticks before it is due
to join, and if so pause the game until its done.
When loading a game, check if the game would block immediately due to
a job which is scheduled to be joined within two date fract ticks,
and if so pause the game until its done.
This avoids the main thread being blocked on a thread join, which appears
to the user as if the game is unresponsive, as the UI does not repaint
and cannot be interacted with.
Show if pause is due to link graph job in status bar, update network
messages.
This does not apply for network clients.
2020-12-22 15:17:57 +01:00
Patric Stout
56d54cf60e
Add: introduce CMake for project management
...
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.
Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.
This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.
Addtiionally, this heavily improves our detection of libraries, etc.
2020-06-05 19:36:05 +02:00
Michael Lutz
f2b40f40aa
Codechange: Replace SmallPair with std::pair.
...
std::pair is already the smallest possible pair, and it already handles non-POD types correctly.
2020-05-21 20:02:34 +02:00
Jonathan G Rennison
6e7117e04c
Codechange: [Linkgraph] Skip MCF source node Dijkstra when all demand satisfied
...
MCF Dijkstra iterations are executed for all source nodes in a round-robin order.
Source nodes typically require different numbers of MCF Dijkstra iterations
to satisfy all of their demand.
This change is to avoid performing MCF Dijkstra iterations on source nodes which
have already been fully satisfied.
2020-01-08 22:49:53 +01:00
glx
09fa39c5b5
Codechange: Replace linkgraph related FOR_ALL with range-based for loops
2019-12-21 20:13:03 +01:00
glx
ddabfed1cd
Codechange: Replace station 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
JMcKiern
04f659e768
Fix: Some typos found using codespell
2019-09-29 21:27:32 +01:00
Charles Pigott
bd87f11355
Codechange: Remove DistributionTypeByte
2019-04-29 17:40:22 +01:00
Henry Wilson
7c8e7c6b6e
Codechange: Use null pointer literal instead of the NULL macro
2019-04-10 23:22:20 +02:00
Michael Lutz
05bc2ed7cb
Codechange: Replace custom thread code with C++11 thread objects.
...
We assume a conforming C++11 compiler environment that has a valid <thread>-header.
Failure to run a real thread is handled gracefully.
2019-04-06 11:27:39 +02:00
PeterN
32fda83d39
Fix aa7ca7fe6: Linkgraph node index order must be maintained due to other references. ( #7431 )
...
Linkgraph nodes require a specific order that was maintained by swapping just the last
element for the node to be removed. std::vector::erase() changed this to removing the
node is then shuffling the remain items down, which upsets other references to this
indices.
This is fixed by switching back to the original swap & pop method.
2019-03-30 22:19:50 +00:00
glx22
66dd7c3879
Fix: MSVC warnings ( #7423 )
2019-03-28 00:09:33 +01:00
Henry Wilson
c01a2e2a81
Codechange: Removed SmallVector completely
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
aa7ca7fe64
Codechange: Replaced SmallVector::Get(n) non-const with std::vector::data() + n
2019-03-26 20:15:57 +00:00
Henry Wilson
bad2c2154b
Codechange: Replaced SmallVector::Resize() with std::vector::resize()
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
peter1138
317f69c152
Codechange: Use override specifier in Window-derived classes.
2019-03-24 16:10:04 +01:00
peter1138
f5f33da126
Codechange: Implement OnTooltip event for custom window tooltips.
...
This avoids windows from needing to know or care about tooltip delay settings.
2019-03-20 23:00:32 +00:00
PeterN
87ebfe1227
Fix #7004 : Mark linkgraph dirty to be rebuilt on next draw call. ( #7265 )
...
Previously the linkgraph was rebuilt before the viewport extents were finalized.
2019-02-23 19:19:41 +00:00
Jonathan G Rennison
64f1847bec
Codechange: [Linkgraph GUI] Replace line visibility detection algorithm
...
Use an implementation of the Cohen-Sutherland line-clipping algorithm.
The previous algorithm had an excessive false-positive rate.
Line-rendering is sufficiently expensive that using a line-clipping
algorithm with a much lower false-positive rate is a net performance
benefit.
2019-01-28 19:15:21 +01:00
Charles Pigott
f5b1115039
Doc: Lots and lots of doxymentation fixes
2018-10-31 12:35:54 +01:00
Niels Martin Hansen
2a868b9f3b
Feature: Framerate display window ( #6822 )
...
Frame rate and various game loop/graphics timing measurements and graphs. Accessible via the Help menu, and can print some stats in the console via the fps command.
2018-07-19 21:17:07 +02:00
Jonathan G Rennison
dc8fff2c4d
Add: Hover tool-tips to cargo dest flow legend window.
...
This is to improve the usability of the window.
The two-letter abbreviations are not always clear, in particular
when using a large number of cargoes.
The company colours can be ambiguous when there are a large
number of companies.
2018-06-24 20:18:10 +02:00
Jonathan G Rennison
458bc90678
Fix: Poor contrast in cargo dest flow legend window cargo labels.
...
Select foreground colour depending on the brightness of the background.
Previously all cargo labels were rendered using black text, even
the background cargo colour was dark/black.
As an example: FIRS coal was black text on a black background.
2018-06-24 19:32:04 +02:00
PeterN
4cebebcf68
Change: Add CargoTypes type for cargo masks. ( #6790 )
2018-05-21 22:08:39 +01:00
frosch
3eae9aba79
(svn r27887) -Cleanup: Remove unused/unimplemented prototype (adf88)
2017-07-11 19:34:21 +00:00
frosch
31f046bd9b
(svn r27670) -Add: [FS#6471] Assign descriptive names to (GNU pthread) threads. (JGR)
2016-10-30 17:29:33 +00:00
fonsinchen
f769305d7d
(svn r27614) -Codechange: Use a fixed array instead of a map for link refresher cargo capacities. (JGR)
2016-07-10 12:17:00 +00:00
fonsinchen
022b284064
(svn r27613) -Codechange: Use a flat vector instead of a map in FlowEdgeIterator. (JGR)
2016-07-10 12:03:23 +00:00
fonsinchen
e2426b22fa
(svn r27612) -Codechange: Replace three uses of std::list with std::queue/vector. (JGR)
2016-07-10 11:57:16 +00:00
fonsinchen
bcdae9a093
(svn r27611) -Codechange: Cache the calculated value of CapacityAnnotation
2016-07-10 11:53:43 +00:00
frosch
780e595933
(svn r27178) -Fix [FS#5969]: Data race due to lazy initialisation of objects.
2015-03-07 18:27:01 +00:00
rubidium
d534c80e94
(svn r27020) -Cleanup: some coding style consistency improvements (mostly spaces)
2014-10-15 18:31:37 +00:00
rubidium
fddeeb5e49
(svn r27002) -Fix-ish: replace some non-ASCII characters with ASCII characters, e.g. @þaram to @param
2014-10-12 18:26:54 +00:00
fonsinchen
9fdb88962f
(svn r26891) -Codechange: Add methods to retrieve flows from a FlowStatMap
2014-09-21 16:19:52 +00:00
fonsinchen
831fb254f6
(svn r26889) -Feature: Predict links for station-autorefitting vehicles
2014-09-21 14:22:32 +00:00
fonsinchen
957f5ca117
(svn r26646) -Fix [FS#6041]: Save locations instead of distances in link graphs to reduce size.
2014-06-14 13:35:39 +00:00
rubidium
89c25b955e
(svn r26580) -Codechange: s/GES_PICKUP/GES_RATING/ (it has nothing to do with actual pickup), s/acceptance_pickup/status/ (the enum isn't called GoodEntryStatus for a reason; it's not only acceptance and pickup anymore)
2014-05-11 18:02:11 +00:00
fonsinchen
11d98f043e
(svn r26549) -Change: better estimation for link capacities during full load
2014-05-01 14:50:52 +00:00
fonsinchen
56e8ea6dde
(svn r26484) -Change: Remove demand calculation based on tiles.
2014-04-23 20:23:22 +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
fonsinchen
bef953a32c
(svn r26448) -Fix [FS#5970]: Avoid division by 0 when scaling flow values.
2014-04-08 19:28:14 +00:00
fonsinchen
782b9f01cb
(svn r26445) -Change [FS#5961]: Draw links to match _settings_game.vehicle.road_side (M3Henry)
2014-04-05 14:28:55 +00:00
fonsinchen
afd1263ce1
(svn r26411) -Change [FS#5941]: Use better distance metric for link graph (MildaIV)
2014-03-17 20:33:26 +00:00
fonsinchen
5d3fcce725
(svn r26393) -Fix: Update distances between link graph nodes when station sign is moved
2014-03-06 21:19:41 +00:00
fonsinchen
cc77d40336
(svn r26347) -Fix [FS#5898]: Make sure link graph jobs can delete themselves after SLA_NULL.
2014-02-16 18:42:59 +00:00