Skip to content

Commit

Permalink
Savegame Tool: Write a map state header, for format detection
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Mar 17, 2014
1 parent e04433d commit 9fa76a1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions doomsday/tools/savegametool/src/main.cpp
Expand Up @@ -696,8 +696,14 @@ static bool convertSavegame(Path oldSavePath)
closeFile();
if(openFile(oldMapStatePath))
{
if(Block *mapStateData = bufferFile())
if(Block *xlatedData = bufferFile())
{
// Append the remaining translated data to header, forming the new serialized
// map state data file.
Block *mapStateData = mapStateHeader();
*mapStateData += *xlatedData;
delete xlatedData;

arch.add(Path("maps") / composeMapUriPath(0, i) + "State", *mapStateData);
delete mapStateData;
}
Expand All @@ -708,9 +714,16 @@ static bool convertSavegame(Path oldSavePath)
{
// The only serialized map state follows the session metadata in the game state file.
// Decompress the rest of the file and write it out to a new map state file.
if(Block *mapStateData = bufferFile())
if(Block *xlatedData = bufferFile())
{
String const mapUriStr = metadata["mapUri"].value().asText();

// Append the remaining translated data to header, forming the new serialized
// map state data file.
Block *mapStateData = mapStateHeader();
*mapStateData += *xlatedData;
delete xlatedData;

arch.add(Path("maps") / mapUriStr + "State", *mapStateData);
delete mapStateData;
}
Expand Down

0 comments on commit 9fa76a1

Please sign in to comment.