diff options
author | D G Turner | 2012-09-13 10:55:10 +0100 |
---|---|---|
committer | D G Turner | 2012-09-13 10:55:10 +0100 |
commit | b7b2a4ee888711d6f2b1e040b4687f700551e777 (patch) | |
tree | ae3257f7b62aa41fb5263dcf85c56cc3b5630d7f | |
parent | bdba8bfb82153bc2a5822bdf46ac7d8f8173f483 (diff) | |
download | scummvm-rg350-b7b2a4ee888711d6f2b1e040b4687f700551e777.tar.gz scummvm-rg350-b7b2a4ee888711d6f2b1e040b4687f700551e777.tar.bz2 scummvm-rg350-b7b2a4ee888711d6f2b1e040b4687f700551e777.zip |
TEENAGENT: Clean up SurfaceList Class.
This removes an unecessary type and unused parameter from the load
method and renames to remove underscores from variable names as per
the project coding conventions.
-rw-r--r-- | engines/teenagent/scene.cpp | 2 | ||||
-rw-r--r-- | engines/teenagent/surface_list.cpp | 18 | ||||
-rw-r--r-- | engines/teenagent/surface_list.h | 7 |
3 files changed, 13 insertions, 14 deletions
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index ac03cf00aa..b94f013333 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -405,7 +405,7 @@ void Scene::init(int id, const Common::Point &pos) { sub_hack = 2; } } - on.load(*stream, SurfaceList::kTypeOn, sub_hack); + on.load(*stream, sub_hack); loadOns(); loadLans(); diff --git a/engines/teenagent/surface_list.cpp b/engines/teenagent/surface_list.cpp index f1e021888b..e293ce6470 100644 --- a/engines/teenagent/surface_list.cpp +++ b/engines/teenagent/surface_list.cpp @@ -26,28 +26,28 @@ namespace TeenAgent { -SurfaceList::SurfaceList() : surfaces(NULL), surfaces_n(0) {} +SurfaceList::SurfaceList() : surfaces(NULL), surfacesCount(0) {} SurfaceList::~SurfaceList() { free(); } -void SurfaceList::load(Common::SeekableReadStream &stream, Type type, int sub_hack) { +void SurfaceList::load(Common::SeekableReadStream &stream, int subHack) { free(); byte fn = stream.readByte(); if (stream.eos()) return; - surfaces_n = fn - sub_hack; - debugC(0, kDebugSurface, "loading %u surfaces from list (skip %d)", surfaces_n, sub_hack); + surfacesCount = fn - subHack; + debugC(0, kDebugSurface, "loading %u surfaces from list (skip %d)", surfacesCount, subHack); - if (surfaces_n == 0) + if (surfacesCount == 0) return; - surfaces = new Surface[surfaces_n]; + surfaces = new Surface[surfacesCount]; - for (byte i = 0; i < surfaces_n; ++i) { + for (byte i = 0; i < surfacesCount; ++i) { uint offset = stream.readUint16LE(); uint pos = stream.pos(); stream.seek(offset); @@ -59,11 +59,11 @@ void SurfaceList::load(Common::SeekableReadStream &stream, Type type, int sub_ha void SurfaceList::free() { delete[] surfaces; surfaces = NULL; - surfaces_n = 0; + surfacesCount = 0; } void SurfaceList::render(Graphics::Surface *surface, const Common::Rect &clip) const { - for (uint i = 0; i < surfaces_n; ++i) { + for (uint i = 0; i < surfacesCount; ++i) { const Surface &s = surfaces[i]; Common::Rect r(s.x, s.y, s.x + s.w, s.y + s.h); if (r.bottom < clip.bottom || !clip.intersects(r)) diff --git a/engines/teenagent/surface_list.h b/engines/teenagent/surface_list.h index f1359ec346..73a41fb5f8 100644 --- a/engines/teenagent/surface_list.h +++ b/engines/teenagent/surface_list.h @@ -30,17 +30,16 @@ class Surface; class SurfaceList { public: - enum Type { kTypeOn }; - SurfaceList(); ~SurfaceList(); - void load(Common::SeekableReadStream &, Type type, int sub_hack = 0); + + void load(Common::SeekableReadStream &, int subHack = 0); void free(); void render(Graphics::Surface *surface, const Common::Rect &clip) const; protected: Surface *surfaces; - uint surfaces_n; + uint surfacesCount; }; } |