Commits

Anonymous committed d0241b3

Port of Constants.java to serializable types.

Comments (0)

Files changed (2)

 .PHONY: all clean
-EXEC=starml
-OBJ=main.cmo
+EXEC=starml.exe
+OBJ=types.cmo main.cmo
+OCAMLFLAGS=-warn-error A -g
 
 all: $(EXEC)
 
 $(EXEC): $(OBJ)
-	ocamlc -g -o $@ unix.cma $+
+	ocamlc $(OCAMLFLAGS) -o $@ unix.cma $+
 	
 %.cmo: %.ml
-	ocamlc -g -c $<
+	ocamlc $(OCAMLFLAGS) -c $<
 
 clean:
 	rm -f *.cmo *.cmi $(EXEC)
+type race =
+    | Zerg   | Terran | Protoss
+    | Random | Other  | No_race
+    | Unknown_race
+
+let race_write = function
+    | Zerg         -> 0 | Terran       -> 1
+    | Protoss      -> 2 | Random       -> 3
+    | Other        -> 4 | No_race      -> 5
+    | Unknown_race -> 6
+	
+let race_read = function
+    | 0 -> Zerg          | 1 -> Terran        
+    | 2 -> Protoss       | 3 -> Random        
+    | 4 -> Other         | 5 -> No_race       
+    | 6 -> Unknown_race
+    | _ -> invalid_arg "race_read"
+
+type unit_t =
+    | T_Marine                 | T_Ghost
+    | T_Vulture                | T_Goliath
+    | T_Siege_Tank_T           | T_SCV
+    | T_Wraith                 | T_Science_Vessel
+    | T_Dropship               | T_Battlecruiser
+    | T_Spider_Mine            | T_Nuclear_Missile
+    | T_Siege_Tank_S           | T_Medic
+    | Z_Larva                  | T_Firebat
+    | Spell_Scanner_Sweep      | Z_Hydralisk
+    | Z_Ultralisk              | Z_Egg
+    | Z_Zergling               | Z_Overlord
+    | Z_Mutalisk               | Z_Broodling
+    | Z_Drone                  | Z_Defiler
+    | Z_Scourge                | Z_Guardian
+    | Z_Queen                  | Z_Infested_Terran
+    | Z_Cocoon                 | T_Valkyrie
+    | P_Dark_Archon            | Z_Devourer
+    | P_Dark_Templar           | P_Corsair
+    | P_Archon                 | P_Shuttle
+    | P_Scout                  | P_Arbiter
+    | P_Probe                  | P_Zealot
+    | P_Dragoon                | P_High_Templar
+    | P_Carrier                | P_Interceptor
+    | P_Scarab                 | P_Observer
+    | P_Reaver                 | Critter_Scantid
+    | Critter_Ragnasaur        | Critter_Kakaru
+    | Critter_Rhynadon         | Critter_Bengalaas
+    | Z_Lurker                 | Critter_Ursadon
+    | Z_Lurker_Egg             | T_Refinery
+    | T_Barracks               | T_Nuclear_Silo
+    | T_Supply_Depot           | T_Command_Center
+    | T_Comsat_Station         | Spell_Disruption_Web
+    | T_Physics_Lab            | T_Covert_Ops
+    | T_Science_Facility       | T_Control_Tower
+    | T_Starport               | T_Factory
+    | T_Academy                | Spec_Ion_Cannon
+    | Spec_Crashed_Norad_II    | T_Bunker
+    | T_Missile_Turret         | T_Armory
+    | T_Engineering_Bay        | T_Machine_Shop
+    | Z_Greater_Spire          | Z_Defiler_Mound
+    | Z_Evolution_Chamber      | Z_Queen__s_Nest
+    | Z_Spire                  | Z_Ultralisk_Cavern
+    | Z_Creep_Colony           | Z_Spawning_Pool
+    | Z_Hatchery               | Z_Infested_Command_Center
+    | Z_Hive                   | Z_Lair
+    | Z_Hydralisk_Den          | Z_Nydus_Canal
+    | Spec_Cerebrate_Daggoth   | P_Nexus
+    | P_Robotics_Facility      | P_Pylon
+    | P_Assimilator            | P_Observatory
+    | Z_Spore_Colony           | Z_Sunken_Colony
+    | Spec_Overmind_With_Shell | Spec_Overmind
+    | Z_Extractor              | Spec_Mature_Chrysalis
+    | Spec_Cerebrate           | P_Robotics_Support_Bay
+    | P_Arbiter_Tribunal       | P_Fleet_Beacon
+    | Spec_Stasis_Cell_Prison  | Spec_XelNaga_Temple
+    | Spec_Protoss_Temple      | Spec_Khaydarin_Crystal_Form
+    | P_Shield_Battery         | P_Citadel_of_Adun
+    | P_Photon_Cannon          | P_Gateway
+    | P_Stargate               | P_Forge
+    | P_Templar_Archives       | P_Cybernetics_Core
+    | Spec_Psi_Disrupter       | Resource_Vespene_Geyser
+    | Spec_Warp_Gate           | Resource_Mineral_Field
+    | Spec_Overmind_Cocoon     | Spec_Power_Generator
+    | Spell_Dark_Swarm         | Type_Unknown
+    | Type_None
+
+let write_unit_t = function
+  | T_Marine                    -> 0
+  | T_Ghost                     -> 1
+  | T_Vulture                   -> 2
+  | T_Goliath                   -> 3
+  | T_Siege_Tank_T              -> 5
+  | T_SCV                       -> 7
+  | T_Wraith                    -> 8
+  | T_Science_Vessel            -> 9
+  | T_Dropship                  -> 11
+  | T_Battlecruiser             -> 12
+  | T_Spider_Mine               -> 13
+  | T_Nuclear_Missile           -> 14
+  | T_Siege_Tank_S              -> 30
+  | T_Medic                     -> 34
+  | Z_Larva                     -> 35
+  | T_Firebat                   -> 32
+  | Spell_Scanner_Sweep         -> 33
+  | Z_Hydralisk                 -> 38
+  | Z_Ultralisk                 -> 39
+  | Z_Egg                       -> 36
+  | Z_Zergling                  -> 37
+  | Z_Overlord                  -> 42
+  | Z_Mutalisk                  -> 43
+  | Z_Broodling                 -> 40
+  | Z_Drone                     -> 41
+  | Z_Defiler                   -> 46
+  | Z_Scourge                   -> 47
+  | Z_Guardian                  -> 44
+  | Z_Queen                     -> 45
+  | Z_Infested_Terran           -> 50
+  | Z_Cocoon                    -> 59
+  | T_Valkyrie                  -> 58
+  | P_Dark_Archon               -> 63
+  | Z_Devourer                  -> 62
+  | P_Dark_Templar              -> 61
+  | P_Corsair                   -> 60
+  | P_Archon                    -> 68
+  | P_Shuttle                   -> 69
+  | P_Scout                     -> 70
+  | P_Arbiter                   -> 71
+  | P_Probe                     -> 64
+  | P_Zealot                    -> 65
+  | P_Dragoon                   -> 66
+  | P_High_Templar              -> 67
+  | P_Carrier                   -> 72
+  | P_Interceptor               -> 73
+  | P_Scarab                    -> 85
+  | P_Observer                  -> 84
+  | P_Reaver                    -> 83
+  | Critter_Scantid             -> 93
+  | Critter_Ragnasaur           -> 95
+  | Critter_Kakaru              -> 94
+  | Critter_Rhynadon            -> 89
+  | Critter_Bengalaas           -> 90
+  | Z_Lurker                    -> 103
+  | Critter_Ursadon             -> 96
+  | Z_Lurker_Egg                -> 97
+  | T_Refinery                  -> 110
+  | T_Barracks                  -> 111
+  | T_Nuclear_Silo              -> 108
+  | T_Supply_Depot              -> 109
+  | T_Command_Center            -> 106
+  | T_Comsat_Station            -> 107
+  | Spell_Disruption_Web        -> 105
+  | T_Physics_Lab               -> 118
+  | T_Covert_Ops                -> 117
+  | T_Science_Facility          -> 116
+  | T_Control_Tower             -> 115
+  | T_Starport                  -> 114
+  | T_Factory                   -> 113
+  | T_Academy                   -> 112
+  | Spec_Ion_Cannon             -> 127
+  | Spec_Crashed_Norad_II       -> 126
+  | T_Bunker                    -> 125
+  | T_Missile_Turret            -> 124
+  | T_Armory                    -> 123
+  | T_Engineering_Bay           -> 122
+  | T_Machine_Shop              -> 120
+  | Z_Greater_Spire             -> 137
+  | Z_Defiler_Mound             -> 136
+  | Z_Evolution_Chamber         -> 139
+  | Z_Queen__s_Nest             -> 138
+  | Z_Spire                     -> 141
+  | Z_Ultralisk_Cavern          -> 140
+  | Z_Creep_Colony              -> 143
+  | Z_Spawning_Pool             -> 142
+  | Z_Hatchery                  -> 131
+  | Z_Infested_Command_Center   -> 130
+  | Z_Hive                      -> 133
+  | Z_Lair                      -> 132
+  | Z_Hydralisk_Den             -> 135
+  | Z_Nydus_Canal               -> 134
+  | Spec_Cerebrate_Daggoth      -> 152
+  | P_Nexus                     -> 154
+  | P_Robotics_Facility         -> 155
+  | P_Pylon                     -> 156
+  | P_Assimilator               -> 157
+  | P_Observatory               -> 159
+  | Z_Spore_Colony              -> 144
+  | Z_Sunken_Colony             -> 146
+  | Spec_Overmind_With_Shell    -> 147
+  | Spec_Overmind               -> 148
+  | Z_Extractor                 -> 149
+  | Spec_Mature_Chrysalis       -> 150
+  | Spec_Cerebrate              -> 151
+  | P_Robotics_Support_Bay      -> 171
+  | P_Arbiter_Tribunal          -> 170
+  | P_Fleet_Beacon              -> 169
+  | Spec_Stasis_Cell_Prison     -> 168
+  | Spec_XelNaga_Temple         -> 175
+  | Spec_Protoss_Temple         -> 174
+  | Spec_Khaydarin_Crystal_Form -> 173
+  | P_Shield_Battery            -> 172
+  | P_Citadel_of_Adun           -> 163
+  | P_Photon_Cannon             -> 162
+  | P_Gateway                   -> 160
+  | P_Stargate                  -> 167
+  | P_Forge                     -> 166
+  | P_Templar_Archives          -> 165
+  | P_Cybernetics_Core          -> 164
+  | Spec_Psi_Disrupter          -> 190
+  | Resource_Vespene_Geyser     -> 188
+  | Spec_Warp_Gate              -> 189
+  | Resource_Mineral_Field      -> 176
+  | Spec_Overmind_Cocoon        -> 201
+  | Spec_Power_Generator        -> 200
+  | Spell_Dark_Swarm            -> 202
+  | Type_Unknown                -> 229
+  | Type_None                   -> 228	
+
+let read_unit_t = function
+  | 0   -> T_Marine                 
+  | 1   -> T_Ghost                  
+  | 2   -> T_Vulture                
+  | 3   -> T_Goliath                
+  | 5   -> T_Siege_Tank_T
+  | 7   -> T_SCV                    
+  | 8   -> T_Wraith                 
+  | 9   -> T_Science_Vessel         
+  | 11  -> T_Dropship               
+  | 12  -> T_Battlecruiser          
+  | 13  -> T_Spider_Mine    
+  | 14  -> T_Nuclear_Missile        
+  | 30  -> T_Siege_Tank_S
+  | 34  -> T_Medic                  
+  | 35  -> Z_Larva                    
+  | 32  -> T_Firebat                
+  | 33  -> Spell_Scanner_Sweep           
+  | 38  -> Z_Hydralisk                
+  | 39  -> Z_Ultralisk                
+  | 36  -> Z_Egg                      
+  | 37  -> Z_Zergling                 
+  | 42  -> Z_Overlord                 
+  | 43  -> Z_Mutalisk                 
+  | 40  -> Z_Broodling                
+  | 41  -> Z_Drone                    
+  | 46  -> Z_Defiler                  
+  | 47  -> Z_Scourge                  
+  | 44  -> Z_Guardian                 
+  | 45  -> Z_Queen                    
+  | 50  -> Z_Infested_Terran          
+  | 59  -> Z_Cocoon                   
+  | 58  -> T_Valkyrie               
+  | 63  -> P_Dark_Archon           
+  | 62  -> Z_Devourer                 
+  | 61  -> P_Dark_Templar          
+  | 60  -> P_Corsair               
+  | 68  -> P_Archon                
+  | 69  -> P_Shuttle               
+  | 70  -> P_Scout                 
+  | 71  -> P_Arbiter               
+  | 64  -> P_Probe                 
+  | 65  -> P_Zealot                
+  | 66  -> P_Dragoon               
+  | 67  -> P_High_Templar          
+  | 72  -> P_Carrier               
+  | 73  -> P_Interceptor           
+  | 85  -> P_Scarab                
+  | 84  -> P_Observer              
+  | 83  -> P_Reaver                
+  | 93  -> Critter_Scantid               
+  | 95  -> Critter_Ragnasaur             
+  | 94  -> Critter_Kakaru                
+  | 89  -> Critter_Rhynadon              
+  | 90  -> Critter_Bengalaas             
+  | 103 -> Z_Lurker                   
+  | 96  -> Critter_Ursadon               
+  | 97  -> Z_Lurker_Egg               
+  | 110 -> T_Refinery               
+  | 111 -> T_Barracks               
+  | 108 -> T_Nuclear_Silo           
+  | 109 -> T_Supply_Depot           
+  | 106 -> T_Command_Center         
+  | 107 -> T_Comsat_Station         
+  | 105 -> Spell_Disruption_Web          
+  | 118 -> T_Physics_Lab            
+  | 117 -> T_Covert_Ops             
+  | 116 -> T_Science_Facility       
+  | 115 -> T_Control_Tower          
+  | 114 -> T_Starport               
+  | 113 -> T_Factory                
+  | 112 -> T_Academy                
+  | 127 -> Spec_Ion_Cannon            
+  | 126 -> Spec_Crashed_Norad_II      
+  | 125 -> T_Bunker                 
+  | 124 -> T_Missile_Turret         
+  | 123 -> T_Armory                 
+  | 122 -> T_Engineering_Bay        
+  | 120 -> T_Machine_Shop           
+  | 137 -> Z_Greater_Spire            
+  | 136 -> Z_Defiler_Mound            
+  | 139 -> Z_Evolution_Chamber        
+  | 138 -> Z_Queen__s_Nest            
+  | 141 -> Z_Spire                    
+  | 140 -> Z_Ultralisk_Cavern         
+  | 143 -> Z_Creep_Colony             
+  | 142 -> Z_Spawning_Pool            
+  | 131 -> Z_Hatchery                 
+  | 130 -> Z_Infested_Command_Center  
+  | 133 -> Z_Hive                     
+  | 132 -> Z_Lair                     
+  | 135 -> Z_Hydralisk_Den            
+  | 134 -> Z_Nydus_Canal              
+  | 152 -> Spec_Cerebrate_Daggoth     
+  | 154 -> P_Nexus                 
+  | 155 -> P_Robotics_Facility     
+  | 156 -> P_Pylon                 
+  | 157 -> P_Assimilator           
+  | 159 -> P_Observatory           
+  | 144 -> Z_Spore_Colony             
+  | 146 -> Z_Sunken_Colony            
+  | 147 -> Spec_Overmind_With_Shell   
+  | 148 -> Spec_Overmind              
+  | 149 -> Z_Extractor                
+  | 150 -> Spec_Mature_Chrysalis      
+  | 151 -> Spec_Cerebrate             
+  | 171 -> P_Robotics_Support_Bay  
+  | 170 -> P_Arbiter_Tribunal      
+  | 169 -> P_Fleet_Beacon          
+  | 168 -> Spec_Stasis_Cell_Prison    
+  | 175 -> Spec_XelNaga_Temple        
+  | 174 -> Spec_Protoss_Temple        
+  | 173 -> Spec_Khaydarin_Crystal_Form
+  | 172 -> P_Shield_Battery        
+  | 163 -> P_Citadel_of_Adun       
+  | 162 -> P_Photon_Cannon         
+  | 160 -> P_Gateway               
+  | 167 -> P_Stargate              
+  | 166 -> P_Forge                 
+  | 165 -> P_Templar_Archives      
+  | 164 -> P_Cybernetics_Core      
+  | 190 -> Spec_Psi_Disrupter         
+  | 188 -> Resource_Vespene_Geyser       
+  | 189 -> Spec_Warp_Gate             
+  | 176 -> Resource_Mineral_Field        
+  | 201 -> Spec_Overmind_Cocoon       
+  | 200 -> Spec_Power_Generator       
+  | 202 -> Spell_Dark_Swarm              
+  | 229 -> Type_Unknown                  
+  | 228 -> Type_None                     	
+  | _   -> invalid_arg "read_unit_t"
+
+type tech =
+    | Stim_Packs         | Lockdown           
+    | EMP_Shockwave      | Spider_Mines       
+    | Scanner_Sweep      | Tank_Siege_Mode    
+    | Defensive_Matrix   | Irradiate          
+    | Yamato_Gun         | Cloaking_Field     
+    | Personnel_Cloaking | Burrowing          
+    | Infestation        | Spawn_Broodlings   
+    | Dark_Swarm         | Plague             
+    | Consume            | Ensnare            
+    | Parasite           | Psionic_Storm      
+    | Hallucination      | Recall             
+    | Stasis_Field       | Archon_Warp        
+    | Restoration        | Disruption_Web     
+    | Mind_Control       | Dark_Archon_Meld   
+    | Feedback           | Optical_Flare      
+    | Maelstrom          | Lurker_Aspect      
+    | Healing            | Tech_None          
+    | Tech_Unknown       | Nuclear_Strike     
+
+let write_rech = function
+    | Stim_Packs           -> 0
+    | Lockdown             -> 1
+    | EMP_Shockwave        -> 2
+    | Spider_Mines         -> 3
+    | Scanner_Sweep        -> 4
+    | Tank_Siege_Mode      -> 5
+    | Defensive_Matrix     -> 6
+    | Irradiate            -> 7
+    | Yamato_Gun           -> 8
+    | Cloaking_Field       -> 9
+    | Personnel_Cloaking   -> 10
+    | Burrowing            -> 11
+    | Infestation          -> 12
+    | Spawn_Broodlings     -> 13
+    | Dark_Swarm           -> 14
+    | Plague               -> 15
+    | Consume              -> 16
+    | Ensnare              -> 17
+    | Parasite             -> 18
+    | Psionic_Storm        -> 19
+    | Hallucination        -> 20
+    | Recall               -> 21
+    | Stasis_Field         -> 22
+    | Archon_Warp          -> 23
+    | Restoration          -> 24
+    | Disruption_Web       -> 25
+    | Mind_Control         -> 27
+    | Dark_Archon_Meld     -> 28
+    | Feedback             -> 29
+    | Optical_Flare        -> 30
+    | Maelstrom            -> 31
+    | Lurker_Aspect        -> 32
+    | Healing              -> 34
+    | Tech_None            -> 44
+    | Tech_Unknown         -> 45
+    | Nuclear_Strike       -> 46
+
+let read_tech = function
+    | 0  -> Stim_Packs         
+    | 1  -> Lockdown           
+    | 2  -> EMP_Shockwave      
+    | 3  -> Spider_Mines       
+    | 4  -> Scanner_Sweep      
+    | 5  -> Tank_Siege_Mode    
+    | 6  -> Defensive_Matrix   
+    | 7  -> Irradiate          
+    | 8  -> Yamato_Gun         
+    | 9  -> Cloaking_Field     
+    | 10 -> Personnel_Cloaking 
+    | 11 -> Burrowing          
+    | 12 -> Infestation        
+    | 13 -> Spawn_Broodlings   
+    | 14 -> Dark_Swarm         
+    | 15 -> Plague             
+    | 16 -> Consume            
+    | 17 -> Ensnare            
+    | 18 -> Parasite           
+    | 19 -> Psionic_Storm      
+    | 20 -> Hallucination      
+    | 21 -> Recall             
+    | 22 -> Stasis_Field       
+    | 23 -> Archon_Warp        
+    | 24 -> Restoration        
+    | 25 -> Disruption_Web     
+    | 27 -> Mind_Control       
+    | 28 -> Dark_Archon_Meld   
+    | 29 -> Feedback           
+    | 30 -> Optical_Flare      
+    | 31 -> Maelstrom          
+    | 32 -> Lurker_Aspect      
+    | 34 -> Healing            
+    | 44 -> Tech_None          
+    | 45 -> Tech_Unknown       
+    | 46 -> Nuclear_Strike       
+    | _   -> invalid_arg "read_tech"
+
+type upgrade = 
+    | Terran_Infantry_Armor   | Terran_Vehicle_Plating  
+    | Terran_Ship_Plating     | Zerg_Carapace           
+    | Zerg_Flyer_Carapace     | Protoss_Armor           
+    | Protoss_Plating         | Terran_Infantry_Weapons 
+    | Terran_Vehicle_Weapons  | Terran_Ship_Weapons     
+    | Zerg_Melee_Attacks      | Zerg_Missile_Attacks    
+    | Zerg_Flyer_Attacks      | Protoss_Ground_Weapons  
+    | Protoss_Air_Weapons     | Protoss_Plasma_Shields  
+    | U___238_Shells          | Ion_Thrusters           
+    | Titan_Reactor           | Ocular_Implants         
+    | Moebius_Reactor         | Apollo_Reactor          
+    | Colossus_Reactor        | Ventral_Sacs            
+    | Antennae                | Pneumatized_Carapace    
+    | Metabolic_Boost         | Adrenal_Glands          
+    | Muscular_Augments       | Grooved_Spines          
+    | Gamete_Meiosis          | Metasynaptic_Node       
+    | Singularity_Charge      | Leg_Enhancements        
+    | Scarab_Damage           | Reaver_Capacity         
+    | Gravitic_Drive          | Sensor_Array            
+    | Gravitic_Boosters       | Khaydarin_Amulet        
+    | Apial_Sensors           | Gravitic_Thrusters      
+    | Carrier_Capacity        | Khaydarin_Core          
+    | Argus_Jewel             | Argus_Talisman          
+    | Caduceus_Reactor        | Chitinous_Plating       
+    | Anabolic_Synthesis      | Charon_Booster          
+    | Upgrade_None            | Upgrade_Unknown         
+
+let write_upgrade = function
+    | Terran_Infantry_Armor   -> 0
+    | Terran_Vehicle_Plating  -> 1
+    | Terran_Ship_Plating     -> 2
+    | Zerg_Carapace           -> 3
+    | Zerg_Flyer_Carapace     -> 4
+    | Protoss_Armor           -> 5
+    | Protoss_Plating         -> 6
+    | Terran_Infantry_Weapons -> 7
+    | Terran_Vehicle_Weapons  -> 8
+    | Terran_Ship_Weapons     -> 9
+    | Zerg_Melee_Attacks      -> 10
+    | Zerg_Missile_Attacks    -> 11
+    | Zerg_Flyer_Attacks      -> 12
+    | Protoss_Ground_Weapons  -> 13
+    | Protoss_Air_Weapons     -> 14
+    | Protoss_Plasma_Shields  -> 15
+    | U___238_Shells          -> 16
+    | Ion_Thrusters           -> 17
+    | Titan_Reactor           -> 19
+    | Ocular_Implants         -> 20
+    | Moebius_Reactor         -> 21
+    | Apollo_Reactor          -> 22
+    | Colossus_Reactor        -> 23
+    | Ventral_Sacs            -> 24
+    | Antennae                -> 25
+    | Pneumatized_Carapace    -> 26
+    | Metabolic_Boost         -> 27
+    | Adrenal_Glands          -> 28
+    | Muscular_Augments       -> 29
+    | Grooved_Spines          -> 30
+    | Gamete_Meiosis          -> 31
+    | Metasynaptic_Node       -> 32
+    | Singularity_Charge      -> 33
+    | Leg_Enhancements        -> 34
+    | Scarab_Damage           -> 35
+    | Reaver_Capacity         -> 36
+    | Gravitic_Drive          -> 37
+    | Sensor_Array            -> 38
+    | Gravitic_Boosters       -> 39
+    | Khaydarin_Amulet        -> 40
+    | Apial_Sensors           -> 41
+    | Gravitic_Thrusters      -> 42
+    | Carrier_Capacity        -> 43
+    | Khaydarin_Core          -> 44
+    | Argus_Jewel             -> 47
+    | Argus_Talisman          -> 49
+    | Caduceus_Reactor        -> 51
+    | Chitinous_Plating       -> 52
+    | Anabolic_Synthesis      -> 53
+    | Charon_Booster          -> 54
+    | Upgrade_None            -> 61
+    | Upgrade_Unknown         -> 62
+
+let read_upgrade = function
+    | 0     -> Terran_Infantry_Armor   
+    | 1     -> Terran_Vehicle_Plating  
+    | 2     -> Terran_Ship_Plating     
+    | 3     -> Zerg_Carapace           
+    | 4     -> Zerg_Flyer_Carapace     
+    | 5     -> Protoss_Armor           
+    | 6     -> Protoss_Plating         
+    | 7     -> Terran_Infantry_Weapons 
+    | 8     -> Terran_Vehicle_Weapons  
+    | 9     -> Terran_Ship_Weapons     
+    | 10    -> Zerg_Melee_Attacks      
+    | 11    -> Zerg_Missile_Attacks    
+    | 12    -> Zerg_Flyer_Attacks      
+    | 13    -> Protoss_Ground_Weapons  
+    | 14    -> Protoss_Air_Weapons     
+    | 15    -> Protoss_Plasma_Shields  
+    | 16    -> U___238_Shells          
+    | 17    -> Ion_Thrusters           
+    | 19    -> Titan_Reactor           
+    | 20    -> Ocular_Implants         
+    | 21    -> Moebius_Reactor         
+    | 22    -> Apollo_Reactor          
+    | 23    -> Colossus_Reactor        
+    | 24    -> Ventral_Sacs            
+    | 25    -> Antennae                
+    | 26    -> Pneumatized_Carapace    
+    | 27    -> Metabolic_Boost         
+    | 28    -> Adrenal_Glands          
+    | 29    -> Muscular_Augments       
+    | 30    -> Grooved_Spines          
+    | 31    -> Gamete_Meiosis          
+    | 32    -> Metasynaptic_Node       
+    | 33    -> Singularity_Charge      
+    | 34    -> Leg_Enhancements        
+    | 35    -> Scarab_Damage           
+    | 36    -> Reaver_Capacity         
+    | 37    -> Gravitic_Drive          
+    | 38    -> Sensor_Array            
+    | 39    -> Gravitic_Boosters       
+    | 40    -> Khaydarin_Amulet        
+    | 41    -> Apial_Sensors           
+    | 42    -> Gravitic_Thrusters      
+    | 43    -> Carrier_Capacity        
+    | 44    -> Khaydarin_Core          
+    | 47    -> Argus_Jewel             
+    | 49    -> Argus_Talisman          
+    | 51    -> Caduceus_Reactor        
+    | 52    -> Chitinous_Plating       
+    | 53    -> Anabolic_Synthesis      
+    | 54    -> Charon_Booster          
+    | 61    -> Upgrade_None            
+    | 62    -> Upgrade_Unknown         
+    | _     -> invalid_arg "read_upgrade"
+
+type order = 
+    | Die
+    | Stop
+    | Guard
+    | PlayerGuard
+    | TurretGuard
+    | BunkerGuard
+    | Move
+    | ReaverStop
+    | Attack1
+    | Attack2
+    | AttackUnit
+    | AttackFixedRange
+    | AttackTile
+    | Hover
+    | AttackMove
+    | InfestMine1
+    | Nothing1
+    | Powerup1
+    | TowerGuard
+    | TowerAttack
+    | VultureMine
+    | StayinRange
+    | TurretAttack
+    | Nothing2
+    | Nothing3
+    | DroneStartBuild
+    | DroneBuild
+    | InfestMine2
+    | InfestMine3
+    | InfestMine4
+    | BuildTerran
+    | BuildProtoss1
+    | BuildProtoss2
+    | ConstructingBuilding
+    | Repair1
+    | Repair2
+    | PlaceAddon
+    | BuildAddon
+    | Train
+    | RallyPoint1
+    | RallyPoint2
+    | ZergBirth
+    | Morph1
+    | Morph2
+    | BuildSelf1
+    | ZergBuildSelf
+    | Build5
+    | Enternyduscanal
+    | BuildSelf2
+    | Follow
+    | Carrier
+    | CarrierIgnore1
+    | CarrierStop
+    | CarrierAttack1
+    | CarrierAttack2
+    | CarrierIgnore2
+    | CarrierFight
+    | HoldPosition1
+    | Reaver
+    | ReaverAttack1
+    | ReaverAttack2
+    | ReaverFight
+    | ReaverHold
+    | TrainFighter
+    | StrafeUnit1
+    | StrafeUnit2
+    | RechargeShields1
+    | Rechargeshields2
+    | ShieldBattery
+    | Return
+    | DroneLand
+    | BuildingLand
+    | BuildingLiftoff
+    | DroneLiftoff
+    | Liftoff
+    | ResearchTech
+    | Upgrade
+    | Larva
+    | SpawningLarva
+    | Harvest1
+    | Harvest2
+    | MoveToGas (* Unit is moving to refinery *)
+    | WaitForGas (* Unit is waiting to enter the refinery (another unit is currently
+    | in it) *)
+    | HarvestGas (* Unit is in refinery *)
+    | ReturnGas (* Unit is returning gas to center   *)
+    | MoveToMinerals (* Unit is moving to mineral patch *)
+    | WaitForMinerals (* Unit is waiting to use the mineral patch (another unit is
+    | currently mining from it) *)
+    | MiningMinerals (* Unit is mining minerals from mineral patch *)
+    | Harvest3
+    | Harvest4
+    | ReturnMinerals (* Unit is returning minerals to center *)
+    | Harvest5
+    | EnterTransport
+    | Pickup1
+    | Pickup2
+    | Pickup3
+    | Pickup4
+    | Powerup2
+    | SiegeMode
+    | TankMode
+    | WatchTarget
+    | InitCreepGrowth
+    | SpreadCreep
+    | StoppingCreepGrowth
+    | GuardianAspect
+    | WarpingArchon
+    | CompletingArchonsummon
+    | HoldPosition2
+    | HoldPosition3
+    | Cloak
+    | Decloak
+    | Unload
+    | MoveUnload
+    | FireYamatoGun1
+    | FireYamatoGun2
+    | MagnaPulse
+    | Burrow
+    | Burrowed
+    | Unburrow
+    | DarkSwarm
+    | CastParasite
+    | SummonBroodlings
+    | EmpShockwave
+    | NukeWait
+    | NukeTrain
+    | NukeLaunch
+    | NukePaint
+    | NukeUnit
+    | NukeGround
+    | NukeTrack
+    | InitArbiter
+    | CloakNearbyUnits
+    | PlaceMine
+    | Rightclickaction
+    | SapUnit
+    | SapLocation
+    | HoldPosition4
+    | Teleport
+    | TeleporttoLocation
+    | PlaceScanner
+    | Scanner
+    | DefensiveMatrix
+    | PsiStorm
+    | Irradiate
+    | Plague
+    | Consume
+    | Ensnare
+    | StasisField
+    | Hallucianation1
+    | Hallucination2
+    | ResetCollision1
+    | ResetCollision2
+    | Patrol
+    | CTFCOPInit
+    | CTFCOP1
+    | CTFCOP2
+    | ComputerAI
+    | AtkMoveEP
+    | HarassMove
+    | AIPatrol
+    | GuardPost
+    | RescuePassive
+    | Neutral
+    | ComputerReturn
+    | InitPsiProvider
+    | SelfDestrucing
+    | Critter
+    | HiddenGun
+    | OpenDoor
+    | CloseDoor
+    | HideTrap
+    | RevealTrap
+    | Enabledoodad
+    | Disabledoodad
+    | Warpin
+    | Medic
+    | MedicHeal1
+    | HealMove
+    | MedicHoldPosition
+    | MedicHeal2
+    | Restoration
+    | CastDisruptionWeb
+    | CastMindControl
+    | WarpingDarkArchon
+    | CastFeedback
+    | CastOpticalFlare
+    | CastMaelstrom
+    | JunkYardDog
+    | Fatal
+    | None
+    | Unknown