]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'martin-t/unused_fields' into 'master'
authorMario <zacjardine@y7mail.com>
Fri, 21 Oct 2016 01:17:03 +0000 (01:17 +0000)
committerMario <zacjardine@y7mail.com>
Fri, 21 Oct 2016 01:17:03 +0000 (01:17 +0000)
Martin t/unused fields

I was playing with grep&friends and decided to see if I could remove some unused fields from the code. I actually expected to find a lot more and only removed a few of those anyway because sometimes I wasn't sure if it's safe to remove them and didn't wanna spend too much time on it.

If anybody wants to go more in-depth, I'll leave the ipython script here as inspiration

```
#!/usr/bin/env ipython3

fields = !find . -type f -name '*.q*' -print0 | xargs -0 grep -hoP '^[[:space:]]*\.[a-zA-Z1-9_]+ [a-zA-Z1-9_]+(, [a-zA-Z1-9_]+)*;' | awk '{$1 = ""; print}' | tr ',' '\n' | tr -d " ;"

fields = set(fields)
fields = sorted(fields)

for field in fields:
    ret = !find . -type f -name '*.q*' -print0 | xargs -0 grep -P '\.$field[^a-zA-Z1-9_]?'
    if len(ret) <= 1:
        print(field + " " + str(len(ret)))
```

See merge request !378

13 files changed:
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh
qcsrc/common/minigames/minigame/pp.qc
qcsrc/common/monsters/monster.qh
qcsrc/common/turrets/sv_turrets.qh
qcsrc/server/bot/default/scripting.qc
qcsrc/server/bot/default/scripting.qh
qcsrc/server/client.qc
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/mutators/mutator/gamemode_assault.qh
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/pathlib/main.qc
qcsrc/server/pathlib/pathlib.qh

index 750ade34b412ece9a6b8a868c4cc747367407ae1..d8b7fd044bcc8e8f5faf4a76dcbac1dbb451dee6 100644 (file)
@@ -48,12 +48,10 @@ entity ons_worldgeneratorlist;
 // list of control points on the map
 entity ons_worldcplist;
 .entity ons_worldcpnext;
-.entity ons_stalecpnext;
 
 // list of links on the map
 entity ons_worldlinklist;
 .entity ons_worldlinknext;
-.entity ons_stalelinknext;
 
 // definitions
 .entity sprite;
index e05658cbf2c0b486f9ccdbeb01e2a53517c2b91b..4ae9fb06b21245ff233831d8a3ff7a280e477439 100644 (file)
@@ -271,8 +271,7 @@ int pp_server_event(entity minigame, string event, ...)
 
 string pp_curr_pos; // identifier of the tile under the mouse
 vector pp_boardpos; // HUD board position
-vector pp_boardsize;// HUD board size
-.int pp_checkwin; // Used to optimize checks to display a win
+vector pp_boardsize; // HUD board size
 
 // Required function, draw the game board
 void pp_hud_board(vector pos, vector mySize)
index e579d7d87dbfd0360f1ae842404c69e51a98d6ca..2685e2fbced75be78c0402980f5a5acea84f9294 100644 (file)
@@ -22,9 +22,6 @@ const int MONSTER_TYPE_PASSIVE = BIT(14); // doesn't target or chase enemies
 .vector anim_melee1;
 .vector anim_melee2;
 .vector anim_melee3;
-.vector anim_pain3;
-.vector anim_pain4;
-.vector anim_pain5;
 .vector anim_walk;
 .vector anim_spawn;
 
index c5a3728d134cf20b1e2f068dc803ff943b647cad..62759c058f3df63b37713919baf4f55a9c8314ee 100644 (file)
@@ -8,7 +8,6 @@ entity turret_select_target(entity this);
 
 // turret fields
 .float ticrate; // interal ai think rate
-.vector aim_idle; // where to aim while idle
 .entity tur_head; // top part of the turret
 .entity tur_defend; // defend this entity
 .vector tur_shotorg; // shot origin
index e8355575edae23ef274bd8ddeb089068a2dc664a..9f29a22176264e9e507c24da84854fd67e90c486 100644 (file)
@@ -1106,7 +1106,6 @@ void bot_setcurrentcommand(entity this)
        if(!this.bot_cmd_current)
        {
                this.bot_cmd_current = new_pure(bot_cmd);
-               this.bot_cmd_current.is_bot_cmd = true;
        }
 
        bot_cmd = this.bot_cmd_current;
