From 7668b60981dadeced3b5c8ee27c16575d59844de Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 21 Aug 2008 19:33:57 +0000 Subject: entity.set_eventstate --- src/game/racetrack.cc | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src/game') diff --git a/src/game/racetrack.cc b/src/game/racetrack.cc index 31e5b40..897a839 100644 --- a/src/game/racetrack.cc +++ b/src/game/racetrack.cc @@ -61,8 +61,7 @@ void RaceTrack::reset() track_checkpointtime = 0; for (CheckPoints::iterator cpit = track_checkpoints.begin(); cpit != track_checkpoints.end(); ++cpit) { - (*cpit)->entity_eventstate |= core::Entity::NoPower; - (*cpit)->entity_dirty = true; + (*cpit)->set_eventstate(core::Entity::NoPower); } entity_eventstate |= core::Entity::NoPower; @@ -83,12 +82,10 @@ void RaceTrack::frame(float seconds) track_player = (*it); track_racestart = core::server()->time(); - entity_eventstate &= (~core::Entity::NoPower); - entity_dirty = true; + set_eventstate(core::Entity::Normal); for (CheckPoints::iterator cpit = track_checkpoints.begin(); cpit != track_checkpoints.end(); ++cpit) { - (*cpit)->entity_eventstate &= (~core::Entity::NoPower); - (*cpit)->entity_dirty = true; + set_eventstate(core::Entity::Normal); } entity_timer = 5.0f; @@ -143,8 +140,7 @@ void RaceTrack::frame(float seconds) track_racestart = core::server()->time(); } else { for (CheckPoints::iterator cpit = track_checkpoints.begin(); cpit != track_checkpoints.end(); ++cpit) { - (*cpit)->entity_eventstate |= core::Entity::NoPower; - (*cpit)->entity_dirty = true; + (*cpit)->set_eventstate(core::Entity::NoPower); } std::string message("^BGo!"); core::server()->broadcast(message); @@ -152,8 +148,7 @@ void RaceTrack::frame(float seconds) track_racestart = core::server()->time(); track_checkpointtime = core::server()->time() + 15.0f; track_checkpoint = track_checkpoints.begin(); - (*track_checkpoint)->entity_eventstate &= ~core::Entity::NoPower; - (*track_checkpoint)->entity_dirty = true; + (*track_checkpoint)->set_eventstate(core::Entity::Normal); } } @@ -177,13 +172,12 @@ void RaceTrack::frame(float seconds) std::string message("^BCheckpoint!"); core::server()->broadcast(message); track_checkpointtime = core::server()->time() + 15.0f; - (*track_checkpoint)->entity_eventstate |= core::Entity::NoPower; - (*track_checkpoint)->entity_dirty = true; + (*track_checkpoint)->set_eventstate(core::Entity::NoPower); track_checkpoint++; - (*track_checkpoint)->entity_eventstate &= ~core::Entity::NoPower; - (*track_checkpoint)->entity_dirty = true; + (*track_checkpoint)->set_eventstate(core::Entity::Normal); } else { + std::stringstream msgstr; msgstr << "^BRace completed in " << core::server()->time() - track_racestart << " seconds!"; core::server()->broadcast(msgstr.str()); -- cgit v1.2.3