Ver Fonte

fix:修复计算移动关卡盘子组合的代码字符串匹配的bug。

wangfengdev há 8 meses atrás
pai
commit
37db0ea0d8
1 ficheiros alterados com 16 adições e 25 exclusões
  1. 16 25
      auto_fill_jewel_v3/LevelGenerate.cpp

+ 16 - 25
auto_fill_jewel_v3/LevelGenerate.cpp

@@ -13,8 +13,7 @@
 #include <tuple>
 #include "BoxPositionTool.hpp"
 #include "GridPositionTool.hpp"
-//#include "LevelThumbTool.hpp"
-#include "LevelOutputWriter.hpp"
+#include "LevelThumbTool.hpp"
 
 #define MOVEID_NO_MOVE 0
 #define MOVEID_1ST_LINE 1
@@ -31,13 +30,9 @@ void LevelGenerate::generateAll(FillGlobalConfig::LevelData levelData, string ou
     vector<ContourData::Point> resultPlateCenterPosiArr ;
     generate(levelData, false, nullptr , resultPlateFRs, resultPlateCenterPosiArr) ;
     //输出结果
-//    string pngName0 = outname + "_000000.png" ;
-//    LevelThumbTool ltt ;
-//    ltt.makeThumb3(pngName0, resultPlateFRs, resultPlateCenterPosiArr) ;
-    
-    string jsonName = outname + "_000000.json" ;
-    LevelOutputWriter out ;
-    out.writeLevelJson(resultPlateFRs, resultPlateCenterPosiArr, jsonName) ;
+    string pngName0 = outname + "_000000.png" ;
+    LevelThumbTool ltt ;
+    ltt.makeThumb3(pngName0, resultPlateFRs, resultPlateCenterPosiArr) ;
     
     //对于所有移动的配置
     vector<FillGlobalConfig::MultiMoveConfig> mmcArr = fgc->getAllMoveConfigByJewels(levelData) ;
@@ -51,13 +46,9 @@ void LevelGenerate::generateAll(FillGlobalConfig::LevelData levelData, string ou
         vector<ContourData::Point> resultPlateCenterPosiArr1 ;
         generate(levelData, true, &mmcArr[im]  , resultPlateFRs1, resultPlateCenterPosiArr1) ;
         //输出结果
-//        string pngName1 = outname + "_" + moveName;
-//        pngName1 += ".png" ;
-//        ltt.makeThumb3(pngName1, resultPlateFRs1, resultPlateCenterPosiArr1) ;
-        
-        string jsonName1 = outname + "_" + moveName + ".json" ;
-        LevelOutputWriter out1 ;
-        out1.writeLevelJson(resultPlateFRs1, resultPlateCenterPosiArr1, jsonName1) ;
+        string pngName1 = outname + "_" + moveName;
+        pngName1 += ".png" ;
+        ltt.makeThumb3(pngName1, resultPlateFRs1, resultPlateCenterPosiArr1) ;
     }
     
     
@@ -774,34 +765,34 @@ void LevelGenerate::computePlateCount(const FillGlobalConfig::MultiMoveConfig* m
         retMidPlateCnt = 0 ;
     }else
     if( mmc->_first && mmc->_second ) {
-        if( mmc->_first->_type.find("A") != string::npos &&  mmc->_second->_type.compare("A") != string::npos ) {
+        if( mmc->_first->_type.find("A") != string::npos &&  mmc->_second->_type.find("A") != string::npos ) {
             retBigPlateCnt = 6 ;
             retMidPlateCnt = 8 ;
-        }else if( mmc->_first->_type.compare("B") != string::npos &&  mmc->_second->_type.compare("B") != string::npos ) {
+        }else if( mmc->_first->_type.find("B") != string::npos &&  mmc->_second->_type.find("B") != string::npos ) {
             retBigPlateCnt = 9 ;
             retMidPlateCnt = 0 ;
-        }else if( mmc->_first->_type.compare("C") != string::npos &&  mmc->_second->_type.compare("C") != string::npos ) {
+        }else if( mmc->_first->_type.find("C") != string::npos &&  mmc->_second->_type.find("C") != string::npos ) {
             retBigPlateCnt = 11 ;
             retMidPlateCnt = 0 ;
-        }else if( mmc->_first->_type.compare("B") != string::npos &&  mmc->_second->_type.compare("A") != string::npos) {
+        }else if( mmc->_first->_type.find("B") != string::npos &&  mmc->_second->_type.find("A") != string::npos) {
             retBigPlateCnt = 6 ;
             retMidPlateCnt = 7 ;
-        }else if( mmc->_first->_type.compare("C") != string::npos &&  mmc->_second->_type.compare("B") != string::npos ) {
+        }else if( mmc->_first->_type.find("C") != string::npos &&  mmc->_second->_type.find("B") != string::npos ) {
             retBigPlateCnt = 10 ;
             retMidPlateCnt = 0 ;
-        }else if( mmc->_first->_type.compare("C") != string::npos &&  mmc->_second->_type.compare("A") != string::npos ) {
+        }else if( mmc->_first->_type.find("C") != string::npos &&  mmc->_second->_type.find("A") != string::npos ) {
             retBigPlateCnt = 7 ;
             retMidPlateCnt = 7 ;
         }
         
     }else if( mmc->_first && mmc->_second==nullptr ) {
-        if( mmc->_first->_type.compare("A") != string::npos  ) {
+        if( mmc->_first->_type.find("A") != string::npos  ) {
             retBigPlateCnt = 6 ;
             retMidPlateCnt = 7 ;
-        }else if( mmc->_first->_type.compare("B") != string::npos ) {
+        }else if( mmc->_first->_type.find("B") != string::npos ) {
             retBigPlateCnt = 9 ;
             retMidPlateCnt = 0 ;
-        }else if( mmc->_first->_type.compare("C") != string::npos ) {
+        }else if( mmc->_first->_type.find("C") != string::npos ) {
             retBigPlateCnt = 10 ;
             retMidPlateCnt = 0 ;
         }