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

implement varaction2houses var 64 #3481

Closed
DorpsGek opened this issue Jan 5, 2010 · 17 comments
Closed

implement varaction2houses var 64 #3481

DorpsGek opened this issue Jan 5, 2010 · 17 comments
Labels
component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Jan 5, 2010

George opened the ticket and wrote:

R18545

I get the following problem with house demolition - they do not get demolished.
I supposed the following code should force every unserviced bank to be demolished after 16 years, but they stay for long

Reproduce steps:

  1. generate a game
  2. find a bank
  3. fast game for over 20 years
  4. bank is still there (but should be demolished, because it is too old)

// - (F7) (CB 21) trigger destruction of building
2540 * 115 02 07 F7 85
1A 20 00 00 \2sto
1A 20 00 01 \2rst
64 05 21 01 00 \2|
64 05 22 01 00 \2|
64 0C 21 01 00 \2|
64 0C 22 01 00 \2|
64 0D 21 01 00 \2|
64 0D 22 01 00 \2sto
1A 20 00 00 \2rst
1A 20 01 00 \2sto
1A 20 00 01 \2rst
64 05 21 01 00 \2|
64 05 22 01 00 \2|
64 0C 21 01 00 \2|
64 0C 22 01 00 \2|
64 0D 21 01 00 \2|
64 0D 22 01 00 \2|
7D 00 00 01 00
01 00 80 01 00 01 00 01 80
2541 * 14 02 07 F7 81 41 00 FF 01 00 80 00 10 F7 00

P.S. prop 19 bit 2 is set, but wiki says it is ignored if CB 143 is defined

Attachments

Reported version: trunk
Operating system: All


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

DorpsGek commented Jan 5, 2010

peter1138 wrote:

Please try a simpler test case. I fail to see anything wrong in OpenTTD's handling.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7253

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 5, 2010

George wrote:

there is the GRF in #3477

If you need more simple case - let me know what should it contain


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7256

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 5, 2010

Yexo wrote:

Preferable a newgrf containing only the bank. Alternatively a small savegame with a bank in it, I've generated multiple games and can't find one.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7257

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 5, 2010

Yexo wrote:

I think I found the problem, action2 houses var 64 is not implemented in OpenTTD.

If you use any 'invalid' vars then the rest of the chain is skipped and the first range is returned (or the default if there were 0 ranges). In your case the first range is 00 80 so "keep house".

Will change this to a feature request to implement var 64.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7258

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 5, 2010

George wrote:

Thank you. Do you need any test GRF or these are enough?


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7260

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 5, 2010

Yexo wrote:

I don't think the necesary information is currently stored in OpenTTD so I see no way to implement it currently. That is, without doing a lot of additions to the station handling code.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7263

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 5, 2010

George wrote:

Well, here goes the GRF with var 64 check disabled, banks still do not disappear normally


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7264

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 5, 2010

George wrote:

I placed stations in 1960-th, and banks are still there

P.S. Banks appear in towns with at least 1k inhabitants.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7265

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 5, 2010

Yexo wrote:

I tried that savegame, after 20years the bank was indeed still there. But at least one newgrf is still using var64 and I don't have half of the newgrfs needed.
Then I deleted everything except that single bank and it was deleted with a year.

The best testcase you could provide: a small newgrf with only a single house where only the age determines when it should be deleted and a savegame with just that single newgrf loaded. Then it's very easy to see if checking the age is bugged or if it's something else. I realize that may be quite some work, but I'm not going to dig through a 500kb grf to the complete varaction2 chain for that house, nor debug a long varaction2 chain if it's not really needed.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7267

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 6, 2010

George wrote:

set parameters to 5
set city size multiplier to 5

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7268

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 6, 2010

George wrote:

As you can see, most of the banks are there after 30 years, while protection period is 10 years. Why? How often is the house removed?

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7269

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 6, 2010

Yexo wrote:

Bit 7 in prop14 (to enable the callback) is not set in that grf. As such callback 21 is never called.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7271

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 6, 2010

Yexo wrote:

I should add that after I manually enabled cb21 all banks disappeared within a month or so.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7272

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 6, 2010

George wrote:

And when the CB 21 is not enabled, how long should the house stay after it is not protected with CB 143 and older, than prop 1F specifies?

Also, is it possible to have var 10 or var 18 to have random value to have demolish probability?


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7273

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 6, 2010

frosch wrote:

Random demolition is a bad idea. How shall AIs plan their routes, when testing a house for destructing succeeds during cost estimation (i.e. shift-clicking) and later fails?

Edit: ok, that applies only to cb 143, not 21 (thanks yexo)


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7274

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 6, 2010

George wrote:

Agree, it may break a route planing.

Then let's come to the question from the other side.
I want to make older special buildings to be replaced with more modern ones (also special buildings, like water towers, banks, post offices). On the other side I do not want to demolish the building as soon as it becomes "old". Some buildings should be more lucky and stay for 2 or 3 times longer, than max protection age, while other unlucky ones should not stay for a year after protection is over. How can I provide such behaviour? Currently houses, protected for 10 years mostly lives over 50 years (no AI in game). It means the probability of destroying a house by a town is relative low. It would nice to have the possibility to increase the probability of destroying a house by a town.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481#comment7277

@DorpsGek
Copy link
Member Author

andythenorth closed the ticket.

Reason for closing: Implemented

Message from george: As I can see here, there is cargo_accepted_nearby_last_month. I've not tested it, but looks like the thing requested

Flyspray clean up, so closing.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3481

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) component: NewGRF This issue is related to NewGRFs enhancement labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant