angered-ghandi / OpenAOE

An open source reimplementation of Age of Empires (1997)
Other
66 stars 6 forks source link

Some scenarios fail to load: negative graphic ID #23

Closed angered-ghandi closed 8 years ago

angered-ghandi commented 8 years ago

Some of the game scenario files no longer load after unit rendering was added. For example:

$ cargo run --release -- game/scenario/mu0a3a_1.scn

Results in:

WARN: Negative ID taken as unsigned
WARN: Negative ID taken as unsigned
Failed to load shape ShapeKey { drs_key: Graphics, slp_id: SlpFileId(-1), player_color: PlayerColorId(1) }: 4294967295.slp not found in "data/graphics.drs"
thread 'main' panicked at 'failed to get shape for unit rendering', ../src/libcore/option.rs:699
stack backtrace:
   1:     0x564ba2c6180f - std::sys::backtrace::tracing::imp::write::h29f5fdb9fc0a7395
   2:     0x564ba2c665cb - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::h2cc84f0378700526
   3:     0x564ba2c6517a - std::panicking::default_hook::hbbe7fa36a995aca0
   4:     0x564ba2c657cc - std::panicking::rust_panic_with_hook::h105c3d42fcd2fb5e
   5:     0x564ba2c65621 - std::panicking::begin_panic::hbf62ea4a5ff3f9de
   6:     0x564ba2c6554a - std::panicking::begin_panic_fmt::h20f5943904e5791d
   7:     0x564ba2c654be - rust_begin_unwind
   8:     0x564ba2c9c44f - core::panicking::panic_fmt::h19323e466869c656
   9:     0x564ba2c9c4b4 - core::option::expect_failed::h5c893070d569702e
  10:     0x564ba2baaf29 - open_aoe::main::h571448b8769fdeb1
  11:     0x564ba2c65428 - std::panicking::try::call::h5df3ac2979db3c90
  12:     0x564ba2c6dddb - __rust_try
  13:     0x564ba2c6dcbe - __rust_maybe_catch_panic
  14:     0x564ba2c64718 - std::rt::lang_start::hfe9ab243c60ffb9b
  15:     0x7f5a0c4d182f - __libc_start_main
  16:     0x564ba2b485e8 - _start
  17:                0x0 - <unknown>
error: Process didn't exit successfully: `target/release/open_aoe game/scenario/mu0a3a_1.scn` (exit code: 101)

Investigate which unit is causing this, and why it has a negative standing graphic ID.

phrohdoh commented 8 years ago

Fire is the only unit I could find with GraphicId(-1) for standing_graphic.

Throwaway branch with these changes.

UnitId(302): Unit {
    id: UnitId(302),
    unit_type: Flag,
    name: "Fire",
    name_id: LocalizationId(5092),
    creation_id: LocalizationId(0),
    class_id: 14,
    standing_graphic: GraphicId(-1),
    dying_graphics: [
        GraphicId(-1),
        GraphicId(-1)
    ],
    death_mode: 0,
    hit_points: 15,
    line_of_sight: 0,
    garrison_capability: 0,
    collision_size_x: 0.5,
    collision_size_y: 0.5,
    collision_size_z: 2,
    train_sound_id: SoundGroupId(-1),
    dead_unit_id: UnitId(-1),
    placement_mode: 5,
    air_mode: true,
    icon_id: -1,
    hide_in_editor: true,
    enabled: true,
    placement_side_terrain_ids: [
        TerrainId(-1),
        TerrainId(-1)
    ],
    placement_terrain_ids: [
        TerrainId(-1),
        TerrainId(-1)
    ],
    clearance_size_x: 0.5,
    clearance_size_y: 0.5,
    hill_mode: 0,
    visible_in_fog: true,
    terrain_restriction: Flying,
    fly_mode: false,
    resource_capacity: 10,
    resource_decay: 0.01,
    blast_defense_level: 0,
    sub_type: 0,
    interaction_mode: 0,
    minimap_mode: 0,
    command_attribute: 0,
    minimap_color: 0,
    help_id: LocalizationId(20001),
    hotkey_text_id: LocalizationId(-1),
    hotkey: 0,
    unselectable: false,
    enable_auto_gather: false,
    auto_gather_mode: 0,
    auto_gather_id: 0,
    selection_effect: 0,
    editor_selection_color: 0,
    selection_shape_size_x: 0.5,
    selection_shape_size_y: 0.5,
    selection_shape_size_z: 2,
    resource_storage: [],
    damage_graphics: [],
    selection_sound: -1,
    dying_sound: -1,
    attack_mode: 0,
    id2: 302,
    motion_params: None,
    commandable_params: None,
    battle_params: None,
    projectile_params: None,
    trainable_params: None,
    building_params: None
},
Gaia
  UnitId(302)
Egyptian
Greek
Babylonian
Assyrian
Minoan
Hittite
Phoenician
Sumerian
Persian
Shang
Yamato
Choson

But mu0a3a_1 doesn't contain UnitId(302) so I don't know why this graphic is being loaded.