← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1451078-fix into lp:widelands

 

Teppo Mäenpää has proposed merging lp:~widelands-dev/widelands/bug-1451078-fix into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1451078 in widelands: "labyrinth malfunctions full report"
  https://bugs.launchpad.net/widelands/+bug/1451078

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1451078-fix/+merge/258118

Fixed a simple bug (changed a break-statement into a continue-statement in the loop where trainingsite checks which soldiers may stay further).


-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1451078-fix into lp:widelands.
=== modified file 'src/logic/trainingsite.cc'
--- src/logic/trainingsite.cc	2014-11-30 18:49:38 +0000
+++ src/logic/trainingsite.cc	2015-05-03 09:34:51 +0000
@@ -483,28 +483,27 @@
 		}
 		else
 		{
-			std::vector<Upgrade>::iterator it = m_upgrades.begin();
-			for (; it != m_upgrades.end(); ++it)
+			for (const Upgrade& it: m_upgrades)
 			if  (! this_soldier_is_safe)
 			{
 				// Soldier is safe, if he:
 				//  - is below maximum, and
 				//  - is not in a stalled state
 				// Check done separately for each art.
-				int32_t level = m_soldiers[i]->get_level(it->attribute);
+				int32_t level = m_soldiers[i]->get_level(it.attribute);
 
 				 // Below maximum -check
-				if (level > it->max)
+				if (level > it.max)
 				{
-					break;
+					continue;
 				}
 
-				TypeAndLevel train_tl(it->attribute, level);
+				TypeAndLevel train_tl(it.attribute, level);
 				TrainFailCount::iterator tstep = training_failure_count.find(train_tl);
 				if (tstep ==  training_failure_count.end())
 					{
 						log("\nTrainingSite::drop_stalled_soldiers: ");
-						log("training step %d,%d not found in this school!\n", it->attribute, level);
+						log("training step %d,%d not found in this school!\n", it.attribute, level);
 						break;
 					}
 


Follow ups