Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Supply the map stream to getRequiredSupps() so it can read stored fil…

…enames

This allows map formats which store filenames of their tilesets to correctly
return them as supplementary items.
  • Loading branch information...
commit 8e650e21ba77253b3d36e998cb1f8c39b4457cab 1 parent 62d013c
@Malvineous authored
View
14 examples/gamemap.cpp
@@ -526,12 +526,15 @@ int main(int iArgC, char *cArgV[])
}
if (cert != gm::MapType::DefinitelyNo) {
// We got a possible match, see if it requires any suppdata
- camoto::SuppFilenames suppList = pTestType->getRequiredSupps(strFilename);
+ camoto::SuppFilenames suppList = pTestType->getRequiredSupps(psMap,
+ strFilename);
if (suppList.size() > 0) {
// It has suppdata, see if it's present
std::cout << " * This format requires supplemental files..." << std::endl;
bool bSuppOK = true;
- for (camoto::SuppFilenames::iterator i = suppList.begin(); i != suppList.end(); i++) {
+ for (camoto::SuppFilenames::iterator
+ i = suppList.begin(); i != suppList.end(); i++
+ ) {
try {
stream::file_sptr suppStream(new stream::file());
suppStream->open(i->second);
@@ -585,10 +588,13 @@ int main(int iArgC, char *cArgV[])
}
// See if the format requires any supplemental files
- camoto::SuppFilenames suppList = pMapType->getRequiredSupps(strFilename);
+ camoto::SuppFilenames suppList = pMapType->getRequiredSupps(psMap,
+ strFilename);
camoto::SuppData suppData;
if (suppList.size() > 0) {
- for (camoto::SuppFilenames::iterator i = suppList.begin(); i != suppList.end(); i++) {
+ for (camoto::SuppFilenames::iterator
+ i = suppList.begin(); i != suppList.end(); i++
+ ) {
try {
stream::file_sptr suppStream(new stream::file());
suppStream->open(i->second);
View
5 include/camoto/gamemaps/maptype.hpp
@@ -161,9 +161,8 @@ class MapType
* returned can have relative paths, and may even have an absolute
* path, if one was passed in with filenameMap.
*/
- virtual SuppFilenames getRequiredSupps(const std::string& filenameMap)
- const = 0;
-
+ virtual SuppFilenames getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const = 0;
};
/// Shared pointer to a MapType.
View
6 src/fmt-map-bash.cpp
@@ -427,11 +427,11 @@ void BashMapType::write(MapPtr map, stream::expanding_output_sptr output,
return;
}
-SuppFilenames BashMapType::getRequiredSupps(
- const std::string& filenameMap) const
+SuppFilenames BashMapType::getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const
{
SuppFilenames supps;
- std::string baseName = filenameMap.substr(0, filenameMap.length() - 3);
+ std::string baseName = filename.substr(0, filename.length() - 3);
supps[SuppItem::Layer1] = baseName + "mbg";
supps[SuppItem::Layer2] = baseName + "mfg";
return supps;
View
4 src/fmt-map-bash.hpp
@@ -40,8 +40,8 @@ class BashMapType: virtual public BaseMapType
virtual MapPtr open(stream::input_sptr input, SuppData& suppData) const;
virtual void write(MapPtr map, stream::expanding_output_sptr output,
ExpandingSuppData& suppData) const;
- virtual SuppFilenames getRequiredSupps(const std::string& filenameMap)
- const;
+ virtual SuppFilenames getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const;
};
class BashForegroundLayer: virtual public GenericMap2D::Layer
View
4 src/fmt-map-ccaves.cpp
@@ -219,8 +219,8 @@ void CCavesMapType::write(MapPtr map, stream::expanding_output_sptr output,
return;
}
-SuppFilenames CCavesMapType::getRequiredSupps(const std::string& filenameMap)
- const
+SuppFilenames CCavesMapType::getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const
{
SuppFilenames supps;
return supps;
View
4 src/fmt-map-ccaves.hpp
@@ -40,8 +40,8 @@ class CCavesMapType: virtual public BaseMapType
virtual MapPtr open(stream::input_sptr input, SuppData& suppData) const;
virtual void write(MapPtr map, stream::expanding_output_sptr output,
ExpandingSuppData& suppData) const;
- virtual SuppFilenames getRequiredSupps(const std::string& filenameMap)
- const;
+ virtual SuppFilenames getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const;
};
class CCavesBackgroundLayer: virtual public GenericMap2D::Layer
View
4 src/fmt-map-ccomic.cpp
@@ -205,8 +205,8 @@ void CComicMapType::write(MapPtr map, stream::expanding_output_sptr output,
return;
}
-SuppFilenames CComicMapType::getRequiredSupps(const std::string& filenameMap)
- const
+SuppFilenames CComicMapType::getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const
{
SuppFilenames supps;
return supps;
View
4 src/fmt-map-ccomic.hpp
@@ -40,8 +40,8 @@ class CComicMapType: virtual public BaseMapType
virtual MapPtr open(stream::input_sptr input, SuppData& suppData) const;
virtual void write(MapPtr map, stream::expanding_output_sptr output,
ExpandingSuppData& suppData) const;
- virtual SuppFilenames getRequiredSupps(const std::string& filenameMap)
- const;
+ virtual SuppFilenames getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const;
};
class CComicBackgroundLayer: virtual public GenericMap2D::Layer
View
4 src/fmt-map-cosmo.cpp
@@ -298,8 +298,8 @@ void CosmoMapType::write(MapPtr map, stream::expanding_output_sptr output,
return;
}
-SuppFilenames CosmoMapType::getRequiredSupps(const std::string& filenameMap)
- const
+SuppFilenames CosmoMapType::getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const
{
SuppFilenames supps;
return supps;
View
4 src/fmt-map-cosmo.hpp
@@ -40,8 +40,8 @@ class CosmoMapType: virtual public BaseMapType
virtual MapPtr open(stream::input_sptr input, SuppData& suppData) const;
virtual void write(MapPtr map, stream::expanding_output_sptr output,
ExpandingSuppData& suppData) const;
- virtual SuppFilenames getRequiredSupps(const std::string& filenameMap)
- const;
+ virtual SuppFilenames getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const;
};
class CosmoActorLayer: virtual public GenericMap2D::Layer
View
4 src/fmt-map-ddave.cpp
@@ -265,8 +265,8 @@ void DDaveMapType::write(MapPtr map, stream::expanding_output_sptr output,
return;
}
-SuppFilenames DDaveMapType::getRequiredSupps(const std::string& filenameMap)
- const
+SuppFilenames DDaveMapType::getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const
{
SuppFilenames supps;
return supps;
View
4 src/fmt-map-ddave.hpp
@@ -40,8 +40,8 @@ class DDaveMapType: virtual public BaseMapType
virtual MapPtr open(stream::input_sptr input, SuppData& suppData) const;
virtual void write(MapPtr map, stream::expanding_output_sptr output,
ExpandingSuppData& suppData) const;
- virtual SuppFilenames getRequiredSupps(const std::string& filenameMap)
- const;
+ virtual SuppFilenames getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const;
};
class DDaveBackgroundLayer: virtual public GenericMap2D::Layer
View
4 src/fmt-map-harry.cpp
@@ -460,8 +460,8 @@ void HarryMapType::write(MapPtr map, stream::expanding_output_sptr output,
return;
}
-SuppFilenames HarryMapType::getRequiredSupps(const std::string& filenameMap)
- const
+SuppFilenames HarryMapType::getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const
{
SuppFilenames supps;
return supps;
View
4 src/fmt-map-harry.hpp
@@ -40,8 +40,8 @@ class HarryMapType: virtual public BaseMapType
virtual MapPtr open(stream::input_sptr input, SuppData& suppData) const;
virtual void write(MapPtr map, stream::expanding_output_sptr output,
ExpandingSuppData& suppData) const;
- virtual SuppFilenames getRequiredSupps(const std::string& filenameMap)
- const;
+ virtual SuppFilenames getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const;
};
class HarryActorLayer: virtual public GenericMap2D::Layer
View
4 src/fmt-map-hocus.cpp
@@ -240,8 +240,8 @@ void HocusMapType::write(MapPtr map, stream::expanding_output_sptr output,
return;
}
-SuppFilenames HocusMapType::getRequiredSupps(const std::string& filenameMap)
- const
+SuppFilenames HocusMapType::getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const
{
SuppFilenames supps;
return supps;
View
4 src/fmt-map-hocus.hpp
@@ -40,8 +40,8 @@ class HocusMapType: virtual public BaseMapType
virtual MapPtr open(stream::input_sptr input, SuppData& suppData) const;
virtual void write(MapPtr map, stream::expanding_output_sptr output,
ExpandingSuppData& suppData) const;
- virtual SuppFilenames getRequiredSupps(const std::string& filenameMap)
- const;
+ virtual SuppFilenames getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const;
};
class HocusBackgroundLayer: virtual public GenericMap2D::Layer
View
6 src/fmt-map-wacky.cpp
@@ -270,11 +270,11 @@ void WackyMapType::write(MapPtr map, stream::expanding_output_sptr output,
return;
}
-SuppFilenames WackyMapType::getRequiredSupps(
- const std::string& filenameMap) const
+SuppFilenames WackyMapType::getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const
{
SuppFilenames supps;
- std::string baseName = filenameMap.substr(0, filenameMap.length() - 1);
+ std::string baseName = filename.substr(0, filename.length() - 1);
supps[SuppItem::Layer1] = baseName + "rd";
return supps;
}
View
4 src/fmt-map-wacky.hpp
@@ -40,8 +40,8 @@ class WackyMapType: virtual public BaseMapType
virtual MapPtr open(stream::input_sptr input, SuppData& suppData) const;
virtual void write(MapPtr map, stream::expanding_output_sptr output,
ExpandingSuppData& suppData) const;
- virtual SuppFilenames getRequiredSupps(const std::string& filenameMap)
- const;
+ virtual SuppFilenames getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const;
};
class WackyBackgroundLayer: virtual public GenericMap2D::Layer
View
8 src/fmt-map-wordresc.cpp
@@ -772,13 +772,13 @@ void WordRescueMapType::write(MapPtr map, stream::expanding_output_sptr output,
return;
}
-SuppFilenames WordRescueMapType::getRequiredSupps(
- const std::string& filenameMap) const
+SuppFilenames WordRescueMapType::getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const
{
SuppFilenames supps;
/// Add wr1.d0 (to wr1.d14) layer file
- std::string baseName = filenameMap.substr(0, filenameMap.find_last_of('.'))
- + ".d" + filenameMap.substr(filenameMap.find_last_of('s') + 1);
+ std::string baseName = filename.substr(0, filename.find_last_of('.'))
+ + ".d" + filename.substr(filename.find_last_of('s') + 1);
supps[SuppItem::Layer1] = baseName;
return supps;
}
View
4 src/fmt-map-wordresc.hpp
@@ -40,8 +40,8 @@ class WordRescueMapType: virtual public BaseMapType
virtual MapPtr open(stream::input_sptr input, SuppData& suppData) const;
virtual void write(MapPtr map, stream::expanding_output_sptr output,
ExpandingSuppData& suppData) const;
- virtual SuppFilenames getRequiredSupps(const std::string& filenameMap)
- const;
+ virtual SuppFilenames getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const;
};
class WordRescueBackgroundLayer: virtual public GenericMap2D::Layer
View
10 src/fmt-map-xargon.cpp
@@ -207,8 +207,8 @@ std::vector<std::string> JillMapType::getGameList() const
return vcGames;
}
-SuppFilenames JillMapType::getRequiredSupps(
- const std::string& filenameMap) const
+SuppFilenames JillMapType::getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const
{
SuppFilenames supps;
supps[SuppItem::Extra1] = "jill.dma";
@@ -252,13 +252,13 @@ std::vector<std::string> XargonMapType::getGameList() const
return vcGames;
}
-SuppFilenames XargonMapType::getRequiredSupps(
- const std::string& filenameMap) const
+SuppFilenames XargonMapType::getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const
{
// Take the extension from the file being opened and use the corresponding
// tiles file, i.e. "blah.xr1" -> "tiles.xr1". There are no ".xr0" levels.
SuppFilenames supps;
- std::string ext = filenameMap.substr(filenameMap.find_last_of('.'));
+ std::string ext = filename.substr(filename.find_last_of('.'));
supps[SuppItem::Extra1] = "tiles" + ext;
return supps;
}
View
8 src/fmt-map-xargon.hpp
@@ -54,8 +54,8 @@ class JillMapType: virtual public SweeneyMapType
virtual std::string getFriendlyName() const;
virtual std::vector<std::string> getFileExtensions() const;
virtual std::vector<std::string> getGameList() const;
- virtual SuppFilenames getRequiredSupps(const std::string& filenameMap)
- const;
+ virtual SuppFilenames getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const;
};
/// Xargon level reader/writer.
@@ -68,8 +68,8 @@ class XargonMapType: virtual public SweeneyMapType
virtual std::string getFriendlyName() const;
virtual std::vector<std::string> getFileExtensions() const;
virtual std::vector<std::string> getGameList() const;
- virtual SuppFilenames getRequiredSupps(const std::string& filenameMap)
- const;
+ virtual SuppFilenames getRequiredSupps(stream::input_sptr input,
+ const std::string& filename) const;
};
Please sign in to comment.
Something went wrong with that request. Please try again.