1 #include "fakemod.h"
2 #include "registrar.h"
3 
4 /* Battle Tanks Game
5  * Copyright (C) 2006-2009 Battle Tanks team
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20  */
21 
22 /*
23  * Additional rights can be granted beyond the GNU General Public License
24  * on the terms provided in the Exception. If you modify this file,
25  * you may extend this exception to your version of the file,
26  * but you are not obligated to do so. If you do not wish to provide this
27  * exception without modification, you must delete this exception statement
28  * from your version and license this file solely under the GPL without exception.
29 */
30 
FakeMod()31 FakeMod::FakeMod() : Object("fake-mod"), _type(), _n(0) {
32 	hp = -1;
33 	impassability = 0;
34 	pierceable = true;
35 }
36 
clone() const37 Object * FakeMod::clone() const {
38 	return new FakeMod(*this);
39 }
40 
setCount(const int n)41 void FakeMod::setCount(const int n) {
42 	_n = n;
43 }
44 
decreaseCount(const int n)45 void FakeMod::decreaseCount(const int n) {
46 	_n -= n;
47 	if (_n < 0)
48 		_n = 0;
49 }
50 
getType() const51 const std::string FakeMod::getType() const {
52 	return _type;
53 }
getCount() const54 const int FakeMod::getCount() const {
55 	return _n;
56 }
57 
setType(const std::string & type)58 void FakeMod::setType(const std::string &type) {
59 	_type = type;
60 }
61 
62 
on_spawn()63 void FakeMod::on_spawn() {
64 	play("main", true);
65 }
66 
render(sdlx::Surface & surface,const int x,const int y)67 void FakeMod::render(sdlx::Surface &surface, const int x, const int y) {}
tick(const float dt)68 void FakeMod::tick(const float dt) {}
calculate(const float dt)69 void FakeMod::calculate(const float dt) {}
70 
71 
serialize(mrt::Serializator & s) const72 void FakeMod::serialize(mrt::Serializator &s) const {
73 	Object::serialize(s);
74 	s.add(_type);
75 	s.add(_n);
76 }
77 
deserialize(const mrt::Serializator & s)78 void FakeMod::deserialize(const mrt::Serializator &s) {
79 	Object::deserialize(s);
80 	s.get(_type);
81 	s.get(_n);
82 }
83 
84 REGISTER_OBJECT("fake-mod", FakeMod, ());
85