summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-07 08:44:52 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-07 08:44:52 +0000
commitabd0c3a98bbbe6bcd0425351207120a00babe329 (patch)
treec932d76f0d07c3b9e0fa4c54dea05a2be296b47a /src/common
parent182cedd95fe67ac29cbc08123cc999cf8cf9bfaf (diff)
downloadhercules-abd0c3a98bbbe6bcd0425351207120a00babe329.tar.gz
hercules-abd0c3a98bbbe6bcd0425351207120a00babe329.tar.bz2
hercules-abd0c3a98bbbe6bcd0425351207120a00babe329.tar.xz
hercules-abd0c3a98bbbe6bcd0425351207120a00babe329.zip
- removed the timer heap correction code when the timers overflow since Flavio points out that it is not needed.
- Modified a bit the changesex code so you get saved and quit before changing your sex rather than afterwards. - Cleaned up #changesex - Signum Crucis now works on bosses. - party_recv_data will not set the sd pointer for not-yet-authed characters. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11867 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r--src/common/timer.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/common/timer.c b/src/common/timer.c
index a2be88876..5f1f17e2f 100644
--- a/src/common/timer.c
+++ b/src/common/timer.c
@@ -351,43 +351,13 @@ int settick_timer(int tid, unsigned int tick)
return tick;
}
-//Correcting the heap when the tick overflows is an idea taken from jA to
-//prevent timer problems. Thanks to [End of Exam] for providing the required data. [Skotlex]
-//This funtion will rearrange the heap and assign new tick values.
-static void fix_timer_heap(unsigned int tick)
-{
- if (timer_heap_num >= 0 && tick < 0x00010000 && timer_data[timer_heap[0]].tick > 0xf0000000)
- { //The last timer is way too far into the future, and the current tick is too close to 0, overflow was very likely
- //(not perfect, but will work as long as the timer is not expected to happen 50 or so days into the future)
- int i;
- int *tmp_heap;
- for (i=0; i < timer_heap_num && timer_data[timer_heap[i]].tick > 0xf0000000; i++)
- { //All functions with high tick value should had been executed already...
- timer_data[timer_heap[i]].tick = 0;
- }
- //Move elements to readjust the heap.
- tmp_heap = aCalloc(sizeof(int), i);
- memcpy(tmp_heap, timer_heap, i*sizeof(int));
- memmove(timer_heap, &timer_heap[i], (timer_heap_num-i)*sizeof(int));
- memmove(&timer_heap[timer_heap_num-i], tmp_heap, i*sizeof(int));
- aFree(tmp_heap);
- }
-}
-
/// Executes all expired timers.
/// Returns the value of the smallest non-expired timer (or 1 second if there aren't any).
int do_timer(unsigned int tick)
{
int nextmin = 1000; // return value
- static int fix_heap_flag = 0; //Flag for fixing the stack only once per tick loop. May not be the best way, but it's all I can think of currently :X [Skotlex]
int i;
- if( tick < 0x010000 && fix_heap_flag )
- {
- fix_timer_heap(tick);
- fix_heap_flag = 0;
- }
-
// process all timers one by one
while( timer_heap_num )
{
@@ -444,9 +414,6 @@ int do_timer(unsigned int tick)
if( nextmin < TIMER_MIN_INTERVAL )
nextmin = TIMER_MIN_INTERVAL;
- if( UINT_MAX - nextmin < tick ) //Tick will loop, rearrange the heap on the next iteration.
- fix_heap_flag = 1;
-
return nextmin;
}