From: <geo...@us...> - 2011-10-27 08:45:42
|
Revision: 4446 http://freeorion.svn.sourceforge.net/freeorion/revision/?rev=4446&view=rev Author: geoffthemedio Date: 2011-10-27 08:45:36 +0000 (Thu, 27 Oct 2011) Log Message: ----------- -Fixed recently-added bug with predictions of tech completion times on research queue. -Updated changelog.txt. Modified Paths: -------------- trunk/FreeOrion/Empire/Empire.cpp trunk/FreeOrion/changelog.txt Modified: trunk/FreeOrion/Empire/Empire.cpp =================================================================== --- trunk/FreeOrion/Empire/Empire.cpp 2011-10-26 11:27:14 UTC (rev 4445) +++ trunk/FreeOrion/Empire/Empire.cpp 2011-10-27 08:45:36 UTC (rev 4446) @@ -342,20 +342,24 @@ double total_RPs_spent = 0.0; int projects_in_progress = 0; SetTechQueueElementSpending(RPs, sim_research_progress, sim_tech_status_map, sim_queue, total_RPs_spent, projects_in_progress); - for (unsigned int i = 0; i < sim_queue.size(); ++i) { - const std::string& name = sim_queue[i].name; + QueueType::iterator sim_q_it = sim_queue.begin(); + while (sim_q_it != sim_queue.end()) { + const std::string& name = sim_q_it->name; const Tech* tech = GetTech(name); if (!tech) { Logger().errorStream() << "ResearchQueue::Update found null tech on future simulated research queue. skipping."; + ++sim_q_it; continue; } - double& status = sim_research_progress[name]; - status += sim_queue[i].allocated_rp; - if (tech->ResearchCost() - EPSILON <= status) { - m_queue[i].turns_left = simulation_results[name]; + double& tech_progress = sim_research_progress[name]; + tech_progress += sim_q_it->allocated_rp; + if (tech->ResearchCost() - EPSILON <= tech_progress) { + sim_tech_status_map[name] = TS_COMPLETE; + sim_q_it->turns_left = simulation_results[name]; simulation_results[name] = turns; - sim_queue.erase(sim_queue.begin() + i--); - sim_tech_status_map[name] = TS_COMPLETE; + sim_q_it = sim_queue.erase(sim_q_it); + } else { + ++sim_q_it; } } Modified: trunk/FreeOrion/changelog.txt =================================================================== --- trunk/FreeOrion/changelog.txt 2011-10-26 11:27:14 UTC (rev 4445) +++ trunk/FreeOrion/changelog.txt 2011-10-27 08:45:36 UTC (rev 4446) @@ -41,6 +41,8 @@ Bugs: ~ Fixed problem with non-Latin font character rendering. ~ Fixed tamed monsters wandering off on their own initiative. + ~ Fixed some crash bugs related to the Psychic Domination tech. + ~ Fixed bug where the tech tree view reset every time a tech was added or removed from the queue. v0.3.17 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |