apocalyptech / eschalon_utils

Eschalon Books I, II, and III Character and Map Editors
http://apocalyptech.com/eschalon/
GNU General Public License v2.0
8 stars 3 forks source link

Doublecheck special-case conditions in code #18

Closed apocalyptech closed 10 years ago

apocalyptech commented 10 years ago

While on my mapscript->tilecontent renaming run, I noticed some apparently special-case stuff which should probably be verified and tested for Book III. Presumably there might be other things like this floating around in the code.

Anyway, starting at line 2389 of mapgui.py:

        # We special-case this to handle the weirdly-trapped door at (25, 26) in outpost
        if (tile.tilecontents[curpages].trap in c.traptable.keys()):
            self.tilecontent_input_dropdown(curpages, binput, 4, 'trap', 'Trap', c.traptable.values(), None, self.on_tilecontent_dropdown_changed)
        else:
            self.tilecontent_input_spin(self.input_uchar, curpages, binput, 4, 'trap', 'Trap', 'The trap value should be between 0 and 8 ordinarily.  The  current trap is undefined.')

        # We special-case this just in case
        if (tile.scripts[curpages].state in c.containertable.keys()):
            self.script_input_dropdown(curpages, binput, 5, 'state', "State\n<i><small>(if container, door, or switch)</small></i>", c.containertable.values(), None, self.on_script_dropdown_changed)
        else:
            self.script_input_spin(self.input_uchar, curpages, binput, 5, 'state', 'State', 'The state value should be between 0 and 5 ordinarily.  The current container state is undefined.')

So yeah, should check it out eventually. Not a huge deal at the moment, but didn't want to lose track of it.

apocalyptech commented 10 years ago

Ah, okay - after some actual investigation, these aren't actually special cases at all. Just protecting ourselves when we use dropdowns in case we load a map whose value is outside the values we'd be putting in the dropdowns. The specific door I mentioned was just one example of that happening, which was probably when I put this in in the first place. Closing!