1 /** @file polyobjdata.cpp  Private data for polyobj.
2  *
3  * @authors Copyright © 2003-2017 Jaakko Keränen <jaakko.keranen@iki.fi>
4  * @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
5  *
6  * @par License
7  * GPL: http://www.gnu.org/licenses/gpl.html
8  *
9  * <small>This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by the
11  * Free Software Foundation; either version 2 of the License, or (at your
12  * option) any later version. This program is distributed in the hope that it
13  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15  * Public License for more details. You should have received a copy of the GNU
16  * General Public License along with this program; if not, see:
17  * http://www.gnu.org/licenses</small>
18  */
19 
20 #include "world/polyobjdata.h"
21 
22 #ifdef __CLIENT__
23 #  include "client/clpolymover.h"
24 #endif
25 
26 #include "world/map.h"
27 #include "world/thinkers.h"
28 
29 using namespace de;
30 using namespace world;
31 
PolyobjData()32 PolyobjData::PolyobjData()
33 {
34     mesh       = new Mesh;
35     indexInMap = MapElement::NoIndex;
36 }
37 
~PolyobjData()38 PolyobjData::~PolyobjData()
39 {
40     delete mesh;
41 }
42 
setThinker(thinker_s * thinker)43 void PolyobjData::setThinker(thinker_s *thinker)
44 {
45     _polyobj = (Polyobj *) thinker;
46 }
47 
think()48 void PolyobjData::think()
49 {
50     // nothing to do; public thinker does all
51 }
52 
duplicate() const53 Thinker::IData *PolyobjData::duplicate() const
54 {
55     return new PolyobjData(*this);
56 }
57 
58 #ifdef __CLIENT__
addMover(ClPolyMover & mover)59 void PolyobjData::addMover(ClPolyMover &mover)
60 {
61     if(_mover)
62     {
63         Thinker_Map(_mover->thinker()).thinkers().remove(_mover->thinker());
64         DENG2_ASSERT(!_mover);
65     }
66 
67     _mover = &mover;
68 }
69 
removeMover(ClPolyMover & mover)70 void PolyobjData::removeMover(ClPolyMover &mover)
71 {
72     if(_mover == &mover)
73     {
74         _mover = 0;
75     }
76 }
77 
mover() const78 ClPolyMover *PolyobjData::mover() const
79 {
80     return _mover;
81 }
82 #endif
83