index cb6cd8731daab16ad2d43147a5c64ad0f5f3f71e..b3f0e90fa38d3129b9d94a94e8381967fe4178af 100644 (file)
@@ -59,7 +59,6 @@ string bot_cmd_string[BOT_CMD_COUNTER];
 entity bot_cmd;        // global current command
 .entity bot_cmd_current; // current command of this bot
 
-.float is_bot_cmd;                     // Tells if the entity is a bot command
 .float bot_cmd_index;                  // Position of the command in the queue
 .int bot_cmd_type;                     // If of command (see the BOT_CMD_* defines)
 .float bot_cmd_parm_float;             // Field to store a float parameter
index 1735a78be8988464792f97b17c52af798d6678af..554ef656b41dd15774f8966e004d600e1b3e13a3 100644 (file)
@@ -708,7 +708,6 @@ void PutClientInServer(entity this)
 
 void ClientInit_misc(entity this);
 
-.float ebouncefactor, ebouncestop; // electro's values
 // TODO do we need all these fields, or should we stop autodetecting runtime
 // changes and just have a console command to update this?
 bool ClientInit_SendEntity(entity this, entity to, int sf)
index 9c3e7bba02148e52f34a75556c054f9affe12457..4574b23490f3147447772eb754d41f1b6a750d08 100644 (file)
@@ -160,7 +160,6 @@ bool nJoinAllowed(entity this, entity ignore);
 .float noalign;                // if set to 1, the item or spawnpoint won't be dropped to the floor
 
 .vector death_origin;
-.vector killer_origin;
 
 float default_player_alpha;
 float default_weapon_alpha;
@@ -418,12 +417,6 @@ const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI;
 
 ////
 
-.entity player_stats;
-//.float playerid;
-.string playernick;
-.float elos;
-.float ranks;
-
 .string cvar_cl_physics;
 
 .void(entity this, entity player) init_for_player;
index cb43861acf4ae272ffc7f67ae07950dbf2c03977..a604a2bade1ef61b8ac45bb1eeac7d068ed3b406 100644 (file)
@@ -289,7 +289,6 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
 
        // Set final information for the death
        targ.death_origin = targ.origin;
-       if(targ != attacker) { targ.killer_origin = attacker.origin; }
        string deathlocation = (autocvar_notification_server_allows_location ? NearestLocation(targ.death_origin) : "");
 
        #ifdef NOTIFICATIONS_DEBUG
index 43c5100cbca59b949ceaa02ade21107a6aef9898..8fd40748543bbcdf5a708845720791f6e6ac5f37 100644 (file)
@@ -49,7 +49,6 @@ const int HAVOCBOT_AST_ROLE_OFFENSE = 4;
 
 void(entity this) havocbot_role_ast_defense;
 void(entity this) havocbot_role_ast_offense;
-.entity havocbot_ast_target;
 
 void(entity bot) havocbot_ast_reset_role;
 
index 781609a9106cf977ed9d5e3a68dccb0592fc1684..944311598090c80e7f19f489ed2631ff52d1ff47 100644 (file)
@@ -77,7 +77,6 @@ float kh_interferemsg_time, kh_interferemsg_team;
 .float kh_dropperteam;
 .entity kh_previous_owner;
 .float kh_previous_owner_playerid;
-.float kh_cp_duration;
 
 float kh_key_dropped, kh_key_carried;
 
index abf7f71523c12146ad8b5422fe417a4d6048cd90..044d6444347d5f93929daa74ffe832da4f1590f1 100644 (file)
@@ -55,7 +55,6 @@ entity pathlib_mknode(vector where,entity parent)
     setsize(node, '0 0 0', '0 0 0');
 
     setorigin(node, where);
-    node.medium = pointcontents(where);
 #if DEBUGPATHING
     pathlib_showsquare(where, 1 ,15);
 #endif
index 4ae0c2c86d4b5f0f2970cf9fdcda76393dfb84bc..028a2c7e6e5b26eb9b01650327ab8b153bc5617e 100644 (file)
@@ -9,7 +9,6 @@
 .entity path_prev;
 
 #define inwater(point) (pointcontents(point) == CONTENT_WATER)
-.int medium;
 
 const vector PLIB_FORWARD = '0 1 0';
 //#define PLIB_BACK    '0 -1 0'