Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Allow map files to specify the filenames of their tilesets and backdrops

  • Loading branch information...
commit d94710c81441d2faa547c204649c314883428c2a 1 parent 8e650e2
Adam Nielsen authored
37  examples/gamemap.cpp
@@ -722,6 +722,43 @@ int main(int iArgC, char *cArgV[])
722 722
 				} else {
723 723
 					std::cout << "0\n"; // number of attributes
724 724
 				}
  725
+
  726
+				std::cout << (bScript ? "gfx_filename_count=" : "Number of graphics filenames: ");
  727
+				gm::Map::FilenameVectorPtr gfxFilenames = pMap->getGraphicsFilenames();
  728
+				if (gfxFilenames) {
  729
+					std::cout << gfxFilenames->size() << "\n";
  730
+					int fileNum = 0;
  731
+					for (gm::Map::FilenameVector::const_iterator
  732
+						i = gfxFilenames->begin(); i != gfxFilenames->end(); i++
  733
+					) {
  734
+						const gm::Map::GraphicsFilename *a = &(*i);
  735
+
  736
+						if (bScript) {
  737
+							std::cout << "gfx_file" << fileNum << "_name=" << a->filename << "\n";
  738
+							std::cout << "gfx_file" << fileNum << "_type=" << a->type << "\n";
  739
+							std::cout << "gfx_file" << fileNum << "_purpose=" << a->purpose << "\n";
  740
+						} else {
  741
+							std::cout << "Graphics file " << fileNum+1 << ": " << a->filename
  742
+								<< " [";
  743
+							switch (a->purpose) {
  744
+								case gm::Map::GraphicsFilename::Tileset:
  745
+									std::cout << "tileset";
  746
+									break;
  747
+								case gm::Map::GraphicsFilename::BackgroundImage:
  748
+									std::cout << "background image";
  749
+									break;
  750
+								default:
  751
+									std::cout << "Unknown purpose <fix this>";
  752
+									break;
  753
+							}
  754
+							std::cout << " of type " << a->type << "]\n";
  755
+						}
  756
+						fileNum++;
  757
+					}
  758
+				} else {
  759
+					std::cout << "0\n"; // number of gfx filenames
  760
+				}
  761
+
725 762
 				std::cout << (bScript ? "map_type=" : "Map type: ");
726 763
 				gm::Map2DPtr map2d = boost::dynamic_pointer_cast<gm::Map2D>(pMap);
