~ubuntu-branches/ubuntu/trusty/lordsawar/trusty

« back to all changes in this revision

Viewing changes to src/port.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2008-06-17 16:07:00 UTC
  • mto: (5.1.1 lenny) (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20080617160700-6d8ofoz0qkasxlnw
ImportĀ upstreamĀ versionĀ 0.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2007, 2008 Ben Asselstine
 
2
//
1
3
//  This program is free software; you can redistribute it and/or modify
2
4
//  it under the terms of the GNU General Public License as published by
3
5
//  the Free Software Foundation; either version 2 of the License, or
10
12
//
11
13
//  You should have received a copy of the GNU General Public License
12
14
//  along with this program; if not, write to the Free Software
13
 
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
15
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
 
16
//  02110-1301, USA.
14
17
 
15
18
#include "port.h"
16
19
#include "GameMap.h"
17
20
 
18
 
Port::Port(Vector<int> pos, std::string name)
19
 
  :Location(name, pos)
 
21
Port::Port(Vector<int> pos)
 
22
  :Location(pos)
20
23
{
21
24
    //mark the location on the game map as occupied by a port
22
 
    GameMap::getInstance()->getTile(d_pos.x, d_pos.y)->setBuilding(Maptile::PORT);
 
25
    GameMap::getInstance()->getTile(getPos())->setBuilding(Maptile::PORT);
23
26
}
24
27
 
25
28
Port::Port(XML_Helper* helper)
26
29
    :Location(helper)
27
30
{
28
31
    //mark the location on the game map as occupied by a port
29
 
    GameMap::getInstance()->getTile(d_pos.x, d_pos.y)->setBuilding(Maptile::PORT);
 
32
    GameMap::getInstance()->getTile(getPos())->setBuilding(Maptile::PORT);
30
33
}
31
34
 
32
35
Port::Port(const Port& s)
44
47
 
45
48
    retval &= helper->openTag("port");
46
49
    retval &= helper->saveData("id", d_id);
47
 
    retval &= helper->saveData("name", d_name);
48
 
    retval &= helper->saveData("x", d_pos.x);
49
 
    retval &= helper->saveData("y", d_pos.y);
 
50
    retval &= helper->saveData("x", getPos().x);
 
51
    retval &= helper->saveData("y", getPos().y);
50
52
    retval &= helper->closeTag();
51
53
    
52
54
    return retval;