Add missing white spaces and some minor cleanups

* Add missing white space
* Fix if-else statement without curly braces
* Fix indentation
* Clean up code
This commit is contained in:
mogemimi 2015-03-11 22:54:22 +09:00
parent abeb269534
commit 279604bac5
1 changed files with 32 additions and 31 deletions

View File

@ -62,6 +62,7 @@ ValueMap& TMXLayerInfo::getProperties()
{
return _properties;
}
void TMXLayerInfo::setProperties(ValueMap var)
{
_properties = var;
@ -142,6 +143,7 @@ void TMXMapInfo::internalInit(const std::string& tmxFileName, const std::string&
_parentElement = TMXPropertyNone;
_currentFirstGID = -1;
}
bool TMXMapInfo::initWithXML(const std::string& tmxString, const std::string& resourcePath)
{
internalInit("", resourcePath);
@ -202,7 +204,6 @@ bool TMXMapInfo::parseXMLFile(const std::string& xmlFilename)
return parser.parse(FileUtils::getInstance()->fullPathForFilename(xmlFilename).c_str());
}
// the XML parser calls here with all the elements
void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
{
@ -227,16 +228,21 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
CCLOG("cocos2d: TMXFormat: Unsupported TMX version: %s", version.c_str());
}
std::string orientationStr = attributeDict["orientation"].asString();
if (orientationStr == "orthogonal")
if (orientationStr == "orthogonal") {
tmxMapInfo->setOrientation(TMXOrientationOrtho);
else if (orientationStr == "isometric")
}
else if (orientationStr == "isometric") {
tmxMapInfo->setOrientation(TMXOrientationIso);
else if(orientationStr == "hexagonal")
}
else if (orientationStr == "hexagonal") {
tmxMapInfo->setOrientation(TMXOrientationHex);
else if(orientationStr == "staggered")
}
else if (orientationStr == "staggered") {
tmxMapInfo->setOrientation(TMXOrientationStaggered);
else
}
else {
CCLOG("cocos2d: TMXFomat: Unsupported orientation: %d", tmxMapInfo->getOrientation());
}
Size s;
s.width = attributeDict["width"].asFloat();
@ -356,7 +362,6 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
// The parent element is now "layer"
tmxMapInfo->setParentElement(TMXPropertyLayer);
}
else if (elementName == "objectgroup")
{
@ -372,7 +377,6 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
// The parent element is now "objectgroup"
tmxMapInfo->setParentElement(TMXPropertyObjectGroup);
}
else if (elementName == "image")
{
@ -428,7 +432,6 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
}
CCASSERT( compression == "" || compression == "gzip" || compression == "zlib", "TMX: unsupported compression method" );
}
}
else if (elementName == "object")
{
@ -470,7 +473,6 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
// The parent element is now "object"
tmxMapInfo->setParentElement(TMXPropertyObject);
}
else if (elementName == "property")
{
@ -669,7 +671,6 @@ void TMXMapInfo::endElement(void *ctx, const char *name)
{
_xmlTileIndex = 0;
}
}
else if (elementName == "map")
{