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

Loading savegame with AI loaded as specific version of that AI fails to load correct version of AI #6468

Open
DorpsGek opened this issue May 25, 2016 · 5 comments

Comments

@DorpsGek
Copy link

@DorpsGek DorpsGek commented May 25, 2016

Wormnest opened the ticket and wrote:

I think there is a AI savegame bug.
Presuming you have both WormAI versions 4 and 5 available statt a new game, open console and do:
startai wormai.4

Run it for a while then save and reload the savegame.

Open console: it shows that savegame has an ai named ´wormai.4´ which is no longer available although obviously WormAI version 4 hasn't been deleted in the meantime.
It als shows that the latest version of the AI has been loaded instead but it didn't receive the savegame data because it's incompatible even though min version to load is 1. This might or might not be caused by the first error.

Note that version numbers are stored in the path inside the tar e.g. WormAI-v5, WormAI-v4 etc so this is not
https://bugs.openttd.org/task/6377

It looks at first glance that it saves the dot and version number as part of the ai name which looks wrong.

Attached example savegame showing the bug.

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/6468
@DorpsGek

This comment has been minimized.

Copy link
Author

@DorpsGek DorpsGek commented May 25, 2016

Wormnest wrote:

See also discussion on IRC: http://irclogs.thegrebs.com/openttd/2016/05/25

Another savegame where I first removed WormAI v5 from content_download/ai and then started a game with the latest version of wormai (= 4).
Loading this again after adding v5 back loads version 5 but without the two complaints in the console. It also does load the savegame data for the AI in contrast to the other savegame.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/6468#comment14194
@DorpsGek

This comment has been minimized.

Copy link
Author

@DorpsGek DorpsGek commented May 26, 2016

Samu wrote:

Hi. From my limited understanding after dwelving into the code, the problem first arises in the console_cmds.cpp, line 1170.

config->Change(argv[1], -1, true);

It takes the value of argv[1], which is wormai.4 and uses that to find the correct version of the ai to start. That is fine, but this also sets the name of the AI, and this name is not corrected to the intended name that should have been retrieved from the ScriptInfo.

When the savegame function is asking for the name of the AI, it takes the wrong name, wormai.4, because it hasn't been corrected when it started via console. The savegame function also asks for the version of the AI, but there is no issue with this part: when the console found version 4 in the ScriptConfig, it also set the version to 4, the savegame functions retrieves version 4 as intended.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6468#comment14196
@DorpsGek

This comment has been minimized.

Copy link
Author

@DorpsGek DorpsGek commented May 30, 2016

Samu wrote:

Perhaps it is intended that it doesn't correct the name of the AI, according to documentation.
https://noai.openttd.org/docs/trunk/classAIController.html# _details


This comment was imported from FlySpray: https://bugs.openttd.org/task/6468#comment14202
@DorpsGek

This comment has been minimized.

Copy link
Author

@DorpsGek DorpsGek commented Jun 22, 2016

Samu wrote:

This fixes it, but my coding skills are horrible.

https://paste.openttdcoop.org/plsfqqmcn

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/6468#comment14225
@andythenorth

This comment has been minimized.

Copy link
Contributor

@andythenorth andythenorth commented Jan 12, 2019

The value of the attached patches is unclear, but the issue remains a bug. Re-labelling and leaving open, for now. It's not frequently reported, so may get closed in future.

SamuXarick added a commit to SamuXarick/OpenTTD that referenced this issue Feb 7, 2019
@TrueBrain TrueBrain added the pinned label Sep 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.