title: Code will not work without CCLOG in Cocos2D
body: <p>I'm currently working on a game that will randomly generate a dungeon for the player. This is made up of a whole heap of different methods being called from different files. I seem to have the code working to be able to calculate how much space is available on the other side of the door.</p>
  
  <p>There is a catch however; the code only seems to work when I am outputting to the console using CCLOG. I wrote a good chunk of the code without testing and decided to then work through it in steps to see how the code worked (I figured I would just get it to run without bugs and next I will check my values).</p>
  
  <p>After I had established that the code was successfully checking available space in each direction, while listing the locations it had checked, I decided that I would like to remove the CCLOG output. Unfortunately though, doing this caused the code to stop working.</p>
  
  <pre><code>//First check "forward"
  bottom = CGPointMake(startLocation.x + forwardDirectionModifier.x, startLocation.y + forwardDirectionModifier.y);
  
  top = bottom;
  
  do
  {
      currentLocation = CGPointMake(top.x + forwardDirectionModifier.x, top.y + forwardDirectionModifier.y);
      tileType = [tileCache getTileType:currentLocation];
      if (tileType == TileTypeFiller)
      {
          top = currentLocation;
          CCLOG(@"Top location is %@", NSStringFromCGPoint(top));
      }
  
  } while (tileType == TileTypeFiller || top.y != 63);
  </code></pre>
  
  <p>This is a small snippet from the code; It is the section of code I think is most likely the issue. Essentially the problem is that if I comment out or delete the line <code>CCLOG(@"Top location is %@", NSStringFromCGPoint(top));</code> it will stop working.</p>
  
  <p>Here are some more details:</p>
  
  <ul>
  <li>I have several little chunks of code like this, as long as I CCLOG in each one, it will be able to move to the next. If i were to comment out any of them, it would stop progress to the next chunk.</li>
  <li>I can change the CCLOG to output anything and it will still work, it just has to be there.</li>
  <li>I have tried cleaning the project.</li>
  <li>There are more CCLOG's that aren't used inside any loops and they can be removed without consequence.</li>
  </ul>
  
  <p>Does anyone have a solution to this? As far as I can tell, whether I do or do not output something to the console,it shouldn't have an effect on whether or not the code will execute.</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>EDIT:</strong> At Ben Trengrove's suggestion, I am adding in further examples of where the CCLOG is being used.</p>
  
  <p>This code immediately follows the previously listed code.</p>
  
  <pre><code>//Check left relative to door
  farLeft = CGPointMake(startLocation.x + leftDirectionModifier.x, startLocation.y + leftDirectionModifier.y);
  
  do
  {
      currentLocation = CGPointMake(farLeft.x + leftDirectionModifier.x, farLeft.y + leftDirectionModifier.y);
      tileType = [tileCache getTileType:currentLocation];
      if (tileType == TileTypeFiller)
      {
          farLeft = currentLocation;
          CCLOG(@"Far Left location is %@", NSStringFromCGPoint(farLeft));
      }
  
  } while (tileType == TileTypeFiller || farLeft.x !=0);
  
  //Check forwards from far left
  top2 = farLeft;
  
  do
  {
      currentLocation = CGPointMake(top2.x + forwardDirectionModifier.x, top2.y + forwardDirectionModifier.y);
      tileType = [tileCache getTileType:currentLocation];
      if (tileType == TileTypeFiller)
      {
          top2 = currentLocation;
          CCLOG(@"Top2 location is %@", NSStringFromCGPoint(top2));
      }
  
  } while ((tileType == TileTypeFiller)|| (top2.y != 63));
  </code></pre>