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

« back to all changes in this revision

Viewing changes to src/roadlist.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:
21
21
#include "GameMap.h"
22
22
#include "xmlhelper.h"
23
23
 
 
24
std::string Roadlist::d_tag = "roadlist";
24
25
//#define debug(x) {cerr<<__FILE__<<": "<<__LINE__<<": "<<x<<endl<<flush;}
25
26
#define debug(x)
26
27
 
57
58
 
58
59
Roadlist::Roadlist(XML_Helper* helper)
59
60
{
60
 
    helper->registerTag("road", sigc::mem_fun(this, &Roadlist::load));
 
61
    helper->registerTag(Road::d_tag, sigc::mem_fun(this, &Roadlist::load));
61
62
}
62
63
 
63
64
bool Roadlist::save(XML_Helper* helper) const
64
65
{
65
66
    bool retval = true;
66
67
 
67
 
    retval &= helper->openTag("roadlist");
 
68
    retval &= helper->openTag(Roadlist::d_tag);
68
69
 
69
70
    for (const_iterator it = begin(); it != end(); it++)
70
 
        retval &= (*it).save(helper);
 
71
        retval &= (*it)->save(helper);
71
72
    
72
73
    retval &= helper->closeTag();
73
74
 
76
77
 
77
78
bool Roadlist::load(std::string tag, XML_Helper* helper)
78
79
{
79
 
    if (tag != "road")
 
80
    if (tag != Road::d_tag)
80
81
    //what has happened?
81
82
        return false;
82
83
    
83
 
    Road s(helper);
84
 
    push_back(s);
 
84
    push_back(new Road(helper));
85
85
 
86
86
    return true;
87
87
}
131
131
    else if (!u && b && !l && r)
132
132
        type = 5;
133
133
    else if (u && !b && !l && !r)
134
 
        type = 1;
 
134
        type = Road::CONNECTS_NORTH;
135
135
    else if (!u && b && !l && !r)
136
 
        type = 1;
 
136
        type = Road::CONNECTS_SOUTH;
137
137
    else if (!u && !b && l && !r)
138
 
        type = 0;
 
138
        type = Road::CONNECTS_WEST;
139
139
    else if (!u && !b && !l && r)
140
 
        type = 0;
 
140
        type = Road::CONNECTS_EAST;
141
141
    return type;
142
142
}
143
143