Constificiation.
[gemrb.git] / gemrb / core / Factory.cpp
blobaa7dbabb436e26ad74ea8781184559baaa8181ac
1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include <cstring>
22 #include "win32def.h"
23 #include "Factory.h"
25 Factory::Factory(void)
29 Factory::~Factory(void)
31 for (unsigned int i = 0; i < fobjects.size(); i++) {
32 delete( fobjects[i] );
36 void Factory::AddFactoryObject(FactoryObject* fobject)
38 fobjects.push_back( fobject );
41 int Factory::IsLoaded(const char* ResRef, SClass_ID type) const
43 for (unsigned int i = 0; i < fobjects.size(); i++) {
44 if (fobjects[i]->SuperClassID == type) {
45 if (strnicmp( fobjects[i]->ResRef, ResRef, 8 ) == 0) {
46 return i;
50 return -1;
53 FactoryObject* Factory::GetFactoryObject(int pos) const
55 return fobjects[pos];
58 void Factory::FreeObjects(void)
60 for (unsigned int i = 0; i < fobjects.size(); i++) {
61 delete( fobjects[i] );