727 764
 				if (map2d) {
58  include/camoto/gamemaps/map.hpp
@@ -43,12 +43,26 @@ class EInvalidFormat: virtual public error {
43 43
 class Map: virtual public Metadata
44 44
 {
45 45
 	public:
46  
-		/// Attribute attached to this map
  46
+		/// Attribute attached to this map.
  47
+		/**
  48
+		 * Attributes are configuration options that apply to particular map files,
  49
+		 * such as a default background colour or which song to play as background
  50
+		 * music in the level.
  51
+		 *
  52
+		 * Attributes should reflect data contained in the map file itself, so for
  53
+		 * example, if the map file doesn't store some value that controls which
  54
+		 * tileset is used to draw the level, then the tileset filename shouldn't be
  55
+		 * exposed as an attribute (because if it was changed, the new value
  56
+		 * couldn't be saved back into the map file.)
  57
+		 *
  58
+		 * Attributes should reflect properties of the map that the user can and may
  59
+		 * wish to change.
  60
+		 */
47 61
 		struct Attribute {
48 62
 			enum Type {
49 63
 				Integer,         ///< One number within a given range
50 64
 				Enum,            ///< One choice from a list of static values
51  
-				Filename,        ///< A filename of the given type
  65
+				Filename,        ///< A filename of the given file type
52 66
 			};
53 67
 			Type type;         ///< What type this attribute is
54 68
 			std::string name;  ///< Short name of this attribute
@@ -61,8 +75,20 @@ class Map: virtual public Metadata
61 75
 			unsigned int enumValue;                  ///< Enum type: current value
62 76
 			std::vector<std::string> enumValueNames; ///< Enum type: permitted values
63 77
 
64  
-			std::string filenameValue; ///< Filename type: current filename
65  
-			/// Valid filename extensions
  78
+			/// Filename type: current filename
  79
+			/**
  80
+			 * Filenames should be specified here as map attributes (as opposed to
  81
+			 * supplementary items) if the files are not required to load the map.
  82
+			 *
  83
+			 * Parts of the actual map (like layer data or sprite positions) should
  84
+			 * be listed as supp data because the map will be incomplete if those
  85
+			 * files are not available, but things like tileset filenames are not
  86
+			 * required to load the map (e.g. if all you want to do is find out the
  87
+			 * map dimensions) so those optional files should be listed as attributes.
  88
+			 */
  89
+			std::string filenameValue;
  90
+
  91
+			/// Filename type: valid filename extensions
66 92
 			/**
67 93
 			 * Any files that match this specification will be listed as valid choices
68 94
 			 * for this attribute value.  An empty string means there is no
@@ -82,6 +108,30 @@ class Map: virtual public Metadata
82 108
 
83 109
 		/// Get a list of attributes that can be set in this map.
84 110
 		virtual AttributePtrVectorPtr getAttributes() = 0;
  111
+
  112
+		/// Const-accessible version
  113
+		virtual const AttributePtrVectorPtr getAttributes() const = 0;
  114
+
  115
+		/// Information about a graphics file used to render this map.
  116
+		struct GraphicsFilename {
  117
+			enum Purpose {
  118
+				Tileset,             ///< Normal tileset
  119
+				BackgroundImage,     ///< Image to appear behind all tiles
  120
+			};
  121
+			Purpose purpose;
  122
+			std::string filename;  ///< Actual filename
  123
+			std::string type;      ///< Type code (e.g. "tls-blah")
  124
+		};
  125
+		typedef std::vector<GraphicsFilename> FilenameVector;
  126
+		typedef boost::shared_ptr<FilenameVector> FilenameVectorPtr;
  127
+
  128
+		/// Get a list of additional files needed to render the map.
  129
+		/**
  130
+		 * This function returns a list of filenames and format types needed to
  131
+		 * render the map.  Tilesets, background images, etc.  These values may
  132
+		 * change as map attributes are altered.
  133
+		 */
  134
+		virtual FilenameVectorPtr getGraphicsFilenames() const = 0;
85 135
 };
86 136
 
87 137
 /// Shared pointer to a Map.
27  src/fmt-map-bash.cpp
@@ -111,6 +111,29 @@ ImagePtr BashBackgroundLayer::imageFromCode(unsigned int code,
111 111
 }
112 112
 
113 113
 
  114
+Map::FilenameVectorPtr bash_getGraphicsFilenames(const Map *map)
  115
+{
  116
+	Map::AttributePtrVectorPtr attributes = map->getAttributes();
  117
+	assert(attributes); // this map format always has attributes
  118
+	assert(attributes->size() == MB_NUM_ATTRIBUTES);
  119
+
  120
+	Map::FilenameVectorPtr files(new Map::FilenameVector);
  121
+	Map::GraphicsFilename gf;
  122
+	gf.purpose = Map::GraphicsFilename::Tileset;
  123
+	gf.type = "tls-bash-bg";
  124
+	gf.filename = attributes->at(0)->filenameValue;
  125
+	files->push_back(gf); // bg tiles
  126
+
  127
+	gf.type = "tls-bash-fg";
  128
+	gf.filename = attributes->at(1)->filenameValue;
  129
+	files->push_back(gf); // fg tiles
  130
+
  131
+	gf.filename = attributes->at(2)->filenameValue;
  132
+	files->push_back(gf); // bon tiles
  133
+	return files;
  134
+}
  135
+
  136
+
114 137
 std::string BashMapType::getMapCode() const
115 138
 {
116 139
 	return "map-bash";
@@ -215,7 +238,6 @@ MapPtr BashMapType::open(stream::input_sptr input, SuppData& suppData) const
215 238
 		attr->type = Map::Attribute::Filename;
216 239
 		attr->name = attrNames[i];
217 240
 		attr->desc = attrDesc[i];
218  
-		attr->filenameValidExtension = validTypes[i];
219 241
 		input >> nullPadded(attr->filenameValue, 31);
220 242
 		if (attr->filenameValue.compare("UNNAMED") == 0) {
221 243
 			attr->filenameValue.clear();
@@ -229,6 +251,7 @@ MapPtr BashMapType::open(stream::input_sptr input, SuppData& suppData) const
229 251
 				attr->filenameValue += validTypes[i];
230 252
 			}
231 253
 		}
  254
+		attr->filenameValidExtension = validTypes[i];
232 255
 		attributes->push_back(attr);
233 256
 	}
234 257
 
@@ -301,7 +324,7 @@ MapPtr BashMapType::open(stream::input_sptr input, SuppData& suppData) const
301 324
 	layers.push_back(fgLayer);
302 325
 
303 326
 	Map2DPtr map(new GenericMap2D(
304  
-		attributes,
  327
+		attributes, bash_getGraphicsFilenames,
305 328
 		Map2D::HasViewport,
306 329
 		MB_VIEWPORT_WIDTH, MB_VIEWPORT_HEIGHT,
307 330
 		mapWidth, mapHeight,
2  src/fmt-map-ccaves.cpp
@@ -171,7 +171,7 @@ MapPtr CCavesMapType::open(stream::input_sptr input, SuppData& suppData) const
171 171
 	layers.push_back(bgLayer);
172 172
 
173 173
 	Map2DPtr map(new GenericMap2D(
174  
-		Map::AttributePtrVectorPtr(),
  174
+		Map::AttributePtrVectorPtr(), NO_GFX_CALLBACK,
175 175
 		Map2D::HasViewport,
176 176
 		CC_VIEWPORT_WIDTH, CC_VIEWPORT_HEIGHT,
177 177
 		CC_MAP_WIDTH, height,
2  src/fmt-map-ccomic.cpp
@@ -158,7 +158,7 @@ MapPtr CComicMapType::open(stream::input_sptr input, SuppData& suppData) const
158 158
 	layers.push_back(bgLayer);
159 159
 
160 160
 	Map2DPtr map(new GenericMap2D(
161  
-		Map::AttributePtrVectorPtr(),
  161
+		Map::AttributePtrVectorPtr(), NO_GFX_CALLBACK,
162 162
 		Map2D::HasViewport,
163 163
 		193, 160, // viewport size
164 164
 		width, height,
2  src/fmt-map-cosmo.cpp
@@ -227,7 +227,7 @@ MapPtr CosmoMapType::open(stream::input_sptr input, SuppData& suppData) const
227 227
 	layers.push_back(actorLayer);
228 228
 
229 229
 	Map2DPtr map(new GenericMap2D(
230  
-		Map::AttributePtrVectorPtr(),
  230
+		Map::AttributePtrVectorPtr(), NO_GFX_CALLBACK,
231 231
 		Map2D::HasViewport,
232 232
 		CCA_VIEWPORT_WIDTH, CCA_VIEWPORT_HEIGHT,
233 233
 		mapWidth, 32768 / mapWidth,
2  src/fmt-map-ddave.cpp
@@ -174,7 +174,7 @@ MapPtr DDaveMapType::open(stream::input_sptr input, SuppData& suppData) const
174 174
 	layers.push_back(bgLayer);
175 175
 
176 176
 	Map2DPtr map(new GenericMap2D(
177  
-		Map::AttributePtrVectorPtr(),
  177
+		Map::AttributePtrVectorPtr(), NO_GFX_CALLBACK,
178 178
 		Map2D::HasViewport | Map2D::HasPaths | Map2D::FixedPathCount,
179 179
 		20 * DD_TILE_WIDTH, 10 * DD_TILE_HEIGHT, // viewport size
180 180
 		DD_MAP_WIDTH, DD_MAP_HEIGHT,
2  src/fmt-map-harry.cpp
@@ -316,7 +316,7 @@ MapPtr HarryMapType::open(stream::input_sptr input, SuppData& suppData) const
316 316
 	layers.push_back(actorLayer);
317 317
 
318 318
 	Map2DPtr map(new GenericMap2D(
319  
-		attributes,
  319
+		attributes, NO_GFX_CALLBACK,
320 320
 		Map2D::HasViewport,
321 321
 		HH_VIEWPORT_WIDTH, HH_VIEWPORT_HEIGHT,
322 322
 		mapWidth, mapHeight,
2  src/fmt-map-hocus.cpp
@@ -171,7 +171,7 @@ MapPtr HocusMapType::open(stream::input_sptr input, SuppData& suppData) const
171 171
 	//layers.push_back(actorLayer);
172 172
 
173 173
 	Map2DPtr map(new GenericMap2D(
174  
-		Map::AttributePtrVectorPtr(),
  174
+		Map::AttributePtrVectorPtr(), NO_GFX_CALLBACK,
175 175
 		Map2D::HasViewport,
176 176
 		HP_VIEWPORT_WIDTH, HP_VIEWPORT_HEIGHT,
177 177
 		HP_MAP_WIDTH, HP_MAP_HEIGHT,
2  src/fmt-map-wacky.cpp
@@ -184,7 +184,7 @@ MapPtr WackyMapType::open(stream::input_sptr input, SuppData& suppData) const
184 184
 	paths->push_back(pathptr);
185 185
 
186 186
 	Map2DPtr map(new GenericMap2D(
187  
-		Map::AttributePtrVectorPtr(),
  187
+		Map::AttributePtrVectorPtr(), NO_GFX_CALLBACK,
188 188
 		Map2D::HasPaths | Map2D::FixedPathCount,
189 189
 		0, 0,
190 190
 		WW_MAP_WIDTH, WW_MAP_HEIGHT,
87  src/fmt-map-wordresc.cpp
@@ -197,6 +197,31 @@ bool WordRescueAttributeLayer::tilePermittedAt(unsigned int code,
197 197
 }
198 198
 
199 199
 
  200
+Map::FilenameVectorPtr wr_getGraphicsFilenames(const Map *map)
  201
+{
  202
+	Map::AttributePtrVectorPtr attributes = map->getAttributes();
  203
+	assert(attributes); // this map format always has attributes
  204
+	assert(attributes->size() == 3);
  205
+
  206
+	Map::FilenameVectorPtr files(new Map::FilenameVector);
  207
+	Map::GraphicsFilename gf;
  208
+	gf.purpose = Map::GraphicsFilename::Tileset;
  209
+	gf.type = "tls-wordresc";
  210
+	gf.filename = createString("back" << (int)(attributes->at(1)->enumValue + 1)
  211
+		<< ".wr");
  212
+	files->push_back(gf); // bg tiles
  213
+
  214
+	unsigned int dropNum = attributes->at(2)->enumValue;
  215
+	if (dropNum > 0) {
  216
+		gf.purpose = Map::GraphicsFilename::BackgroundImage;
  217
+		gf.filename = createString("drop" << dropNum << ".wr");
  218
+		files->push_back(gf); // fg tiles
  219
+	}
  220
+
  221
+	return files;
  222
+}
  223
+
  224
+
200 225
 /// Write the given data to the stream, RLE encoded
201 226
 int rleWrite(stream::output_sptr output, uint8_t *data, int len)
202 227
 {
@@ -400,47 +425,28 @@ MapPtr WordRescueMapType::open(stream::input_sptr input, SuppData& suppData) con
400 425
 	attrTileset->type = Map::Attribute::Enum;
401 426
 	attrTileset->name = "Tileset";
402 427
 	attrTileset->desc = "Tileset to use for this map";
403  
-	switch (tileset) {
404  
-		case 1: attrTileset->enumValue = 0; break;
405  
-		case 2: attrTileset->enumValue = 1; break;
406  
-		case 3: attrTileset->enumValue = 2; break;
407  
-		case 5: attrTileset->enumValue = 3; break;
408  
-		case 4: attrTileset->enumValue = 4; break;
409  
-
410  
-		case 6: attrTileset->enumValue = 5; break;
411  
-		case 7: attrTileset->enumValue = 6; break;
412  
-		case 8: attrTileset->enumValue = 7; break;
413  
-		default: attrTileset->enumValue = 0; break;
414  
-	}
  428
+	if (tileset > 0) tileset--; // just in case it *is* ever zero
  429
+	attrTileset->enumValue = tileset;
415 430
 	attrTileset->enumValueNames.push_back("Desert");
416 431
 	attrTileset->enumValueNames.push_back("Castle");
417 432
 	attrTileset->enumValueNames.push_back("Suburban");
418  
-	attrTileset->enumValueNames.push_back("Industrial");
419 433
 	attrTileset->enumValueNames.push_back("Spooky (episode 3 only)");
420  
-	attrTileset->enumValueNames.push_back("Custom (back5.wr)");
  434
+	attrTileset->enumValueNames.push_back("Industrial");
421 435
 	attrTileset->enumValueNames.push_back("Custom (back6.wr)");
422 436
 	attrTileset->enumValueNames.push_back("Custom (back7.wr)");
  437
+	attrTileset->enumValueNames.push_back("Custom (back8.wr)");
423 438
 	attributes->push_back(attrTileset);
424 439
 
425 440
 	Map::AttributePtr attrBackdrop(new Map::Attribute);
426 441
 	attrBackdrop->type = Map::Attribute::Enum;
427 442
 	attrBackdrop->name = "Backdrop";
428 443
 	attrBackdrop->desc = "Image to show behind map (overrides background colour)";
429  
-	switch (backdrop) {
430  
-		case 0: attrBackdrop->enumValue = 0; break;
431  
-		case 3: attrBackdrop->enumValue = 1; break;
432  
-		case 4: attrBackdrop->enumValue = 2; break;
433  
-		case 2: attrBackdrop->enumValue = 3; break;
434  
-
435  
-		case 5: attrBackdrop->enumValue = 4; break;
436  
-		case 6: attrBackdrop->enumValue = 5; break;
437  
-		case 7: attrBackdrop->enumValue = 6; break;
438  
-		default: attrBackdrop->enumValue = 0; break;
439  
-	}
  444
+	attrBackdrop->enumValue = backdrop;
440 445
 	attrBackdrop->enumValueNames.push_back("None (use background colour)");
  446
+	attrBackdrop->enumValueNames.push_back("Custom (drop1.wr)");
  447
+	attrBackdrop->enumValueNames.push_back("Cave (episodes 2-3 only)");
441 448
 	attrBackdrop->enumValueNames.push_back("Desert");
442 449
 	attrBackdrop->enumValueNames.push_back("Mountain");
443  
-	attrBackdrop->enumValueNames.push_back("Cave (episodes 2-3 only)");
444 450
 	attrBackdrop->enumValueNames.push_back("Custom (drop5.wr)");
445 451
 	attrBackdrop->enumValueNames.push_back("Custom (drop6.wr)");
446 452
 	attrBackdrop->enumValueNames.push_back("Custom (drop7.wr)");
@@ -581,7 +587,7 @@ MapPtr WordRescueMapType::open(stream::input_sptr input, SuppData& suppData) con
581 587
 	layers.push_back(itemLayer);
582 588
 
583 589
 	Map2DPtr map(new GenericMap2D(
584  
-		attributes,
  590
+		attributes, wr_getGraphicsFilenames,
585 591
 		Map2D::HasViewport,
586 592
 		288, 152, // viewport
587 593
 		mapWidth, mapHeight,
@@ -621,37 +627,14 @@ void WordRescueMapType::write(MapPtr map, stream::expanding_output_sptr output,
621 627
 		throw stream::error("Cannot write map as there is an attribute of the "
622 628
 			"wrong type (tileset != enum)");
623 629
 	}
624  
-	uint16_t tileset;
625  
-	switch (attrTileset->enumValue) {
626  
-		case 0: tileset = 1; break;
627  
-		case 1: tileset = 2; break;
628  
-		case 2: tileset = 3; break;
629  
-		case 3: tileset = 5; break;
630  
-		case 4: tileset = 4; break;
631  
-
632  
-		case 5: tileset = 6; break;
633  
-		case 6: tileset = 7; break;
634  
-		case 7: tileset = 8; break;
635  
-		default: tileset = 1; break;
636  
-	}
  630
+	uint16_t tileset = attrTileset->enumValue + 1;
637 631
 
638 632
 	Map::Attribute *attrBackdrop = attributes->at(2).get();
639 633
 	if (attrBackdrop->type != Map::Attribute::Enum) {
640 634
 		throw stream::error("Cannot write map as there is an attribute of the "
641 635
 			"wrong type (backdrop != enum)");
642 636
 	}
643  
-	uint16_t backdrop;
644  
-	switch (attrBackdrop->enumValue) {
645  
-		case 0: backdrop = 0; break;
646  
-		case 1: backdrop = 3; break;
647  
-		case 2: backdrop = 4; break;
648  
-		case 3: backdrop = 2; break;
649  
-
650  
-		case 4: backdrop = 5; break;
651  
-		case 5: backdrop = 6; break;
652  
-		case 6: backdrop = 7; break;
653  
-		default: backdrop = 0; break;
654  
-	}
  637
+	uint16_t backdrop = attrBackdrop->enumValue;
655 638
 
656 639
 	typedef std::pair<uint16_t, uint16_t> point;
657 640
 	std::vector<point> itemLocations[INDEX_SIZE];
2  src/fmt-map-xargon.cpp
@@ -508,7 +508,7 @@ MapPtr SweeneyMapType::open(stream::input_sptr input, SuppData& suppData) const
508 508
 	layers.push_back(objLayer);
509 509
 
510 510
 	Map2DPtr map(new GenericMap2D(
511  
-		Map::AttributePtrVectorPtr(),
  511
+		Map::AttributePtrVectorPtr(), NO_GFX_CALLBACK,
512 512
 		Map2D::HasViewport,
513 513
 		20 * XR_TILE_WIDTH, 10 * XR_TILE_HEIGHT, // viewport size
514 514
 		XR_MAP_WIDTH, XR_MAP_HEIGHT,
17  src/map-generic.cpp
@@ -23,8 +23,10 @@
23 23
 namespace camoto {
24 24
 namespace gamemaps {
25 25
 
26  
-GenericMap::GenericMap(AttributePtrVectorPtr attributes)
27  
-	:	attributes(attributes)
  26
+GenericMap::GenericMap(AttributePtrVectorPtr attributes,
  27
+	GraphicsFilenamesCallback fnGfxFiles)
  28
+	:	attributes(attributes),
  29
+		fnGfxFiles(fnGfxFiles)
28 30
 {
29 31
 }
30 32
 
@@ -37,5 +39,16 @@ Map::AttributePtrVectorPtr GenericMap::getAttributes()
37 39
 	return this->attributes;
38 40
 }
39 41
 
  42
+const Map::AttributePtrVectorPtr GenericMap::getAttributes() const
  43
+{
  44
+	return this->attributes;
  45
+}
  46
+
  47
+Map::FilenameVectorPtr GenericMap::getGraphicsFilenames() const
  48
+{
  49
+	if (this->fnGfxFiles) return this->fnGfxFiles(this);
  50
+	return Map::FilenameVectorPtr();
  51
+}
  52
+
40 53
 } // namespace gamemaps
41 54
 } // namespace camoto
20  src/map-generic.hpp
@@ -21,22 +21,40 @@
21 21
 #ifndef _CAMOTO_GAMEMAPS_MAP_GENERIC_HPP_
22 22
 #define _CAMOTO_GAMEMAPS_MAP_GENERIC_HPP_
23 23
 
  24
+#include <boost/function.hpp>
24 25
 #include <camoto/gamemaps/map.hpp>
25 26
 
26 27
 namespace camoto {
27 28
 namespace gamemaps {
28 29
 
  30
+/// Callback to use when the list of graphics filenames is required
  31
+/**
  32
+ * This is used as a convenience function, to avoid having to derive from
  33
+ * GenericMap and implement getGraphicsFilenames().
  34
+ */
  35
+typedef boost::function<Map::FilenameVectorPtr(const Map *)> GraphicsFilenamesCallback;
  36
+
  37
+/// Value to use when there is no callback to get the list of graphics filenames
  38
+#define NO_GFX_CALLBACK ((GraphicsFilenamesCallback)NULL)
  39
+
29 40
 /// Generic implementation of a Map.
30 41
 class GenericMap: virtual public Map
31 42
 {
32 43
 	public:
33  
-		GenericMap(AttributePtrVectorPtr attributes);
  44
+		GenericMap(AttributePtrVectorPtr attributes,
  45
+			GraphicsFilenamesCallback fnGfxFiles);
34 46
 		virtual ~GenericMap();
35 47
 
36 48
 		virtual AttributePtrVectorPtr getAttributes();
  49
+		virtual const AttributePtrVectorPtr getAttributes() const;
  50
+		virtual FilenameVectorPtr getGraphicsFilenames() const;
37 51
 
38 52
 	protected:
  53
+		/// Vector holding the current attributes
39 54
 		AttributePtrVectorPtr attributes;
  55
+
  56
+		/// Callback function to get the names of the graphics files
  57
+		GraphicsFilenamesCallback fnGfxFiles;
40 58
 };
41 59
 
42 60
 } // namespace gamemaps
5  src/map2d-generic.cpp
@@ -24,11 +24,12 @@
24 24
 namespace camoto {
25 25
 namespace gamemaps {
26 26
 
27  
-GenericMap2D::GenericMap2D(AttributePtrVectorPtr attributes, int caps,
  27
+GenericMap2D::GenericMap2D(AttributePtrVectorPtr attributes,
  28
+	GraphicsFilenamesCallback fnGfxFiles, int caps,
28 29
 	unsigned int viewportWidth, unsigned int viewportHeight, unsigned int width,
29 30
 	unsigned int height, unsigned int tileWidth, unsigned int tileHeight,
30 31
 	LayerPtrVector& layers, PathPtrVectorPtr paths)
31  
-	:	GenericMap(attributes),
  32
+	:	GenericMap(attributes, fnGfxFiles),
32 33
 		caps(caps),
33 34
 		viewportWidth(viewportWidth), viewportHeight(viewportHeight),
34 35
 		width(width), height(height),
7  src/map2d-generic.hpp
@@ -38,6 +38,10 @@ class GenericMap2D: virtual public Map2D, virtual public GenericMap
38 38
 		 * @param attributes
39 39
 		 *   List of attributes that apply to this map.
40 40
 		 *
  41
+		 * @param fnGfxFiles
  42
+		 *   Callback to retrieve the list of graphics files needed to render this
  43
+		 *   map.
  44
+		 *
41 45
 		 * @param caps
42 46
 		 *   Map capabilities.  One or more Caps values OR'd together.
43 47
 		 *
@@ -88,7 +92,8 @@ class GenericMap2D: virtual public Map2D, virtual public GenericMap
88 92
 		 *   map size in pixels, then divided by the layer's different tile size to
89 93
 		 *   reveal the dimensions of the layer in a number of tiles.
90 94
 		 */
91  
-		GenericMap2D(AttributePtrVectorPtr attributes, int caps,
  95
+		GenericMap2D(AttributePtrVectorPtr attributes,
  96
+			GraphicsFilenamesCallback fnGfxFiles, int caps,
92 97
 			unsigned int viewportWidth, unsigned int viewportHeight,
93 98
 			unsigned int width, unsigned int height, unsigned int tileWidth,
94 99
 			unsigned int tileHeight, LayerPtrVector& layers, PathPtrVectorPtr paths);

0 notes on commit d94710c

Please sign in to comment.
Something went wrong with that request. Please try again.