Nice prograss in coding, guys. I'm really happy, that we have two more talanted programmers
The first rule in programming is "Premature optimization is evil".
The second one: "Optimize only after profiling".
Profiling is calling !!FU(GetTimeMsec), then repeating some function many times, then calling GetTimeMsec once again and display the difference.
In really important code places evaluating billions of times and in LuaJit/C++ language goto/continue could increase performance a bit, but the second version has better maintainability.
Maintainability is really important.
Generic rules are:
-) Prefer IF block over goto/continue/break if possible, unless it's "FAST EXIT" pattern like:
IF something THEN RETURN
IF something THEN RETURN
...
ok, main logics
...or unless it's really simple iteration with simple exit condition.
-) Loops without breaks can be extended without effort.
!!br&(hero)=(tavernHero); is simulation of WHILE (complex condition) DO, which is ok.
It's generic linear search pattern:
while (position is before end AND current item does not match) do
increase position
end
if (position is < end) then
something was found
else
nothing was found
end
----------------------
In daemon_n's variant I would replace
!!co|(x)>=0/(y)>=0/(z)>=0;
!!br;
with
IF x < 0 OR x < 0 OR z < 0 THEN
BREAK
END
Too many breaks/gotos/continue complicate the logics and increase mental efforts to undestand code flow.
It's also nice to separate commented lines with empty lines.
Code:
!!VR(heroAvailable:y):S(TRUE);
; Check if Hourglass of Asmodeus is enabled to decide whether include Xeron to the list
!!UN:P106/?(asmodeusOn:y)
=>
Code:
!!VR(heroAvailable:y):S(TRUE);
; Check if Hourglass of Asmodeus is enabled to decide whether include Xeron to the list
!!UN:P106/?(asmodeusOn:y)