1 | // SuperTux |
2 | // Copyright (C) 2006 Matthias Braun <matze@braunis.de> |
3 | // 2018 Ingo Ruhnke <grumbel@gmail.com> |
4 | // |
5 | // This program is free software: you can redistribute it and/or modify |
6 | // it under the terms of the GNU General Public License as published by |
7 | // the Free Software Foundation, either version 3 of the License, or |
8 | // (at your option) any later version. |
9 | // |
10 | // This program is distributed in the hope that it will be useful, |
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | // GNU General Public License for more details. |
14 | // |
15 | // You should have received a copy of the GNU General Public License |
16 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | |
18 | #include "collision/collision_object.hpp" |
19 | |
20 | #include "collision/collision_listener.hpp" |
21 | #include "supertux/game_object.hpp" |
22 | |
23 | CollisionObject::CollisionObject(CollisionGroup group, CollisionListener& listener) : |
24 | m_listener(listener), |
25 | m_bbox(), |
26 | m_movement(), |
27 | m_group(group), |
28 | m_dest() |
29 | { |
30 | } |
31 | |
32 | void |
33 | CollisionObject::collision_solid(const CollisionHit& hit) |
34 | { |
35 | m_listener.collision_solid(hit); |
36 | } |
37 | |
38 | bool |
39 | CollisionObject::collides(CollisionObject& other, const CollisionHit& hit) const |
40 | { |
41 | return m_listener.collides(dynamic_cast<GameObject&>(other.m_listener), hit); |
42 | } |
43 | |
44 | HitResponse |
45 | CollisionObject::collision(CollisionObject& other, const CollisionHit& hit) |
46 | { |
47 | return m_listener.collision(dynamic_cast<GameObject&>(other.m_listener), hit); |
48 | } |
49 | |
50 | void |
51 | CollisionObject::collision_tile(uint32_t tile_attributes) |
52 | { |
53 | m_listener.collision_tile(tile_attributes); |
54 | } |
55 | |
56 | bool |
57 | CollisionObject::is_valid() const |
58 | { |
59 | return m_listener.listener_is_valid(); |
60 | } |
61 | |
62 | /* EOF */ |
63 | |