From bf16951d480ce411f5bf5ad22cecfb8bd62e6d5d Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sun, 7 Feb 2010 10:58:15 +0000 Subject: [PATCH] Simplify and fix point state changing --- src/Game.cpp | 6 ++++-- src/Points.cpp | 26 ++------------------------ 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/Game.cpp b/src/Game.cpp index b00a5fd..2d9f33b 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -288,6 +288,10 @@ void Game::alterTrackState(TrackStateReq req) const int maxAlterLook = 10; for (int i = 0; i < maxAlterLook; i++) { + + // Skip over the first section of track which may be some + // points - we don't want to alter the track we're on! + it = it.next(); if (it.status == TRACK_CHOICE) { switch (req) { @@ -301,8 +305,6 @@ void Game::alterTrackState(TrackStateReq req) return; } - - it = it.next(); } warn() << "No nearby track state to change"; diff --git a/src/Points.cpp b/src/Points.cpp index 0d65310..0e71333 100644 --- a/src/Points.cpp +++ b/src/Points.cpp @@ -462,34 +462,12 @@ xml::element Points::toXml() const void Points::nextState() { - debug() << "nextState r=" << reflected << " state=" << state; - - switch (state) { - case 0: - state = reflected ? NOT_TAKEN : NOT_TAKEN; - break; - case 1: - state = reflected ? NOT_TAKEN : TAKEN; - break; - } - - debug() << "now=" << state; + state = reflected ? NOT_TAKEN : TAKEN; } void Points::prevState() { - debug() << "prevState r=" << reflected << " state=" << state; - - switch (state) { - case 0: - state = reflected ? TAKEN : TAKEN; - break; - case 1: - state = reflected ? TAKEN : NOT_TAKEN; - break; - } - - debug() << "now="<