]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Lyberta/TeamplayOverhaul2
authorLyberta <lyberta@lyberta.net>
Fri, 17 Aug 2018 22:36:10 +0000 (01:36 +0300)
committerLyberta <lyberta@lyberta.net>
Fri, 17 Aug 2018 22:36:10 +0000 (01:36 +0300)
1  2 
qcsrc/server/command/cmd.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/defs.qh

index 30abb6848794221e08a675dc7b2cc251facd306d,443aac085d3f652872b9f7b5135bb8d16b9f6ef0..ed1024df52fac0faac030bcbd4fcd58a15e750d7
@@@ -72,7 -72,7 +72,7 @@@ bool SV_ParseClientCommand_floodcheck(e
  //  Command Sub-Functions
  // =======================
  
- void ClientCommand_autoswitch(entity caller, float request, float argc)
+ void ClientCommand_autoswitch(entity caller, int request, int argc)
  {
        switch (request)
        {
@@@ -97,7 -97,7 +97,7 @@@
        }
  }
  
- void ClientCommand_clientversion(entity caller, float request, float argc)  // internal command, used only by code
+ void ClientCommand_clientversion(entity caller, int request, int argc)  // internal command, used only by code
  {
        switch (request)
        {
                                        {
                                                // JoinBestTeam(caller, false, true);
                                        }
 -                                      else if (teamplay && !autocvar_sv_spectate && !(caller.team_forced > 0))
 +                                      else if (teamplay && !autocvar_sv_spectate && !(Player_GetForcedTeamIndex(caller) > 0))
                                        {
                                                TRANSMUTE(Observer, caller);  // really?
                                                stuffcmd(caller, "menu_showteamselect\n");
        }
  }
  
- void ClientCommand_mv_getpicture(entity caller, float request, float argc)  // internal command, used only by code
+ void ClientCommand_mv_getpicture(entity caller, int request, int argc)  // internal command, used only by code
  {
        switch (request)
        {
        }
  }
  
- void ClientCommand_join(entity caller, float request)
+ void ClientCommand_join(entity caller, int request)
  {
        switch (request)
        {
        }
  }
  
- void ClientCommand_physics(entity caller, float request, float argc)
+ void ClientCommand_physics(entity caller, int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void ClientCommand_ready(entity caller, float request)  // todo: anti-spam for toggling readyness
+ void ClientCommand_ready(entity caller, int request)  // todo: anti-spam for toggling readyness
  {
        switch (request)
        {
        }
  }
  
- void ClientCommand_say(entity caller, float request, float argc, string command)
+ void ClientCommand_say(entity caller, int request, int argc, string command)
  {
        switch (request)
        {
        }
  }
  
- void ClientCommand_say_team(entity caller, float request, float argc, string command)
+ void ClientCommand_say_team(entity caller, int request, int argc, string command)
  {
        switch (request)
        {
  }
  
  .bool team_selected;
- void ClientCommand_selectteam(entity caller, float request, float argc)
+ void ClientCommand_selectteam(entity caller, int request, int argc)
  {
        switch (request)
        {
                                sprint(caller, "^7selectteam can only be used in teamgames\n");
                                return;
                        }
 -                      if (caller.team_forced > 0)
 +                      if (Player_GetForcedTeamIndex(caller) > 0)
                        {
                                sprint(caller, "^7selectteam can not be used as your team is forced\n");
                                return;
        }
  }
  
- void ClientCommand_selfstuff(entity caller, float request, string command)
+ void ClientCommand_selfstuff(entity caller, int request, string command)
  {
        switch (request)
        {
        }
  }
  
- void ClientCommand_sentcvar(entity caller, float request, float argc, string command)
+ void ClientCommand_sentcvar(entity caller, int request, int argc, string command)
  {
        switch (request)
        {
        }
  }
  
- void ClientCommand_spectate(entity caller, float request)
+ void ClientCommand_spectate(entity caller, int request)
  {
        switch (request)
        {
        }
  }
  
- void ClientCommand_suggestmap(entity caller, float request, float argc)
+ void ClientCommand_suggestmap(entity caller, int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void ClientCommand_tell(entity caller, float request, float argc, string command)
+ void ClientCommand_tell(entity caller, int request, int argc, string command)
  {
        switch (request)
        {
        }
  }
  
- void ClientCommand_voice(entity caller, float request, float argc, string command)
+ void ClientCommand_voice(entity caller, int request, int argc, string command)
  {
        switch (request)
        {
  
  /* use this when creating a new command, making sure to place it in alphabetical order... also,
  ** ADD ALL NEW COMMANDS TO commands.cfg WITH PROPER ALIASES IN THE SAME FASHION!
- void ClientCommand_(entity caller, float request)
+ void ClientCommand_(entity caller, int request)
  {
      switch(request)
      {
  #define CLIENT_COMMANDS(ent, request, arguments, command) \
        CLIENT_COMMAND("autoswitch", ClientCommand_autoswitch(ent, request, arguments), "Whether or not to switch automatically when getting a better weapon") \
        CLIENT_COMMAND("clientversion", ClientCommand_clientversion(ent, request, arguments), "Release version of the game") \
-       CLIENT_COMMAND("mv_getpicture", ClientCommand_mv_getpicture(ent, request, arguments), "Retrieve mapshot picture from the server") \
        CLIENT_COMMAND("join", ClientCommand_join(ent, request), "Become a player in the game") \
+       CLIENT_COMMAND("minigame", ClientCommand_minigame(ent, request, arguments, command), "Start a minigame") \
+       CLIENT_COMMAND("mv_getpicture", ClientCommand_mv_getpicture(ent, request, arguments), "Retrieve mapshot picture from the server") \
        CLIENT_COMMAND("physics", ClientCommand_physics(ent, request, arguments), "Change physics set") \
        CLIENT_COMMAND("ready", ClientCommand_ready(ent, request), "Qualify as ready to end warmup stage (or restart server if allowed)") \
        CLIENT_COMMAND("say", ClientCommand_say(ent, request, arguments, command), "Print a message to chat to all players") \
        CLIENT_COMMAND("suggestmap", ClientCommand_suggestmap(ent, request, arguments), "Suggest a map to the mapvote at match end") \
        CLIENT_COMMAND("tell", ClientCommand_tell(ent, request, arguments, command), "Send a message directly to a player") \
        CLIENT_COMMAND("voice", ClientCommand_voice(ent, request, arguments, command), "Send voice message via sound") \
-       CLIENT_COMMAND("minigame", ClientCommand_minigame(ent, request, arguments, command), "Start a minigame") \
        /* nothing */
  
  void ClientCommand_macro_help(entity caller)
  #undef CLIENT_COMMAND
  }
  
- float ClientCommand_macro_command(float argc, entity caller, string command)
+ float ClientCommand_macro_command(int argc, entity caller, string command)
  {
        #define CLIENT_COMMAND(name, function, description) \
                { if (name == strtolower(argv(0))) { function; return true; } }
        return false;
  }
  
- float ClientCommand_macro_usage(float argc, entity caller)
+ float ClientCommand_macro_usage(int argc, entity caller)
  {
        #define CLIENT_COMMAND(name, function, description) \
                { if (name == strtolower(argv(1))) { function; return true; } }
@@@ -744,7 -744,7 +744,7 @@@ void SV_ParseClientCommand(entity this
        // if we're banned, don't even parse the command
        if (Ban_MaybeEnforceBanOnce(this)) return;
  
-       float argc = tokenize_console(command);
+       int argc = tokenize_console(command);
  
        // Guide for working with argc arguments by example:
        // argc:   1    - 2      - 3     - 4
index 8b8c345d8037f86822568be780091aaaf7ac224a,c917874c358f5d345cd740fcffa194033f9f54c7..c3e5bf9015293c712bb59f4e1d05c6c71f626804
@@@ -88,7 -88,7 +88,7 @@@ void changematchtime(float delta, floa
  //  Command Sub-Functions
  // =======================
  
- void GameCommand_adminmsg(float request, float argc)
+ void GameCommand_adminmsg(int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_allready(float request)
+ void GameCommand_allready(int request)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_allspec(float request, float argc)
+ void GameCommand_allspec(int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_anticheat(float request, float argc)
+ void GameCommand_anticheat(int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_bbox(float request)
+ void GameCommand_bbox(int request)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_bot_cmd(float request, float argc, string command)
+ void GameCommand_bot_cmd(int request, int argc, string command)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_cointoss(float request, float argc)
+ void GameCommand_cointoss(int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_database(float request, float argc)
+ void GameCommand_database(int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_defer_clear(float request, float argc)
+ void GameCommand_defer_clear(int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_defer_clear_all(float request)
+ void GameCommand_defer_clear_all(int request)
  {
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
                {
                        int n = 0;
-                       float argc;
+                       int argc;
  
                        FOREACH_CLIENT(true, {
                                argc = tokenize_console(strcat("defer_clear ", ftos(etof(it))));
        }
  }
  
- void GameCommand_delrec(float request, float argc)  // perhaps merge later with records and printstats and such?
+ void GameCommand_delrec(int request, int argc)  // perhaps merge later with records and printstats and such?
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_effectindexdump(float request)
+ void GameCommand_effectindexdump(int request)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_extendmatchtime(float request)
+ void GameCommand_extendmatchtime(int request)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_gametype(float request, float argc)
+ void GameCommand_gametype(int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_gettaginfo(float request, float argc)
+ void GameCommand_gettaginfo(int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_animbench(float request, float argc)
+ void GameCommand_animbench(int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_gotomap(float request, float argc)
+ void GameCommand_gotomap(int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_lockteams(float request)
+ void GameCommand_lockteams(int request)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_make_mapinfo(float request)
+ void GameCommand_make_mapinfo(int request)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_moveplayer(float request, float argc)
+ void GameCommand_moveplayer(int request, int argc)
  {
        switch (request)
        {
                                                        {
                                                                // set up
                                                                float team_id;
 -                                                              float save = client.team_forced;
 -                                                              client.team_forced = 0;
 +                                                              int save = Player_GetForcedTeamIndex(client);
 +                                                              Player_SetForcedTeamIndex(client, TEAM_FORCE_DEFAULT);
  
                                                                // find the team to move the player to
                                                                team_id = Team_ColorToTeam(destination);
                                                                {
                                                                        balance = TeamBalance_CheckAllowedTeams(client);
                                                                }
 -                                                              client.team_forced = save;
 +                                                              Player_SetForcedTeamIndex(client, save);
  
                                                                // Check to see if the destination team is even available
                                                                switch (team_id)
                                                                }
  
                                                                // If so, lets continue and finally move the player
 -                                                              client.team_forced = 0;
 +                                                              Player_SetForcedTeamIndex(client, TEAM_FORCE_DEFAULT);
                                                                if (MoveToTeam(client, Team_TeamToIndex(team_id), 6))
                                                                {
                                                                        successful = strcat(successful, (successful ? ", " : ""), playername(client, false));
        }
  }
  
- void GameCommand_nospectators(float request)
+ void GameCommand_nospectators(int request)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_printstats(float request)
+ void GameCommand_printstats(int request)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_radarmap(float request, float argc)
+ void GameCommand_radarmap(int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_reducematchtime(float request)
+ void GameCommand_reducematchtime(int request)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_setbots(float request, float argc)
+ void GameCommand_setbots(int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_shuffleteams(float request)
+ void GameCommand_shuffleteams(int request)
  {
        switch (request)
        {
                        }
  
                        FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, {
 -                              if (it.team_forced) {
 +                              if (Player_HasRealForcedTeam(it)) {
                                        // we could theoretically assign forced players to their teams
                                        // and shuffle the rest to fill the empty spots but in practise
                                        // either all players or none are gonna have forced teams
        }
  }
  
- void GameCommand_stuffto(float request, float argc)
+ void GameCommand_stuffto(int request, int argc)
  {
        // This... is a fairly dangerous and powerful command... - It allows any arguments to be sent to a client via rcon.
        // Because of this, it is disabled by default and must be enabled by the server owner when doing compilation. That way,
  #endif
  }
  
- void GameCommand_trace(float request, float argc)
+ void GameCommand_trace(int request, int argc)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_unlockteams(float request)
+ void GameCommand_unlockteams(int request)
  {
        switch (request)
        {
        }
  }
  
- void GameCommand_warp(float request, float argc)
+ void GameCommand_warp(int request, int argc)
  {
        switch (request)
        {
  
  /* use this when creating a new command, making sure to place it in alphabetical order... also,
  ** ADD ALL NEW COMMANDS TO commands.cfg WITH PROPER ALIASES IN THE SAME FASHION!
- void GameCommand_(float request)
+ void GameCommand_(int request)
  {
      switch(request)
      {
@@@ -1713,7 -1713,7 +1713,7 @@@ void GameCommand_macro_help(
        FOREACH(SERVER_COMMANDS, true, { LOG_INFOF("  ^2%s^7: %s", it.m_name, it.m_description); });
  }
  
- float GameCommand_macro_command(float argc, string command)
+ float GameCommand_macro_command(int argc, string command)
  {
        string c = strtolower(argv(0));
        FOREACH(SERVER_COMMANDS, it.m_name == c, {
        return false;
  }
  
- float GameCommand_macro_usage(float argc)
+ float GameCommand_macro_usage(int argc)
  {
        string c = strtolower(argv(1));
        FOREACH(SERVER_COMMANDS, it.m_name == c, {
@@@ -1746,7 -1746,7 +1746,7 @@@ void GameCommand_macro_write_aliases(fl
  
  void GameCommand(string command)
  {
-       float argc = tokenize_console(command);
+       int argc = tokenize_console(command);
  
        // Guide for working with argc arguments by example:
        // argc:   1    - 2      - 3     - 4
diff --combined qcsrc/server/defs.qh
index 908d99444887f43ebeef093a34039fc532d08089,3aed06ee41a22b66d9cb69e1357628e91c90d480..f1299bf30d0ae141dbcb01c9a4e32baf74f223f0
@@@ -25,7 -25,7 +25,7 @@@ float currentbots
  float bots_would_leave;
  
  void UpdateFrags(entity player, int f);
- .float totalfrags;
+ .int totalfrags;
  
  // flag set on worldspawn so that the code knows if it is dedicated or not
  float server_is_dedicated;
@@@ -41,7 -41,7 +41,7 @@@
  
  //.float      worldtype;
  // Needed for dynamic clientwalls
- .float inactive; // Clientwall disappears when inactive
+ .bool inactive; // Clientwall disappears when inactive
  .float alpha_max, alpha_min;
  .float fade_start, fade_end, fade_vertical_offset;
  .float default_solid; // Variable to store default .solid for clientwalls
@@@ -213,7 -213,7 +213,7 @@@ float assault_attacker_team
  float ServerProgsDB;
  float TemporaryDB;
  
- .float team_saved;
+ .int team_saved;
  
  bool some_spawn_has_been_used;
  int have_team_spawns; // 0 = no team spawns requested, -1 = team spawns requested but none found, 1 = team spawns requested and found
@@@ -308,9 -308,9 +308,9 @@@ float client_cefc_accumulatortime
  
  .float weapon_load[Weapons_MAX];
  .int ammo_none; // used by the reloading system, must always be 0
- .float clip_load;
- .float old_clip_load;
- .float clip_size;
+ .int clip_load;
+ .int old_clip_load;
+ .int clip_size;
  
  .int minelayer_mines;
  .float vortex_charge;
  // when doing this, hagar can go through clones
  // #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_BBOX
  
- .float spectatee_status;
- .float zoomstate;
- .float restriction;
+ .int spectatee_status;
+ .bool zoomstate;
+ .int restriction;
  
  .entity clientdata;
  .entity personal;
@@@ -339,22 -339,24 +339,22 @@@ string deathmessage
  .bool just_joined;
  
  .float cvar_cl_weaponimpulsemode;
- .float selectweapon; // last selected weapon of the player
+ .int selectweapon; // last selected weapon of the player
  
  .float ballistics_density; // wall piercing factor, larger = bullet can pass through more
  
- const float ACTIVE_NOT                = 0;
- const float ACTIVE_ACTIVE     = 1;
- const float ACTIVE_IDLE       = 2;
- const float ACTIVE_BUSY       = 2;
- const float ACTIVE_TOGGLE     = 3;
- .float active;
+ const int ACTIVE_NOT          = 0;
+ const int ACTIVE_ACTIVE       = 1;
+ const int ACTIVE_IDLE         = 2;
+ const int ACTIVE_BUSY         = 2;
+ const int ACTIVE_TOGGLE       = 3;
+ .int active;
  .void (entity this, int act_state) setactive;
  .entity realowner;
  
  //float serverflags;
  
- .float player_blocked;
 -.int team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
 -
+ .bool player_blocked;
  
  .float revival_time; // time at which player was last revived
  .float revive_speed; // NOTE: multiplier (anything above 1 is instaheal)
@@@ -374,7 -376,7 +374,7 @@@ USING(spawn_evalfunc_t, vector(entity t
  
  string modname;
  
- .float missile_flags;
+ .int missile_flags;
  const int MIF_SPLASH = BIT(1);
  const int MIF_ARC = BIT(2);
  const int MIF_PROXY = BIT(3);