Advertisement
Guest User

try-catch to handle bounds error

a guest
Aug 3rd, 2017
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1.         try{ //we use try-catch so we don't have to worry about bounds errors...
  2.             if(x1-1 == x2 && y1 == y2){ //means we found target!
  3.                 node = {x1-1, y1, node[2]+1};
  4.                 search_q.push_back(node);
  5.                 findingTarget = false;
  6.                 break;
  7.             }
  8.             if(!isIntIn(map[y1][x1-1], blocked)){//if index is *not* in blocked list
  9.                 //we also gotta make sure node isn't in queue with lower distance already...
  10.                
  11.                
  12.             }
  13.         }catch(...){
  14.             k = k; //do nothing pretty much
  15.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement