void undoAction(AbstractAction::EnvType env) { int index = env->getCountryIndex(); Country* country = (*env->getCountries())[index]; country->setColor(Country::GREY); env->setCountryIndex(env->getCountryIndex() - 1); }
bool doAction(AbstractAction::EnvType env) { int index = env->getCountryIndex(); Country* country = (*env->getCountries())[index]; int size = (*country->getAdjacents()).size(); for (int i = 0; i < size; i++) { if ((*country->getAdjacents())[i]->getColor() == color) return false; } country->setColor(color); env->setCountryIndex(env->getCountryIndex() + 1); }