Skip to content

Conversation

@themuffinator
Copy link
Owner

Motivation

  • Bring movement-related APIs into parity with HLIL by emitting the same diagnostics when the bot library is uninitialised or move-state handles are invalid.
  • Prevent callers from observing stale or uninitialised output by clearing moveresult buffers where required.
  • Provide a single, reusable library-initialisation guard so callers can report the canonical HLIL message.
  • Ensure avoid-reach state is reset by clearing the underlying arrays as the HLIL behaviour indicates.

Description

  • Added BotLibraryEnsureInitialized and its prototype in src/botlib/interface/botlib_interface.{c,h} which emits the HLIL diagnostic "%s: bot library used before being setup\n" when the library is not initialised.
  • Implemented BotMove_ResolveMoveState in src/botlib/ai_move/bot_move.c to centralise move-state handle validation and emit the HLIL parity diagnostic "%s: index %d not setup\n" on invalid handles.
  • Updated movement entry points in src/botlib/ai_move/bot_move.c (BotAllocMoveState, BotResetMoveState, BotInitMoveState, BotMoveToGoal, BotMoveInDirection) to call the new initialisation guard and/or handle resolver, and to clear output where appropriate (notably BotMoveToGoal now calls BotClearMoveResult early).
  • Added the required commented function headers above the modified movement functions and left BotMove_ResetAvoidReach implementation that clears avoidreach, avoidreachtimes and avoidreachtries with memset, matching HLIL behaviour (and BotResetAvoidReach in bot_goal.c also performs equivalent clears).

Testing

  • No automated tests were executed for this change.
  • The change compiles/committed to the branch (changes staged and committed), but no CI/build verification was run in this rollout.
  • Static inspections: code paths for invalid-handle and uninitialised-library now produce the HLIL-style diagnostic messages via BotLib_Print.
  • Manual runtime validation is recommended (start with calls to BotMoveToGoal/BotMoveInDirection before BotSetupLibrary and with invalid handles to observe the diagnostic output).

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants