Map.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2003 The Pentagram team
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (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 #ifndef MAP_H
00020 #define MAP_H
00021 
00022 #include <list>
00023 
00024 class Item;
00025 class IDataSource;
00026 class ODataSource;
00027 
00028 class Map
00029 {
00030         friend class CurrentMap;
00031 public:
00032         explicit Map(uint32 mapnum);
00033         ~Map();
00034 
00035         void clear();
00036 
00037         void loadNonFixed(IDataSource* ds);
00038         void loadFixed(IDataSource* ds);
00039         void unloadFixed();
00040 
00041         bool isEmpty()
00042                 { return fixeditems.size() == 0 && dynamicitems.size() == 0; }
00043 
00044         void save(ODataSource* ods);
00045         bool load(IDataSource* ids, uint32 version);
00046 
00047 private:
00048 
00049         // load items from something formatted like 'fixed.dat'
00050         void loadFixedFormatObjects(std::list<Item*>& itemlist, IDataSource* ds,
00051                                                                 uint32 extendedflags);
00052 
00053         // Q: How should we store the items in a map.
00054         // It might make things more efficient if we order them by 'chunk'
00055         // (512x512). This would mean we need about 128x128 item lists.
00056 
00057         // It would probably be overkill to permanently maintain all these lists
00058         // for all maps, so we could only set them up for the current map.
00059         // (which makes me wonder if there should be a separate class for the
00060         // active map?)
00061 
00062         // (Note that we probably won't even have all items permanently stored,
00063         // since fixed items will be cached out most of the time)
00064 
00065 
00066         std::list<Item*> fixeditems;
00067         std::list<Item*> dynamicitems;
00068 
00069         uint32 mapnum;
00070 };
00071 
00072 
00073 #endif

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