vaendryl / Sunrider

source code of the visual novel 'Sunrider'
http://sunrider-vn.com/
41 stars 21 forks source link

Use Orange idea of separated dispatcher and function call further #69

Closed DoumanAsh closed 9 years ago

DoumanAsh commented 9 years ago

This way only dictionary lookup will be checked by try/except Function calls now will avoid that and all exception will be properly catched

Then i again since i'm unsure where are these Bool/None values coming i dont even know if we really should check for them....

BlueOrange commented 9 years ago

As discussed in the forum PMs, my biggest concern with this change is that it reduces the information value of the exceptions.

DoumanAsh commented 9 years ago

Generally no exceptions MUST happen when you check dictionary keys(except for these unclear Bool/None values)

BlueOrange commented 9 years ago

'should' - the nightmare word of maintenance programmers and support technicians :)

DoumanAsh commented 9 years ago

Ok, it is actually MUST as all return values were fitted to lists to avoid need to handle both lists and strings.... i always forget that should < must as i'm not native english speaker.

vaendryl commented 9 years ago

only now do I notice that you put the skirmish battle loop into a python while loop. this is problematic as it gets very hard to debug it with the ingame console :< (as in, console doesn't work at all anymore) there may be more side effects like no auto-saves. saving in general may even be problematic. also no shift-r reload. I remember once trying to have the main battle work that way too... it wasn't a big success.

as for this particular commit, could you explain in a bit more detail how this improves anything?

DoumanAsh commented 9 years ago

If there is problem in RenPy with python loops then i better to move it out to Renpy cycles?

could you explain in a bit more detail how this improves anything?

Generally i just removed unneeded IF. Orange make a great idea how to separate try/except from catching exceptions. You can just store function inside of temporary variable. So now these try/except will affect dictionary look-up. And try/except > IF(performance at least. It is also more python style, but i dont really fond of python) in case of rare exceptions(at least i hope that Bool\None is that case?) Generally i would love to remove try/except and IFs but since it is not possible right now....

vaendryl commented 9 years ago

since the result is 3 times the same code more or less maybe we need a function to handle the dispatcher. I'll merge this and tweak it myself.