Skip to content

Commit

Permalink
Query f_{modified,ruleset,version} if matchtag is set
Browse files Browse the repository at this point in the history
  • Loading branch information
osm committed Jan 15, 2025
1 parent ff05d75 commit bd5890a
Showing 1 changed file with 10 additions and 6 deletions.
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 @@ void EndMatch(float skip_log)
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 @@ void EndMatch(float skip_log)
{
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 @@ -2634,6 +2636,8 @@ void PlayerReady(qbool startIdlebot)
{
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 @@ void PlayerReady(qbool startIdlebot)
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

0 comments on commit bd5890a

Please sign in to comment.