fork download
  1. auto& instance = _glo->Instance();
  2. auto& grow_timers = instance->getGrowingTimers();
  3. if (instance->isDebug()) {
  4. Utils::LogTextWithInt("growing timers size: ", _glo->Instance()->getGrowingTimers().size());
  5. for(auto& grow_timer : grow_timers)
  6. std::cout << "growing timer Field id and plant id: " << grow_timer.getFieldID() << " - " << grow_timer.getPlantID() << std::endl;
  7. }
  8. auto& fields = instance->getFields();
  9. for (auto _gtIterB=grow_timers.begin(); _gtIterB!=grow_timers.end();) {
  10. //find the right field
  11. auto _fIterB=fields.begin();
  12. for(; _fIterB!=fields.end(); ++field) {
  13. if (_fIterB->getFieldID() == _gtIterB->getFieldNumber())
  14. break;
  15. }
  16. if (_fIterB==fields.end()) {
  17. ++_gtIterB
  18. continue; //field not found, next timer
  19. }
  20. //find the right plant
  21. auto& plants = _fIterB->getPlants();
  22. auto _pIterB=plants.begin();
  23. for(; _pIterB!=plants.end(); ++_pIterB) {
  24. if (_gtIterB->getPlantID() == _pIterB->getPlantID())
  25. break;
  26. }
  27. if (_pIterB==plants.end()) {
  28. ++_gtIterB
  29. continue; //plant not found, abort
  30. }
  31. //log it
  32. Utils::LogText("gt and plant ID's match");
  33. Utils::LogTextWithInt("Plant ID after matching: ", plant.getPlantID());
  34. // Wiggle our plant.
  35. Utils::wiggleNode(_pIterB->getPlantSprite(), 10.0f, 5.0f);
  36. _pIterB.setPlantStoppedGrowing(true);
  37. //erase the timer
  38. _gtIterB = grow_timers.erase(_gtIterB);
  39. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:18: error: ‘_glo’ was not declared in this scope
 auto& instance = _glo->Instance();
                  ^
prog.cpp:3:1: error: expected unqualified-id before ‘if’
 if (instance->isDebug()) {
 ^
prog.cpp:9:1: error: expected unqualified-id before ‘for’
 for (auto _gtIterB=grow_timers.begin(); _gtIterB!=grow_timers.end();) { 
 ^
prog.cpp:9:41: error: ‘_gtIterB’ does not name a type
 for (auto _gtIterB=grow_timers.begin(); _gtIterB!=grow_timers.end();) { 
                                         ^
prog.cpp:9:69: error: expected unqualified-id before ‘)’ token
 for (auto _gtIterB=grow_timers.begin(); _gtIterB!=grow_timers.end();) { 
                                                                     ^
stdout
Standard output is empty