Patch: Loading indicator on vehicle status bar (update 19/6)
Moderator: OpenTTD Developers
Patch: Loading indicator on vehicle status bar (update 19/6)
In the topic about improving the orders system (http://tt-forums.net/viewtopic.php?t=12193), mention was made of a statusbar indicator for the loading progress. It seems the entire idea got dropped in the transition to someone else picking up that development process, so I made my own.
For now, it splits up the Loading and Unloading displays, and for the Loading display also shows the % of cargo space that has been filled.
*update 19/6*
- Moved all logic to one function as per gigajum's suggestion (thanks peter1138 and Hackykid for the pointers)
- Made the statusbar update on new cargo added, as per gigajum's suggestion (thanks to Tron and glx for pointing in the right direction )
- Some coding-style fixes.
For now, it splits up the Loading and Unloading displays, and for the Loading display also shows the % of cargo space that has been filled.
*update 19/6*
- Moved all logic to one function as per gigajum's suggestion (thanks peter1138 and Hackykid for the pointers)
- Made the statusbar update on new cargo added, as per gigajum's suggestion (thanks to Tron and glx for pointing in the right direction )
- Some coding-style fixes.
- Attachments
-
- loadingindicators.png
- Shows the vehicle windows for all types with their progress indicators in the status bar.
- (117.62 KiB) Downloaded 728 times
-
- loadingindicators.diff
- New diff against r5317
- (5.18 KiB) Downloaded 320 times
Last edited by anboni on 19 Jun 2006 21:37, edited 3 times in total.
Re: Patch: Loading indicator on vehicle status bar
i never said i drop it, but until now no one said it is needed much, so i gave it not top priority. I noticed myself during development, it is usefull, if that information how far the loading process is shown on the statusbar.
"loading 13% of 30%" if you only want to load minimal or exact 30%
I noticed you have 4 times almost the same code in four different functions. It should be better if you create a new function which does that.
i suggest you edit that according to the % loading. So that you get shownanboni wrote: For now, it splits up the Loading and Unloading displays, and for the Loading display also shows the % of cargo space that has been filled.
"loading 13% of 30%" if you only want to load minimal or exact 30%
I noticed you have 4 times almost the same code in four different functions. It should be better if you create a new function which does that.
Re: Patch: Loading indicator on vehicle status bar
Yeah, sorry, I didn't express myself that well there. Also, frankly, I thought of this feature, then started coding, and only when it was finished did I run across the improved orders patch. Because it was already done anyway, I decided to post itgigajum wrote:i never said i drop it, but until now no one said it is needed much, so i gave it not top priority. I noticed myself during development, it is usefull, if that information how far the loading process is shown on the statusbar.
That would be useful information when combined with the improved orders patch. Going by the current state of trunk, it would always show 13% of 100%, which seems kinda redundant I'll look into the improved orders patch sometime soon and see if I can prepare my patch for the improved orders stuff.gigajum wrote:i suggest you edit that according to the % loading. So that you get shown
"loading 13% of 30%" if you only want to load minimal or exact 30%
I'm not too sure about that. While the code is all very similar, there's quite a few differences between the various vehicle types (roadveh and ships are almost the same, aircraft and trains both are different). Handling all that in one function might make that single function more complex than the 4 pieces of similar code. Also, this piece of code gets called fairly often while a vehicle is in a station, so I'd prefer to keep it "lean and mean" and avoid extra function calls.gigajum wrote: I noticed you have 4 times almost the same code in four different functions. It should be better if you create a new function which does that.
All 4 functions look really the same, except for the calculation of cargo_count. You can do this beforehand and pass as an argument to a function. Should be the best thing to do.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
It'd be nice to show the % indicator above trains waiting in station, so you can discern how efficiently your empire is running without having to bring up train dialogs to monitor them.
Open source tycoon games
--
Free Gamer - open source and Free Software games
FreeGameDev forums - open source game development community
--
Free Gamer - open source and Free Software games
FreeGameDev forums - open source game development community
i do not understand why. if you set full loading the train will always load 100% not more or less. if not set to full load, why care how full they are? if there are goods left at the station you have to look there and buy another train (or other vehicle) if neded. For me your suggestion is a waste of resources.
gigajum: so when you see a train waiting for a full load, you can click on it and instantly see just how much space its got left to fill, its not much use with coal, iron ore, grain etc, when you can visably see the wagons loaded, but it'd be very useful with goods, passengers, mail etc.
We Am De Best
Host of ThroughTheTube site
Host of ThroughTheTube site
Rediff against trunk r9813.
It's no big deal but I like it.
It's no big deal but I like it.
- Attachments
-
- LoadingIndicators_9813.7z
- Win32 Executable
- (851.14 KiB) Downloaded 177 times
-
- LoadingIndicators_9813.patch
- (5.91 KiB) Downloaded 203 times
-
- Tycoon
- Posts: 11501
- Joined: 20 Sep 2004 22:45
As I said in bug 212, this doesn't work too well with gradual loading since parts of the vehicle can be unloading while a different part is loading. Do you have any suggestions for making that work properly?
No-one's more important than the earthworm.
Would http://fuzzle.org/o/loadingindicators.diff work? I've not tested it...
He's like, some kind of OpenTTD developer.
I had a similar idea but loading and unloading will be both count as loading.
Edit:
Ah, I've find it, not:
that:
Edit:
Ah, I've find it, not:
Code: Select all
for (const Vehicle *u = v; u != NULL; u = u->next) {
/* Loop through all wagons; add currently loaded amount to cargo_count
* and wagon capacity to cargo_cap
*/
if (!HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING)) cargo_count += u->cargo_count;
cargo_cap += u->cargo_cap;
}
Code: Select all
for (const Vehicle *u = v; u != NULL; u = u->next) {
/* Loop through all wagons; add currently loaded amount to cargo_count
* and wagon capacity to cargo_cap
*/
if (!HASBIT(u->vehicle_flags, VF_CARGO_UNLOADING)){
cargo_count += u->cargo_count;
cargo_cap += u->cargo_cap;
}
}
- Attachments
-
- LoadingIndicators_v2_r9813.patch
- (5.85 KiB) Downloaded 212 times
Who is online
Users browsing this forum: Google Adsense [Bot] and 3 guests