diff --git a/docs/API.md b/docs/API.md index c32075ca..27a7ba1b 100644 --- a/docs/API.md +++ b/docs/API.md @@ -406,7 +406,7 @@ build instructions. - [`GetTalentIDByIndex(tabIndex, talentIndex)`](#gettalentidbyindextabindex-talentindex) - [TaxiMap](#taximap) - - [`C_TaxiMap.GetTaxiNodesForMap(mapID)`](#c_taximapgettaxinodesformapmapid) + - [`C_TaxiMap.GetTaxiNodesForMap([mapID])`](#c_taximapgettaxinodesformapmapid) - [`C_TaxiMap.GetAllTaxiNodes([uiMapID])`](#c_taximapgetalltaxinodesuimapid) - [Time](#time) @@ -10001,16 +10001,18 @@ Ship both because they answer different questions: | function | source | use | |---|---|---| -| `C_TaxiMap.GetTaxiNodesForMap(mapID)` | `TaxiNodes.dbc` (static) | every flight point on a continent, faction-tagged, discovered or not — for a database / map overlay | +| `C_TaxiMap.GetTaxiNodesForMap([mapID])` | `TaxiNodes.dbc` (static) | every flight point (one continent, or all with no arg), faction-tagged, discovered or not — for a database / map overlay | | `C_TaxiMap.GetAllTaxiNodes([uiMapID])` | live taxi session | the nodes reachable from the **open** flight master, with per-node state + the slot index to fly — for a flight-map UI | -### `C_TaxiMap.GetTaxiNodesForMap(mapID)` +### `C_TaxiMap.GetTaxiNodesForMap([mapID])` -Returns an array of every `TaxiNodes.dbc` flight point on continent -`mapID` (a `Map.dbc` id — `0` Eastern Kingdoms, `1` Kalimdor, `30` -Alterac Valley, … — the same identity `C_Map.GetAreaTriggers([mapID])` -uses; retail's `uiMapID` has no vanilla analog). Omit / non-number → -the currently viewed continent. +Returns an array of flight masters. A numeric `mapID` (a `Map.dbc` id — +`0` Eastern Kingdoms, `1` Kalimdor, `30` Alterac Valley, … — the same +identity `C_Map.GetAreaTriggers([mapID])` uses; retail's `uiMapID` has no +vanilla analog) filters to that continent. **Omitted / non-number returns +every flight master on every continent** — a one-call flight database +(each entry carries its own `mapID`). This is a ClassicAPI extension to +retail's required-argument signature. Only real flight masters are returned. `TaxiNodes.dbc` also contains non-flight rows — transports/boats/zeppelins (no flight mount) and diff --git a/src/taxi/Map.cpp b/src/taxi/Map.cpp index 7a0b9e94..45792fda 100644 --- a/src/taxi/Map.cpp +++ b/src/taxi/Map.cpp @@ -17,9 +17,9 @@ // `Enum.FlightPathState` tables so retail code ports unchanged. // // - **GetTaxiNodesForMap** reads `TaxiNodes.dbc` directly: every flight point -// on a continent, faction-tagged, regardless of discovery — the static DB -// a zone-map addon (pfQuest's `pfDB.meta.flight`) wants. No flight master -// needed. Non-flight rows are filtered out — the DBC also holds transports/ +// on a continent (or all continents with no arg), faction-tagged, +// regardless of discovery — the static DB a zone-map addon (pfQuest's +// `pfDB.meta.flight`) wants. No flight master needed. Non-flight rows are filtered out — the DBC also holds transports/ // boats/zeppelins (no flight mount) and non-selectable markers like // Northshire Abbey (no connecting flight path); a real flight master has a // mount AND is a TaxiPath endpoint. @@ -93,28 +93,16 @@ bool BuildEndpointSet(bool *out, int outSize) { return true; } -// The Map.dbc continent id of the currently viewed world map (for the -// no-arg form) — the WorldMapArea current-view row's mapID column. -int CurrentContinentMapID() { - const int row = ::Map::Area::CurrentViewRow(); - if (row <= 0) - return -1; - const uint8_t *wma = DBC::Record(Offsets::VAR_WORLDMAP_AREA_RECORDS, - Offsets::VAR_WORLDMAP_AREA_COUNT, - static_cast(row)); - return wma ? IntField(wma, Offsets::OFF_WMA_MAP_ID) : -1; -} - -// `C_TaxiMap.GetTaxiNodesForMap(mapID)` — see module comment. +// `C_TaxiMap.GetTaxiNodesForMap([mapID])` — see module comment. A numeric +// `mapID` filters to that continent; omitted / non-number returns every +// flight master on every continent. int __fastcall Script_GetTaxiNodesForMap(void *L) { - const int mapID = Game::Lua::IsNumber(L, 1) - ? static_cast(Game::Lua::ToNumber(L, 1)) - : CurrentContinentMapID(); + const bool filterMap = Game::Lua::IsNumber(L, 1); + const int wantMap = + filterMap ? static_cast(Game::Lua::ToNumber(L, 1)) : -1; Game::Lua::SetTop(L, 0); Game::Lua::NewTable(L); - if (mapID < 0) - return 1; // Real flight masters are TaxiPath endpoints (see BuildEndpointSet). bool endpoint[kMaxTaxiNodeID] = {}; @@ -129,7 +117,8 @@ int __fastcall Script_GetTaxiNodesForMap(void *L) { static_cast(id)); if (rec == nullptr) continue; - if (IntField(rec, Offsets::OFF_TAXINODE_MAP_ID) != mapID) + const int mapID = IntField(rec, Offsets::OFF_TAXINODE_MAP_ID); + if (filterMap && mapID != wantMap) continue; // Two filters isolate real flight masters from the DBC's non-flight