From 8d765994cd044af22d355d90c7b466a1990a7ae1 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sun, 31 May 2009 17:32:28 +0100 Subject: [PATCH] Rename functions to make it seem less of a hack --- include/IRollingStock.hpp | 8 ++++++-- src/Engine.cpp | 4 ++-- src/Train.cpp | 2 +- src/Waggon.cpp | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/IRollingStock.hpp b/include/IRollingStock.hpp index c0c2f85..d6a75d3 100644 --- a/include/IRollingStock.hpp +++ b/include/IRollingStock.hpp @@ -30,8 +30,12 @@ struct IRollingStock { // Update speed, fuel, etc. virtual void update(int aDelta, Vector aPosition) = 0; - // Display the object and any animiation - virtual void render() const = 0; + // Display the base object + // This should also display any animation that is attached to + // the model + // Animation that is not attached to the model should use + // `renderEffects' below + virtual void renderModel() const = 0; // Display any effects that should occur with absolute // co-ordinates (like smoke trails) diff --git a/src/Engine.cpp b/src/Engine.cpp index 100be20..57e25f0 100644 --- a/src/Engine.cpp +++ b/src/Engine.cpp @@ -61,7 +61,7 @@ public: Engine(); // IRollingStock interface - void render() const; + void renderModel() const; void renderEffects() const; void update(int aDelta, Vector aPosition); @@ -115,7 +115,7 @@ Engine::Engine() } // Draw the engine model -void Engine::render() const +void Engine::renderModel() const { myModel->render(); } diff --git a/src/Train.cpp b/src/Train.cpp index 0dee3fb..3c60204 100644 --- a/src/Train.cpp +++ b/src/Train.cpp @@ -177,7 +177,7 @@ void Train::render() const (*it).transformer((*it).segmentDelta); glTranslatef(0.0f, track::RAIL_HEIGHT, 0.0f); - (*it).vehicle->render(); + (*it).vehicle->renderModel(); glPopMatrix(); diff --git a/src/Waggon.cpp b/src/Waggon.cpp index cae3254..7bc9511 100644 --- a/src/Waggon.cpp +++ b/src/Waggon.cpp @@ -29,7 +29,7 @@ public: ~Waggon() {} void update(int aDelta, Vector aPosition); - void render() const; + void renderModel() const; void renderEffects() const {} IControllerPtr controller(); double speed() const { return 0.0; } @@ -52,7 +52,7 @@ void Waggon::update(int aDelta, Vector aPosition) } -void Waggon::render() const +void Waggon::renderModel() const { myModel->render(); } -- 2.39.2