Skip to content

Medium: goto_cvn() Incorrect Coordinate Comparison #3

@smooge

Description

@smooge

Priority: MEDIUM
File: Src/selectG.c
Function: goto_cvn()
Discovered: During Phase 4 documentation of selectG.c

Description: Function incorrectly compares YREAL with c1_ptr->xloc when it should compare XREAL with xloc. This is a logic error in coordinate validation that could cause incorrect caravan navigation behavior.

Reproduction Steps:

  1. Navigate to a caravan using goto_cvn()
  2. Function checks if (YREAL != c1_ptr->xloc) at line 1012
  3. Expected: Should check if (XREAL != c1_ptr->xloc) for X-coordinate validation
  4. Bug causes incorrect coordinate comparison (Y vs X mismatch)

Impact: Navigation to caravans may work incorrectly when caravan X-coordinate differs from current Y-coordinate, potentially causing navigation failures or unexpected map positioning.

Proposed Fix: Change the coordinate comparison to match X with X:

/* Before (buggy) */
if (YREAL != c1_ptr->xloc) {

/* After (fixed) */
if (XREAL != c1_ptr->xloc) {

Original Bug ID: BUG-003

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmodernizationIssues related to C code modernization

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions