Credits

Without the help of dderevjanik and KSneijders, this update would not be possible.

Update: <2020-06-27 Sat>

Using AoE2ScenarioParser by KSneijders

Extract a trigger into JSON using the python library.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
{
  "_TriggerObject__description": "\u0000",
  "_TriggerObject__short_description": "\u0000",
  "_name": "StartYearCountdown\u0000",
  "condition_order": [
    0
  ],
  "conditions": [
    {
      "ai_signal": -1,
      "amount_or_quantity": 0,
      "area_1_x": -1,
      "area_1_y": -1,
      "area_2_x": -1,
      "area_2_y": -1,
      "comparison": -1,
      "condition_type": 4,
      "inverted": -1,
      "next_object": -1,
      "object_group": -1,
      "object_list": 826,
      "object_type": -1,
      "player": 0,
      "py/object": "AoE2ScenarioParser.objects.condition_obj.ConditionObject",
      "resource_type_or_tribute_list": -1,
      "target_player": -1,
      "technology": -1,
      "timer": -1,
      "unit_object": -1,
      "variable": -1
    }
  ],
  "description_order": 0,
  "description_stid": -1,
  "display_as_objective": 0,
  "display_on_screen": 0,
  "effect_order": [
    0,
    1
  ],
  "effects": [
    {
      "_message": "Years\u0000",
      "_sound_name": "",
      "aa_armor_or_attack_type": -1,
      "aa_quantity": -1,
      "ai_script_goal": -1,
      "ai_signal_value": -1,
      "area_1_x": -1,
      "area_1_y": -1,
      "area_2_x": -1,
      "area_2_y": -1,
      "attack_stance": -1,
      "button_location": -1,
      "diplomacy": -1,
      "display_time": -1,
      "effect_type": 56,
      "enabled_or_victory": -1,
      "facet": -1,
      "flash_object": -1,
      "food": -1,
      "force_research_technology": -1,
      "from_variable": 1,
      "gold": -1,
      "instruction_panel_position": -1,
      "item_id": -1,
      "location_x": -1,
      "location_y": -1,
      "number_of_units_selected": -1,
      "object_attributes": -1,
      "object_group": -1,
      "object_list_unit_id": -1,
      "object_list_unit_id_2": -1,
      "object_type": -1,
      "operation": 1,
      "play_sound": -1,
      "player_source": -1,
      "player_target": -1,
      "py/object": "AoE2ScenarioParser.objects.effect_obj.EffectObject",
      "quantity": 550,
      "scroll": -1,
      "selected_object_id": -1,
      "stone": -1,
      "string_id": -1,
      "technology": -1,
      "time_unit": -1,
      "tribute_list": -1,
      "trigger_id": -1,
      "variable_or_timer": -1,
      "visibility_state": -1,
      "wood": -1
    },
    {
      "_message": "PlayerControl\u0000",
      "_sound_name": "",
      "aa_armor_or_attack_type": -1,
      "aa_quantity": -1,
      "ai_script_goal": -1,
      "ai_signal_value": -1,
      "area_1_x": -1,
      "area_1_y": -1,
      "area_2_x": -1,
      "area_2_y": -1,
      "attack_stance": -1,
      "button_location": -1,
      "diplomacy": -1,
      "display_time": -1,
      "effect_type": 56,
      "enabled_or_victory": -1,
      "facet": -1,
      "flash_object": -1,
      "food": -1,
      "force_research_technology": -1,
      "from_variable": 2,
      "gold": -1,
      "instruction_panel_position": -1,
      "item_id": -1,
      "location_x": -1,
      "location_y": -1,
      "number_of_units_selected": -1,
      "object_attributes": -1,
      "object_group": -1,
      "object_list_unit_id": -1,
      "object_list_unit_id_2": -1,
      "object_type": -1,
      "operation": 1,
      "play_sound": -1,
      "player_source": -1,
      "player_target": -1,
      "py/object": "AoE2ScenarioParser.objects.effect_obj.EffectObject",
      "quantity": 0,
      "scroll": -1,
      "selected_object_id": -1,
      "stone": -1,
      "string_id": -1,
      "technology": -1,
      "time_unit": -1,
      "tribute_list": -1,
      "trigger_id": -1,
      "variable_or_timer": -1,
      "visibility_state": -1,
      "wood": -1
    }
  ],
  "enabled": 1,
  "header": 0,
  "looping": 0,
  "mute_objectives": 0,
  "py/object": "AoE2ScenarioParser.objects.trigger_obj.TriggerObject",
  "short_description_stid": -1,
  "trigger_id": 0
}

asciinema recording

Using the AoE2ScenarioParser debug output vs emac’s hexl-mode

This utility is great for seeing what changes between AOE2DE versions.

Started: <2019-11-16 Sat>

Class diagram of TS

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
n17 [label="{LinkList|- _head\l- _tail\l|  clear()\l  getById()\l  getByIdSafe()\l  head()\l  pop()\l  push_back()\l}" style=filled fillcolor="#ffffff" shape="record"];
n19 [label="{MapCopyCache|+ source\l+ source\l+ unitcount\l+ unitcount\l+ units\l+ units\l|}" style=filled fillcolor="#ffffff" shape="record"];
n41 [label="{playersunit_ucnst_equals|- _cnst\l|}" style=filled fillcolor="#ffffff" shape="record"];
n42 [label="{playersunit_ucnst_notequals|- _cnst\l|}" style=filled fillcolor="#ffffff" shape="record"];
n3 [label="{Campaign|+ header\l|  open()\l  reset()\l}" style=filled fillcolor="#ffffff" shape="record"];
n11 [label="{EditEC|+ index\l+ mapview\l+ parent\l+ players\l+ trigindex\l+ user\l|}" style=filled fillcolor="#ffffff" shape="record"];
n30 [label="{TrigXmlVisitor|- _ss\l- _trigcount\l|  visit()\l  visitEnd()\l}" style=filled fillcolor="#ffffff" shape="record"];
n44 [label="{uid_equals|- _uid\l|}" style=filled fillcolor="#ffffff" shape="record"];
n45 [label="{unit_in_area|- _area\l|}" style=filled fillcolor="#ffffff" shape="record"];
n8 [label="{ECBase|+ GAIA_INDEX\l+ ectype\l+ parent_trigger_id\l+ size\l+ type\l|}" style=filled fillcolor="#ffffff" shape="record"];
n14 [label="{EffectItemData|+ editor\l+ treeitem\l+ trig_index\l|  Copy()\l  Delete()\l  DuplicatePlayers()\l  GetEffect()\l  GetName()\l+ GetTrigger()\l  ModifyIndex()\l  OpenEditor()\l}" style=filled fillcolor="#ffffff" shape="record"];
n37 [label="{get_ec_player|- _player\l|+ player()\l}" style=filled fillcolor="#ffffff" shape="record"];
n40 [label="{players||}" style=filled fillcolor="#ffffff" shape="record"];
n43 [label="{send_visitor|- _tv\l|}" style=filled fillcolor="#ffffff" shape="record"];
n28 [label="{TrigScrawlVisitor|- _ss\l- _trigcount\l|  visit()\l  visitEnd()\l}" style=filled fillcolor="#ffffff" shape="record"];
n34 [label="{UnitGroupLink|+ count\l+ list\l|}" style=filled fillcolor="#ffffff" shape="record"];
n22 [label="{Player|+ age\l+ ai\l+ aifile\l+ aimode\l+ avictory\l+ camera\l+ civ\l+ color\l+ cty\l+ ctyfile\l+ diplomacy\l+ dis_bldg\l+ dis_tech\l+ dis_unit\l+ enable\l+ ending_age\l+ human\l+ name\l  names\l+ names\l+ ndis_b\l+ ndis_t\l+ ndis_u\l  num_players\l+ num_players\l+ player_number\l+ pop\l+ resources\l+ stable\l+ u1\l+ u2\l+ ucount\l+ units\l+ vc\l+ vcfile\l|  add_unit()\l  change_unit_type_for_all_of_type()\l  clear_ai()\l  clear_cty()\l  clear_vc()\l  erase_unit()\l  erase_unit_area()\l  erase_unit_type()\l  export_ai()\l  export_cty()\l  export_vc()\l  find_unit()\l  import_ai()\l  import_cty()\l  import_vc()\l  read_age()\l  read_aifiles()\l  read_aimode()\l  read_camera_longs()\l  read_data1()\l  read_data3()\l  read_data4()\l  read_diplomacy()\l  read_dis_bldgs()\l  read_dis_techs()\l  read_dis_units()\l  read_header_name()\l  read_header_stable()\l  read_ndis_bldgs()\l  read_ndis_techs()\l  read_ndis_units()\l  read_player_number()\l  read_resources()\l  read_units()\l  reset()\l  write_data1()\l  write_data3()\l  write_header_name()\l  write_header_stable()\l  write_no_units()\l  write_units()\l}" style=filled fillcolor="#ffffff" shape="record"];
n26 [label="{Setts|+ BasePath\l+ DelTempOnExit\l+ ScenPath\l+ TempPath\l+ asktoconverteffects\l+ disabletips\l+ displayhints\l+ drawconds\l+ draweffects\l+ drawelevation\l+ drawlocations\l+ drawplayer\l+ drawterrain\l+ editall\l+ forceenabletips\l+ intense\l+ logname\l+ nowarnings\l- path\l- recent\l+ recent_first\l- recent_used\l+ showdisplayorder\l+ showtrigfunction\l+ showtrigids\l+ showtrignames\l+ warnbits\l+ zoom\l|  load()\l  read_recent()\l  recent_getnext()\l  recent_push()\l  write_recent()\l}" style=filled fillcolor="#ffffff" shape="record"];
n6 [label="{Condition|+ NUM_CONDITIONS_AOF4\l+ NUM_CONDITIONS_AOHD4\l+ NUM_CONDITIONS_AOK\l+ NUM_CONDITIONS_CC\l+ NUM_CONDITIONS_SWGB\l+ NUM_TAUNT_SETS\l+ NUM_VIRTUAL_CONDITIONS_AOC\l+ NUM_VIRTUAL_CONDITIONS_AOF\l+ NUM_VIRTUAL_CONDITIONS_AOHD\l+ NUM_VIRTUAL_CONDITIONS_AOK\l+ NUM_VIRTUAL_CONDITIONS_CC\l+ NUM_VIRTUAL_CONDITIONS_SWGB\l+ NUM_VIRTUAL_CONDITIONS_UP\l+ ai_signal\l+ amount\l+ area\l  defaultvals\l+ defaultvals\l+ group\l+ object\l+ pTech\l+ pUnit\l+ player\l+ res_type\l+ reserved\l+ reverse_hd\l  taunt_set\l+ taunt_set\l+ tech_cnst\l+ timer\l  types\l+ types\l  types_aok\l+ types_aok\l  types_cc\l+ types_cc\l  types_short\l+ types_short\l  types_short_aok\l+ types_short_aok\l  types_short_cc\l+ types_short_cc\l  types_short_swgb\l+ types_short_swgb\l  types_swgb\l+ types_swgb\l+ u_loc\l+ unit_cnst\l+ unknown2\l+ utype\l- valid_since_last_check\l  virtual_types\l+ virtual_types\l  virtual_types_aoc\l+ virtual_types_aoc\l  virtual_types_aof\l+ virtual_types_aof\l  virtual_types_aohd\l+ virtual_types_aohd\l  virtual_types_aok\l+ virtual_types_aok\l  virtual_types_cc\l+ virtual_types_cc\l  virtual_types_swgb\l+ virtual_types_swgb\l  virtual_types_up\l+ virtual_types_up\l|  accept()\l  areaName()\l  check()\l  check_and_save()\l  compress()\l  getName()\l  getPlayer()\l  get_valid_since_last_check()\l  null_location_unit()\l  null_object()\l  read()\l  selectedUnits()\l  setPlayer()\l  tobuffer()\l  valid_area()\l  valid_area_location()\l  valid_full_map()\l  valid_location_unit()\l  valid_object()\l  valid_partial_map()\l  valid_player()\l  valid_technology_spec()\l  valid_unit_spec()\l  write()\l}" style=filled fillcolor="#ffffff" shape="record"];
n7 [label="{ConditionItemData|+ editor\l+ treeitem\l+ trig_index\l|  Copy()\l  Delete()\l  DuplicatePlayers()\l  GetCondition()\l  GetName()\l+ GetTrigger()\l  ModifyIndex()\l  OpenEditor()\l}" style=filled fillcolor="#ffffff" shape="record"];
n38 [label="{io_error||}" style=filled fillcolor="#ffffff" shape="record"];
n39 [label="{p||}" style=filled fillcolor="#ffffff" shape="record"];
n47 [label="{unit_in_rect|- _rect\l- _rect\l|}" style=filled fillcolor="#ffffff" shape="record"];
n5 [label="{ColorLink|+ ref\l|}" style=filled fillcolor="#ffffff" shape="record"];
n20 [label="{MemBuffer|- blen\l- buffer\l- mine\l- pos\l- writeable\l|  checkFits()\l  fill()\l+ get()\l  read()\l  reads()\l  skip()\l  write()\l  writes()\l}" style=filled fillcolor="#ffffff" shape="record"];
n15 [label="{ItemData|+ index\l+ type\l|  Copy()\l  Delete()\l  DuplicatePlayers()\l  GetName()\l+ GetTrigger()\l  ModifyIndex()\l  OpenEditor()\l}" style=filled fillcolor="#ffffff" shape="record"];
n16 [label="{Link|- _id\l- _name\l+ _next\l|  id()\l  name()\l  next()\l  read()\l  setNext()\l}" style=filled fillcolor="#ffffff" shape="record"];
n21 [label="{NullBuffer|- _size\l|  fill()\l  read()\l  reads()\l  size()\l  skip()\l  write()\l  writes()\l}" style=filled fillcolor="#ffffff" shape="record"];
n24 [label="{SVector|- begin\l- end\l- next\l- realloc_flag\l|+ allocate()\l+ append()\l+ at()\l+ clear()\l- copy()\l+ count()\l- expand()\l+ first()\l+ insert()\l+ last()\l+ remove()\l}" style=filled fillcolor="#ffffff" shape="record"];
n25 [label="{Scenario|+ OUTOFBOUNDS\l  StandardAI\l+ StandardAI\l  StandardAI2\l+ StandardAI2\l+ TEMPTERRAIN\l+ TEMPTERRAIN2\l+ all_techs\l+ bBitmap\l+ bitmap\l+ cFiles\l+ cinem\l+ editor_pos\l+ files\l+ game\l+ header\l+ lock_teams\l+ map\l+ max_teams\l+ messages\l- mod_status\l+ msg\l+ mstrings\l+ next_uid\l+ objstate\l+ origname\l+ pergame\l+ perversion\l  pgAOC\l+ pgAOC\l  pgAOE\l+ pgAOE\l  pgAOF\l+ pgAOF\l  pgAOF4\l+ pgAOF4\l  pgAOF6\l+ pgAOF6\l  pgAOHD\l+ pgAOHD\l  pgAOHD4\l+ pgAOHD4\l  pgAOHD6\l+ pgAOHD6\l  pgAOK\l+ pgAOK\l+ pgGame\l  pgSWGB\l+ pgSWGB\l  pgSWGBCC\l+ pgSWGBCC\l  pgUP\l+ pgUP\l+ player_choose_teams\l+ players\l  pv1_15\l+ pv1_15\l  pv1_18\l+ pv1_18\l+ pv1_21\l  pv1_22\l+ pv1_22\l  pv1_23\l+ pv1_23\l  pv1_24\l+ pv1_24\l  pv1_26\l+ pv1_26\l  pv1_30\l+ pv1_30\l+ random_start_points\l- sect\l+ t_order\l+ triggers\l+ trigver\l+ unk3\l+ unk4\l+ unknown\l+ ver1\l+ ver2\l+ version2\l+ vict\l|  AOKBMP()\l  accept()\l  adapt_game()\l  add_activation()\l  aoc_to_aok()\l  aoc_to_hd4()\l  aoc_to_hd6()\l  aohd_to_hd6()\l  aok_to_aoc()\l  auto_upgrade_hd4()\l  auto_upgrade_hd6()\l  change_unit_type_for_all_of_type()\l  clean_format()\l  clean_triggers()\l  clearaicpvc()\l  compress_unit_ids()\l  datasetRequired()\l  delete_player_units()\l  delete_triggers()\l  duplicate_triggers()\l  exFile()\l  expansionsRequired()\l  export_bmp()\l  fix_t_order()\l  fix_trigger_outliers()\l  floodFill4()\l  floodFillElev4()\l  getPlayerCount()\l  get_number_active_players()\l  hd4_to_hd6()\l  hd_to_10c()\l  hd_to_swgb()\l  hd_to_up()\l  insert_trigger()\l  instructions_panel_set()\l  instructions_sound_id_set()\l  instructions_sound_text_set()\l  instructions_string_reset()\l  instructions_string_zero()\l  isTerrainEdge()\l  is_userpatch()\l  map_change_elevation()\l  map_copy()\l  map_delete()\l  map_duplicate()\l  map_move()\l  map_paste()\l  map_repeat()\l  map_scale()\l  map_size()\l  map_swap()\l  move_triggers()\l+ needsave()\l  next_sect()\l  open()\l  outline()\l  outlineDraw()\l  prefix_display_order()\l  randomize_unit_frames()\l  read()\l  read_data()\l  remove_display_order_prefix()\l  remove_trigger_descriptions()\l  remove_trigger_names()\l  requireDataset()\l  reset()\l  save()\l  save_pseudonyms()\l  set_number_active_players()\l  set_unit_z_to_map_elev()\l  sort_conds_effects()\l  strip_patch4()\l  strip_patch6()\l  swapTerrain()\l  swap_players()\l  swap_trigger_names_descriptions()\l  swap_triggers()\l  sync_triggers()\l  toFile()\l  unrequireDataset()\l  up_to_10c()\l  up_to_aofe()\l  up_to_hd()\l  up_to_swgb()\l  water_cliffs_visibility()\l  write()\l  write_data()\l}" style=filled fillcolor="#ffffff" shape="record"];
n4 [label="{ChangePlayerVisitor|- _player\l|  visit()\l}" style=filled fillcolor="#ffffff" shape="record"];
n9 [label="{ESDATA|- aitype_count\l+ aitypes\l- civ_count\l+ civs\l- color_count\l+ colors\l  pfuncs\l- pfuncs\l- res_count\l+ resources\l- rstate\l- tech_count\l+ techs\l- terrain_count\l+ terrains\l+ ug_buildings\l+ ug_units\l- unit_count\l- unitgroup_count\l+ unitgroups\l+ units\l|  endResources()\l  getCount()\l  load()\l  readAitypes()\l  readCiv()\l  readColor()\l  readResources()\l  readSimple()\l  readTech()\l  readTerrain()\l  readUnit()\l  readUnitGroup()\l}" style=filled fillcolor="#ffffff" shape="record"];
n12 [label="{EditEffect|+ N_CONTROLS\l+ TrigCallback\l+ e\l|  update()\l}" style=filled fillcolor="#ffffff" shape="record"];
n23 [label="{SString|- data\l- len\l  null\l- null\l|+ c_str()\l  erase()\l+ length()\l  lock()\l+ lwn()\l  put()\l  read()\l  set()\l+ total_size()\l  unlock()\l  write()\l}" style=filled fillcolor="#ffffff" shape="record"];
n29 [label="{TrigXmlReader||  read()\l}" style=filled fillcolor="#ffffff" shape="record"];
n31 [label="{Trigger|+ conds\l+ description\l+ display_order\l+ effects\l+ id\l+ loop\l+ name\l+ obj\l+ obj_order\l+ obj_str_id\l+ state\l+ u1\l|  accept()\l  getIDName()\l  getName()\l  get_player()\l  read()\l  sort_conditions()\l  sort_effects()\l  tobuffer()\l  write()\l}" style=filled fillcolor="#ffffff" shape="record"];
n32 [label="{TriggerVisitor||+ visitEnd()\l}" style=filled fillcolor="#ffffff" shape="record"];
n33 [label="{Unit|- cnst\l+ frame\l+ garrison\l+ ident\l- pType\l+ rotate\l  size\l+ size\l+ state\l+ x\l+ y\l+ z\l|  getType()\l  getTypeID()\l  read()\l  setType()\l  toBuffer()\l}" style=filled fillcolor="#ffffff" shape="record"];
n1 [label="{AutoFile|- _file\l|  close()\l  get()\l}" style=filled fillcolor="#ffffff" shape="record"];
n10 [label="{EditCondition|+ N_CONTROLS\l+ c\l|  update()\l}" style=filled fillcolor="#ffffff" shape="record"];
n48 [label="{unit_is_type|- _type\l|}" style=filled fillcolor="#ffffff" shape="record"];
n35 [label="{UnitLink|+ hp\l|}" style=filled fillcolor="#ffffff" shape="record"];
n36 [label="{bad_data_error||}" style=filled fillcolor="#ffffff" shape="record"];
n27 [label="{TechLink|+ civ\l|}" style=filled fillcolor="#ffffff" shape="record"];
n2 [label="{Buffer||}" style=filled fillcolor="#ffffff" shape="record"];
n13 [label="{Effect|+ NUM_EFFECTS_AOC\l+ NUM_EFFECTS_AOF\l+ NUM_EFFECTS_AOF4\l+ NUM_EFFECTS_AOF6\l+ NUM_EFFECTS_AOHD\l+ NUM_EFFECTS_AOHD4\l+ NUM_EFFECTS_AOHD6\l+ NUM_EFFECTS_AOK\l+ NUM_EFFECTS_CC\l+ NUM_EFFECTS_SWGB\l+ NUM_EFFECTS_UP\l+ NUM_VIRTUAL_EFFECTS_AOC\l+ NUM_VIRTUAL_EFFECTS_AOF\l+ NUM_VIRTUAL_EFFECTS_AOHD\l+ NUM_VIRTUAL_EFFECTS_AOK\l+ NUM_VIRTUAL_EFFECTS_CC\l+ NUM_VIRTUAL_EFFECTS_SWGB\l+ NUM_VIRTUAL_EFFECTS_UP\l+ ai_goal\l+ amount\l+ area\l  defaultvals\l+ defaultvals\l+ diplomacy\l+ disp_time\l+ group\l+ location\l+ num_sel\l+ pTech\l+ pUnit\l+ panel\l+ res_type\l+ s_player\l+ sound\l+ soundid\l+ stance\l+ t_player\l+ tech_cnst\l+ text\l+ textid\l+ trig_index\l  types\l+ types\l  types_aoc\l+ types_aoc\l  types_aof\l+ types_aof\l  types_aohd\l+ types_aohd\l  types_aok\l+ types_aok\l  types_cc\l+ types_cc\l  types_short\l+ types_short\l  types_short_aoc\l+ types_short_aoc\l  types_short_aof\l+ types_short_aof\l  types_short_aohd\l+ types_short_aohd\l  types_short_aok\l+ types_short_aok\l  types_short_cc\l+ types_short_cc\l  types_short_swgb\l+ types_short_swgb\l  types_short_up\l+ types_short_up\l  types_swgb\l+ types_swgb\l  types_up\l+ types_up\l+ uid_loc\l+ uids\l+ unit_cnst\l+ utype\l- valid_since_last_check\l  virtual_types\l+ virtual_types\l  virtual_types_aoc\l+ virtual_types_aoc\l  virtual_types_aof\l+ virtual_types_aof\l  virtual_types_aohd\l+ virtual_types_aohd\l  virtual_types_aok\l+ virtual_types_aok\l  virtual_types_cc\l+ virtual_types_cc\l  virtual_types_swgb\l+ virtual_types_swgb\l  virtual_types_up\l+ virtual_types_up\l|  accept()\l  areaName()\l  check()\l  check_and_save()\l  compress()\l  getName()\l  getPlayer()\l  getTypeName()\l  get_valid_since_last_check()\l  has_selected()\l  has_unit_constant()\l  isCeilAmount()\l  isFloorAmount()\l  null_location_unit()\l  read()\l  selectedUnits()\l  setPlayer()\l  tobuffer()\l  valid_area()\l  valid_area_location()\l  valid_destination()\l  valid_full_map()\l  valid_location_coord()\l  valid_location_unit()\l  valid_panel()\l  valid_partial_map()\l  valid_points()\l  valid_selected()\l  valid_source_player()\l  valid_target_player()\l  valid_technology_spec()\l  valid_trigger()\l  valid_unit_constant()\l  valid_unit_spec()\l  write()\l}" style=filled fillcolor="#ffffff" shape="record"];
{ n21 n20 } -> n2 [arrowhead="empty"];
{ n10 n12 } -> n11 [arrowhead="empty"];
{ n35 n27 n34 n5 } -> n16 [arrowhead="empty"];
{ n13 n6 } -> n8 [arrowhead="empty"];
{ n14 n7 } -> n15 [arrowhead="empty"];
{ n4 n30 n28 } -> n32 [arrowhead="empty"];

