From 8b5282a0cfc1d9c212c260256a1ab9364aa4adc2 Mon Sep 17 00:00:00 2001 From: natural-law Date: Tue, 12 Jul 2011 14:21:29 +0800 Subject: [PATCH] fixed #603, The test case TMXGIDObjectsTest in TileMapTest not crash any more. --- cocos2dx/tileMap_parallax_nodes/CCTMXXMLParser.cpp | 2 +- tests/tests/TileMapTest/TileMapTest.cpp | 14 +++++++------- tests/tests/TileMapTest/TileMapTest.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cocos2dx/tileMap_parallax_nodes/CCTMXXMLParser.cpp b/cocos2dx/tileMap_parallax_nodes/CCTMXXMLParser.cpp index 510bf591b2..9819fe574f 100644 --- a/cocos2dx/tileMap_parallax_nodes/CCTMXXMLParser.cpp +++ b/cocos2dx/tileMap_parallax_nodes/CCTMXXMLParser.cpp @@ -393,7 +393,7 @@ namespace cocos2d { layerAttribs = pTMXMapInfo->getLayerAttribs(); pTMXMapInfo->setLayerAttribs(layerAttribs | TMXLayerAttribGzip); } else - if (compression == "zip") + if (compression == "zlib") { layerAttribs = pTMXMapInfo->getLayerAttribs(); pTMXMapInfo->setLayerAttribs(layerAttribs | TMXLayerAttribZlib); diff --git a/tests/tests/TileMapTest/TileMapTest.cpp b/tests/tests/TileMapTest/TileMapTest.cpp index b5f08406c4..c4b8ed0526 100644 --- a/tests/tests/TileMapTest/TileMapTest.cpp +++ b/tests/tests/TileMapTest/TileMapTest.cpp @@ -1219,7 +1219,7 @@ CCLayer* createTileMapLayer(int nIndex) case 21: return new TileMapEditTest(); case 22: return new TMXBug987(); case 23: return new TMXBug787(); - case 24: return new TMXGIDObjectTest(); + case 24: return new TMXGIDObjectsTest(); } return NULL; @@ -1389,7 +1389,7 @@ void TileMapTestScene::runThisTest() CCDirector::sharedDirector()->replaceScene(this); } -TMXGIDObjectTest::TMXGIDObjectTest() +TMXGIDObjectsTest::TMXGIDObjectsTest() { CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/test-object-layer.tmx"); addChild(map, -1, kTagTileMap); @@ -1398,14 +1398,14 @@ TMXGIDObjectTest::TMXGIDObjectTest() CCLOG("Contentsize: %f, %f", s.width, s.height); CCLOG("----> Iterating over all the group objets"); - CCTMXObjectGroup *group = map->objectGroupNamed("Object Group 1"); + CCTMXObjectGroup *group = map->objectGroupNamed("Object Layer 1"); } -void TMXGIDObjectTest::draw() +void TMXGIDObjectsTest::draw() { CCTMXTiledMap *map = (CCTMXTiledMap*)getChildByTag(kTagTileMap); - CCTMXObjectGroup *group = map->objectGroupNamed("Object Group 1"); + CCTMXObjectGroup *group = map->objectGroupNamed("Object Layer 1"); CCMutableArray *array = group->getObjects(); CCMutableArray::CCMutableArrayIterator iter; @@ -1439,12 +1439,12 @@ void TMXGIDObjectTest::draw() } } -string TMXGIDObjectTest::title() +string TMXGIDObjectsTest::title() { return "TMX GID objects"; } -string TMXGIDObjectTest::subtitle() +string TMXGIDObjectsTest::subtitle() { return "Tiles are created from an object group"; } diff --git a/tests/tests/TileMapTest/TileMapTest.h b/tests/tests/TileMapTest/TileMapTest.h index 544634e76c..595f8a001a 100644 --- a/tests/tests/TileMapTest/TileMapTest.h +++ b/tests/tests/TileMapTest/TileMapTest.h @@ -248,10 +248,10 @@ public: virtual std::string subtitle(); }; -class TMXGIDObjectTest : public TileDemo +class TMXGIDObjectsTest : public TileDemo { public: - TMXGIDObjectTest(); + TMXGIDObjectsTest(); virtual std::string title(); virtual std::string subtitle(); virtual void draw();