Peter Nelson
0880616851
Codechange: Remove various STRING strings.
1 year ago
Tyler Trahan
6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar ( #10753 )
1 year ago
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.
1 year ago
PeterN
57f2d70fef
Change: Use cstdint instead of rolling our own types. ( #10651 )
1 year ago
Tyler Trahan
930f0a16d8
Codechange: Define Date/Year/Month/Day within TimerGameCalendar class
1 year ago
Patric Stout
7aa2b9ab0a
Codechange: move all date-related variables inside the timer ( #10706 )
1 year ago
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.
1 year ago
Tyler Trahan
646a7e625b
Change: Use seconds for Linkgraph update settings ( #10610 )
1 year ago
Peter Nelson
5199881a8d
Codechange: Use correct type for linkgraph company mask.
2 years ago
PeterN
c1077212d7
Codechange: Use a shared_ptr for viewport overlay. ( #10586 )
2 years ago
Jonathan G Rennison
87f4d37de3
Fix #10522 : Link graph line tooltip test for vertical lines ( #10524 )
2 years ago
Michael Lutz
aab580e0ac
Codechange: [Linkgraph] Drop node/edge wrappers from LinkGraph.
2 years ago
Michael Lutz
4d3da0cf14
Codechange: [Linkgraph] Drop node/edge wrappers from LinkGraphJob.
2 years ago
Michael Lutz
7352f812e6
Codechange: [Linkgraph] Only store present link graph edges and not all possible edges.
2 years ago
Michael Lutz
8f851ead70
Codechange: [Linkgraph] Split annotation for demand between nodes from the edge annotations.
2 years ago
Michael Lutz
fe27db3dfd
Codechange: [Linkgraph] Store edges in each node and not in a global matrix.
2 years ago
Rubidium
00721787e1
Fix: wrong type for INVALID_LINK_GRAPH_JOB
2 years ago
Rubidium
fe2bcd2a58
Codechange: migrate size related functions to Map structure
2 years ago
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.
2 years ago
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.
2 years ago
Peter Nelson
890b2666d3
Change: Use scaled WidgetDimensions.
2 years ago
Peter Nelson
b6ed595176
Codechange: Prefer suggested widget padding.
2 years ago
Peter Nelson
6f95e04005
Change: Use Rect helpers for widget drawing.
...
This replaces repetitive and sometimes unwieldy use of constants.
2 years ago
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.
2 years ago
Jonathan G Rennison
e931f3061f
Fix: Dereference of past-the-end iterator in linkgraph overlay tooltip ( #10145 )
2 years ago
Nicolas Chappe
8bf56f39f2
Fix #9708 : [Linkgraph] Don't assume vehicles have a non-zero max speed
2 years ago
Nicolas Chappe
c5369caa45
Fix: [Linkgraph] possible rounding errors for travel times of low-capacity links
2 years ago
Nicolas Chappe
25b3ff6423
Cleanup: simplify LinkRefresher::RefreshStats
2 years ago
Nicolas Chappe
864771ca09
Feature: [Linkgraph] Show a tooltip with statistics when hovering a link
2 years ago
Bouke Haarsma
c7f55a058b
Fix: link overlay line width on HiDPI displays ( #10064 )
2 years ago
Tyler Trahan
e79724ea22
Feature: Alternative linkgraph colour schemes ( #9866 )
2 years ago
Niels Martin Hansen
e68bf58989
Codechange: Use anonymous union for vehicle orders/old orders list
3 years ago
Michael Lutz
13528bfcd0
Codechange: Un-bitstuff all remaining commands.
3 years ago
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.
3 years ago
Michael Lutz
549caca39c
Codechange: Move command arguments to the back of the networked command function calls.
3 years ago
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.
3 years ago
Nicolas Chappe
de28817d9f
Fix 977604ef: [Linkgraph] Add a special case for unknown travel times on link update
3 years ago
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.
3 years ago
glx22
a543a4b7bb
Codechange: Remove FOR_EACH_SET_CARGO_ID
3 years ago
Patric Stout
7b135a8269
Codechange: use SLE_STRUCT(LIST) for Linkgraph chunks
3 years ago
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.
3 years ago
rubidium42
6fe4d4ad7b
Codechange: linkgraph always iterates with NodeIDs over the Size(), so make Size() the same type to prevent infinite loops
3 years ago
rubidium42
44ca7d9377
Change: Use gender-neutral pronouns
3 years ago
Rubidium
bb9121dbd4
Fix: comparison of narrow type to wide type in loop (potential for infinite loops)
3 years ago
Peter Nelson
56a6f66903
Codechange: Use text lines instead of pixel height of font for link graph widgets.
3 years ago
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.
4 years ago
Tyler Trahan
de891238d6
Change: Recolour graph windows to brown ( #8700 )
4 years ago
Charles Pigott
9b800a96ed
Codechange: Remove min/max functions in favour of STL variants ( #8502 )
4 years ago
Charles Pigott
860c270c73
Codechange: Replace assert_compile macro with static_assert
4 years ago
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.
4 years ago
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.
4 years ago
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.
4 years ago
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.
4 years ago
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.
4 years ago
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.
5 years ago
glx
09fa39c5b5
Codechange: Replace linkgraph related FOR_ALL with range-based for loops
5 years ago
glx
ddabfed1cd
Codechange: Replace station related FOR_ALL with range-based for loops
5 years ago
S. D. Cloudt
13cc8a0cee
Cleanup: Removed SVN headers
5 years ago
JMcKiern
04f659e768
Fix: Some typos found using codespell
5 years ago
Charles Pigott
bd87f11355
Codechange: Remove DistributionTypeByte
6 years ago
Henry Wilson
7c8e7c6b6e
Codechange: Use null pointer literal instead of the NULL macro
6 years ago
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.
6 years ago
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.
6 years ago
glx22
66dd7c3879
Fix: MSVC warnings ( #7423 )
6 years ago
Henry Wilson
c01a2e2a81
Codechange: Removed SmallVector completely
6 years ago
Henry Wilson
a0f36a50e6
Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back()
6 years ago
Henry Wilson
aa7ca7fe64
Codechange: Replaced SmallVector::Get(n) non-const with std::vector::data() + n
6 years ago
Henry Wilson
bad2c2154b
Codechange: Replaced SmallVector::Resize() with std::vector::resize()
6 years ago
Henry Wilson
a690936ed7
Codechange: Replace SmallVector::Length() with std::vector::size()
6 years ago
peter1138
317f69c152
Codechange: Use override specifier in Window-derived classes.
6 years ago
peter1138
f5f33da126
Codechange: Implement OnTooltip event for custom window tooltips.
...
This avoids windows from needing to know or care about tooltip delay settings.
6 years ago
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.
6 years ago
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.
6 years ago
Charles Pigott
f5b1115039
Doc: Lots and lots of doxymentation fixes
6 years ago
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.
6 years ago
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.
6 years ago
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.
6 years ago
PeterN
4cebebcf68
Change: Add CargoTypes type for cargo masks. ( #6790 )
6 years ago
frosch
3eae9aba79
(svn r27887) -Cleanup: Remove unused/unimplemented prototype (adf88)
7 years ago
frosch
31f046bd9b
(svn r27670) -Add: [FS#6471] Assign descriptive names to (GNU pthread) threads. (JGR)
8 years ago
fonsinchen
f769305d7d
(svn r27614) -Codechange: Use a fixed array instead of a map for link refresher cargo capacities. (JGR)
8 years ago
fonsinchen
022b284064
(svn r27613) -Codechange: Use a flat vector instead of a map in FlowEdgeIterator. (JGR)
8 years ago
fonsinchen
e2426b22fa
(svn r27612) -Codechange: Replace three uses of std::list with std::queue/vector. (JGR)
8 years ago
fonsinchen
bcdae9a093
(svn r27611) -Codechange: Cache the calculated value of CapacityAnnotation
8 years ago
frosch
780e595933
(svn r27178) -Fix [FS#5969]: Data race due to lazy initialisation of objects.
10 years ago
rubidium
d534c80e94
(svn r27020) -Cleanup: some coding style consistency improvements (mostly spaces)
10 years ago
rubidium
fddeeb5e49
(svn r27002) -Fix-ish: replace some non-ASCII characters with ASCII characters, e.g. @þaram to @param
10 years ago
fonsinchen
9fdb88962f
(svn r26891) -Codechange: Add methods to retrieve flows from a FlowStatMap
10 years ago
fonsinchen
831fb254f6
(svn r26889) -Feature: Predict links for station-autorefitting vehicles
10 years ago
fonsinchen
957f5ca117
(svn r26646) -Fix [FS#6041]: Save locations instead of distances in link graphs to reduce size.
10 years ago
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)
11 years ago
fonsinchen
11d98f043e
(svn r26549) -Change: better estimation for link capacities during full load
11 years ago
fonsinchen
56e8ea6dde
(svn r26484) -Change: Remove demand calculation based on tiles.
11 years ago
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
11 years ago
fonsinchen
bef953a32c
(svn r26448) -Fix [FS#5970]: Avoid division by 0 when scaling flow values.
11 years ago
fonsinchen
782b9f01cb
(svn r26445) -Change [FS#5961]: Draw links to match _settings_game.vehicle.road_side (M3Henry)
11 years ago
fonsinchen
afd1263ce1
(svn r26411) -Change [FS#5941]: Use better distance metric for link graph (MildaIV)
11 years ago
fonsinchen
5d3fcce725
(svn r26393) -Fix: Update distances between link graph nodes when station sign is moved
11 years ago
fonsinchen
cc77d40336
(svn r26347) -Fix [FS#5898]: Make sure link graph jobs can delete themselves after SLA_NULL.
11 years ago
fonsinchen
2945e76269
(svn r26341) -Fix [FS#5902]: Reroute cargo when automatic distribution is switched off.
11 years ago