auto& instance = _glo->Instance();
auto& grow_timers = instance->getGrowingTimers();
if (instance->isDebug()) {
Utils::LogTextWithInt("growing timers size: ", _glo->Instance()->getGrowingTimers().size());
for(auto& grow_timer : grow_timers)
std::cout << "growing timer Field id and plant id: " << grow_timer.getFieldID() << " - " << grow_timer.getPlantID() << std::endl;
}
auto& fields = instance->getFields();
for (auto _gtIterB=grow_timers.begin(); _gtIterB!=grow_timers.end();) {
//find the right field
auto _fIterB=fields.begin();
for(; _fIterB!=fields.end(); ++field) {
if (_fIterB->getFieldID() == _gtIterB->getFieldNumber())
break;
}
if (_fIterB==fields.end()) {
++_gtIterB
continue; //field not found, next timer
}
//find the right plant
auto& plants = _fIterB->getPlants();
auto _pIterB=plants.begin();
for(; _pIterB!=plants.end(); ++_pIterB) {
if (_gtIterB->getPlantID() == _pIterB->getPlantID())
break;
}
if (_pIterB==plants.end()) {
++_gtIterB
continue; //plant not found, abort
}
//log it
Utils::LogText("gt and plant ID's match");
Utils::LogTextWithInt("Plant ID after matching: ", plant.getPlantID());
// Wiggle our plant.
Utils::wiggleNode(_pIterB->getPlantSprite(), 10.0f, 5.0f);
_pIterB.setPlantStoppedGrowing(true);
//erase the timer
_gtIterB = grow_timers.erase(_gtIterB);
}