Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ModelList.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net)
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  */
00009 #include "ModelList.h"
00010 
00011 #include "View.h"
00012 #include "Landslip.h"
00013 
00014 //-----------------------------------------------------------------
00015 /**
00016  * Create new wrapper.
00017  * @param models wrapped models.
00018  */
00019 ModelList::ModelList(const Cube::t_models *models)
00020 {
00021     m_models = models;
00022 }
00023 //-----------------------------------------------------------------
00024 void
00025 ModelList::drawOn(View *view) const
00026 {
00027     Cube::t_models::const_iterator end = m_models->end();
00028     for (Cube::t_models::const_iterator i = m_models->begin(); i != end; ++i) {
00029         view->drawModel(*i);
00030     }
00031 }
00032 //-----------------------------------------------------------------
00033 /**
00034  * Stone all models on fixed pad.
00035  * @return true when new model was stoned
00036  */
00037 bool
00038 ModelList::stoneOn(Landslip *slip) const
00039 {
00040     bool change = false;
00041     Cube::t_models::const_iterator end = m_models->end();
00042     for (Cube::t_models::const_iterator i = m_models->begin(); i != end; ++i) {
00043         if (slip->stoneModel(*i)) {
00044             change = true;
00045         }
00046     }
00047     return change;
00048 }
00049 //-----------------------------------------------------------------
00050 /**
00051  * Let all not stoned models to fall.
00052  * @return true when something is falling
00053  */
00054 bool
00055 ModelList::fallOn(Landslip *slip) const
00056 {
00057     bool falling = false;
00058     Cube::t_models::const_iterator end = m_models->end();
00059     for (Cube::t_models::const_iterator i = m_models->begin(); i != end; ++i) {
00060         falling |= slip->fallModel(*i);
00061     }
00062     return falling;
00063 }
00064 

Generated on Wed Jun 1 09:54:31 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2