~ubuntu-branches/ubuntu/saucy/lordsawar/saucy

« back to all changes in this revision

Viewing changes to src/tilestyleset.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese, Barry deFreese
  • Date: 2008-12-20 13:52:12 UTC
  • mfrom: (1.1.6 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20081220135212-noeb2w3y98ebo7o9
Tags: 0.1.4-1
[ Barry deFreese ]
* New upstream release.
* Move 0.0.8-2.1 changelog entry to correct point in changelog.
* Make lordsawar-data suggest lordsawar.
* Update my e-mail address.
* Add build-depends on intltool, uuid-dev, and libboost-dev.
* Don't install locales since there are no translations currently.
* Add simple man page for new lordsawar-pbm binary.
* Drop gcc4.3 patches as they have been fixed upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
//  02110-1301, USA.
17
17
 
18
18
#include <SDL_image.h>
 
19
#include <algorithm>
19
20
#include <sigc++/functors/mem_fun.h>
20
21
 
21
22
#include "tilestyleset.h"
22
23
 
23
 
#include "File.h"
 
24
#include "GraphicsCache.h"
24
25
#include "xmlhelper.h"
25
26
 
 
27
std::string TileStyleSet::d_tag = "tilestyleset";
26
28
using namespace std;
27
29
 
28
30
#include <iostream>
43
45
    delete (*this)[i];
44
46
}
45
47
 
46
 
void TileStyleSet::instantiatePixmaps(std::string tileset, Uint32 tilesize)
47
 
{
48
 
  SDL_Surface* pixmaps = File::getTilesetPicture(tileset, d_name + ".png");
49
 
  if (pixmaps)
50
 
    {
51
 
      for (unsigned int i=0; i < size(); i++)
52
 
        (*this)[i]->instantiatePixmap(pixmaps, tilesize, i);
53
 
      SDL_FreeSurface (pixmaps);
54
 
    }
55
 
}
56
 
 
57
48
bool TileStyleSet::save(XML_Helper *helper)
58
49
{
59
50
  bool retval = true;
60
51
 
61
 
  retval &= helper->openTag("tilestyleset");
 
52
  retval &= helper->openTag(TileStyleSet::d_tag);
62
53
  retval &= helper->saveData("name", d_name);
63
54
  for (TileStyleSet::iterator i = begin(); i != end(); ++i)
64
55
    retval &= (*i)->save(helper);
66
57
 
67
58
  return retval;
68
59
}
 
60
 
 
61
void TileStyleSet::getUniqueTileStyleTypes(std::list<TileStyle::Type> &types)
 
62
{
 
63
  for (TileStyleSet::iterator i = begin(); i != end(); ++i)
 
64
    if (find (types.begin(), types.end(), (*i)->getType()) == types.end())
 
65
      types.push_back((*i)->getType());
 
66
}
 
67
 
 
68
bool TileStyleSet::validate()
 
69
{
 
70
  return true;
 
71
}
 
72
 
69
73
// End of file