33 const std::vector<Figure>& figures) {
34 const auto theirs = factions_.find(faction_);
35 if (!npc_ || theirs == factions_.end()) {
38 const auto you = std::ranges::find_if(figures, &
Figure::you);
40 factions_.find(you != figures.end() ? you->faction : uint32_t{0});
41 const char* faction =
NameOf(theirs->second);
42 const ImVec2 display = ImGui::GetIO().DisplaySize;
43 ImGui::SetNextWindowPos({display.x / 2, display.y * 0.7f},
44 ImGuiCond_Appearing, {0.5f, 0.5f});
45 ImGui::SetNextWindowSize({
Ui(380.0f), 0.0f});
48 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings);
50 const Color color = GetColor(theirs->second.color());
51 ImGui::PushFont(
GetFonts().title, 22.0f);
53 ImGui::ColorConvertU32ToFloat4(IM_COL32(color.r, color.g, color.b, 255)),
57 std::optional<uint32_t> sworn;
58 if (yours != factions_.end()) {
60 ImGui::TextWrapped(
"%s", absl::Substitute(
Tr(
"You're sworn to $0 already."),
63 }
else if (!asking_) {
66 absl::Substitute(
Tr(
"Swear to $0, and its colour goes by your name, "
67 "for everyone to see."),
70 if (
GameButton(
"Enlist", {-1.0f, 0.0f},
true)) {
75 "%s", absl::Substitute(
Tr(
"It's for good: there's no leaving $0, nor "
76 "swearing to another."),
void Open(uint32_t npc, std::string name, uint32_t faction)
The herald, by the NPC's id, and their faction, by its id.