Loading

Paste #pgvb7po6o

  1.     void OnQueryTextFinished(char* str) override
  2.     {
  3.         /* The user pressed cancel */
  4.         if (str == nullptr) return;
  5.  
  6.         int32 value;
  7.         if (StrEmpty(str)) {
  8.             if (widget == WID_AIC_NUMBER) return;
  9.             switch (GetGameSettings().script.settings_profile) {
  10.                 case SP_EASY:   value = AI::START_DELAY_EASY;   break;
  11.                 case SP_MEDIUM: value = AI::START_DELAY_MEDIUM; break;
  12.                 case SP_HARD:   value = AI::START_DELAY_HARD;   break;
  13.                 case SP_CUSTOM: value = AI::START_DELAY_CUSTOM; break;
  14.                 default: NOT_REACHED();
  15.             }
  16.         } else {
  17.             value = atoi(str);
  18.         }
  19.         IConsoleSetSetting(widget == WID_AIC_NUMBER ? "difficulty.max_no_competitors" : "ai.ai_start_delay", value);
  20.         this->SetDirty();
  21.     }

Comments