HomeWildfire Games

Correct handling of replays with no turns or only turn 0.

Description

Correct handling of replays with no turns or only turn 0.
Add a comment for r17709.
Some style fixes.

Details

Committed
elexisFeb 9 2016, 1:09 PM
Parents
rP17745: Fix compile error for gcc 4.6, refs #3168.
Branches
Unknown
Tags
Unknown

Event Timeline

wraitii added a subscriber: wraitii.Nov 9 2020, 2:26 PM
wraitii added inline comments.
/ps/trunk/source/ps/Game.cpp
165

This appears to be useless, currentTurn is always 1 or more (you can't actually load a replay without turns).

vladislavbelov added inline comments.
/ps/trunk/source/ps/Game.cpp
165

It's not actually true. You might have an early loop exit, because the data was malformed and (*m_ReplayStream >> type).good() is false.

wraitii added inline comments.Nov 9 2020, 3:08 PM
/ps/trunk/source/ps/Game.cpp
165

Only locally, because there is a check for ENSURE((*m_ReplayStream >> type).good() && type == "start"); in StartVisualReplay (which is done earlier).

vladislavbelov added inline comments.Nov 9 2020, 4:29 PM
/ps/trunk/source/ps/Game.cpp
165

Nope, it only means that the current read is good, but it doesn't guarantee that the next one will be correct.

wraitii added inline comments.Nov 9 2020, 4:34 PM
/ps/trunk/source/ps/Game.cpp
165

Oh, you're right, yeah. /me needs to stop thinking that computers work.