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

Mapvote time next #128

Merged
merged 9 commits into from
Jul 31, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions TNG-manual.txt
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ Features

Commands:
mapvote_next [0/1] - Default on (1), set to 0 to disable this feature.
mapvote_next_limit [#] - Default (0, disabled), how many seconds remaining in a map (via timelimit)
to restrict the use of votemap, so last second voters can't change the next map. Enforced on mapvote_next=1.

* Empty Rotate
Prevent unpopular maps from keeping your server empty. This feature will rotate the map after the server
Expand Down
4 changes: 4 additions & 0 deletions change.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Changes in TNG 2.82
- = bug fix
* = major bug fix

From 2.82
+ mapvote_next_limit: Value in seconds, restricts players from voting for a map at the very end of the match while still enabling mapvote_next features


From 2.81
* 3team mode: third team can not be locked forever anymore
- Player can not flood sounds through menu
Expand Down
19 changes: 15 additions & 4 deletions source/a_vote.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,23 @@ static void Votemap(edict_t *ent, const char *mapname)
{
char *oldvote;
int voteWaitTime;
int gametime = 0;
int remaining = 0;

gametime = level.matchTime;
remaining = (timelimit->value * 60) - gametime;

if (!use_mapvote->value) {
gi.cprintf(ent, PRINT_HIGH, "Map voting is disabled.\n");
return;
}

// If timelimit is set and if mapvote_next is set, and the remaining time is less than the mapvote_next_limit, do not allow the mapvote
if (timelimit->value && mapvote_next->value && remaining < mapvote_next_limit->value){
gi.cprintf(ent, PRINT_HIGH, "It is too late to vote for the next map.\n");
return;
}

if (!*mapname) {
MapVoteMenu( ent, NULL );
return;
Expand Down Expand Up @@ -667,8 +678,8 @@ void AddMapToMenu (edict_t * ent, int fromix)
spc[i--] = '\0';
while (i >= 0)
spc[i--] = ' ';
//+ Marker: Hier einbauen, da� die gew�hlte Karte markiert ist
// problem: '*' am anfang wird nicht ber�cksichtigt. - erledigt -
//+ Marker: Hier einbauen, daß die gewählte Karte markiert ist
// problem: '*' am anfang wird nicht berücksichtigt. - erledigt -
//alt: sprintf(buffer, "%s%s%.1f%%", search->mapname, spc, prozent);
sprintf (buffer, "%s%s%s%.1f%%",
ent->client->resp.mapvote == search->mapname ? "*" : "",
Expand Down Expand Up @@ -1061,7 +1072,7 @@ void _AddKickuserToMenu (edict_t * ent, int fromix)

if (other != ent)
{
//+ Marker: Hier gew�hlten markieren - erledigt -
//+ Marker: Hier gewählten markieren - erledigt -
sprintf (buf, "%s%2i: %s%s",
other == ent->client->resp.kickvote ? "*" : "", i,
other->client->pers.netname,
Expand Down Expand Up @@ -1945,7 +1956,7 @@ void _AddIgnoreuserToMenu (edict_t * ent, int fromix)
{
if (other->inuse && other != ent)
{
//+ Marker: Hier gew�hlten markieren - erledigt -
//+ Marker: Hier gewählten markieren - erledigt -
sprintf (buf, "%s%2i: %s", IsInIgnoreList (ent, other) ? "*" : "",
i, other->client->pers.netname);
erg = xMenu_Add (ent, buf, _IgnoreSelected);
Expand Down
1 change: 1 addition & 0 deletions source/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,7 @@ extern cvar_t *medkit_instant;
extern cvar_t *e_enhancedSlippers;

extern cvar_t *sv_limp_highping;
extern cvar_t *mapvote_next_limit;

#define world (&g_edicts[0])

Expand Down
1 change: 1 addition & 0 deletions source/g_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ cvar_t *jump; // jumping mod
cvar_t *e_enhancedSlippers;

cvar_t *sv_limp_highping;
cvar_t *mapvote_next_limit;

void SpawnEntities (char *mapname, char *entities, char *spawnpoint);
void ClientThink (edict_t * ent, usercmd_t * cmd);
Expand Down
1 change: 1 addition & 0 deletions source/g_save.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ void InitGame( void )
sv_antilag = gi.cvar("sv_antilag", "0", CVAR_SERVERINFO);
sv_antilag_interp = gi.cvar("sv_antilag_interp", "0", CVAR_SERVERINFO);
sv_limp_highping = gi.cvar("sv_limp_highping", "70", CVAR_SERVERINFO);
mapvote_next_limit = gi.cvar( "mapvote_next_limit", "0", 0);

// items
InitItems();
Expand Down