Clean code - how do you handle resimulating events and integrating loaded data?

Suppose you have a racing game. Player has started a race, then saves and quits.

There is a few variables you save such as the time remaining, pawn location, etc.

Now, in begining that race, you likely setup some data in preparation. What race is it? Where does it take place? What is the reward and time limit?

Something like this:

Now you need to load that race up again. This is not hard to get the saved data and basically set things back to where they were. But doing so with clean code is another battle…

In preparing the race, I have a series of events, each responsible for generating some necessary data:

What I did previously was go through each event and, where necessary, have some Branch or Select node that ask, “are we loading data, or generating new data?” If loading a race then I would get the saved data from the Save Object and plug that in, rather than generating new data.

That worked, but it is quite hard to maintain down the road. I don’t like to have to hunt and peck through code that has a lot of caveats weaved through it.

Another approach that may work better:

I plug back in the same starting data, fire off the whole Race Preparation sequence again, and then , in a separate series of events, I ovverride those variables that had changed.

e.g. after starting the same race over, then I take the Timer variables, the pawn location variable, and set those from the Save Object. Essentially, this separates my logic - I have a series of events for starting a race, and a series of events for overriding variables in a race.

That seems like a cleaner way to handle this and more in line with the single responsibility principle?

How might you approach a problem like this?

A few other caveats: This is single player, single developer project. Main goal is just simple code that is easy to jump into months later after my focus has been on art or marketing or something else for a long time.

Thanks for any input.