Skip to content

Commit

Permalink
add generic warlist chat commands
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed Jan 3, 2025
1 parent 0f9dfad commit 687b18f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/game/client/components/tclient/bindchat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ void CBindchat::OnConsoleInit()
AddBindDefault(".delwarclan", "remove_war_clan_index 1");
AddBindDefault(".delteam", "remove_war_name_index 2");
AddBindDefault(".delteamclan", "remove_war_clan_index 2");

AddBindDefault(".name", "war_name");
AddBindDefault(".clan", "war_clan");
AddBindDefault(".delname", "remove_war_name");
AddBindDefault(".delclan", "remove_war_clan");

AddBindDefault("!mute", "add_foe");
AddBindDefault("!unmute", "remove_foe");
}
Expand Down
15 changes: 13 additions & 2 deletions src/game/client/components/tclient/menus_tclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ bool CMenus::DoSliderWithScaledValue(const void *pId, int *pOption, const CUIRec
bool CMenus::DoEditBoxWithLabel(CLineInput *LineInput, const CUIRect *pRect, const char *pLabel, const char *pDefault, char *pBuf, size_t BufSize)
{
CUIRect Button, Label;
pRect->VSplitLeft(175.0f, &Label, &Button);
pRect->VSplitLeft(210.0f, &Label, &Button);
Ui()->DoLabel(&Label, pLabel, FontSize, TEXTALIGN_ML);
LineInput->SetBuffer(pBuf, BufSize);
LineInput->SetEmptyText(pDefault);
Expand Down Expand Up @@ -300,7 +300,9 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
Ui()->DoLabel(&Label, Localize("Warlist"), HeadlineFontSize, TEXTALIGN_ML);
Column.HSplitTop(MarginSmall, nullptr, &Column);

static CLineInput s_Warlist1, s_Warlist2, s_Warlist3, s_Warlist4, s_Warlist5, s_Warlist6, s_Warlist7, s_Warlist8;
static CLineInput s_Warlist1, s_Warlist2, s_Warlist3, s_Warlist4, s_Warlist5, s_Warlist6, s_Warlist7, s_Warlist8,
s_Warlist9, s_Warlist10, s_Warlist11, s_Warlist12;

char aBuf[128];
char aGroup1Name[MAX_WARLIST_TYPE_LENGTH]; // enemy by default
char aGroup2Name[MAX_WARLIST_TYPE_LENGTH]; // team by default
Expand Down Expand Up @@ -330,6 +332,15 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
Column.HSplitTop(MarginSmall, nullptr, &Column);
str_format(aBuf, sizeof(aBuf), "Remove %s clan:", aGroup2Name);
DoBindchat(s_Warlist8, aBuf, ".delteamclan", "remove_war_clan_index 2");

Column.HSplitTop(MarginSmall, nullptr, &Column);
DoBindchat(s_Warlist9, "Add [group] [name] [reason]", ".name", "war_name");
Column.HSplitTop(MarginSmall, nullptr, &Column);
DoBindchat(s_Warlist10, "Add [group] [clan] [reason]", ".clan", "war_clan");
Column.HSplitTop(MarginSmall, nullptr, &Column);
DoBindchat(s_Warlist11, "Remove [group] [name]", ".delname", "remove_war_name");
Column.HSplitTop(MarginSmall, nullptr, &Column);
DoBindchat(s_Warlist12, "Remove [group] [clan]", ".delclan", "remove_war_clan");
}

if(s_CurCustomTab == TCLIENT_TAB_BINDWHEEL)
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ struct SCursorAndBoundingBox

static SCursorAndBoundingBox CalcFontSizeCursorHeightAndBoundingBox(ITextRender *pTextRender, const char *pText, int Flags, float &Size, float MaxWidth, const SLabelProperties &LabelProps)
{
const float MinFontSize = 4.0f;
const float MinFontSize = 5.0f;
const float MaxTextWidth = LabelProps.m_MaxWidth != -1.0f ? LabelProps.m_MaxWidth : MaxWidth;
const int FlagsWithoutStop = Flags & ~(TEXTFLAG_STOP_AT_END | TEXTFLAG_ELLIPSIS_AT_END);
const float MaxTextWidthWithoutStop = Flags == FlagsWithoutStop ? LabelProps.m_MaxWidth : -1.0f;
Expand Down

0 comments on commit 687b18f

Please sign in to comment.