Esempio n. 1
0
    int VMapManager::loadMap(const char* pBasePath, unsigned int pMapId, int x, int y)
    {
        int result = VMAP_LOAD_RESULT_IGNORED;
        if(isMapLoadingEnabled() && !iIgnoreMapIds.containsKey(pMapId))
        {
            bool loaded = _loadMap(pBasePath, pMapId, x, y, false);
            if(!loaded)
            {
                // if we can't load the map it might be splitted into tiles. Try that one and store the result
                loaded = _loadMap(pBasePath, pMapId, x, y, true);
                if(loaded)
                {
                    iMapsSplitIntoTiles.set(pMapId, true);
                }
            }
            if(loaded)
            {
                result = VMAP_LOAD_RESULT_OK;
                // just for debugging
#ifdef _VMAP_LOG_DEBUG
                Command c = Command();
                c.fillLoadTileCmd(x, y, pMapId);
                iCommandLogger.appendCmd(c);
#endif
            }
            else
            {
                result = VMAP_LOAD_RESULT_ERROR;
            }
        }
        return result;
    }
  void tagKeyCountTest()
  {
    shared_ptr<OsmMap> map = _loadMap();

    shared_ptr<TagKeyCountVisitor> visitor(new TagKeyCountVisitor("source"));
    map->visitRo(*visitor);

    CPPUNIT_ASSERT_EQUAL((long)6, (long)visitor->getStat());
  }
Esempio n. 3
0
Map::Map(RobotInterface *robotInterface, int startingX, int startingY) {
	_robotInterface = robotInterface;
	_score1 = 0;
	_score2 = 0;
	// load the map for the first time from the game server
	_loadMap();
	// we are the robot at this cell
	_claimRobotAt(startingX, startingY);
	_curCell = cells[startingX][startingY];
}
Esempio n. 4
0
 VMAPLoadResult VMapManager2::loadMap(const char* pBasePath, unsigned int pMapId, int x, int y)
 {
     VMAPLoadResult result = VMAP_LOAD_RESULT_IGNORED;
     if (isMapLoadingEnabled())
     {
         if (_loadMap(pMapId, pBasePath, x, y))
             result = VMAP_LOAD_RESULT_OK;
         else
             result = VMAP_LOAD_RESULT_ERROR;
     }
     return result;
 }
  void tagRenameKeyTest()
  {
    OsmMapPtr map = _loadMap();

    TagRenameKeyVisitor visitor("source", "source_modified");
    map->visitRw(visitor);

    boost::shared_ptr<TagKeyCountVisitor> keyCountVisitor1(new TagKeyCountVisitor("source"));
    map->visitRo(*keyCountVisitor1);
    CPPUNIT_ASSERT_EQUAL((long)0, (long)keyCountVisitor1->getStat());

    boost::shared_ptr<TagKeyCountVisitor> keyCountVisitor2(new TagKeyCountVisitor("source_modified"));
    map->visitRo(*keyCountVisitor2);
    CPPUNIT_ASSERT_EQUAL((long)6, (long)keyCountVisitor2->getStat());
  }