mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 20:55:44 +00:00
Convert to castle as modifier
This commit is contained in:
@@ -8,23 +8,23 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
struct GameFile : Codable {
|
struct OldGameFile : Codable {
|
||||||
public let hexMap : HexMap
|
public let hexMap : OldHexMap
|
||||||
}
|
}
|
||||||
|
|
||||||
struct NewGameFile : Codable {
|
struct NewGameFile : Codable {
|
||||||
public let hexMap : NewHexMap
|
public let hexMap : HexMap
|
||||||
}
|
}
|
||||||
|
|
||||||
let deserializer = CroissantDeserializer()
|
let deserializer = CroissantDeserializer()
|
||||||
let fileUrl = URL(fileURLWithPath: "/Users/dancrosby/CodingProjects/github/eagle0/server/installdata/usr/local/share/eagle0/startfiles/bigfightWithRiver.e0g")
|
let fileUrl = URL(fileURLWithPath: "/Users/dancrosby/CodingProjects/github/eagle0/server/installdata/usr/local/share/eagle0/startfiles/narrowWithRiver.e0g")
|
||||||
let data = try! Data(contentsOf: fileUrl)
|
let data = try! Data(contentsOf: fileUrl)
|
||||||
|
|
||||||
let gameFile = CroissantDeserializer.deserialize(GameFile.self, from: data)!
|
let oldGameFile = CroissantDeserializer.deserialize(OldGameFile.self, from: data)!
|
||||||
let oldMap = gameFile.hexMap
|
let oldMap = oldGameFile.hexMap
|
||||||
let newGameFile = NewGameFile(hexMap: NewHexMap(oldMap: oldMap))
|
let newGameFile = NewGameFile(hexMap: HexMap(oldMap: oldMap))
|
||||||
let newData = newGameFile.croissantEncodedData!
|
let newData = newGameFile.croissantEncodedData!
|
||||||
|
|
||||||
let newUrl = URL(fileURLWithPath: "/Users/dancrosby/CodingProjects/github/eagle0/server/installdata/usr/local/share/eagle0/startfiles/bigfightWithRiver.e0g_")
|
let newUrl = URL(fileURLWithPath: "/Users/dancrosby/CodingProjects/github/eagle0/server/installdata/usr/local/share/eagle0/startfiles/narrowWithRiver.e0g_")
|
||||||
try! newData.write(to: newUrl)
|
try! newData.write(to: newUrl)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user