Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
--- a/share/hedgewars/Data/Scripts/Animate.lua Sat Jul 21 01:54:41 2012 +0300
+++ b/share/hedgewars/Data/Scripts/Animate.lua Mon Jul 23 19:15:59 2012 +0300
@@ -11,7 +11,7 @@
skipFuncList[anim] = {sfunc = func, sargs = args}
end
-function RemoveSkipFunctin(anim)
+function RemoveSkipFunction(anim)
skipFuncList[anim] = nil
end
@@ -323,6 +323,18 @@
stageEvents[seNum].evType = evType
end
+function AddNewEvent(condFunc, condArgs, doFunc, doArgs, evType)
+ local i
+ for i = 1, seNum do
+ if stageEvents[i].cFunc == condFunc and stageEvents[i].cArgs == condArgs and
+ stageEvents[i].dFunc == doFunc and stageEvents[i].dArgs == doArgs and
+ stageEvents[seNum].evType == evType then
+ return
+ end
+ end
+ AddEvent(condFunc, condArgs, doFunc, doArgs, evType)
+end
+
function RemoveEvent(evNum)
if stageEvents[evNum] ~= nil then
seNum = seNum - 1