Skip to content

[botlib] Compiler warning cleanup — unused variables, wrong types, orphaned file #290

@darkshade9

Description

@darkshade9

The botlib produces many compiler warnings. Cleaning these up will help ensure real warnings are not missed.

Unused variables (-Wunused-variable, -Wunused-but-set-variable)

  • botlib_cmd.c:13 — int cc
  • botlib_ctf.c:325 — float flag2_dist
  • botlib_esp.c:18 — edict_t *target
  • botlib_movement.c:140 — qboolean foundProblem
  • botlib_movement.c:4897 — qboolean not_infront
  • botlib_movement.c:5049 — qboolean found_target
  • botlib_movement.c:5240 — gitem_t *clweapon
  • botlib_movement.c:6476 — int old_waterlevel
  • botlib_spawn.c:329 — int prev_bots_skipped
  • botlib_spawn.c:1728 — int i
  • botlib_personality.c:370/397/398/539/540/614 — attempts, name, skin, chosen_weapon_index, highest_pref (x2)
  • botlib_nodes.c:1801 — target_is_above, target_is_equal, higher
  • botlib_nodes.c:3004/3007/3277/3562/3564/4142/4580/4759/4760/4761/5413 — multiple dead variables

Unused expression results (-Wunused-value)

These are bare statements that do nothing — likely placeholder code that was never completed:

  • botlib_movement.c:4752-4759 — self->s.origin; / self->enemy->s.origin; / self->s.angles[PITCH]; (inside knife aiming block)
  • botlib_nav.c:2650 — players[0]->client->pers.draw->draw_arrow_num; (bare read)

const qualifier stripping (-Wincompatible-pointer-types-discards-qualifiers)

vec3_origin (const vec3_t) passed to non-const vec3_t parameters:

  • botlib_ai.c:317
  • botlib_spawn.c:1631, 1703, 1752
  • botlib_nodes.c:658

Fix: add const to affected function parameters or use a local zero vec3_t.

Wrong struct field type (-Wincompatible-pointer-types)

  • g_local.h:870 — char* bot_file_path[MAX_QPATH] is an array of char pointers, but is used as a flat char buffer via strncpy. Should be: char bot_file_path[MAX_QPATH]

Orphaned source file

  • src/action/botlib/botlib_win.c — not in meson.build, duplicates seed_random_number_generator already implemented in botlib_utils.c. Can be deleted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    aq2-tngOnly TNG (server dll) affectedgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions