| 1 | // This file is part of Dust Racing 2D. |
| 2 | // Copyright (C) 2015 Jussi Lind <[email protected]> |
| 3 | // |
| 4 | // Dust Racing 2D 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 | // Dust Racing 2D is distributed in the hope that it will be useful, |
| 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | // GNU General Public License for more details. |
| 12 | // |
| 13 | // You should have received a copy of the GNU General Public License |
| 14 | // along with Dust Racing 2D. If not, see <http://www.gnu.org/licenses/>. |
| 15 | |
| 16 | #ifndef BRIDGE_HPP |
| 17 | #define BRIDGE_HPP |
| 18 | |
| 19 | #include <MCObject> |
| 20 | #include <map> |
| 21 | |
| 22 | class MCCollisionEvent; |
| 23 | class MCSeparationEvent; |
| 24 | class MCSurface; |
| 25 | |
| 26 | class Bridge : public MCObject |
| 27 | { |
| 28 | public: |
| 29 | Bridge(); |
| 30 | |
| 31 | //! \reimp |
| 32 | virtual void collisionEvent(MCCollisionEvent & event) override; |
| 33 | |
| 34 | //! \reimp |
| 35 | virtual void separationEvent(MCSeparationEvent & event) override; |
| 36 | |
| 37 | void objectUnderBridge(MCObject & object, bool isUnder); |
| 38 | |
| 39 | static void reset(); |
| 40 | |
| 41 | private: |
| 42 | void doExitObject(MCObject & object); |
| 43 | |
| 44 | void raiseObject(MCObject & object, bool raise); |
| 45 | |
| 46 | using ObjectStatusMap = std::map<MCObject *, std::set<Bridge *>>; |
| 47 | static ObjectStatusMap m_onBridgeStatusMap; |
| 48 | static ObjectStatusMap m_underBridgeStatusMap; |
| 49 | }; |
| 50 | |
| 51 | #endif // BRIDGE_HPP |