mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-08-17 05:29:02 +00:00
Preserve previous saved game if 2mg is present.
This commit is contained in:
parent
b05e138400
commit
17793d011f
@ -2359,10 +2359,14 @@ end
|
|||||||
// Copy the memory manager to the output directory
|
// Copy the memory manager to the output directory
|
||||||
copyIfNewer(new File("build/src/core/build/cmd.sys#2000"), new File("build/root/cmd.sys#2000"))
|
copyIfNewer(new File("build/src/core/build/cmd.sys#2000"), new File("build/root/cmd.sys#2000"))
|
||||||
|
|
||||||
// Decompress the base image
|
// If we preserved a previous save game, copy it to the new image.
|
||||||
|
def prevSave = new File("build/prevGame/game.1.save.\$f1")
|
||||||
|
if (prevSave.exists())
|
||||||
|
Files.copy(prevSave.toPath(), new File("build/root/game.1.save.\$f1").toPath())
|
||||||
|
|
||||||
|
// Decompress the base image.
|
||||||
|
// No need to delete old file; that was done by outer-level code.
|
||||||
def dst = new File("game.2mg")
|
def dst = new File("game.2mg")
|
||||||
if (dst.exists())
|
|
||||||
dst.delete()
|
|
||||||
Files.copy(new GZIPInputStream(new FileInputStream(jitCopy(new File("build/data/disks/base.2mg.gz")))), dst.toPath())
|
Files.copy(new GZIPInputStream(new FileInputStream(jitCopy(new File("build/data/disks/base.2mg.gz")))), dst.toPath())
|
||||||
|
|
||||||
// Now put the files into the image
|
// Now put the files into the image
|
||||||
@ -2396,6 +2400,11 @@ end
|
|||||||
}
|
}
|
||||||
def xmlFile = new File(args.size() == 1 ? args[0] : "world.xml")
|
def xmlFile = new File(args.size() == 1 ? args[0] : "world.xml")
|
||||||
|
|
||||||
|
// Create the build directory if necessary
|
||||||
|
def buildDir = new File("build").getCanonicalFile()
|
||||||
|
if (!buildDir.exists())
|
||||||
|
buildDir.mkdirs()
|
||||||
|
|
||||||
// If there's an existing error file, remove it first, so user doesn't
|
// If there's an existing error file, remove it first, so user doesn't
|
||||||
// get confused by an old file.
|
// get confused by an old file.
|
||||||
def errorFile = new File("pack_error.txt")
|
def errorFile = new File("pack_error.txt")
|
||||||
@ -2409,16 +2418,18 @@ end
|
|||||||
// Also remove existing game image if any, for the same reason.
|
// Also remove existing game image if any, for the same reason.
|
||||||
def gameFile = new File("game.2mg")
|
def gameFile = new File("game.2mg")
|
||||||
if (gameFile.exists())
|
if (gameFile.exists())
|
||||||
|
{
|
||||||
|
// We want to preserve any existing saved game, so grab files from the old image.
|
||||||
|
String[] args2 = ["-get", "game.2mg", "/", "build/prevGame"]
|
||||||
|
new a2copy.A2Copy().main(args2)
|
||||||
|
|
||||||
|
// Then delete the old image.
|
||||||
gameFile.delete()
|
gameFile.delete()
|
||||||
|
}
|
||||||
|
|
||||||
// Go for it.
|
// Go for it.
|
||||||
def inst
|
def inst
|
||||||
try {
|
try {
|
||||||
// Create the build directory if necessary
|
|
||||||
def buildDir = new File("build").getCanonicalFile()
|
|
||||||
if (!buildDir.exists())
|
|
||||||
buildDir.mkdirs()
|
|
||||||
|
|
||||||
// Create PLASMA headers
|
// Create PLASMA headers
|
||||||
inst = new PackPartitions()
|
inst = new PackPartitions()
|
||||||
inst.buildDir = buildDir
|
inst.buildDir = buildDir
|
||||||
|
Loading…
Reference in New Issue
Block a user