Skip to content

Keep nav area attributes when marking stairs - #2225

Merged
sunzenshen merged 1 commit into
NeotokyoRebuild:masterfrom
sunzenshen:nav-keep-attrs-on-stairs
Oct 17, 2026
Merged

sunzenshen merged 1 commit into
NeotokyoRebuild:masterfrom
sunzenshen:nav-keep-attrs-on-stairs

Conversation

@sunzenshen

@sunzenshen sunzenshen commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes a side effect of marking an area as NAV_MESH_STAIRS which clears out any other properties of the nav area.


CNavArea::TestStairs() replaces every attribute of a stair area with NAV_MESH_STAIRS. MarkStairAreas() calls it for every area on every nav load (nav_file.cpp), so an attribute set by hand on a stair area is erased each time a map loads, and again in every nav_analyze save.

This PR sets the flag with an OR instead (SetAttributes( GetAttributes() | NAV_MESH_STAIRS )). One file, nav_generate.cpp, +6. The flag-clearing line at the top of the function is unchanged, so an area that stops testing as stairs loses only that flag.

Who it affects

No mesh on master has a hand-set attribute on a stair area, so master's behavior does not change. Two navmesh PRs in neoAssets have such areas:

It was found because the attributes were present in the .nav files but missing from bots' in-game area data, and a nav_analyze save of those meshes had lost them too.

Tested

Release dedicated server build of this branch, no compiler warnings. Loaded the ntre_rise_ctg mesh from neoAssets#160 and ran nav_edit 1; nav_save, then read the saved file's area attributes:

build area 2720 area 2777
mesh as committed AVOID, STAIRS AVOID, STAIRS
master load and save STAIRS STAIRS
this branch load and save AVOID, STAIRS AVOID, STAIRS

On this branch the saved file is byte-identical to the committed one. The vtol areas were not checked in game.

STAIRS is still set on exactly the areas that test as stairs, so a mesh without hand-set stair attributes loads as before.

CNavArea::TestStairs() replaced every attribute of a stair area with
NAV_MESH_STAIRS. MarkStairAreas() runs on every nav load (nav_file.cpp),
so a stair area lost its hand-set attributes each time a map loaded, in
every match and in every nav_analyze save.

Two NeotokyoRebuild/neoAssets meshes mark stair areas this way:
ntre_rise_ctg areas 2720 and 2777 (AVOID) and ntre_vtol_ctg areas 149
and 39678 (PRECISE and CLIFF). Their marks were gone by the time a bot
planned a path.

Set the stairs flag with an OR instead. The line that clears the flag
at the top of the function is unchanged, so an area that stops testing
as stairs still loses only that flag.
@sunzenshen sunzenshen added the Bots Related to bot players label Oct 13, 2026
@sunzenshen
sunzenshen requested a review from sunmachine October 13, 2026 01:23
@sunzenshen
sunzenshen marked this pull request as ready for review October 13, 2026 01:23

@sunmachine sunmachine left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I was crazy when I was toying with this like a month ago.

@sunzenshen
sunzenshen merged commit 9ad837b into NeotokyoRebuild:master Oct 17, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bots Related to bot players

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants