Statistics Patch
Moderator: OpenTTD Developers
Statistics Patch
The original version of the statistics patch is from Celestar.
EDIT: I commented out the saving of statistics (for now), so it should be able to use savegames from this version with other versions, too
The downside is that stats start at 0 after loading a game (same as pressing the reset-button)
What Celestars patch did:
- show how much vehicles are scheduled for the station
- show number of vehicles that visited the station in last month and this month and how much cargo was delivered/picked up/transfered in last month and this month for each cargo individually
- make it possible to reset a station (ratings, which goods are there, ...)
- save the stats in the savegame
now, what did i do?
- i did not touch the transfer order patch
- i moved the resetting of stations to the cheat-menu (if enabled you will get a button when clicking a station to allow resetting it)
- added button to switch between statistics for this/last month and average/min/max statistics
- and added the statistics for average/min/max, of course
- added possibility to reset statistics
EDIT:
- added monthly/yearly statistics for waypoints
EDIT2:
- button to display vehicles scheduled for a waypoint now works
- button "buses" (station-stats) shows only buses
- button "trucks" (station-stats) shows all but buses
- added new function for vehicle-list-creation that makes it possible to select one or more basic vehicle-type and one or more cargotypes to be selected and that not only works for stations, but waypoints as well (this is used for displaying trains and roadvehicles now... please report any problems you encounter)
- changed counting of scheduled vehicles (hopefully the numbers shown are still correct and it is faster... please report problems with that)
EDIT4:
- added wizeman's show station ratings patch
- moved his button beyond the switch for rating/acceptance
- added a button to his window to show all vehicles scheduled for the station for this specific cargo, regardless of type (please report problems with that)
- made roadvehicle list update if selecting buses/trucks in stats-window, while window is already open
Known Issues:
- button for catchment area not working (yet)
- vehicles scheduled for a station with a cargo-type that does not have a rating could not be shown (yet)
EDIT: added known issues, exchanged one screenshot, updated some text and .diff
EDIT2: new version, updated some text and .diff
EDIT3: removed infos of transfer order patch, as this is committed now
EDIT4: new version, updated some text and .diff
EDIT5: new .diff uploaded... some bugfixes
EDIT6: new .diff uploaded... some bugfixes, some magic numbers removed
EDIT7: new .diff uploaded... just made it compile with current SVN, no real changes
EDIT8: new .diff uploaded... fixed a bug with building waypoints, some minor cleanup
EDIT9: replaced one screenshot by a windows-build
EDIT: I commented out the saving of statistics (for now), so it should be able to use savegames from this version with other versions, too
The downside is that stats start at 0 after loading a game (same as pressing the reset-button)
What Celestars patch did:
- show how much vehicles are scheduled for the station
- show number of vehicles that visited the station in last month and this month and how much cargo was delivered/picked up/transfered in last month and this month for each cargo individually
- make it possible to reset a station (ratings, which goods are there, ...)
- save the stats in the savegame
now, what did i do?
- i did not touch the transfer order patch
- i moved the resetting of stations to the cheat-menu (if enabled you will get a button when clicking a station to allow resetting it)
- added button to switch between statistics for this/last month and average/min/max statistics
- and added the statistics for average/min/max, of course
- added possibility to reset statistics
EDIT:
- added monthly/yearly statistics for waypoints
EDIT2:
- button to display vehicles scheduled for a waypoint now works
- button "buses" (station-stats) shows only buses
- button "trucks" (station-stats) shows all but buses
- added new function for vehicle-list-creation that makes it possible to select one or more basic vehicle-type and one or more cargotypes to be selected and that not only works for stations, but waypoints as well (this is used for displaying trains and roadvehicles now... please report any problems you encounter)
- changed counting of scheduled vehicles (hopefully the numbers shown are still correct and it is faster... please report problems with that)
EDIT4:
- added wizeman's show station ratings patch
- moved his button beyond the switch for rating/acceptance
- added a button to his window to show all vehicles scheduled for the station for this specific cargo, regardless of type (please report problems with that)
- made roadvehicle list update if selecting buses/trucks in stats-window, while window is already open
Known Issues:
- button for catchment area not working (yet)
- vehicles scheduled for a station with a cargo-type that does not have a rating could not be shown (yet)
EDIT: added known issues, exchanged one screenshot, updated some text and .diff
EDIT2: new version, updated some text and .diff
EDIT3: removed infos of transfer order patch, as this is committed now
EDIT4: new version, updated some text and .diff
EDIT5: new .diff uploaded... some bugfixes
EDIT6: new .diff uploaded... some bugfixes, some magic numbers removed
EDIT7: new .diff uploaded... just made it compile with current SVN, no real changes
EDIT8: new .diff uploaded... fixed a bug with building waypoints, some minor cleanup
EDIT9: replaced one screenshot by a windows-build
- Attachments
-
- average/min/max stats page
- Stats_Page_2.png (9.55 KiB) Viewed 11463 times
-
- stats_r2724.diff
- .diff for r2724
- (114.93 KiB) Downloaded 439 times
-
- mingw32.zip
- windows binary
- (1.27 MiB) Downloaded 414 times
Last edited by Asterix on 27 Jul 2005 20:04, edited 9 times in total.
- bobingabout
- Tycoon
- Posts: 1850
- Joined: 21 May 2005 15:10
- Location: Hull, England
i like that
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
- lucaspiller
- Tycoon
- Posts: 1228
- Joined: 18 Apr 2004 20:27
Very nice patch indeed.
I've got a small suggestion though... There isn't enough room for the 'Statistics' button, so now a new row was added. Wouldn't it be possible to move the "Rename" button to the top of the window? Like it is with trains? It's more consistent, and you don't need two rows.
The windows I'm talking about:
I've got a small suggestion though... There isn't enough room for the 'Statistics' button, so now a new row was added. Wouldn't it be possible to move the "Rename" button to the top of the window? Like it is with trains? It's more consistent, and you don't need two rows.
The windows I'm talking about:
Well, there is a cause why i left the button, where Celestar put itoVRoM wrote:I've got a small suggestion though... There isn't enough room for the 'Statistics' button, so now a new row was added. Wouldn't it be possible to move the "Rename" button to the top of the window? Like it is with trains? It's more consistent, and you don't need two rows.
If you enable "Reset Station" in the Cheat-menu the button for resetting the station appears on the free place there...
And I was thinking about including wizeman's "detailed station ratings" patch as well and put his butten on there, too
Hmm, I might think about adding that below the icons for the different vehicle-types (even though I don't know locomotion at all )Jumper wrote:What abut a button to show the station coverage area like in locomotion? Would be nice to see the coverage area even if the station is already build.
But I don't know yet how much work this will be and how long it will take to do it.
In locomotion that button shows a blue coverage area. Mayby it can be done with the same tiles/sprites that are used for displaying the coverage area while building the station.Asterix wrote:Hmm, I might think about adding that below the icons for the different vehicle-types (even though I don't know locomotion at all )Jumper wrote:What abut a button to show the station coverage area like in locomotion? Would be nice to see the coverage area even if the station is already build.
But I don't know yet how much work this will be and how long it will take to do it.
- Attachments
-
- locostyle.png (79.11 KiB) Viewed 11302 times
- lucaspiller
- Tycoon
- Posts: 1228
- Joined: 18 Apr 2004 20:27
This is not difficult to do. I gave Celestar a patch a while back which enabled this simply by clicking on a button from within a station dialog. The main problem with implementing it on the current base is that some of the viewport stuff is really poorly written. My patch works on the map branch where a lot of this code is revised and cleaned up (mostly by Truelight, Blathijs and Celestar).Jumper wrote:In locomotion that button shows a blue coverage area. Mayby it can be done with the same tiles/sprites that are used for displaying the coverage area while building the station.Asterix wrote:Hmm, I might think about adding that below the icons for the different vehicle-types (even though I don't know locomotion at all )Jumper wrote:What abut a button to show the station coverage area like in locomotion? Would be nice to see the coverage area even if the station is already build.
But I don't know yet how much work this will be and how long it will take to do it.
Maybe I'll look into doing this on the current code base...
If you already have a patch for this, even if its not for the current code, it might be interesting for me, how you did it and maybe use some of your old code (that is, if you dont update it yourself ).Jango wrote:This is not difficult to do. I gave Celestar a patch a while back which enabled this simply by clicking on a button from within a station dialog. The main problem with implementing it on the current base is that some of the viewport stuff is really poorly written. My patch works on the map branch where a lot of this code is revised and cleaned up (mostly by Truelight, Blathijs and Celestar).
Maybe I'll look into doing this on the current code base...
Currently I add some statistics to waypoints.
Then there is still including wizeman's patch and making it possible to show only buses *or* trucks in the road-vehicle-list on my ToDo-List.
Catchment-area is the last thing in that list
i'd be more than happy to give you the patch (if i can find it) for you to look at. If i can't find it, then i'm sure Celestar has it somewhere.
The principle is pretty easy. Within viewport.c there is the possibility to overlay squares with either blue (for catchment) or red (error) or white outlines. The map rewrite handled this much better than the existing code.
I then had a simple linked list which kept track of all the stations which currently were supposed to be displaying their catchment area. If i remember rightly, whenever the viewport code wanted to draw a square, it would quickly iterate through the stations within the linked list (normally 0 or 1 stations) and check to see whether the square came within the bounds, and if so, it would draw a blue box.
Celestar thought about doing it a different way. I believe he was thinking about putting an additional variable within the station struct (or reutilising existing bits). I suspect that although the code would be much easier to understand, the performance would not be as good because you'd have to iterate through every station to check this bit.
Celestar, if you ever read this, perhaps you could comment....
The principle is pretty easy. Within viewport.c there is the possibility to overlay squares with either blue (for catchment) or red (error) or white outlines. The map rewrite handled this much better than the existing code.
I then had a simple linked list which kept track of all the stations which currently were supposed to be displaying their catchment area. If i remember rightly, whenever the viewport code wanted to draw a square, it would quickly iterate through the stations within the linked list (normally 0 or 1 stations) and check to see whether the square came within the bounds, and if so, it would draw a blue box.
Celestar thought about doing it a different way. I believe he was thinking about putting an additional variable within the station struct (or reutilising existing bits). I suspect that although the code would be much easier to understand, the performance would not be as good because you'd have to iterate through every station to check this bit.
Celestar, if you ever read this, perhaps you could comment....
thanks, got it now, but still have to look at itJango wrote:i'd be more than happy to give you the patch (if i can find it) for you to look at.
First post updated with new .diff, as i added stats for waypoints, so if you click on a rail-tile with a waypoint on it (not the waypoint-sign) you will get a statswindow (see first post for more info).
comments welcome
EDIT: updated first post with new version again, look there for details
- lucaspiller
- Tycoon
- Posts: 1228
- Joined: 18 Apr 2004 20:27
I have just noticed that GCC gives quite a few warnings (see the attachement), this is with r2448.
EDIT: Ok, your testy one seems to fix most of those, except:
EDIT: Ok, your testy one seems to fix most of those, except:
Code: Select all
vehicle_gui.c: In function `BuildVehicleListMasked':
vehicle_gui.c:1069: warning: left shift count >= width of type
- Attachments
-
- warnings.txt
- (15.13 KiB) Downloaded 304 times
No longer active here, but you can still reach me via email: luca[at]stackednotion[dot]com
Thanks, for help with those warnings...
They didnt show up on MSVC... For the one left, I forgot to do something about it (and it doesnt show up for me, too, as the code itself should be ok)
Anyway: New version in top post, now with rating stats, and a new station-rating system (which could be deactivated in patchsettings->stations)
On the station-rating window there is a button which should show ALL vehicles that transport the currently selected cargo-type (please report bugs/problems). I already found one issue: the currently selected button sometimes gets unpressed when pushing the button for the list (didnt find how to solve this yet)
The button for showing catchment-area does NOT work yet, I just put it there for getting the gui-thingys right
They didnt show up on MSVC... For the one left, I forgot to do something about it (and it doesnt show up for me, too, as the code itself should be ok)
Anyway: New version in top post, now with rating stats, and a new station-rating system (which could be deactivated in patchsettings->stations)
On the station-rating window there is a button which should show ALL vehicles that transport the currently selected cargo-type (please report bugs/problems). I already found one issue: the currently selected button sometimes gets unpressed when pushing the button for the list (didnt find how to solve this yet)
The button for showing catchment-area does NOT work yet, I just put it there for getting the gui-thingys right
Who is online
Users browsing this forum: ketony and 5 guests