I have no idea what it does...

Monkey Forums/Monkey Programming/I have no idea what it does...

Amon(Posted 2013) [#1]
Going over my code this morning to find a certain bug I stumbled on some code that was obviously put there to do something.

This piece of code at first/second glance is quite integrated with the rest of the code in that particular method. Again, from looking at it the code definitely does something to support the rest of the code; provide a value or values in order to keep my game running properly....

I have no idea what it does though. Worst part of it is when I remove the main chunk or certain parts of it the game still works properly.

I know it does something though otherwise why would I have coded it in and put it in that specific part of my source...? The method it is in is definitely being called in OnUpdate.

If it does fulfill a duty and is a needed routine/chunk of code why doesn't my game codefart itself in to a crash when I remove it or alter bits of it?

Oh well... I'm just going to leave it there. :/


ElectricBoogaloo(Posted 2013) [#2]
Stick a DebugLog("!?!"+Rnd(1)) in there, and watch how often it's called.. Might tip you off as to where it's being used.
.. maybe!


therevills(Posted 2013) [#3]
Is it a function or method? If you removed it and your game still compiles and works I would say that you are not calling it...


Xaron(Posted 2013) [#4]
LOL, yes. Monkey removes code which isn't called by itself.


Gerry Quinn(Posted 2013) [#5]
This is why I am a big fan of const methods!


Paul - Taiphoz(Posted 2013) [#6]
Remove the call from onUpdate() and see if your code runs, if it does then try testing your game for a little while, just in case its some bound checking code, or something that's there to make sure some values don't go over a set limit.