Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remaining lifetime (years) does not go negative #6359

Closed
DorpsGek opened this issue Aug 9, 2015 · 8 comments
Closed

Remaining lifetime (years) does not go negative #6359

DorpsGek opened this issue Aug 9, 2015 · 8 comments
Labels
bug Something isn't working flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) stale Stale issues

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Aug 9, 2015

Simons_Mith opened the ticket and wrote:

An order such as

'Jump to order 7 when Remaining lifetime (years) is less than 0'

never triggers, even when the vehicle concerned was 41 years (max age 38).

I altered it to 'Jump to order 7 when Remaining lifetime (years) is less equal to 0'
and that did work, but then it triggered a year earlier than I really wanted.

See also feature request 'Req: 'max reliability' order filter', which is what I really wanted
in the first place.

Reported version: 1.5.1
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/6359
@DorpsGek
Copy link
Member Author

chindit wrote:

Fixed!
See this post: http://www.tt-forums.net/viewtopic.php?f=33&t=73475


This comment was imported from FlySpray: https://bugs.openttd.org/task/6359#comment14041

@DorpsGek
Copy link
Member Author

Alberth wrote:

So how is it fixed exactly?

You only seem to throw a message when you detect 'property < 0'. The OP doesn't want '< 0', and he doesn't want '<= 0' (or '== 0') that you force him into by throwing messages.
At least with the patch here http://www.tt-forums.net/viewtopic.php?p=1154397# p1154397

(you can link to specific posts with the 'post' icon at the right-top. Even better, attach the patch here, so it doesn't get lost.)


This comment was imported from FlySpray: https://bugs.openttd.org/task/6359#comment14042

@DorpsGek
Copy link
Member Author

chindit wrote:

I've worked on two different solutions which are complementary.

1st : throwing a message if there is an unfulfillable condition, like «load percentage < 0» Patch (latest version) is joined to this post.
2nd : removing the negative limit for remaining lifetime. This was done just with a small modification on the check of conditional order. Patch is also joined to this post.

I've tested it and orders like this are now 100% functional:
1)Go to A, full load
2)Service at depot X
3)Go to B, unload
4)CONDITIONAL : jump to 1 if Remaining lifetime is >= 0
5)Go to depot X, stop

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/6359#comment14043

@DorpsGek
Copy link
Member Author

frosch wrote:

2nd: "value" is an unsigned integer. All the input to the conditional orders is unsigned, all the way from the GUI to the game logic.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6359#comment14044

@DorpsGek
Copy link
Member Author

chindit wrote:

It's not a problem because I don't change "value".
"Value" is the number entered by the user. In this particular case: 0.
Only the calculated age is under 0 and this particular value is used ONLY in the order comparator. So, there is no problem


This comment was imported from FlySpray: https://bugs.openttd.org/task/6359#comment14045

@DorpsGek
Copy link
Member Author

adf88 wrote:

I can think of few ways of dealing with the problem.

  1. Do an exact comparison without rounding (probably most feasible).
  2. Change years to months (minimise the damage).
  3. Compare against ceil(years(lifetime)) instead of floor(years(lifetime))

This comment was imported from FlySpray: https://bugs.openttd.org/task/6359#comment14063

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) Vehicles labels Apr 7, 2018
@TrueBrain
Copy link
Member

I do like the: warn if an condition order makes no sense.

I also agree that <= 0 should trigger when it becomes 0, not when it becomes slight-less-than 1 (it is also very common to make that exception for your minimum and maximum .. the time between 100% and 99% is often longer/shorter than from 99% to 98%).

But negative remaining lifetimes .. that makes no sense to me :D The estimation might be wrong, but I cannot have a negative remaining lifetime. Not even for comparison that makes sense to me :D

@andythenorth andythenorth added the stale Stale issues label Jan 5, 2019
@andythenorth
Copy link
Contributor

Thanks for this. There's been no activity on this for some time, and as it stands, it doesn't look likely that it will go any further. I'm closing it as we try to keep the issue count low for OpenTTD, it helps us focus on things that are important and fun. Feel free to discuss in irc or request re-opening if you disagree. Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) stale Stale issues
Projects
None yet
Development

No branches or pull requests

4 participants