Iterate through signs in reverse order when seeking for click events in order to ensure when clicking on stacked signs the top-most sign is detected

This commit is contained in:
Simon Robertshaw 2013-10-29 19:59:13 +00:00
parent f2e28ee667
commit 2d22776a2c

View File

@ -255,7 +255,7 @@ GameView * GameController::GetView()
sign * GameController::GetSignAt(int x, int y){
Simulation * sim = gameModel->GetSimulation();
for (std::vector<sign>::iterator iter = sim->signs.begin(), end = sim->signs.end(); iter != end; ++iter)
for (std::vector<sign>::reverse_iterator iter = sim->signs.rbegin(), end = sim->signs.rend(); iter != end; ++iter)
{
int signx, signy, signw, signh;
(*iter).pos((*iter).getText(sim), signx, signy, signw, signh);