From b308a9445cfe1883ea8068d3f4d1a04bfcff9aa8 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Fri, 10 May 2002 20:45:27 +0000 Subject: [PATCH] Fixed a bug in the shipstealing code.. --- bs/fleet.cpp | 18 ++++++++++++++++++ bs/fleet.h | 1 + bs/planet.cpp | 4 ++-- bs/ui/resourceview.ui | 5 ++++- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/bs/fleet.cpp b/bs/fleet.cpp index 19bc386..85304bb 100644 --- a/bs/fleet.cpp +++ b/bs/fleet.cpp @@ -801,3 +801,21 @@ void Fleet::calculateSalvage() } } } + +////////////////////////////////////////////////////////////////////////// +// +void Fleet::resetTicks() +{ + for (FleetList::iterator i = m_Fleet.begin(); i != m_Fleet.end(); ++i) + { + if ( i->second.size() < 2) + continue; + + int temp = i->second[0]; + i->second.clear(); + + if (temp > 0) + i->second.push_back(temp); + } + resetResources(); +} diff --git a/bs/fleet.h b/bs/fleet.h index 6696151..f632093 100644 --- a/bs/fleet.h +++ b/bs/fleet.h @@ -274,6 +274,7 @@ public: */ void printFleet(); + void resetTicks(); //static functions // /** This function is used to set the different races used. diff --git a/bs/planet.cpp b/bs/planet.cpp index f1290ff..4133277 100644 --- a/bs/planet.cpp +++ b/bs/planet.cpp @@ -149,10 +149,10 @@ void Planet::runBattle(std::vector friendly, std::vector hostile int skipped = 0; for (vector::iterator i = friendly.begin(); i != friendly.end(); ++i) - (*i)->resetResources(); + (*i)->resetTicks(); for (vector::iterator i = hostile.begin(); i != hostile.end(); ++i) - (*i)->resetResources(); + (*i)->resetTicks(); for(int tick = 1; skipped < 20; ++tick) { diff --git a/bs/ui/resourceview.ui b/bs/ui/resourceview.ui index 71eae5a..e1faa98 100644 --- a/bs/ui/resourceview.ui +++ b/bs/ui/resourceview.ui @@ -136,7 +136,10 @@ ScoreLostLabel - Lost + Difference + + + Shows the difference in score between the selected ticks. -- 2.39.2