Oolite
Loading...
Searching...
No Matches
OOScriptTimer.h
Go to the documentation of this file.
1
/*
2
3
OOScriptTimer.h
4
5
Abstract base class for script timers. An OOScriptTimer does nothing when it
6
fires; subclasses should override the -timerFired method.
7
8
Timers are immutable. They are retained by the timer subsystem while scheduled.
9
A timer with a negative interval will only fire once. A negative nexttime when
10
inited will cause the timer to fire after the specified interval. A persistent
11
timer will remain if the player dies and respawns; non-persistent timers will
12
be removed.
13
14
15
Oolite
16
Copyright (C) 2004-2013 Giles C Williams and contributors
17
18
This program is free software; you can redistribute it and/or
19
modify it under the terms of the GNU General Public License
20
as published by the Free Software Foundation; either version 2
21
of the License, or (at your option) any later version.
22
23
This program is distributed in the hope that it will be useful,
24
but WITHOUT ANY WARRANTY; without even the implied warranty of
25
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
GNU General Public License for more details.
27
28
You should have received a copy of the GNU General Public License
29
along with this program; if not, write to the Free Software
30
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
31
MA 02110-1301, USA.
32
33
*/
34
35
#import "
OOFoundation.h
"
36
#import "
OOTypes.h
"
37
38
@interface
OOScriptTimer
: NSObject {
39
@private
40
OOTimeAbsolute
_nextTime
;
41
OOTimeDelta
_interval
;
42
BOOL
_isScheduled
;
43
BOOL
_hasBeenRun
;
// Needed for one-shot timers.
44
}
45
46
- (id)initWithNextTime:(
OOTimeAbsolute
)nextTime
47
interval:(
OOTimeDelta
)interval;
48
49
// Sets nextTime to current time + delay.
50
- (id)initOneShotTimerWithDelay:(
OOTimeDelta
)delay;
51
52
- (
OOTimeAbsolute
)nextTime;
53
- (BOOL)setNextTime:(
OOTimeAbsolute
)nextTime;
// Only works when timer is not scheduled.
54
- (
OOTimeDelta
)interval;
55
- (void)setInterval:(
OOTimeDelta
)interval;
56
57
// Subclass responsibility:
58
- (void)timerFired;
59
60
- (BOOL)scheduleTimer;
61
- (void)unscheduleTimer;
62
- (BOOL)isScheduled;
63
64
+ (void)updateTimers;
65
+ (void)noteGameReset;
66
67
- (BOOL)isValidForScheduling;
68
69
- (NSComparisonResult)compareByNextFireTime:(
OOScriptTimer
*)other;
70
71
@end
OOFoundation.h
OOTypes.h
OOTimeDelta
double OOTimeDelta
Definition
OOTypes.h:193
OOTimeAbsolute
double OOTimeAbsolute
Definition
OOTypes.h:192
OOScriptTimer
Definition
OOScriptTimer.h:38
OOScriptTimer::_nextTime
OOTimeAbsolute _nextTime
Definition
OOScriptTimer.h:40
OOScriptTimer::_isScheduled
BOOL _isScheduled
Definition
OOScriptTimer.h:42
OOScriptTimer::_hasBeenRun
BOOL _hasBeenRun
Definition
OOScriptTimer.h:43
OOScriptTimer::_interval
OOTimeDelta _interval
Definition
OOScriptTimer.h:41
src
Core
Scripting
OOScriptTimer.h
Generated by
1.15.0