I need a new threaded timer event system. My current solution is not working as I would like it. This is the problem...
CPlayer and CMonster fight. A new thread is launched in which time elapses. Once a certain time is reached Cmonster has to either perform an action or resort to the default action. Next is CPlayer. It then has also a few seconds to input an action or resort to the default one.
The thread responsible for the timer is too heavy for the CPU because of my rather weak system for counting time which is based on an endless loop:
I need something better. I can't seem to find any info about this. Can you at least point me in the right direction for a more efficient time based counter? The system is Windows.Code:// something like this while(true) { if(time == threshold) break; }