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

GSTown.PerformTownAction crashes OpenTTD if called during world generation #6966

Closed
James103 opened this issue Nov 9, 2018 · 3 comments
Closed
Labels
bug Something isn't working component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) needs triage This issue needs further investigation before it becomes actionable

Comments

@James103
Copy link
Contributor

James103 commented Nov 9, 2018

To reproduce this, do the following:

  1. Download the attached Game Script (appears as "BaseGS" in list)
  2. Select it in the AI/Game Script menu.
  3. Start new game.
  4. OpenTTD crashes when it's world gen phase should have moved to "Running script".

Note: OpenTTD only crashes due to GSTown.PerformTownAction if it is called under a valid company scope and during world generation. If GSTown.PerformTownAction is called outside of valid company scope, or during the main gameplay, OpenTTD does not crash.

Test Game Script
Attached crash files

@TrueBrain TrueBrain added component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) needs triage This issue needs further investigation before it becomes actionable bug Something isn't working labels Nov 25, 2018
@Alberth289346
Copy link
Contributor

Alberth289346 commented Dec 29, 2018

The zipped BaseGS.tar file has no BaseGS directory prefix, either unpack the tar in such a directory or rebuild the tar to include such a directory.

The application crashes on

openttd: /home/alberth/openttd/openttd.git/src/ai/../core/pool_type.hpp:113: Titem* Pool<Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero>::Get(size_t) [with Titem = Company; Tindex = Owner; long unsigned int Tgrowth_step = 1; long unsigned int Tmax_size = 15; PoolType Tpool_type = (PoolType)1; bool Tcache = false; bool Tzero = true; size_t = long unsigned int]:
Assertion `index < this->first_unused' failed.

where _company_pool.first_unused is 0 (ie no Companies available in the pool).

@LordAro
Copy link
Member

LordAro commented Dec 29, 2018

Same assert as #6605 & #6507 ...

@Alberth289346
Copy link
Contributor

Alberth289346 commented Dec 29, 2018

#6605 and #6507 crash on town pools rather than company pools, so this issue is different

nielsmh pushed a commit to nielsmh/OpenTTD that referenced this issue Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) needs triage This issue needs further investigation before it becomes actionable
Projects
None yet
Development

No branches or pull requests

4 participants