Try opening a scenario saved from DE

I receive this error

1
2
3
4
5
6
7
8
Failed to open as The Conquerors scenario file.
Try opening as a SWGB scx file instead
using File->Open

The problem: Not a valid scenario.

If the game is able to open the scenario,
please report this error. Thanks.

Attempt to get the scenario loading

Search for Not a valid scenario in the code.

It happens as the scenario is being read.

1
2
3
4
5
6
/* Header */
if (!header.read(scx.get()))
{
  printf_log("Invalid scenario header in %s\n", path);
  throw runtime_error("Not a valid scenario.");
}

header is a struct inside scen.{cpp,h} with a read method

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//	Un-compressed Header
struct _header
{
  char version[5];		//Version string (+ 1 for NULL)
  long length;			//length of header (after this point)
  HeaderType header_type;
  unsigned long instruct_len;  	//Instructions string length
  unsigned long n_players;
  unsigned long uses_expansions; // not sure about this
  unsigned long n_datasets;
  unsigned long datasets[NUM_DATASETS];  // the number of elements read and saved is given by n_datasets. 5 is an arbitrary number
  __time32_t timestamp;	//last save
  //left out instructions in header
  UNREAD(long pcount);

  void reset();
  bool read(FILE *scx);	//error return
  void write(FILE *scx, const SString *instr, long players, Game g);
    bool expansionsRequired();
    bool datasetRequired(Dataset::Value d);
    void requireDataset(Dataset::Value d);
    void unrequireDataset(Dataset::Value d);
} header;

It appears there should be decent logging.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
bool Scenario::_header::read(FILE *scx)
{
  bool ret = true;
  printf_log("header:\n");
  fread(version, sizeof(char), 4, scx);
  version[5] = '\0';
  printf_log("\tversion: %s.\n", version);

  fread(&length, sizeof(long), 1, scx);
  printf_log("\tlength: %ld.\n", length);

  fread(&header_type, sizeof(long), 1, scx); // version number I think
  printf_log("\theader_type: %ld.\n", header_type);
  REPORTS(header_type == HT_SC || header_type == HT_AOE2SCENARIO, ret = false, "Header type value invalid.\n");
  fread(&timestamp, sizeof(timestamp), 1, scx);
  fread(&instruct_len, sizeof(long), 1, scx);
  printf_log("\tinstruct_len: %ld.\n", instruct_len);
  SKIP(scx, instruct_len);             //instructions
  SKIP(scx, sizeof(long));	//unknown
  fread(&n_players, sizeof(long), 1, scx);
  if (header_type == HT_AOE2SCENARIO) {
  	  // aoe2scenario format
  	  SKIP(scx, sizeof(long));
  	  fread(&uses_expansions, sizeof(long), 1, scx);
  	  printf_log("uses expansions ? %d\n", uses_expansions);
  	  fread(&n_datasets, sizeof(long), 1, scx);
  	  for (int i = 0; i < n_datasets; i++) {
  	      fread(&datasets[i], sizeof(long), 1, scx);
  	      printf_log("dataset %d enabled\n", datasets[i]);
  	  }
  }

  return ret;
}

This is the log

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Opened log file y:\\ts.log.
TS Path: y:\
Last game was Age of Empires II: HD Edition 4.3 (2F).

Opened successfully genie/esdata from "y:\\data_aok.xml"...
Loaded:
648 technologies,
9 colors,
1115 units,
209 resources,
36 aitypes,
65 terrains,
20 unitgroups,
and 32 civilizations.
Done.

Game is Age of Empires II: HD Edition 4.3 (2F)
allies 1 1 1
allies 0 0 0
allies 1 1 1
allies 0 0 0
allies 1 1 1
allies 0 0 0
allies 1 1 1
allies 0 0 0
allies 1 1 1
allies 0 0 0
Selected 1, AOE 2.
Game is Age of Empires II: HD Edition 4.3 (2F)
Opening scenario "Z:\DE version check.aoe2scenario"
header:
  version: 1.36.
  length: 0.
  header_type: 5.
Header type value invalid.
  instruct_len: 1.
Invalid scenario header in Z:\DE version check.aoe2scenario
User message: Failed to open as The Conquerors scenario file.
Try opening as a SWGB scx file instead
using File->Open

The problem: Not a valid scenario.

If the game is able to open the scenario,
please report this error. Thanks.
Game is Age of Empires II: HD Edition 4.3 (2F)
allies 1 1 1
allies 0 0 0
allies 1 1 1
allies 0 0 0
Selected 1, AOE 2.
Game is Age of Empires II: HD Edition 4.3 (2F)
Opening scenario "Z:\DE version check.aoe2scenario"
header:
  version: 1.36.
  length: 0.
  header_type: 5.
Header type value invalid.
  instruct_len: 1.
Invalid scenario header in Z:\DE version check.aoe2scenario
User message: Failed to open as The Conquerors scenario file.
Try opening as a SWGB scx file instead
using File->Open

The problem: Not a valid scenario.

If the game is able to open the scenario,
please report this error. Thanks.
Game is Age of Empires II: HD Edition 4.3 (2F)
allies 1 1 1
allies 0 0 0
allies 1 1 1
allies 0 0 0

It failed at Header type value invalid.

Add the type into the logged output.

1
2
-	REPORTS(header_type == HT_SC || header_type == HT_AOE2SCENARIO, ret = false, "Header type value invalid.\n");
+	REPORTS(header_type == HT_SC || header_type == HT_AOE2SCENARIO, ret = false, "Header type value %ul invalid.\n", header_type);

header_type is not an enum value.

1
2
3
4
  version: 1.36.
  length: 0.
  header_type: 5.
Header type value 2118293808l invalid.

I overlooked length.

0= in the log.

It appears the header has been removed from the format.

This has gotten us past this and to the next error

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
bool Scenario::_header::read(FILE *scx)
{
  bool ret = true;
  printf_log("header:\n");
  fread(version, sizeof(char), 4, scx);
  version[5] = '\0';
  printf_log("\tversion: %s.\n", version);

  fread(&length, sizeof(long), 1, scx);
  printf_log("\tlength: %ld.\n", length);

        //if (! (length == 0 && strcmp(version, "1.36") == 0)) {
        if (length > 0) {
          fread(&header_type, sizeof(long), 1, scx); // version number I think
          printf_log("\theader_type: %ld.\n", header_type);
          REPORTS(header_type == HT_SC || header_type == HT_AOE2SCENARIO, ret = false, "Header type value %ul invalid.\n", header_type);
          fread(&timestamp, sizeof(timestamp), 1, scx);
          fread(&instruct_len, sizeof(long), 1, scx);
          printf_log("\tinstruct_len: %ld.\n", instruct_len);
          SKIP(scx, instruct_len);             //instructions
          SKIP(scx, sizeof(long));	//unknown
          fread(&n_players, sizeof(long), 1, scx);
          if (header_type == HT_AOE2SCENARIO) {
          	  // aoe2scenario format
          	  SKIP(scx, sizeof(long));
          	  fread(&uses_expansions, sizeof(long), 1, scx);
          	  printf_log("uses expansions ? %d\n", uses_expansions);
          	  fread(&n_datasets, sizeof(long), 1, scx);
          	  for (int i = 0; i < n_datasets; i++) {
          	      fread(&datasets[i], sizeof(long), 1, scx);
          	      printf_log("dataset %d enabled\n", datasets[i]);
          	  }
          }
        }

  return ret;
}

The new error message. I must solve this

1
2
3
4
5
Failed to open as Unknown scenario file.
The problem: There was a problem with the scenario data: unrecognized Format version

