-
-
Save SamuXarick/57b79067c5635d894c02f5aebc0fe5bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case WID_SCRL_LIST: { | |
/* Draw a list of all available Scripts. */ | |
Rect tr = r.Shrink(WidgetDimensions::scaled.matrix); | |
Dimension rai = GetSpriteSize(SPR_AICONFIG_RANDOM); | |
bool rtl = _current_text_dir == TD_RTL; | |
Rect rai_rect = tr.WithWidth(rai.width, rtl); | |
Rect text_rect = tr.Indent(rai.width + WidgetDimensions::scaled.hsep_normal, rtl); | |
/* First AI in the list is hardcoded to random */ | |
if (this->vscroll->IsVisible(0)) { | |
StringID text = STR_AI_CONFIG_RANDOM_AI; | |
if (this->slot == OWNER_DEITY) text = STR_AI_CONFIG_NONE; | |
DrawString(text_rect.left, text_rect.right, tr.top, text, this->selected == -1 ? TC_WHITE : TC_ORANGE); | |
tr.top += this->line_height; | |
} | |
int i = 0; | |
for (const auto &item : *this->info_list) { | |
i++; | |
if (this->vscroll->IsVisible(i)) { | |
SetDParamStr(0, item.second->GetName()); | |
if (this->slot != OWNER_DEITY && static_cast<AIInfo *>(item.second)->UseAsRandomAI()) { | |
DrawSprite(SPR_AICONFIG_RANDOM, PAL_NONE, rai_rect.left, tr.top); | |
} | |
DrawString(text_rect.left, text_rect.right, tr.top, item.second->GetName(), (this->selected == i - 1) ? TC_WHITE : TC_ORANGE); | |
tr.top += this->line_height; | |
} | |
} | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment