1 /***************************************************************************
2 shaper.cpp - description
3 -------------------
4 begin : feb 10th, 2007
5 copyright : (C) 2006 by Fr�d�ric RODRIGO
6 email : f.rodrigo free.fr
7
8 $Id: shaper.cpp 373 2008-10-11 21:32:54Z neoneurone $
9 ***************************************************************************/
10
11 /***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * any later version. *
17 * *
18 ***************************************************************************/
19
20 #include "shaper.h"
21
22
23 namespace MapGen
24 {
25
26
27 /*=====================================================================*/
Shaper(const Shape * shape)28 Shaper::Shaper( const Shape *shape ):
29 _shape(shape)
30 {
31 MAP_DEBUG( "ctor" );
32 }
33
34
35 /*=====================================================================*/
~Shaper()36 Shaper::~Shaper()
37 {
38 MAP_DEBUG( "dtor" );
39 delete _shape;
40 }
41
42
43 /*=====================================================================*/
apply(Map * map)44 void Shaper::apply( Map* map )
45 {
46 uint w, h;
47
48 w = map->getW();
49 h = map->getL();
50
51 for( uint x = 0 ; x < w; ++x )
52 for( uint y = 0 ; y < h; ++y )
53 map->setAt( x, y, map->getAt(x,y) + _shape->value(x,y) );
54 }
55
56
57 }
58