~ubuntu-branches/ubuntu/raring/lordsawar/raring

« back to all changes in this revision

Viewing changes to src/maptile.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese, Barry deFreese, Gonéri Le Bouder
  • Date: 2008-06-17 11:15:26 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080617111526-yjyvu9df50zmpdo0
Tags: 0.0.9-1
[ Barry deFreese ]
* New upstream release.
  + Fixes gcc-4.3 builds so drop ftbfs_gcc-4.3_fix.diff.
  + Add new build-dependency for libgnet-dev.
* Add simple man page for new lordsawar-tile-editor.
* Add desktop file for lordsawar-tile-editor.
* Remove French translation on install.

[ Gonéri Le Bouder ]
* bump Debian Policy to 3.8.0. No change needed.
* fix wording in the 0.0.8-3 entry of the Debian changelog

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2003 Michael Bartl
 
2
// Copyright (C) 2003, 2004, 2005, 2006 Ulf Lorenz
 
3
// Copyright (C) 2007, 2008 Ben Asselstine
 
4
// Copyright (C) 2008 Ole Laursen
 
5
//
1
6
//  This program is free software; you can redistribute it and/or modify
2
7
//  it under the terms of the GNU General Public License as published by
3
8
//  the Free Software Foundation; either version 2 of the License, or
10
15
//
11
16
//  You should have received a copy of the GNU General Public License
12
17
//  along with this program; if not, write to the Free Software
13
 
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
18
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
 
19
//  02110-1301, USA.
14
20
 
15
21
#include "maptile.h"
16
22
#include <stdlib.h>
24
30
    d_tileStyle = tileStyle;
25
31
}
26
32
 
 
33
Maptile::Maptile(Tileset* tileSet, int x, int y, Tile::Type type, TileStyle *tileStyle)
 
34
{
 
35
    bool found = false;
 
36
    d_building = NONE;
 
37
    d_tileSet = tileSet;
 
38
    d_tileStyle = tileStyle;
 
39
    for (unsigned int i = 0; i < (*tileSet).size(); i++)
 
40
      {
 
41
        if ((*tileSet)[i]->getType() == type)
 
42
          {
 
43
            found = true;
 
44
            d_index = i;
 
45
            break;
 
46
          }
 
47
      }
 
48
    if (found == false)
 
49
      d_index = 0;
 
50
}
 
51
 
27
52
Maptile::~Maptile()
28
53
{
29
54
    while (!d_items.empty())
33
58
    }
34
59
}
35
60
 
36
 
Tile::Type Maptile::getMaptileType() const
37
 
{
38
 
    return (*d_tileSet)[d_index]->getType();
39
 
}
40
 
 
41
61
Uint32 Maptile::getMoves() const
42
62
{
43
63
    if (d_building == Maptile::CITY)
57
77
    return tile->getMoves();
58
78
}
59
79
 
60
 
SDL_Color Maptile::getColor() const
61
 
{
62
 
    return (*d_tileSet)[d_index]->getColor();
63
 
}
64
 
 
65
 
Tile::Pattern Maptile::getPattern() const
66
 
{
67
 
    return (*d_tileSet)[d_index]->getPattern();
68
 
}
69
 
 
70
 
SDL_Color Maptile::getSecondColor() const
71
 
{
72
 
    return (*d_tileSet)[d_index]->getSecondColor();
73
 
}
74
 
 
75
 
SDL_Color Maptile::getThirdColor() const
76
 
{
77
 
    return (*d_tileSet)[d_index]->getThirdColor();
78
 
}
79
 
 
80
80
void Maptile::printDebugInfo() const
81
81
{
82
82
    std::cerr << "MAPTILE: type = " << d_index << std::endl;
92
92
    }
93
93
 
94
94
    std::list<Item*>::iterator it;
95
 
    for (it = d_items.begin(); position > 0; position--, it++);
 
95
    for (it = d_items.begin(); position > 0; position--, it++)
 
96
      ;
96
97
    d_items.insert(it, item);
97
98
}
98
99