Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query f_{modified,ruleset,version} if matchtag is set #386

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/match.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@
float f1;
qbool is_real_match_end = !isHoonyModeAny() || HM_is_game_over();
qbool f_modified_done = false, f_ruleset_done = false, f_version_done = false;
char *matchtag = ezinfokey(world, "matchtag");
qbool has_matchtag = matchtag != NULL && matchtag[0];

if (match_over || !match_in_progress)
{
Expand Down Expand Up @@ -401,17 +403,17 @@
{
p->ready = 0; // force players be not ready after match is end.

if (cvar("k_on_end_f_modified") && !f_modified_done)
if (has_matchtag && cvar("k_on_end_f_modified") && !f_modified_done)
{
stuffcmd(p, "say f_modified\n");
f_modified_done = true;
}
if (cvar("k_on_end_f_ruleset") && !f_ruleset_done)
if (has_matchtag && cvar("k_on_end_f_ruleset") && !f_ruleset_done)
{
stuffcmd(p, "say f_ruleset\n");
f_ruleset_done = true;
}
if (cvar("k_on_end_f_version") && !f_version_done)
if (has_matchtag && cvar("k_on_end_f_version") && !f_version_done)
{
stuffcmd(p, "say f_version\n");
f_version_done = true;
Expand Down Expand Up @@ -1563,7 +1565,7 @@
if (hm_timelimit)
{
int minutes = hm_timelimit / 60;
int seconds = hm_timelimit % 60;

Check warning on line 1568 in src/match.c

View workflow job for this annotation

GitHub Actions / verify-msvc

declaration of 'seconds' hides function parameter [D:\a\ktx\ktx\builddir\qwprogs.vcxproj]

if (minutes == 0)
{
Expand Down Expand Up @@ -2634,6 +2636,8 @@
{
gedict_t *p;
float nready;
char *matchtag = ezinfokey(world, "matchtag");
qbool has_matchtag = matchtag != NULL && matchtag[0];

if (isRACE() && !race_match_mode())
{
Expand Down Expand Up @@ -2817,17 +2821,17 @@
G_bprint(2, "All players ready\n");
}

if (cvar("k_on_start_f_modified"))
if (has_matchtag && cvar("k_on_start_f_modified"))
{
stuffcmd(self, "say f_modified\n");
}

if (cvar("k_on_start_f_ruleset"))
if (has_matchtag && cvar("k_on_start_f_ruleset"))
{
stuffcmd(self, "say f_ruleset\n");
}

if (cvar("k_on_start_f_version"))
if (has_matchtag && cvar("k_on_start_f_version"))
{
stuffcmd(self, "say f_version\n");
}
Expand Down
Loading