If the game is able to open the scenario,
please report this error. Thanks.

The problematic code.

1
2
3
4
5
6
7
/* Inflate and Read Compressed Data */
if (header.header_type == HT_AOE2SCENARIO) {
  	// length no longer indicates header length (or likely never truly did)
  	c_len = fsize(path) - ((8 + 2 + header.n_datasets) * 4 + header.instruct_len);
} else {
  	c_len = fsize(path) - (header.length + 8);	//subtract header length
}

Well, header_type wasn’t loaded because there was no header, so we shouldn’t be checking that value anyway.

I need a hex editor to find these magic numbers.

hex
0d 0a line break

Using the hex editor

My own laptop is incapable of running Age of Empires II: Definitive Edition.

Thankfully, my friend SpookyMagician supplied me with some scenarios I can diff.

asciinema recording

<2019-12-17 Tue>

1
zcd $MYGIT/mullikine/aokts

UML

Generate

asciinema recording

Output

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
                                                   +------------------------------------+
                                                   |              AutoFile              |
                                                   +------------------------------------+
                                                   |              - _file               |
                                                   +------------------------------------+
                                                   |              close()               |
                                                   | get()                              |
                                                   +------------------------------------+

                                                                                                +---------------------------+
                                                                                                v                           |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+
                                                   |           EditCondition            | --> |       EditEC        | <-- |          EditEffect           |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+
                                                   |                                    |     |       + index       |     |                               |
                                                   |                                    |     | + mapview           |     |                               |
                                                   |            + N_CONTROLS            |     | + parent            |     |         + N_CONTROLS          |
                                                   | + c                                |     | + players           |     | + TrigCallback                |
                                                   |                                    |     | + trigindex         |     | + e                           |
                                                   |                                    |     | + user              |     |                               |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+
                                                   |              update()              |     |                     |     |           update()            |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+

                                                                                                +---------------------------+
                                                                                                v                           |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+
                                                   |               Effect               | --> |       ECBase        | <-- |           Condition           |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+
                                                   |         + NUM_EFFECTS_AOC          |     |                     |     |                               |
                                                   | + NUM_EFFECTS_AOF                  |     |                     |     |                               |
                                                   | + NUM_EFFECTS_AOF4                 |     |                     |     |                               |
                                                   | + NUM_EFFECTS_AOF6                 |     |                     |     |                               |
                                                   | + NUM_EFFECTS_AOHD                 |     |                     |     |                               |
                                                   | + NUM_EFFECTS_AOHD4                |     |                     |     |                               |
                                                   | + NUM_EFFECTS_AOHD6                |     |                     |     |                               |
                                                   | + NUM_EFFECTS_AOK                  |     |                     |     |                               |
                                                   | + NUM_EFFECTS_CC                   |     |                     |     |                               |
                                                   | + NUM_EFFECTS_SWGB                 |     |                     |     |                               |
                                                   | + NUM_EFFECTS_UP                   |     |                     |     |                               |
                                                   | + NUM_VIRTUAL_EFFECTS_AOC          |     |                     |     |                               |
                                                   | + NUM_VIRTUAL_EFFECTS_AOF          |     |                     |     |                               |
                                                   | + NUM_VIRTUAL_EFFECTS_AOHD         |     |                     |     |                               |
                                                   | + NUM_VIRTUAL_EFFECTS_AOK          |     |                     |     |     + NUM_CONDITIONS_AOF4     |
                                                   | + NUM_VIRTUAL_EFFECTS_CC           |     |                     |     | + NUM_CONDITIONS_AOHD4        |
                                                   | + NUM_VIRTUAL_EFFECTS_SWGB         |     |                     |     | + NUM_CONDITIONS_AOK          |
                                                   | + NUM_VIRTUAL_EFFECTS_UP           |     |                     |     | + NUM_CONDITIONS_CC           |
                                                   | + ai_goal                          |     |                     |     | + NUM_CONDITIONS_SWGB         |
                                                   | + amount                           |     |                     |     | + NUM_TAUNT_SETS              |
                                                   | + area                             |     |                     |     | + NUM_VIRTUAL_CONDITIONS_AOC  |
                                                   | defaultvals                        |     |                     |     | + NUM_VIRTUAL_CONDITIONS_AOF  |
                                                   | + defaultvals                      |     |                     |     | + NUM_VIRTUAL_CONDITIONS_AOHD |
                                                   | + diplomacy                        |     |                     |     | + NUM_VIRTUAL_CONDITIONS_AOK  |
                                                   | + disp_time                        |     |                     |     | + NUM_VIRTUAL_CONDITIONS_CC   |
                                                   | + group                            |     |                     |     | + NUM_VIRTUAL_CONDITIONS_SWGB |
                                                   | + location                         |     |                     |     | + NUM_VIRTUAL_CONDITIONS_UP   |
                                                   | + num_sel                          |     |                     |     | + ai_signal                   |
                                                   | + pTech                            |     |                     |     | + amount                      |
                                                   | + pUnit                            |     |                     |     | + area                        |
                                                   | + panel                            |     |                     |     | defaultvals                   |
                                                   | + res_type                         |     |                     |     | + defaultvals                 |
                                                   | + s_player                         |     |                     |     | + group                       |
                                                   | + sound                            |     |                     |     | + object                      |
                                                   | + soundid                          |     |                     |     | + pTech                       |
                                                   | + stance                           |     |                     |     | + pUnit                       |
                                                   | + t_player                         |     |                     |     | + player                      |
                                                   | + tech_cnst                        |     |                     |     | + res_type                    |
                                                   | + text                             |     |                     |     | + reserved                    |
                                                   | + textid                           |     |                     |     | + reverse_hd                  |
                                                   | + trig_index                       |     |                     |     | taunt_set                     |
                                                   | types                              |     |                     |     | + taunt_set                   |
                                                   | + types                            |     |                     |     | + tech_cnst                   |
                                                   | types_aoc                          |     |                     |     | + timer                       |
                                                   | + types_aoc                        |     |                     |     | types                         |
                                                   | types_aof                          |     |    + GAIA_INDEX     |     | + types                       |
                                                   | + types_aof                        |     | + ectype            |     | types_aok                     |
                                                   | types_aohd                         |     | + parent_trigger_id |     | + types_aok                   |
                                                   | + types_aohd                       |     | + size              |     | types_cc                      |
                                                   | types_aok                          |     | + type              |     | + types_cc                    |
                                                   | + types_aok                        |     |                     |     | types_short                   |
                                                   | types_cc                           |     |                     |     | + types_short                 |
                                                   | + types_cc                         |     |                     |     | types_short_aok               |
                                                   | types_short                        |     |                     |     | + types_short_aok             |
                                                   | + types_short                      |     |                     |     | types_short_cc                |
                                                   | types_short_aoc                    |     |                     |     | + types_short_cc              |
                                                   | + types_short_aoc                  |     |                     |     | types_short_swgb              |
                                                   | types_short_aof                    |     |                     |     | + types_short_swgb            |
                                                   | + types_short_aof                  |     |                     |     | types_swgb                    |
                                                   | types_short_aohd                   |     |                     |     | + types_swgb                  |
                                                   | + types_short_aohd                 |     |                     |     | + u_loc                       |
                                                   | types_short_aok                    |     |                     |     | + unit_cnst                   |
                                                   | + types_short_aok                  |     |                     |     | + unknown2                    |
                                                   | types_short_cc                     |     |                     |     | + utype                       |
                                                   | + types_short_cc                   |     |                     |     | - valid_since_last_check      |
                                                   | types_short_swgb                   |     |                     |     | virtual_types                 |
                                                   | + types_short_swgb                 |     |                     |     | + virtual_types               |
                                                   | types_short_up                     |     |                     |     | virtual_types_aoc             |
                                                   | + types_short_up                   |     |                     |     | + virtual_types_aoc           |
                                                   | types_swgb                         |     |                     |     | virtual_types_aof             |
                                                   | + types_swgb                       |     |                     |     | + virtual_types_aof           |
                                                   | types_up                           |     |                     |     | virtual_types_aohd            |
                                                   | + types_up                         |     |                     |     | + virtual_types_aohd          |
                                                   | + uid_loc                          |     |                     |     | virtual_types_aok             |
                                                   | + uids                             |     |                     |     | + virtual_types_aok           |
                                                   | + unit_cnst                        |     |                     |     | virtual_types_cc              |
                                                   | + utype                            |     |                     |     | + virtual_types_cc            |
                                                   | - valid_since_last_check           |     |                     |     | virtual_types_swgb            |
                                                   | virtual_types                      |     |                     |     | + virtual_types_swgb          |
                                                   | + virtual_types                    |     |                     |     | virtual_types_up              |
                                                   | virtual_types_aoc                  |     |                     |     | + virtual_types_up            |
                                                   | + virtual_types_aoc                |     |                     |     |                               |
                                                   | virtual_types_aof                  |     |                     |     |                               |
                                                   | + virtual_types_aof                |     |                     |     |                               |
                                                   | virtual_types_aohd                 |     |                     |     |                               |
                                                   | + virtual_types_aohd               |     |                     |     |                               |
                                                   | virtual_types_aok                  |     |                     |     |                               |
                                                   | + virtual_types_aok                |     |                     |     |                               |
                                                   | virtual_types_cc                   |     |                     |     |                               |
                                                   | + virtual_types_cc                 |     |                     |     |                               |
                                                   | virtual_types_swgb                 |     |                     |     |                               |
                                                   | + virtual_types_swgb               |     |                     |     |                               |
                                                   | virtual_types_up                   |     |                     |     |                               |
                                                   | + virtual_types_up                 |     |                     |     |                               |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+
                                                   |              accept()              |     |                     |     |                               |
                                                   | areaName()                         |     |                     |     |                               |
                                                   | check()                            |     |                     |     |                               |
                                                   | check_and_save()                   |     |                     |     |                               |
                                                   | compress()                         |     |                     |     |                               |
                                                   | getName()                          |     |                     |     |                               |
                                                   | getPlayer()                        |     |                     |     |           accept()            |
                                                   | getTypeName()                      |     |                     |     | areaName()                    |
                                                   | get_valid_since_last_check()       |     |                     |     | check()                       |
                                                   | has_selected()                     |     |                     |     | check_and_save()              |
                                                   | has_unit_constant()                |     |                     |     | compress()                    |
                                                   | isCeilAmount()                     |     |                     |     | getName()                     |
                                                   | isFloorAmount()                    |     |                     |     | getPlayer()                   |
                                                   | null_location_unit()               |     |                     |     | get_valid_since_last_check()  |
                                                   | read()                             |     |                     |     | null_location_unit()          |
                                                   | selectedUnits()                    |     |                     |     | null_object()                 |
                                                   | setPlayer()                        |     |                     |     | read()                        |
                                                   | tobuffer()                         |     |                     |     | selectedUnits()               |
                                                   | valid_area()                       |     |                     |     | setPlayer()                   |
                                                   | valid_area_location()              |     |                     |     | tobuffer()                    |
                                                   | valid_destination()                |     |                     |     | valid_area()                  |
                                                   | valid_full_map()                   |     |                     |     | valid_area_location()         |
                                                   | valid_location_coord()             |     |                     |     | valid_full_map()              |
                                                   | valid_location_unit()              |     |                     |     | valid_location_unit()         |
                                                   | valid_panel()                      |     |                     |     | valid_object()                |
                                                   | valid_partial_map()                |     |                     |     | valid_partial_map()           |
                                                   | valid_points()                     |     |                     |     | valid_player()                |
                                                   | valid_selected()                   |     |                     |     | valid_technology_spec()       |
                                                   | valid_source_player()              |     |                     |     | valid_unit_spec()             |
                                                   | valid_target_player()              |     |                     |     | write()                       |
                                                   | valid_technology_spec()            |     |                     |     |                               |
                                                   | valid_trigger()                    |     |                     |     |                               |
                                                   | valid_unit_constant()              |     |                     |     |                               |
                                                   | valid_unit_spec()                  |     |                     |     |                               |
                                                   | write()                            |     |                     |     |                               |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+

                                                     +------------------------------------------+
                                                     |                                          v
                                                   +------------------------------------+     +---------------------+     +-------------------------------+
                                                   |           EffectItemData           | --> |      ItemData       | <-- |       ConditionItemData       |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+
                                                   |              + editor              |     |                     |     |           + editor            |
                                                   | + treeitem                         |     |       + index       |     | + treeitem                    |
                                                   | + trig_index                       |     | + type              |     | + trig_index                  |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+
                                                   |               Copy()               |     |                     |     |            Copy()             |
                                                   | Delete()                           |     |       Copy()        |     | Delete()                      |
                                                   | DuplicatePlayers()                 |     | Delete()            |     | DuplicatePlayers()            |
                                                   | GetEffect()                        |     | DuplicatePlayers()  |     | GetCondition()                |
                                                   | GetName()                          |     | GetName()           |     | GetName()                     |
                                                   | + GetTrigger()                     |     | + GetTrigger()      |     | + GetTrigger()                |
                                                   | ModifyIndex()                      |     | ModifyIndex()       |     | ModifyIndex()                 |
                                                   | OpenEditor()                       |     | OpenEditor()        |     | OpenEditor()                  |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+

                                                     +------------------------------------------+
                                                     |                                          v
                                                   +------------------------------------+     +---------------------+     +-------------------------------+
                                                   |             MemBuffer              | --> |       Buffer        | <-- |          NullBuffer           |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+
                                                   |               - blen               |     |                     |     |                               |
                                                   | - buffer                           |     |                     |     |                               |
                                                   | - mine                             |     |                     |     |            - _size            |
                                                   | - pos                              |     |                     |     |                               |
                                                   | - writeable                        |     |                     |     |                               |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+
                                                   |            checkFits()             |     |                     |     |                               |
                                                   | fill()                             |     |                     |     |            fill()             |
                                                   | + get()                            |     |                     |     | read()                        |
                                                   | read()                             |     |                     |     | reads()                       |
                                                   | reads()                            |     |                     |     | size()                        |
                                                   | skip()                             |     |                     |     | skip()                        |
                                                   | write()                            |     |                     |     | write()                       |
                                                   | writes()                           |     |                     |     | writes()                      |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+

                                                                                                +------------------------------------------------------------+
                                                                                                v                                                            |
                                                   +------------------------------------+     +---------------------+     +-------------------------------+  |  +---------------+
                                                   |              TechLink              | --> |                     | <-- |           ColorLink           |  +- | UnitGroupLink |
                                                   +------------------------------------+     |                     |     +-------------------------------+     +---------------+
                                                   |                                    |     |                     |     |                               |     |    + count    |
                                                   |               + civ                |     |        Link         |     |             + ref             |     | + list        |
                                                   +------------------------------------+     |                     |     +-------------------------------+     +---------------+
                                                   |                                    |     |                     |     |                               |     |               |
                                                   |                                    |  +> |                     | <+  |                               |     |               |
                                                   +------------------------------------+  |  +---------------------+  |  +-------------------------------+     +---------------+
                                                                                           |  |        - _id        |  |
                                                                                           |  | - _name             |  |
  +---------------------------+                                                            |  | + _next             |  |
  |                           v                                                            |  +---------------------+  |
