@@ -699,7 +699,9 @@ private IEnumerable<string> LoadINI(INI ini)
699
699
if ( buildingType != null )
700
700
{
701
701
var coord = int . Parse ( tokens [ 1 ] ) ;
702
- var location = new Point ( ( coord >> 8 ) & 0x3F , ( coord >> 24 ) & 0x3F ) ;
702
+ // Megamap support - bitwise AND needs to be larger
703
+ // var location = new Point((coord >> 8) & 0x3F, (coord >> 24) & 0x3F);
704
+ var location = new Point ( ( coord >> 8 ) & 0x7F , ( coord >> 24 ) & 0x7F ) ;
703
705
if ( Map . Buildings . OfType < Building > ( ) . Where ( x => x . Location == location ) . FirstOrDefault ( ) . Occupier is Building building )
704
706
{
705
707
building . BasePriority = priority ;
@@ -842,7 +844,7 @@ private void LoadBinary(BinaryReader reader)
842
844
{
843
845
/*
844
846
** Format for this is e.g. 0F 00
845
- ** Cell number = every cell gets 2 bytes in the bin file
847
+ ** Cell number = not required as every cell gets 2 bytes in the bin file
846
848
** Template = 0x0F
847
849
** Icon = 0x00
848
850
*/
@@ -1086,7 +1088,9 @@ private void SaveINI(INI ini, FileType fileType)
1086
1088
1087
1089
baseSection [ key ] = string . Format ( "{0},{1}" ,
1088
1090
building . Type . Name . ToUpper ( ) ,
1089
- ( ( location . Y & 0x3F ) << 24 ) | ( ( location . X & 0x3F ) << 8 )
1091
+ // Megamap support - bitwise AND needs to be larger
1092
+ // ((location.Y & 0x3F) << 24) | ((location.X & 0x3F) << 8)
1093
+ ( ( location . Y & 0x7F ) << 24 ) | ( ( location . X & 0x7F ) << 8 )
1090
1094
) ;
1091
1095
}
1092
1096
baseSection [ "Count" ] = baseBuildings . Length . ToString ( ) ;
0 commit comments