Git Product home page Git Product logo

Comments (9)

philcampeau avatar philcampeau commented on August 11, 2024

Strange. The code is in place, and when I create a new game in hotseat mode, the discount works on this train. I've also played many games of 18VA and never encountered this issue. But when I create a hotseat game using the game data from this game, I can confirm the issue occurs on my end too.

from 18xx.

dtschirmer avatar dtschirmer commented on August 11, 2024

from 18xx.

magnusrk-ch avatar magnusrk-ch commented on August 11, 2024

Stepping through it in a debugger I found the following:

  1. The ability doesn't work because @selected_company is actually nil at the time of the purchase.
  2. @selected_company is nil because render in app/view/game/round/operating.rb sets it to nil after determining it doesn't have any abilities.
  3. It doesn't have any abilities because ability_right_time? looks for when = buy_train, but the ability has when = buying_train.

The check in 2) is relatively new, from early September: 7ea0f18
Based on the commit description, it seems entirely possible this is yet another case of clearing @selected_company when it shouldn't be, due to the mismatch in 3). E.g. the render time check might expect buy_train while the buy action processing check might require buying_train, so if we didn't clear the company it would Just Work.

The actual mismatch in 3) is weird. 18NY and variants use buy_train and everything else uses buying_train. I don't see any reason these should be different, but I am not at all familiar with train buying abilities.

from 18xx.

JaySixA avatar JaySixA commented on August 11, 2024

Any idea when this will be addressed?

from 18xx.

jasonbegy avatar jasonbegy commented on August 11, 2024

Same bug here: https://18xx.games/game/146806

from 18xx.

ChrisTheCat avatar ChrisTheCat commented on August 11, 2024

Same bug here: https://18xx.games/game/146806

I don't see the bug in that game. When VR acquired Tredegar Iron Works, it had ~450 and needed 800 to buy a train from the depot.

from 18xx.

jasonbegy avatar jasonbegy commented on August 11, 2024

The bug was present throughout the game. Anytime the owner of Tredegar tried buying it into any company, and applying the discount to any train, it did not work. We tried all sorts of combinations of owning company and train buying and it never worked.

from 18xx.

magnusrk-ch avatar magnusrk-ch commented on August 11, 2024

https://github.com/tobymao/18xx/blob/master/assets/app/view/game/round/operating.rb#L40

This is the code that wipes out @selected_company and prevents the ability from working.

The bug only triggers when there are zero purchasable companies. In the buggy game there are zero player owned companies. In the functional game there is one.

So it comes down to 7ea0f18 again. That's attempt #3 to get it right, and it turns out didn't work that time either.

Exactly why the train discount doesn't register as an available ability is still puzzling, but we should revert the change above to unbreak games first.

from 18xx.

ventusignis avatar ventusignis commented on August 11, 2024

I'm uploading a fix soon; changing the timing from buying_train to buy_train fixes Tredgar; looking at the ability_right_time? implementation it looks like buying_train isn't the name of a step or explicitly stated so it doesn't get past this

https://github.com/tobymao/18xx/blob/master/lib/engine/game/base.rb#L3082

from 18xx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.