@@ -30,8 +30,8 @@ public static C7SaveFormat ImportSav(string savePath, string defaultBicPath)
3030
3131 ImportCiv3TerrainTypes ( theBiq , c7Save ) ;
3232 Dictionary < int , Resource > resourcesByIndex = ImportCiv3Resources ( civ3Save . Bic , c7Save ) ;
33- SetMapDimensions ( civ3Save , theBiq , c7Save ) ;
34- SetWorldWrap ( theBiq , c7Save ) ;
33+ SetMapDimensions ( civ3Save , c7Save ) ;
34+ SetWorldWrap ( civ3Save , c7Save ) ;
3535
3636 // Import tiles. This is similar to, but different from the BIQ version as tile contents may have changed in-game.
3737 int i = 0 ;
@@ -85,7 +85,7 @@ public static C7SaveFormat ImportBiq(string biqPath, string defaultBiqPath)
8585
8686 ImportCiv3TerrainTypes ( theBiq , c7Save ) ;
8787 Dictionary < int , Resource > resourcesByIndex = ImportCiv3Resources ( theBiq , c7Save ) ;
88- SetMapDimensions ( null , theBiq , c7Save ) ;
88+ SetMapDimensions ( theBiq , c7Save ) ;
8989 SetWorldWrap ( theBiq , c7Save ) ;
9090
9191 // Import tiles
@@ -187,22 +187,40 @@ private static void ImportCiv3TerrainTypes(BiqData theBiq, C7SaveFormat c7Save)
187187 }
188188 }
189189
190+ private static void SetWorldWrap ( SavData civ3Save , C7SaveFormat c7Save )
191+ {
192+ if ( civ3Save != null && civ3Save . Wrld . Height > 0 && civ3Save . Wrld . Width > 0 )
193+ {
194+ c7Save . GameData . map . wrapHorizontally = civ3Save . Wrld . XWrapping ;
195+ c7Save . GameData . map . wrapVertically = civ3Save . Wrld . YWrapping ;
196+ }
197+ }
198+
190199 private static void SetWorldWrap ( BiqData biq , C7SaveFormat c7Save )
191200 {
192- c7Save . GameData . map . wrapHorizontally = biq . Wmap [ 0 ] . XWrapping ;
193- c7Save . GameData . map . wrapVertically = biq . Wmap [ 0 ] . YWrapping ;
194- }
195201
196- private static void SetMapDimensions ( SavData civ3Save , BiqData biq , C7SaveFormat c7Save )
197- {
198- if ( biq != null && biq . Wmap != null && biq . Wmap . Length > 0 ) {
199- c7Save . GameData . map . numTilesTall = biq . Wmap [ 0 ] . Height ;
200- c7Save . GameData . map . numTilesWide = biq . Wmap [ 0 ] . Width ;
202+ if ( biq != null && biq . Wmap != null && biq . Wmap . Length > 0 )
203+ {
204+ c7Save . GameData . map . wrapHorizontally = biq . Wmap [ 0 ] . XWrapping ;
205+ c7Save . GameData . map . wrapVertically = biq . Wmap [ 0 ] . YWrapping ;
201206 }
207+ }
208+
209+ private static void SetMapDimensions ( SavData civ3Save , C7SaveFormat c7Save )
210+ {
202211 if ( civ3Save != null && civ3Save . Wrld . Height > 0 && civ3Save . Wrld . Width > 0 ) {
203212 c7Save . GameData . map . numTilesTall = civ3Save . Wrld . Height ;
204213 c7Save . GameData . map . numTilesWide = civ3Save . Wrld . Width ;
205214 }
206215 }
207- }
216+
217+ private static void SetMapDimensions ( BiqData biq , C7SaveFormat c7Save )
218+ {
219+ if ( biq != null && biq . Wmap != null && biq . Wmap . Length > 0 )
220+ {
221+ c7Save . GameData . map . numTilesTall = biq . Wmap [ 0 ] . Height ;
222+ c7Save . GameData . map . numTilesWide = biq . Wmap [ 0 ] . Width ;
223+ }
224+ }
225+ }
208226}
0 commit comments