K3dStream.cpp

Go to the documentation of this file.
00001 
00014 /***************************************************************************
00015  *   Copyright (C) 2007 by Jan Koci   *
00016  *   honza.koci@email.cz   *
00017  *   http://kengine.sourceforge.net/tutorial/
00018  *                                                                         *
00019  *   This program is free software; you can redistribute it and/or modify  *
00020  *   it under the terms of the GNU General Public License as published by  *
00021  *   the Free Software Foundation; either version 2 of the License, or     *
00022  *   (at your option) any later version.                                   *
00023  *                                                                         *
00024  *   This program is distributed in the hope that it will be useful,       *
00025  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00026  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00027  *   GNU General Public License for more details.                          *
00028  *                                                                         *
00029  *   You should have received a copy of the GNU General Public License     *
00030  *   along with this program; if not, write to the                         *
00031  *   Free Software Foundation, Inc.,                                       *
00032  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00033  ***************************************************************************/
00034 
00035 #include <fstream>
00036 using namespace std;
00037 
00038 #include "K3dStream.h"
00039 
00040 K3dStream::K3dStream(K3dGameData *_pGameData)
00041 {
00042         m_pGameData = _pGameData;
00043         // Set this pointer to the game data
00044         m_pGameData->SetStream(this);   
00045 }
00046 
00047 K3dStream::~K3dStream(void)
00048 {
00049 }
00050 
00054 bool K3dStream::LoadIni(const K3dString& _strFileName)
00055 {
00056         cout << "K3dStream::LoadIni()" << endl;
00057         cout << "Input filename = " << _strFileName.GetString( ) << endl;
00058 
00059         if(_strFileName == "")
00060         {
00061                 cerr << "void K3dStream::LoadIni() -- Error - Filename doesn`t exist" << endl;
00062                 return false;
00063         }
00064         // Get lua from global data
00065         K3dLua *pLua = m_pGameData->GetLua();
00066         if(pLua)
00067         {
00068                 if(!pLua->LuaLoadFile(_strFileName.GetString().c_str()))
00069                 {
00070                         pLua->LuaError("void K3dStream::LoadIni() -- Error - cannot run configuration file: %s", pLua->LuaToString(-1));
00071                         return false;
00072                 }
00073         }
00074         else
00075         {
00076                 cerr << "Error -- K3dStream::LoadIni() -- pLua doesn`t allocated !!" << endl;
00077                 exit(1);
00078         }
00079         return true;
00080 }

Generated on Thu Aug 16 23:53:28 2007 for K3dEngine by  doxygen 1.5.0