~ubuntu-branches/ubuntu/natty/kdegames/natty-proposed

« back to all changes in this revision

Viewing changes to konquest/planet.cc

  • Committer: Bazaar Package Importer
  • Author(s): Rohan Garg
  • Date: 2010-05-28 20:16:42 UTC
  • mfrom: (1.2.45 upstream)
  • Revision ID: james.westby@ubuntu.com-20100528201642-vh75rp06hh5hjt6l
Tags: 4:4.4.80-0ubuntu1
* New upstream beta release
* New package for kajongg in debian/control
* Custom deb flag for kajongg in debian/rules
* New install file for kajongg
* Remove README.source from debian/
* Bump dep on kde-sc-dev-latest to 4.4.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    along with this program; if not, write to the Free Software
20
20
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
21
 */
22
 
#include "planet.h"
 
22
#include "gamelogic.h"
23
23
#include "planet.moc"
24
24
 
25
25
#include "sector.h"
38
38
  : m_name(planetName),
39
39
    m_owner(initialOwner),
40
40
    m_sector(sector),
41
 
    m_homeFleet( this, newProd ),
 
41
    m_homeFleet( this, 0 ),
42
42
    m_killPercentage(newKillP),
43
 
    m_productionRate(newProd),
 
43
    m_productionRate(newProd), m_originalProductionRate(newProd),
44
44
    m_oldShips(newProd),
45
 
    m_showCurShips(true)
 
45
    m_showCurShips(true),
 
46
    m_justconquered(false)
46
47
{
47
48
    KRandomSequence r;
48
49
    m_planetLook = r.getLong(9);
50
51
    m_sector->setPlanet( this );
51
52
}
52
53
 
53
 
Planet::~Planet() {}
 
54
Planet::~Planet() {  m_sector->removePlanet(); }
 
55
 
54
56
 
55
57
Planet *
56
58
Planet::createPlayerPlanet( Sector *sector, Player *initialOwner, 
87
89
    m_owner = conqueringFleet->owner;
88
90
    m_owner->statPlanetsConquered(1);
89
91
    m_homeFleet.become( conqueringFleet );
 
92
    m_productionRate = m_originalProductionRate;
 
93
    m_justconquered = true;
90
94
}
91
95
 
92
96
void
93
 
Planet::turn()
 
97
Planet::turn(GameOptions *options)
94
98
{
95
 
    if( !(m_owner->isNeutral()) ) {
96
 
        m_homeFleet.addShips( m_productionRate );
97
 
        m_owner->statShipsBuilt( m_productionRate );
98
 
    } else {
99
 
        m_homeFleet.addShips( 1 );
 
99
    if(options->ProductionAfterConquere || !m_justconquered) {
 
100
        if( m_owner->isNeutral() )
 
101
            m_homeFleet.addShips( options->NeutralsProduction );
 
102
        else {
 
103
            m_homeFleet.addShips( m_productionRate );
 
104
            m_owner->statShipsBuilt( m_productionRate );
 
105
        }
 
106
      
 
107
        if(options->CumulativeProduction)
 
108
            m_productionRate++;
100
109
    }
 
110
 
101
111
    m_oldShips = m_homeFleet.shipCount();
102
112
    m_showCurShips = true;
 
113
    m_justconquered = false;
103
114
    emit update();
104
115
}