Remove bogus assert
[supertux.git] / src / object / endsequence.cpp
1 //  SuperTux - End Sequence
2 //  Copyright (C) 2007 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
3 //
4 //  This program is free software: you can redistribute it and/or modify
5 //  it under the terms of the GNU General Public License as published by
6 //  the Free Software Foundation, either version 3 of the License, or
7 //  (at your option) any later version.
8 //
9 //  This program is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //  GNU General Public License for more details.
13 //
14 //  You should have received a copy of the GNU General Public License
15 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 #include "object/endsequence.hpp"
18
19 #include "object/player.hpp"
20 #include "supertux/sector.hpp"
21
22 EndSequence::EndSequence() :
23   isrunning(false),
24   isdone(false),
25   tux_may_walk(true),
26   end_sequence_controller(0)
27 {
28 }
29
30 EndSequence::~EndSequence()
31 {
32   delete end_sequence_controller;
33 }
34
35 void
36 EndSequence::update(float elapsed_time)
37 {
38   if (!isrunning) return;
39   running(elapsed_time);
40 }
41
42 void
43 EndSequence::draw(DrawingContext& /*context*/)
44 {
45 }
46
47 void
48 EndSequence::start()
49 {
50   if (isrunning) return;
51   isrunning = true;
52   isdone = false;
53
54   Player& tux = *Sector::current()->player;
55   end_sequence_controller = new CodeController();
56   tux.set_controller(end_sequence_controller);
57   tux.set_speedlimit(230); //MAX_WALK_XM
58
59   starting();
60 }
61
62 void
63 EndSequence::stop_tux()
64 {
65   tux_may_walk = false;
66 }
67
68 void
69 EndSequence::stop()
70 {
71   if (!isrunning) return;
72   isrunning = false;
73   isdone = true;
74   stopping();
75 }
76
77 bool
78 EndSequence::is_tux_stopped()
79 {
80   return !tux_may_walk;
81 }
82
83 bool
84 EndSequence::is_done()
85 {
86   return isdone;
87 }
88
89 void
90 EndSequence::starting()
91 {
92 }
93
94 void
95 EndSequence::running(float /*elapsed_time*/)
96 {
97   end_sequence_controller->update();
98 }
99
100 void
101 EndSequence::stopping()
102 {
103 }
104
105 /* EOF */