data.cpp

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2005  The Pentagram Team
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  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #include "pent_include.h"
00020 
00021 #include "FileSystem.h"
00022 
00023 #ifdef BUILTIN_DATA
00024 #include "data/data.h"
00025 #endif
00026 
00027 void FileSystem::initBuiltinData(bool allowoverride)
00028 {
00029 #ifdef BUILTIN_DATA
00030         allowdataoverride = allowoverride;
00031 
00032         int i = 0;
00033         while (true) {
00034                 PentagramData::DataFile& file = PentagramData::files[i++];
00035                 if (!file.name) break;
00036 
00037                 std::string vp = "@data/";
00038                 vp += file.name;
00039 
00040                 std::map<std::string, MemoryFile*>::iterator p = memoryfiles.find(vp);
00041 
00042                 if (p != memoryfiles.end())
00043                 {
00044                         perr << "Warning: duplicate builtin data file: " << vp
00045                                  << std::endl;
00046                         continue;
00047                 }
00048 
00049                 memoryfiles[vp] = new MemoryFile(file.data, file.size);
00050 
00051         }
00052 #endif
00053 }

Generated on Fri Jul 27 22:27:13 2007 for pentagram by  doxygen 1.4.7