Now reversing check structures order.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/reverse_mode@10824 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
mcmic 2012-02-08 12:48:07 +00:00
parent c3a9c03b8b
commit 01458892f0
2 changed files with 22 additions and 1 deletions

View File

@ -19,6 +19,7 @@
#include "tracks/check_manager.hpp"
#include <string>
#include <algorithm>
#include "io/xml_node.hpp"
#include "tracks/ambient_light_sphere.hpp"
@ -67,7 +68,26 @@ CheckManager::~CheckManager()
/** Reverse checks order. */
void CheckManager::reverse()
{
// FIXME
std::map<unsigned int, std::vector<unsigned int> > structures_to_change_state;
std::vector<CheckStructure*>::iterator it;
for(unsigned int i=0;i<m_all_checks.size(); ++i)
{
for(std::vector<int>::const_iterator it = m_all_checks[i]->m_check_structures_to_change_state.begin();
it != m_all_checks[i]->m_check_structures_to_change_state.end(); ++it)
{
if(*it>=0)
{
structures_to_change_state[*it].push_back(i);
}
}
}
for(unsigned int i=0;i<m_all_checks.size(); ++i)
{
m_all_checks[i]->m_check_structures_to_change_state.clear();
m_all_checks[i]->m_check_structures_to_change_state.resize(structures_to_change_state[i].size());
copy(structures_to_change_state[i].begin(),structures_to_change_state[i].end(),
m_all_checks[i]->m_check_structures_to_change_state.begin());
}
} // reverse
// ----------------------------------------------------------------------------

View File

@ -47,6 +47,7 @@ class CheckManager;
*/
class CheckStructure
{
friend class CheckManager;
public:
/** Different types of check structures:
* ACTIVATE: Activates another check structure (independent of