Oolite
1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
src
Core
Scripting
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 "
OOCocoa.h
"
36
#import "
OOTypes.h
"
37
38
39
@interface
OOScriptTimer
: NSObject
40
{
41
@private
42
OOTimeAbsolute
_nextTime
;
43
OOTimeDelta
_interval
;
44
BOOL
_isScheduled
;
45
BOOL
_hasBeenRun
;
// Needed for one-shot timers.
46
}
47
48
- (id) initWithNextTime:(
OOTimeAbsolute
)nextTime
49
interval:(
OOTimeDelta
)interval;
50
51
// Sets nextTime to current time + delay.
52
- (id) initOneShotTimerWithDelay:(
OOTimeDelta
)delay;
53
54
- (
OOTimeAbsolute
)nextTime;
55
- (BOOL)setNextTime:(
OOTimeAbsolute
)nextTime;
// Only works when timer is not scheduled.
56
- (
OOTimeDelta
)interval;
57
- (void)setInterval:(
OOTimeDelta
)interval;
58
59
// Subclass responsibility:
60
- (void) timerFired;
61
62
- (BOOL) scheduleTimer;
63
- (void) unscheduleTimer;
64
- (BOOL) isScheduled;
65
66
67
+ (void) updateTimers;
68
+ (void) noteGameReset;
69
70
71
- (BOOL) isValidForScheduling;
72
73
- (NSComparisonResult) compareByNextFireTime:(
OOScriptTimer
*)other;
74
75
@end
OOCocoa.h
OOTypes.h
OOTimeDelta
double OOTimeDelta
Definition
OOTypes.h:224
OOTimeAbsolute
double OOTimeAbsolute
Definition
OOTypes.h:223
OOScriptTimer
Definition
OOScriptTimer.h:40
OOScriptTimer::_nextTime
OOTimeAbsolute _nextTime
Definition
OOScriptTimer.h:42
OOScriptTimer::_isScheduled
BOOL _isScheduled
Definition
OOScriptTimer.h:44
OOScriptTimer::_hasBeenRun
BOOL _hasBeenRun
Definition
OOScriptTimer.h:45
OOScriptTimer::_interval
OOTimeDelta _interval
Definition
OOScriptTimer.h:43
Generated by
1.12.0