@@ -114,7 +114,6 @@ namespace MMAP
114114 {
115115 std::vector<std::string> files;
116116 uint32 mapID, tileX, tileY, tileID, count = 0 ;
117- char filter[12 ];
118117
119118 printf (" Discovering maps... " );
120119 getDirContents (files, " maps" );
@@ -148,9 +147,8 @@ namespace MMAP
148147 std::set<uint32>* tiles = (*itr).m_tiles ;
149148 mapID = (*itr).m_mapId ;
150149
151- sprintf (filter, " %03u*.vmtile" , mapID);
152150 files.clear ();
153- getDirContents (files, " vmaps" , filter );
151+ getDirContents (files, " vmaps" , Trinity::StringFormat ( " {:03}*.vmtile " , mapID) );
154152 for (uint32 i = 0 ; i < files.size (); ++i)
155153 {
156154 tileX = uint32 (atoi (files[i].substr (7 ,2 ).c_str ()));
@@ -161,9 +159,8 @@ namespace MMAP
161159 count++;
162160 }
163161
164- sprintf (filter, " %03u*" , mapID);
165162 files.clear ();
166- getDirContents (files, " maps" , filter );
163+ getDirContents (files, " maps" , Trinity::StringFormat ( " {:03}* " , mapID) );
167164 for (uint32 i = 0 ; i < files.size (); ++i)
168165 {
169166 tileY = uint32 (atoi (files[i].substr (3 ,2 ).c_str ()));
@@ -597,9 +594,8 @@ namespace MMAP
597594 dtNavMesh* navMesh)
598595 {
599596 // console output
600- char tileString[20 ];
601- sprintf (tileString, " [Map %03i] [%02i,%02i]: " , mapID, tileX, tileY);
602- printf (" %s Building movemap tiles...\n " , tileString);
597+ std::string tileString = Trinity::StringFormat (" [Map {:03}] [{:02},{:02}]]: " , mapID, tileX, tileY);
598+ printf (" %s Building movemap tiles...\n " , tileString.c_str ());
603599
604600 IntermediateValues iv;
605601
@@ -656,7 +652,7 @@ namespace MMAP
656652 tile.solid = rcAllocHeightfield ();
657653 if (!tile.solid || !rcCreateHeightfield (m_rcContext, *tile.solid , tileCfg.width , tileCfg.height , tileCfg.bmin , tileCfg.bmax , tileCfg.cs , tileCfg.ch ))
658654 {
659- printf (" %s Failed building heightfield! \n " , tileString);
655+ printf (" %s Failed building heightfield! \n " , tileString. c_str () );
660656 continue ;
661657 }
662658
@@ -686,54 +682,54 @@ namespace MMAP
686682 tile.chf = rcAllocCompactHeightfield ();
687683 if (!tile.chf || !rcBuildCompactHeightfield (m_rcContext, tileCfg.walkableHeight , tileCfg.walkableClimb , *tile.solid , *tile.chf ))
688684 {
689- printf (" %s Failed compacting heightfield! \n " , tileString);
685+ printf (" %s Failed compacting heightfield! \n " , tileString. c_str () );
690686 continue ;
691687 }
692688
693689 // build polymesh intermediates
694690 if (!rcErodeWalkableArea (m_rcContext, config.walkableRadius , *tile.chf ))
695691 {
696- printf (" %s Failed eroding area! \n " , tileString);
692+ printf (" %s Failed eroding area! \n " , tileString. c_str () );
697693 continue ;
698694 }
699695
700696 if (!rcMedianFilterWalkableArea (m_rcContext, *tile.chf ))
701697 {
702- printf (" %s Failed filtering area! \n " , tileString);
698+ printf (" %s Failed filtering area! \n " , tileString. c_str () );
703699 continue ;
704700 }
705701
706702 if (!rcBuildDistanceField (m_rcContext, *tile.chf ))
707703 {
708- printf (" %s Failed building distance field! \n " , tileString);
704+ printf (" %s Failed building distance field! \n " , tileString. c_str () );
709705 continue ;
710706 }
711707
712708 if (!rcBuildRegions (m_rcContext, *tile.chf , tileCfg.borderSize , tileCfg.minRegionArea , tileCfg.mergeRegionArea ))
713709 {
714- printf (" %s Failed building regions! \n " , tileString);
710+ printf (" %s Failed building regions! \n " , tileString. c_str () );
715711 continue ;
716712 }
717713
718714 tile.cset = rcAllocContourSet ();
719715 if (!tile.cset || !rcBuildContours (m_rcContext, *tile.chf , tileCfg.maxSimplificationError , tileCfg.maxEdgeLen , *tile.cset ))
720716 {
721- printf (" %s Failed building contours! \n " , tileString);
717+ printf (" %s Failed building contours! \n " , tileString. c_str () );
722718 continue ;
723719 }
724720
725721 // build polymesh
726722 tile.pmesh = rcAllocPolyMesh ();
727723 if (!tile.pmesh || !rcBuildPolyMesh (m_rcContext, *tile.cset , tileCfg.maxVertsPerPoly , *tile.pmesh ))
728724 {
729- printf (" %s Failed building polymesh! \n " , tileString);
725+ printf (" %s Failed building polymesh! \n " , tileString. c_str () );
730726 continue ;
731727 }
732728
733729 tile.dmesh = rcAllocPolyMeshDetail ();
734730 if (!tile.dmesh || !rcBuildPolyMeshDetail (m_rcContext, *tile.pmesh , *tile.chf , tileCfg.detailSampleDist , tileCfg.detailSampleMaxError , *tile.dmesh ))
735731 {
736- printf (" %s Failed building polymesh detail! \n " , tileString);
732+ printf (" %s Failed building polymesh detail! \n " , tileString. c_str () );
737733 continue ;
738734 }
739735
@@ -756,7 +752,7 @@ namespace MMAP
756752 iv.polyMesh = rcAllocPolyMesh ();
757753 if (!iv.polyMesh )
758754 {
759- printf (" %s alloc iv.polyMesh FAILED!\n " , tileString);
755+ printf (" %s alloc iv.polyMesh FAILED!\n " , tileString. c_str () );
760756 delete[] pmmerge;
761757 delete[] dmmerge;
762758 delete[] tiles;
@@ -767,7 +763,7 @@ namespace MMAP
767763 iv.polyMeshDetail = rcAllocPolyMeshDetail ();
768764 if (!iv.polyMeshDetail )
769765 {
770- printf (" %s alloc m_dmesh FAILED!\n " , tileString);
766+ printf (" %s alloc m_dmesh FAILED!\n " , tileString. c_str () );
771767 delete[] pmmerge;
772768 delete[] dmmerge;
773769 delete[] tiles;
@@ -838,12 +834,12 @@ namespace MMAP
838834 // so we have a clear error message
839835 if (params.nvp > DT_VERTS_PER_POLYGON)
840836 {
841- printf (" %s Invalid verts-per-polygon value! \n " , tileString);
837+ printf (" %s Invalid verts-per-polygon value! \n " , tileString. c_str () );
842838 break ;
843839 }
844840 if (params.vertCount >= 0xffff )
845841 {
846- printf (" %s Too many vertices! \n " , tileString);
842+ printf (" %s Too many vertices! \n " , tileString. c_str () );
847843 break ;
848844 }
849845 if (!params.vertCount || !params.verts )
@@ -852,37 +848,37 @@ namespace MMAP
852848 // loaded but those models don't span into this tile
853849
854850 // message is an annoyance
855- // printf("%sNo vertices to build tile! \n", tileString);
851+ // printf("%sNo vertices to build tile! \n", tileString.c_str() );
856852 break ;
857853 }
858854 if (!params.polyCount || !params.polys )
859855 {
860856 // we have flat tiles with no actual geometry - don't build those, its useless
861857 // keep in mind that we do output those into debug info
862- printf (" %s No polygons to build on tile! \n " , tileString);
858+ printf (" %s No polygons to build on tile! \n " , tileString. c_str () );
863859 break ;
864860 }
865861 if (!params.detailMeshes || !params.detailVerts || !params.detailTris )
866862 {
867- printf (" %s No detail mesh to build tile! \n " , tileString);
863+ printf (" %s No detail mesh to build tile! \n " , tileString. c_str () );
868864 break ;
869865 }
870866
871- printf (" %s Building navmesh tile...\n " , tileString);
867+ printf (" %s Building navmesh tile...\n " , tileString. c_str () );
872868 if (!dtCreateNavMeshData (¶ms, &navData, &navDataSize))
873869 {
874- printf (" %s Failed building navmesh tile! \n " , tileString);
870+ printf (" %s Failed building navmesh tile! \n " , tileString. c_str () );
875871 break ;
876872 }
877873
878874 dtTileRef tileRef = 0 ;
879- printf (" %s Adding tile to navmesh...\n " , tileString);
875+ printf (" %s Adding tile to navmesh...\n " , tileString. c_str () );
880876 // DT_TILE_FREE_DATA tells detour to unallocate memory when the tile
881877 // is removed via removeTile()
882878 dtStatus dtResult = navMesh->addTile (navData, navDataSize, DT_TILE_FREE_DATA, 0 , &tileRef);
883879 if (!tileRef || dtResult != DT_SUCCESS)
884880 {
885- printf (" %s Failed adding tile to navmesh! \n " , tileString);
881+ printf (" %s Failed adding tile to navmesh! \n " , tileString. c_str () );
886882 break ;
887883 }
888884
@@ -896,7 +892,7 @@ namespace MMAP
896892 break ;
897893 }
898894
899- printf (" %s Writing to file...\n " , tileString);
895+ printf (" %s Writing to file...\n " , tileString. c_str () );
900896
901897 // write header
902898 MmapTileHeader header;
0 commit comments