[MOD FIX] IndieStone Anti Deletion-Crash Fixinator SQL

Discussion in 'Civ5 - Mod Components' started by lemmy101, Nov 1, 2010.

  1. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    Let me see if I have this right. If the unit ids get reindexed, then pre-made scenario maps will load the wrong units on the map because of mistaken ids?

    Could scenario makers store the unit name in the unit's script data? Then on game initialization a generic Lua file could look over all the unit names, match the names in the database if they are still there, and convert the unit id as necessary?

    I don't know if that's the best solution or not, just a thought, if I'm reading this correctly.
     
  2. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    Or better yet, let the generic Lua script compile all the unit names before any reindexing is done, then reassign ids after. That way the scenario makers wouldn't have to do anything.

    Hmmm... not sure a Lua can be run prior to the SQL now that I think of it.
     
  3. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    Instead of reindexing, could you fill the gaps with some kind of dummy data? I know that might be a little inefficient, with a lot of unnecessary loops being executed throughout the code, but could it work?
     
  4. primordial stew

    primordial stew Emperor

    Joined:
    Sep 1, 2005
    Messages:
    1,219
    Location:
    a puddle
    I delete all the units, and then add in 15. Start WB, set mod, load map from shortcut (back to mod area).. you know, since it doesn't open in the mod maps dir. Everything looks fine. Now, load other map by "change mod" -> load map. Now units are my 15 + all the regular units! The debug database still only shows my units, so WB must be pulling them from memory somewhere.......... sometimes, not always though :confused:

    With civs, if I keep all the originals, and add Carthage (#22 now). Set the battle to Rome (14) vs Arabia (1), save + exit. Delete civs except Rome, Carthage, England, Germany, Egypt, Greece and Persia -> save + build. In civ5 load the battle and it shows England and ???. England is debugdatabase ID 1 and ?? is past my ID range.

    So for certain it saves the ID number for civs.

    Which should be fine if WB didn't have a corrupt ID list.

    > Could scenario makers store the unit name in the unit's script data
    The battle map can be used with Advanced Setup to pick the right civs. And then I have a lua script running to add the armies. This works, but I don't know how to set everything. Anyway, yeah it might be possible to work around some of this.

    This mod comp is needed to compact the IDs, but till WB is fixed it's only useful for random map mods, which is actually most of them.
     
  5. lemmy101

    lemmy101 Emperor

    Joined:
    Apr 10, 2006
    Messages:
    1,064
    Do deleted units actually crash the game with invalid unaltered IDs? Is that confirmed? I know techs do, and other things do, but I'm sure I read somewhere that deleting units had a much less serious side effect... missing flag or something?
     
  6. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    In my original delete attempts (when ignorant of missing IDs) I found that deleting techs, buildings and policies crashed the game outright. Civs and leaders: no ill effects. Units: all seemed OK except that the startup 2D civ graphic was missing (go figure). Sometimes, also, I saw the starting warrior replaced by something else (e.g., mech infantry) but I don't remember whether that was from unit deleting or something else.
     
  7. Mannu

    Mannu Warlord

    Joined:
    Sep 23, 2005
    Messages:
    230
    Thanks lemmy101! :goodjob:

    For everyone's benefit, I get crashes when deleting either Improvements or Builds as well.
     
  8. lemmy101

    lemmy101 Emperor

    Joined:
    Apr 10, 2006
    Messages:
    1,064
  9. Mannu

    Mannu Warlord

    Joined:
    Sep 23, 2005
    Messages:
    230
    Even better!
     

Share This Page