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

fix time travel due to 1s turns #36576

Merged

Conversation

KorGgenT
Copy link
Member

@KorGgenT KorGgenT commented Dec 30, 2019

Summary

SUMMARY: Bugfixes "Fix time travel due to 1s turns"

Purpose of change

Fixes #31249
When loading a save from 0.D in 0.E, you get sent back in time. this fixes that by altering some key things upon load given the previous savegame loading version:

  • start date
  • turns
  • item birthdays
  • item last_rot_check

Testing

Created a game in 0.D summer and waited a few days. Spawned in some fresh meat and dropped it at my feet, and walked away several OMTs. Loaded the game with these changes and observed the meat did not rot in my hands, the season is the same, and the meat i dropped a few OMTs away is still fresh.

Additional context

This PR should hang out for a couple days just so people who are playing on experimental and migrate their savs periodically have a chance to bump their savegame version.

@KorGgenT KorGgenT added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) Time / Turns / Duration / Date Issues concerning any activities being too fast or too slow. Also issues about time and date ingame labels Dec 30, 2019
src/savegame_json.cpp Outdated Show resolved Hide resolved
src/savegame_json.cpp Outdated Show resolved Hide resolved
@Qrox
Copy link
Contributor

Qrox commented Dec 31, 2019

I think this will also make saves created after the 1s turn change and before this PR gets merged to time-travel forward when loaded?

@kevingranade
Copy link
Member

Yes, that's the reason for the suggestion to wait a while before merging the PR, to give players a chance to pick up the new version number in their saves.

src/savegame.cpp Outdated Show resolved Hide resolved
@KorGgenT KorGgenT force-pushed the fix-time-travel-due-to-1s-turns branch from c9508f5 to fa222fe Compare January 2, 2020 22:24
src/mapbuffer.cpp Outdated Show resolved Hide resolved
@KorGgenT KorGgenT force-pushed the fix-time-travel-due-to-1s-turns branch from e25f073 to 989dfbe Compare January 3, 2020 18:59
@esotericist
Copy link
Contributor

esotericist commented Jan 4, 2020

Took the time to set up a 0.D world with 3 revealed overmaps, and a scattering of fruit pies across 5 locations. This save archive is directly out of 0.D, and has not yet been loaded in 0.E.
TimeTest.zip

I marked all of the locations where I have fruit pies with map notes. For instance, this is the starting evac shelter (first overmap):
image

Directly southwest from that, in the same overmap, is the first refugee center I gifted with a single fruit pie. (it's on the road in front of the building. Don't mind the military base, the character is invincible.) (still first overmap)
image

Almost straight west is a tacoma ranch (the notes are in the wrong location, the actual target is the road out front like with the refugee center). (second overmap)
image

This location is notable, because the stack of 99 pies there, should be rotten (due to being something like 30 days old), but somehow isn't.

There's also a single pie which shouldn't be rotten. its stats reflect what's expected.

Directly north of the midpoint between the first refugee center and the first ranch, is the second refugee center (still second overmap):
image

It had a slight ant problem, but those are dead and now there is pie.

North a bunch and west a little, is the second ranch (third overmap):
image

I saved and loaded in the first overmap, then explored the second and third overmaps in a second go. everything except the rotting seems to be approximately what I expect.

Important note: for some reason, when I loaded up in 0.E, the pie in the evac shelter was frozen, which wasn't quite expected. I let a little over a day pass so it would thaw, before checking out other locations.

@esotericist
Copy link
Contributor

Additional Debug data.

The evac shelter fruit pie in 0.D, immediately after loading archived 0.D save (no time passed beyond movement):
image

should-be-rotten pies in first ranch in 0.D can't be examined immediately after loading archived save; I think they're removed due to being too rotten.

The evac shelter fruit pie in 0.E, immediately after loading archived 0.D save (no time passed beyond movement):
image

should-be-rotten pies in first ranch in 0.E, only a handful of turns passed (still for movement):
image

@esotericist
Copy link
Contributor

With latest commit, the previously-rotten pies are gone when loading a fresh copy of the 0.D save into 0.E.

@esotericist
Copy link
Contributor

Things that I haven't tested yet:

  • Monster evolution (the nature of the change means we don't have to worry about zombies suddenly hulking out, but evolution effectively stopping for old monsters could be weird)
  • Crop growth (crops ending up needing more time to grow could be pretty sucky for a player transitioning from 0.D, if they were agri-focused)

@KorGgenT
Copy link
Member Author

KorGgenT commented Jan 7, 2020

all right, i think 5 days since the savegame bump is pretty good for those on experimental.

@kevingranade kevingranade merged commit 6674292 into CleverRaven:master Jan 10, 2020
@kevingranade
Copy link
Member

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/date-change-and-sudden-food-rotting/22450/2

@KorGgenT KorGgenT deleted the fix-time-travel-due-to-1s-turns branch March 11, 2020 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Time / Turns / Duration / Date Issues concerning any activities being too fast or too slow. Also issues about time and date ingame
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Character get sent back in time on load.
5 participants