+---------------------+     +----------------+     +------------------------------------+  |  |        id()         |  |
|                     |     |                |     |                                    |  |  | name()              |  |
| ChangePlayerVisitor |     | TriggerVisitor |     |         TrigScrawlVisitor          |  |  | next()              |  |
|                     |     |                |     |                                    |  |  | read()              |  |
|                     | --> |                | <-- |                                    |  |  | setNext()           |  |
+---------------------+     +----------------+     +------------------------------------+  |  +---------------------+  |
|                     |     |                |     |               - _ss                |  |                           |
|      - _player      |     |                |     | - _trigcount                       |  +----+                      |
+---------------------+     +----------------+     +------------------------------------+       |                      |
|                     |     |                |     |              visit()               |     +---------------------+  |
|       visit()       |     |  + visitEnd()  |     | visitEnd()                         |     |      UnitLink       | -+
+---------------------+     +----------------+     +------------------------------------+     +---------------------+
                                                                                              |        + hp         |
                                                                                              +---------------------+
                            +----------------+     +------------------------------------+     |                     |
                            | TrigXmlVisitor |     |              LinkList              |     |                     |
                            +----------------+     +------------------------------------+     +---------------------+
                            |     - _ss      |     |              - _head               |
                            | - _trigcount   |     | - _tail                            |
                            +----------------+     +------------------------------------+
                            |                |     |              clear()               |
                            |                |     | getById()                          |
                            |    visit()     |     | getByIdSafe()                      |
                            | visitEnd()     |     | head()                             |
                            |                |     | pop()                              |
                            |                |     | push_back()                        |
                            +----------------+     +------------------------------------+
                                                   +------------------------------------+
                                                   |            MapCopyCache            |
                                                   +------------------------------------+
                                                   |              + source              |
                                                   | + source                           |
                                                   | + unitcount                        |
                                                   | + unitcount                        |
                                                   | + units                            |
                                                   | + units                            |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |               Player               |
                                                   +------------------------------------+
                                                   |               + age                |
                                                   | + ai                               |
                                                   | + aifile                           |
                                                   | + aimode                           |
                                                   | + avictory                         |
                                                   | + camera                           |
                                                   | + civ                              |
                                                   | + color                            |
                                                   | + cty                              |
                                                   | + ctyfile                          |
                                                   | + diplomacy                        |
                                                   | + dis_bldg                         |
                                                   | + dis_tech                         |
                                                   | + dis_unit                         |
                                                   | + enable                           |
                                                   | + ending_age                       |
                                                   | + human                            |
                                                   | + name                             |
                                                   | names                              |
                                                   | + names                            |
                                                   | + ndis_b                           |
                                                   | + ndis_t                           |
                                                   | + ndis_u                           |
                                                   | num_players                        |
                                                   | + num_players                      |
                                                   | + player_number                    |
                                                   | + pop                              |
                                                   | + resources                        |
                                                   | + stable                           |
                                                   | + u1                               |
                                                   | + u2                               |
                                                   | + ucount                           |
                                                   | + units                            |
                                                   | + vc                               |
                                                   | + vcfile                           |
                                                   +------------------------------------+
                                                   |             add_unit()             |
                                                   | change_unit_type_for_all_of_type() |
                                                   | clear_ai()                         |
                                                   | clear_cty()                        |
                                                   | clear_vc()                         |
                                                   | erase_unit()                       |
                                                   | erase_unit_area()                  |
                                                   | erase_unit_type()                  |
                                                   | export_ai()                        |
                                                   | export_cty()                       |
                                                   | export_vc()                        |
                                                   | find_unit()                        |
                                                   | import_ai()                        |
                                                   | import_cty()                       |
                                                   | import_vc()                        |
                                                   | read_age()                         |
                                                   | read_aifiles()                     |
                                                   | read_aimode()                      |
                                                   | read_camera_longs()                |
                                                   | read_data1()                       |
                                                   | read_data3()                       |
                                                   | read_data4()                       |
                                                   | read_diplomacy()                   |
                                                   | read_dis_bldgs()                   |
                                                   | read_dis_techs()                   |
                                                   | read_dis_units()                   |
                                                   | read_header_name()                 |
                                                   | read_header_stable()               |
                                                   | read_ndis_bldgs()                  |
                                                   | read_ndis_techs()                  |
                                                   | read_ndis_units()                  |
                                                   | read_player_number()               |
                                                   | read_resources()                   |
                                                   | read_units()                       |
                                                   | reset()                            |
                                                   | write_data1()                      |
                                                   | write_data3()                      |
                                                   | write_header_name()                |
                                                   | write_header_stable()              |
                                                   | write_no_units()                   |
                                                   | write_units()                      |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |              SString               |
                                                   +------------------------------------+
                                                   |               - data               |
                                                   | - len                              |
                                                   | null                               |
                                                   | - null                             |
                                                   +------------------------------------+
                                                   |             + c_str()              |
                                                   | erase()                            |
                                                   | + length()                         |
                                                   | lock()                             |
                                                   | + lwn()                            |
                                                   | put()                              |
                                                   | read()                             |
                                                   | set()                              |
                                                   | + total_size()                     |
                                                   | unlock()                           |
                                                   | write()                            |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |              SVector               |
                                                   +------------------------------------+
                                                   |              - begin               |
                                                   | - end                              |
                                                   | - next                             |
                                                   | - realloc_flag                     |
                                                   +------------------------------------+
                                                   |            + allocate()            |
                                                   | + append()                         |
                                                   | + at()                             |
                                                   | + clear()                          |
                                                   | - copy()                           |
                                                   | + count()                          |
                                                   | - expand()                         |
                                                   | + first()                          |
                                                   | + insert()                         |
                                                   | + last()                           |
                                                   | + remove()                         |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |              Scenario              |
                                                   +------------------------------------+
                                                   |           + OUTOFBOUNDS            |
                                                   | StandardAI                         |
                                                   | + StandardAI                       |
                                                   | StandardAI2                        |
                                                   | + StandardAI2                      |
                                                   | + TEMPTERRAIN                      |
                                                   | + TEMPTERRAIN2                     |
                                                   | + all_techs                        |
                                                   | + bBitmap                          |
                                                   | + bitmap                           |
                                                   | + cFiles                           |
                                                   | + cinem                            |
                                                   | + editor_pos                       |
                                                   | + files                            |
                                                   | + game                             |
                                                   | + header                           |
                                                   | + lock_teams                       |
                                                   | + map                              |
                                                   | + max_teams                        |
                                                   | + messages                         |
                                                   | - mod_status                       |
                                                   | + msg                              |
                                                   | + mstrings                         |
                                                   | + next_uid                         |
                                                   | + objstate                         |
                                                   | + origname                         |
                                                   | + pergame                          |
                                                   | + perversion                       |
                                                   | pgAOC                              |
                                                   | + pgAOC                            |
                                                   | pgAOE                              |
                                                   | + pgAOE                            |
                                                   | + pgAOE2DE                         |
                                                   | + pgAOE2DE137                      |
                                                   | pgAOF                              |
                                                   | + pgAOF                            |
                                                   | pgAOF4                             |
                                                   | + pgAOF4                           |
                                                   | pgAOF6                             |
                                                   | + pgAOF6                           |
                                                   | pgAOHD                             |
                                                   | + pgAOHD                           |
                                                   | pgAOHD4                            |
                                                   | + pgAOHD4                          |
                                                   | pgAOHD6                            |
                                                   | + pgAOHD6                          |
                                                   | pgAOK                              |
                                                   | + pgAOK                            |
                                                   | + pgGame                           |
                                                   | pgSWGB                             |
                                                   | + pgSWGB                           |
                                                   | pgSWGBCC                           |
                                                   | + pgSWGBCC                         |
                                                   | pgUP                               |
                                                   | + pgUP                             |
                                                   | + player_choose_teams              |
                                                   | + players                          |
                                                   | pv1_15                             |
                                                   | + pv1_15                           |
                                                   | pv1_18                             |
                                                   | + pv1_18                           |
                                                   | + pv1_21                           |
                                                   | pv1_22                             |
                                                   | + pv1_22                           |
                                                   | pv1_23                             |
                                                   | + pv1_23                           |
                                                   | pv1_24                             |
                                                   | + pv1_24                           |
                                                   | pv1_26                             |
                                                   | + pv1_26                           |
                                                   | pv1_30                             |
                                                   | + pv1_30                           |
                                                   | + pv1_36                           |
                                                   | + pv1_37                           |
                                                   | + random_start_points              |
                                                   | - sect                             |
                                                   | + t_order                          |
                                                   | + triggers                         |
                                                   | + trigver                          |
                                                   | + unk3                             |
                                                   | + unk4                             |
                                                   | + unknown                          |
                                                   | + ver1                             |
                                                   | + ver2                             |
                                                   | + version2                         |
                                                   | + vict                             |
                                                   +------------------------------------+
                                                   |              AOKBMP()              |
                                                   | accept()                           |
                                                   | adapt_game()                       |
                                                   | add_activation()                   |
                                                   | aoc_to_aok()                       |
                                                   | aoc_to_hd4()                       |
                                                   | aoc_to_hd6()                       |
                                                   | aohd_to_hd6()                      |
                                                   | aok_to_aoc()                       |
                                                   | auto_upgrade_hd4()                 |
                                                   | auto_upgrade_hd6()                 |
                                                   | change_unit_type_for_all_of_type() |
                                                   | clean_format()                     |
                                                   | clean_triggers()                   |
                                                   | clearaicpvc()                      |
                                                   | compress_unit_ids()                |
                                                   | datasetRequired()                  |
                                                   | delete_player_units()              |
                                                   | delete_triggers()                  |
                                                   | duplicate_triggers()               |
                                                   | exFile()                           |
                                                   | expansionsRequired()               |
                                                   | export_bmp()                       |
                                                   | fix_t_order()                      |
                                                   | fix_trigger_outliers()             |
                                                   | floodFill4()                       |
                                                   | floodFillElev4()                   |
                                                   | getPlayerCount()                   |
                                                   | get_number_active_players()        |
                                                   | hd4_to_hd6()                       |
                                                   | hd_to_10c()                        |
                                                   | hd_to_swgb()                       |
                                                   | hd_to_up()                         |
                                                   | insert_trigger()                   |
                                                   | instructions_panel_set()           |
                                                   | instructions_sound_id_set()        |
                                                   | instructions_sound_text_set()      |
                                                   | instructions_string_reset()        |
                                                   | instructions_string_zero()         |
                                                   | isTerrainEdge()                    |
                                                   | is_userpatch()                     |
                                                   | map_change_elevation()             |
                                                   | map_copy()                         |
                                                   | map_delete()                       |
                                                   | map_duplicate()                    |
                                                   | map_move()                         |
                                                   | map_paste()                        |
                                                   | map_repeat()                       |
                                                   | map_scale()                        |
                                                   | map_size()                         |
                                                   | map_swap()                         |
                                                   | move_triggers()                    |
                                                   | + needsave()                       |
                                                   | next_sect()                        |
                                                   | open()                             |
                                                   | outline()                          |
                                                   | outlineDraw()                      |
                                                   | prefix_display_order()             |
                                                   | randomize_unit_frames()            |
                                                   | read()                             |
                                                   | read_data()                        |
                                                   | remove_display_order_prefix()      |
                                                   | remove_trigger_descriptions()      |
                                                   | remove_trigger_names()             |
                                                   | requireDataset()                   |
                                                   | reset()                            |
                                                   | save()                             |
                                                   | save_pseudonyms()                  |
                                                   | set_number_active_players()        |
                                                   | set_unit_z_to_map_elev()           |
                                                   | sort_conds_effects()               |
                                                   | strip_patch4()                     |
                                                   | strip_patch6()                     |
                                                   | swapTerrain()                      |
                                                   | swap_players()                     |
                                                   | swap_trigger_names_descriptions()  |
                                                   | swap_triggers()                    |
                                                   | sync_triggers()                    |
                                                   | toFile()                           |
                                                   | unrequireDataset()                 |
                                                   | up_to_10c()                        |
                                                   | up_to_aofe()                       |
                                                   | up_to_hd()                         |
                                                   | up_to_swgb()                       |
                                                   | water_cliffs_visibility()          |
                                                   | write()                            |
                                                   | write_data()                       |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |               Setts                |
                                                   +------------------------------------+
                                                   |             + BasePath             |
                                                   | + DelTempOnExit                    |
                                                   | + ScenPath                         |
                                                   | + TempPath                         |
                                                   | + asktoconverteffects              |
                                                   | + disabletips                      |
                                                   | + displayhints                     |
                                                   | + drawconds                        |
                                                   | + draweffects                      |
                                                   | + drawelevation                    |
                                                   | + drawlocations                    |
                                                   | + drawplayer                       |
                                                   | + drawterrain                      |
                                                   | + editall                          |
                                                   | + forceenabletips                  |
                                                   | + intense                          |
                                                   | + logname                          |
                                                   | + nowarnings                       |
                                                   | - path                             |
                                                   | - recent                           |
                                                   | + recent_first                     |
                                                   | - recent_used                      |
                                                   | + showdisplayorder                 |
                                                   | + showtrigfunction                 |
                                                   | + showtrigids                      |
                                                   | + showtrignames                    |
                                                   | + warnbits                         |
                                                   | + zoom                             |
                                                   +------------------------------------+
                                                   |               load()               |
                                                   | read_recent()                      |
                                                   | recent_getnext()                   |
                                                   | recent_push()                      |
                                                   | write_recent()                     |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |           TrigXmlReader            |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   |               read()               |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |              Campaign              |
                                                   +------------------------------------+
                                                   |              + header              |
                                                   +------------------------------------+
                                                   |               open()               |
                                                   | reset()                            |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |              Trigger               |
                                                   +------------------------------------+
                                                   |              + conds               |
                                                   | + description                      |
                                                   | + display_order                    |
                                                   | + effects                          |
                                                   | + id                               |
                                                   | + loop                             |
                                                   | + name                             |
                                                   | + obj                              |
                                                   | + obj_order                        |
                                                   | + obj_str_id                       |
                                                   | + state                            |
                                                   | + u1                               |
                                                   +------------------------------------+
                                                   |              accept()              |
                                                   | getIDName()                        |
                                                   | getName()                          |
                                                   | get_player()                       |
                                                   | read()                             |
                                                   | sort_conditions()                  |
                                                   | sort_effects()                     |
                                                   | tobuffer()                         |
                                                   | write()                            |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |                Unit                |
                                                   +------------------------------------+
                                                   |               - cnst               |
                                                   | + frame                            |
                                                   | + garrison                         |
                                                   | + ident                            |
                                                   | - pType                            |
                                                   | + rotate                           |
                                                   | size                               |
                                                   | + size                             |
                                                   | + state                            |
                                                   | + x                                |
                                                   | + y                                |
                                                   | + z                                |
                                                   +------------------------------------+
                                                   |             getType()              |
                                                   | getTypeID()                        |
                                                   | read()                             |
                                                   | setType()                          |
                                                   | toBuffer()                         |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |           bad_data_error           |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |           get_ec_player            |
                                                   +------------------------------------+
                                                   |             - _player              |
                                                   +------------------------------------+
                                                   |             + player()             |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |              io_error              |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |                 p                  |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |              players               |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |      playersunit_ucnst_equals      |
                                                   +------------------------------------+
                                                   |              - _cnst               |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |    playersunit_ucnst_notequals     |
                                                   +------------------------------------+
                                                   |              - _cnst               |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |            send_visitor            |
                                                   +------------------------------------+
                                                   |               - _tv                |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |             uid_equals             |
                                                   +------------------------------------+
                                                   |               - _uid               |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |            unit_in_area            |
                                                   +------------------------------------+
                                                   |              - _area               |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |            unit_in_rect            |
                                                   +------------------------------------+
                                                   |              - _rect               |
                                                   | - _rect                            |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |            unit_is_type            |
                                                   +------------------------------------+
                                                   |              - _type               |
                                                   +------------------------------------+
                                                   |                                    |
                                                   +------------------------------------+
                                                   +------------------------------------+
                                                   |               ESDATA               |
                                                   +------------------------------------+
                                                   |           - aitype_count           |
                                                   | + aitypes                          |
                                                   | - civ_count                        |
                                                   | + civs                             |
                                                   | - color_count                      |
                                                   | + colors                           |
                                                   | pfuncs                             |
                                                   | - pfuncs                           |
                                                   | - res_count                        |
                                                   | + resources                        |
                                                   | - rstate                           |
                                                   | - tech_count                       |
                                                   | + techs                            |
                                                   | - terrain_count                    |
                                                   | + terrains                         |
                                                   | + ug_buildings                     |
                                                   | + ug_units                         |
                                                   | - unit_count                       |
                                                   | - unitgroup_count                  |
                                                   | + unitgroups                       |
                                                   | + units                            |
                                                   +------------------------------------+
                                                   |           endResources()           |
                                                   | getCount()                         |
                                                   | load()                             |
                                                   | readAitypes()                      |
                                                   | readCiv()                          |
                                                   | readColor()                        |
                                                   | readResources()                    |
                                                   | readSimple()                       |
                                                   | readTech()                         |
                                                   | readTerrain()                      |
                                                   | readUnit()                         |
                                                   | readUnitGroup()                    |
                                                   +------------------------------------+