1
// $Id: groundpiece.cpp 3216 2007-09-22 01:47:03Z grumbel $
3
// Pingus - A free Lemmings clone
4
// Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
6
// This program is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU General Public License
8
// as published by the Free Software Foundation; either version 2
9
// of the License, or (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
#include "../world.hpp"
22
#include "../ground_map.hpp"
23
#include "../col_map.hpp"
24
#include "../resource.hpp"
25
#include "groundpiece.hpp"
29
Groundpiece::Groundpiece(const FileReader& reader)
31
reader.read_vector("position", pos);
32
reader.read_desc ("surface", desc);
34
gptype = Groundtype::GP_GROUND;
35
reader.read_enum("type", gptype, &Groundtype::string_to_type);
39
Groundpiece::on_startup ()
41
// FIXME: using a CollisionMask is kind of unneeded here
42
CollisionMask mask(desc);
44
// FIXME: overdrawing of bridges and similar things aren't handled here
45
if (gptype == Groundtype::GP_REMOVE)
46
get_world()->remove(mask, static_cast<int>(pos.x), static_cast<int>(pos.y));
48
get_world()->put(mask, static_cast<int>(pos.x), static_cast<int>(pos.y), gptype);
51
} // namespace WorldObjs