00001 00012 /*************************************************************************** 00013 * Copyright (C) 2007 by Jan Koci * 00014 * honza.koci@email.cz * 00015 * http://kengine.sourceforge.net/tutorial/ 00016 * * 00017 * This program is free software; you can redistribute it and/or modify * 00018 * it under the terms of the GNU General Public License as published by * 00019 * the Free Software Foundation; either version 2 of the License, or * 00020 * (at your option) any later version. * 00021 * * 00022 * This program is distributed in the hope that it will be useful, * 00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00025 * GNU General Public License for more details. * 00026 * * 00027 * You should have received a copy of the GNU General Public License * 00028 * along with this program; if not, write to the * 00029 * Free Software Foundation, Inc., * 00030 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00031 ***************************************************************************/ 00032 00033 #include "K3dPolyBuild.h" 00034 00038 K3dPolyBuild::K3dPolyBuild(K3dGameData *_pGameData): 00039 K3dPolyWork(_pGameData) 00040 { 00041 m_pGameData = _pGameData; 00042 // Set this pointer to the game data 00043 m_pGameData->SetPolyBuild(this); 00044 } 00045 00046 K3dPolyBuild::~K3dPolyBuild(void) 00047 { 00048 DeletePolyhedrons(); 00049 } 00050 00053 K3dPolyObj *K3dPolyBuild::CreateNewPolyObj() 00054 { 00055 K3dPolyObj *pPoly = m_pGameData->GetPolyObjSP().New(); 00056 pPoly->GetId() = m_pGameData->GetPolyObjSP().GetNum()-1; 00057 return pPoly; 00058 } 00059 00060 00062 void K3dPolyBuild::DeletePolyhedrons() 00063 { 00064 std::cout << "void K3dPolyBuild::DeletePolyhedrons()" << endl; 00065 while(m_pGameData->GetPolyObjSP().GetNum()) 00066 { 00067 K3dPolyObj *p = m_pGameData->GetPolyObjSP().Get(0); 00068 p = m_pGameData->GetPolyObjSP().Delete(p); 00069 } 00070 } 00071