MOO negative fleet fix
It can be frustrating when the negative fleet bug strikes in MOO so I looked to provide an automated way to fix this. The Oreo editor can fix this but only for fleets at planets and is likely to disclose spoiler information apart from which it apparently removes Future Tech from all players. My solution is a Rexx script which resets any ship count of 32,000 or more to zero whether in a fleet enroute or at a planet. Rexx interpreters are freely available and sample ones tested are mentioned (it should be easy to convert to other languages provided they have functions for handling binary data).
Setting up Rexx & script
1. Download Regina Rexx from http://regina-rexx.sourceforge.net/ (or R4 Rexx from http://www.kilowattsoftware.com/r4Page.htm ) and install into its own folder
2. Download my mooFleetFix.rexx.zip below and unzip to the same folder
3. Optionally create batch invocation file (eg. moofix.bat) with single command regina moofleetfix.rexx (or r4 moofleetfix.rexx)
Fixing negative fleet
1. Copy save file(s) SAVEn.GAM with negative fleets into rexx folder – the script will look for SAVE1.GAM to SAVE7.GAM
2. Open command window (Start->run->cmd), change to rexx folder and type command regina moofleetfix.rexx (or r4 moofleetfix.rexx) or simply run batch file created above from Windows Explorer
3. Follow script prompts on whether to start, to fix negative ship groups found and to exit
4. Backup original save file before replacing with updated one from rexx folder
Sample Output (from edited save)
Details (for those interested)
Ships enroute are stored at x’4DA0’ with each fleet 28 bytes long and space for 260 fleets. The first byte of each fleet entry is the race number (0-5) else invalid (usually x’80’+) and the 6 ship counts are in 2 byte pairs from position 11 in standard Intel format (little endian).
Ships at planets are stored at x’74BA’ for player0 (that’s you) then x’828E’, x’9062’, x’9E36’, x’AC0A and x’B9DE’ (x’DD4’ or 3,540 bytes apart) for players 1-5 as they appear on map screen. Fleet entries are 24 bytes long with room for 108 planets (huge galaxy). The 6 ship counts are again standard 2 byte entries from position 13 but there is no validity check so all entries are scanned.
Nothing else is changed including total ship count or maintenance cost. If these need adjusting the program will automatically recalculate them. If you want more details of the save file layout for this ship data or other things not shown in editors then see my other thread: http://forums.civfanatics.com/showthread.php?t=275055
Please let me know of any failure (or success!) you have with this little utility and post your save with negative fleets so I can learn more about them.
Rexx script: View attachment 181827
It can be frustrating when the negative fleet bug strikes in MOO so I looked to provide an automated way to fix this. The Oreo editor can fix this but only for fleets at planets and is likely to disclose spoiler information apart from which it apparently removes Future Tech from all players. My solution is a Rexx script which resets any ship count of 32,000 or more to zero whether in a fleet enroute or at a planet. Rexx interpreters are freely available and sample ones tested are mentioned (it should be easy to convert to other languages provided they have functions for handling binary data).
Setting up Rexx & script
1. Download Regina Rexx from http://regina-rexx.sourceforge.net/ (or R4 Rexx from http://www.kilowattsoftware.com/r4Page.htm ) and install into its own folder
2. Download my mooFleetFix.rexx.zip below and unzip to the same folder
3. Optionally create batch invocation file (eg. moofix.bat) with single command regina moofleetfix.rexx (or r4 moofleetfix.rexx)
Fixing negative fleet
1. Copy save file(s) SAVEn.GAM with negative fleets into rexx folder – the script will look for SAVE1.GAM to SAVE7.GAM
2. Open command window (Start->run->cmd), change to rexx folder and type command regina moofleetfix.rexx (or r4 moofleetfix.rexx) or simply run batch file created above from Windows Explorer
3. Follow script prompts on whether to start, to fix negative ship groups found and to exit
4. Backup original save file before replacing with updated one from rexx folder
Sample Output (from edited save)
mooFleetFix - by sargon0 from CFC & RB Master of Orion forums
Fixes negative fleets in moo save files SAVEn.GAM (n=1-7) in current folder.
It will show negative fleet sizes in each save file then prompt for Y to fix.
Hit Y and return to continue or anything else to exit
y
SAVE1.GAM
No bad fleets in SAVE1.GAM
SAVE2.GAM
Bad ENROUTE ship count for player 3 = 32000
Number of negative ship groups = 1
Fix bad fleets in SAVE2.GAM - hit Y to confirm or anything else for next file
y
Bad ENROUTE count for player 3 = 32000 reset to zero
SAVE3.GAM
Bad PLANET ship count for player 4 = 32000
Number of negative ship groups = 1
Fix bad fleets in SAVE3.GAM - hit Y to confirm or anything else for next file
y
Bad PLANET count for player 3 = 32000 reset to zero
SAVE4.GAM does not exist in current folder
SAVE5.GAM does not exist in current folder
SAVE6.GAM does not exist in current folder
SAVE7.GAM does not exist in current folder
Hit enter to exit
Details (for those interested)
Ships enroute are stored at x’4DA0’ with each fleet 28 bytes long and space for 260 fleets. The first byte of each fleet entry is the race number (0-5) else invalid (usually x’80’+) and the 6 ship counts are in 2 byte pairs from position 11 in standard Intel format (little endian).
Ships at planets are stored at x’74BA’ for player0 (that’s you) then x’828E’, x’9062’, x’9E36’, x’AC0A and x’B9DE’ (x’DD4’ or 3,540 bytes apart) for players 1-5 as they appear on map screen. Fleet entries are 24 bytes long with room for 108 planets (huge galaxy). The 6 ship counts are again standard 2 byte entries from position 13 but there is no validity check so all entries are scanned.
Nothing else is changed including total ship count or maintenance cost. If these need adjusting the program will automatically recalculate them. If you want more details of the save file layout for this ship data or other things not shown in editors then see my other thread: http://forums.civfanatics.com/showthread.php?t=275055
Please let me know of any failure (or success!) you have with this little utility and post your save with negative fleets so I can learn more about them.
Rexx script: View attachment 181827