summaryrefslogtreecommitdiff
path: root/src/resources/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-12-22 02:03:59 +0300
committerAndrei Karas <akaras@inbox.ru>2017-12-22 02:03:59 +0300
commit5133814218de74d57c7febadf61b3ab05216dc25 (patch)
tree60b88270c9a50ef333fefed38c805baab00429a1 /src/resources/map
parentcc7a39f467a49b2e91717739cb6e7c3c4b34a245 (diff)
downloadmv-5133814218de74d57c7febadf61b3ab05216dc25.tar.gz
mv-5133814218de74d57c7febadf61b3ab05216dc25.tar.bz2
mv-5133814218de74d57c7febadf61b3ab05216dc25.tar.xz
mv-5133814218de74d57c7febadf61b3ab05216dc25.zip
Remove default parameters from properties.h
Diffstat (limited to 'src/resources/map')
-rw-r--r--src/resources/map/map.cpp44
-rw-r--r--src/resources/map/properties.h6
2 files changed, 25 insertions, 25 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index 39365643d..56483486f 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -244,23 +244,23 @@ void Map::initializeAmbientLayers() restrict2
}
Image *restrict const img = Loader::getImage(
- getProperty(name + "image"));
+ getProperty(name + "image", std::string()));
if (img != nullptr)
{
- int mask = atoi(getProperty(name + "mask").c_str());
+ int mask = atoi(getProperty(name + "mask", std::string()).c_str());
if (mask == 0)
mask = 1;
- const float parallax = getFloatProperty(name + "parallax");
+ const float parallax = getFloatProperty(name + "parallax", 0.0F);
mForegrounds.push_back(new AmbientLayer(
name,
img,
getFloatProperty(name + "parallaxX", parallax),
getFloatProperty(name + "parallaxY", parallax),
- getFloatProperty(name + "posX"),
- getFloatProperty(name + "posY"),
- getFloatProperty(name + "scrollX"),
- getFloatProperty(name + "scrollY"),
- getBoolProperty(name + "keepratio"),
+ getFloatProperty(name + "posX", 0.0F),
+ getFloatProperty(name + "posY", 0.0F),
+ getFloatProperty(name + "scrollX", 0.0F),
+ getFloatProperty(name + "scrollY", 0.0F),
+ getBoolProperty(name + "keepratio", false),
mask));
// The AmbientLayer takes control over the image.
@@ -274,25 +274,25 @@ void Map::initializeAmbientLayers() restrict2
{
const std::string name("background" + toString(i));
Image *restrict const img = Loader::getImage(
- getProperty(name + "image"));
+ getProperty(name + "image", std::string()));
if (img != nullptr)
{
- int mask = atoi(getProperty(name + "mask").c_str());
+ int mask = atoi(getProperty(name + "mask", std::string()).c_str());
if (mask == 0)
mask = 1;
- const float parallax = getFloatProperty(name + "parallax");
+ const float parallax = getFloatProperty(name + "parallax", 0.0F);
mBackgrounds.push_back(new AmbientLayer(
name,
img,
getFloatProperty(name + "parallaxX", parallax),
getFloatProperty(name + "parallaxY", parallax),
- getFloatProperty(name + "posX"),
- getFloatProperty(name + "posY"),
- getFloatProperty(name + "scrollX"),
- getFloatProperty(name + "scrollY"),
- getBoolProperty(name + "keepratio"),
+ getFloatProperty(name + "posX", 0.0F),
+ getFloatProperty(name + "posY", 0.0F),
+ getFloatProperty(name + "scrollX", 0.0F),
+ getFloatProperty(name + "scrollY", 0.0F),
+ getBoolProperty(name + "keepratio", false),
mask));
// The AmbientLayer takes control over the image.
@@ -822,27 +822,27 @@ void Map::removeActor(const Actors::iterator &restrict iterator) restrict2
const std::string Map::getMusicFile() const restrict2
{
- return getProperty("music");
+ return getProperty("music", std::string());
}
const std::string Map::getName() const restrict2
{
if (hasProperty("name"))
- return getProperty("name");
+ return getProperty("name", std::string());
- return getProperty("mapname");
+ return getProperty("mapname", std::string());
}
const std::string Map::getFilename() const restrict2
{
- const std::string fileName = getProperty("_filename");
+ const std::string fileName = getProperty("_filename", std::string());
const size_t lastSlash = fileName.rfind('/') + 1;
return fileName.substr(lastSlash, fileName.rfind('.') - lastSlash);
}
const std::string Map::getGatName() const restrict2
{
- const std::string fileName = getProperty("_filename");
+ const std::string fileName = getProperty("_filename", std::string());
const size_t lastSlash = fileName.rfind('/') + 1;
return fileName.substr(lastSlash,
fileName.rfind('.') - lastSlash).append(".gat");
@@ -1258,7 +1258,7 @@ void Map::saveExtraLayer() const restrict2
std::string Map::getUserMapDirectory() const restrict2
{
return pathJoin(settings.serverConfigDir,
- getProperty("_realfilename"));
+ getProperty("_realfilename", std::string()));
}
void Map::addRange(const std::string &restrict name,
diff --git a/src/resources/map/properties.h b/src/resources/map/properties.h
index 31d8cfe77..cf05da560 100644
--- a/src/resources/map/properties.h
+++ b/src/resources/map/properties.h
@@ -56,7 +56,7 @@ class Properties notfinal
* doesn't exist.
*/
const std::string getProperty(const std::string &name,
- const std::string &def = "")
+ const std::string &def)
const A_WARN_UNUSED
{
const PropertyMap::const_iterator i = mProperties.find(name);
@@ -72,7 +72,7 @@ class Properties notfinal
* doesn't exist.
*/
float getFloatProperty(const std::string &name,
- const float def = 0.0F) const A_WARN_UNUSED
+ const float def) const A_WARN_UNUSED
{
const PropertyMap::const_iterator i = mProperties.find(name);
float ret = def;
@@ -94,7 +94,7 @@ class Properties notfinal
* doesn't exist.
*/
bool getBoolProperty(const std::string &name,
- const bool def = false) const A_WARN_UNUSED
+ const bool def) const A_WARN_UNUSED
{
const PropertyMap::const_iterator i = mProperties.find(name);
bool ret = def;