Skip to content

Commit 17c9280

Browse files
committed
taxi: GetTaxiNodesForMap() with no arg returns all continents
Previously no-arg meant the currently-viewed continent; make it return every flight master on every continent instead -- a one-call flight DB. A numeric mapID still filters to that continent. Each entry already carries its own mapID, and the mount + TaxiPath-endpoint filters apply uniformly. Verified: no-arg 97, GetTaxiNodesForMap(0) 48.
1 parent a47f384 commit 17c9280

2 files changed

Lines changed: 21 additions & 30 deletions

File tree

docs/API.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ build instructions.
406406
- [`GetTalentIDByIndex(tabIndex, talentIndex)`](#gettalentidbyindextabindex-talentindex)
407407

408408
- [TaxiMap](#taximap)
409-
- [`C_TaxiMap.GetTaxiNodesForMap(mapID)`](#c_taximapgettaxinodesformapmapid)
409+
- [`C_TaxiMap.GetTaxiNodesForMap([mapID])`](#c_taximapgettaxinodesformapmapid)
410410
- [`C_TaxiMap.GetAllTaxiNodes([uiMapID])`](#c_taximapgetalltaxinodesuimapid)
411411

412412
- [Time](#time)
@@ -10001,16 +10001,18 @@ Ship both because they answer different questions:
1000110001

1000210002
| function | source | use |
1000310003
|---|---|---|
10004-
| `C_TaxiMap.GetTaxiNodesForMap(mapID)` | `TaxiNodes.dbc` (static) | every flight point on a continent, faction-tagged, discovered or not — for a database / map overlay |
10004+
| `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 |
1000510005
| `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 |
1000610006

10007-
### `C_TaxiMap.GetTaxiNodesForMap(mapID)`
10007+
### `C_TaxiMap.GetTaxiNodesForMap([mapID])`
1000810008

10009-
Returns an array of every `TaxiNodes.dbc` flight point on continent
10010-
`mapID` (a `Map.dbc` id — `0` Eastern Kingdoms, `1` Kalimdor, `30`
10011-
Alterac Valley, … — the same identity `C_Map.GetAreaTriggers([mapID])`
10012-
uses; retail's `uiMapID` has no vanilla analog). Omit / non-number →
10013-
the currently viewed continent.
10009+
Returns an array of flight masters. A numeric `mapID` (a `Map.dbc` id —
10010+
`0` Eastern Kingdoms, `1` Kalimdor, `30` Alterac Valley, … — the same
10011+
identity `C_Map.GetAreaTriggers([mapID])` uses; retail's `uiMapID` has no
10012+
vanilla analog) filters to that continent. **Omitted / non-number returns
10013+
every flight master on every continent** — a one-call flight database
10014+
(each entry carries its own `mapID`). This is a ClassicAPI extension to
10015+
retail's required-argument signature.
1001410016

1001510017
Only real flight masters are returned. `TaxiNodes.dbc` also contains
1001610018
non-flight rows — transports/boats/zeppelins (no flight mount) and

src/taxi/Map.cpp

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
// `Enum.FlightPathState` tables so retail code ports unchanged.
1818
//
1919
// - **GetTaxiNodesForMap** reads `TaxiNodes.dbc` directly: every flight point
20-
// on a continent, faction-tagged, regardless of discovery — the static DB
21-
// a zone-map addon (pfQuest's `pfDB.meta.flight`) wants. No flight master
22-
// needed. Non-flight rows are filtered out — the DBC also holds transports/
20+
// on a continent (or all continents with no arg), faction-tagged,
21+
// regardless of discovery — the static DB a zone-map addon (pfQuest's
22+
// `pfDB.meta.flight`) wants. No flight master needed. Non-flight rows are filtered out — the DBC also holds transports/
2323
// boats/zeppelins (no flight mount) and non-selectable markers like
2424
// Northshire Abbey (no connecting flight path); a real flight master has a
2525
// mount AND is a TaxiPath endpoint.
@@ -93,28 +93,16 @@ bool BuildEndpointSet(bool *out, int outSize) {
9393
return true;
9494
}
9595

96-
// The Map.dbc continent id of the currently viewed world map (for the
97-
// no-arg form) — the WorldMapArea current-view row's mapID column.
98-
int CurrentContinentMapID() {
99-
const int row = ::Map::Area::CurrentViewRow();
100-
if (row <= 0)
101-
return -1;
102-
const uint8_t *wma = DBC::Record(Offsets::VAR_WORLDMAP_AREA_RECORDS,
103-
Offsets::VAR_WORLDMAP_AREA_COUNT,
104-
static_cast<uint32_t>(row));
105-
return wma ? IntField(wma, Offsets::OFF_WMA_MAP_ID) : -1;
106-
}
107-
108-
// `C_TaxiMap.GetTaxiNodesForMap(mapID)` — see module comment.
96+
// `C_TaxiMap.GetTaxiNodesForMap([mapID])` — see module comment. A numeric
97+
// `mapID` filters to that continent; omitted / non-number returns every
98+
// flight master on every continent.
10999
int __fastcall Script_GetTaxiNodesForMap(void *L) {
110-
const int mapID = Game::Lua::IsNumber(L, 1)
111-
? static_cast<int>(Game::Lua::ToNumber(L, 1))
112-
: CurrentContinentMapID();
100+
const bool filterMap = Game::Lua::IsNumber(L, 1);
101+
const int wantMap =
102+
filterMap ? static_cast<int>(Game::Lua::ToNumber(L, 1)) : -1;
113103

114104
Game::Lua::SetTop(L, 0);
115105
Game::Lua::NewTable(L);
116-
if (mapID < 0)
117-
return 1;
118106

119107
// Real flight masters are TaxiPath endpoints (see BuildEndpointSet).
120108
bool endpoint[kMaxTaxiNodeID] = {};
@@ -129,7 +117,8 @@ int __fastcall Script_GetTaxiNodesForMap(void *L) {
129117
static_cast<uint32_t>(id));
130118
if (rec == nullptr)
131119
continue;
132-
if (IntField(rec, Offsets::OFF_TAXINODE_MAP_ID) != mapID)
120+
const int mapID = IntField(rec, Offsets::OFF_TAXINODE_MAP_ID);
121+
if (filterMap && mapID != wantMap)
133122
continue;
134123

135124
// Two filters isolate real flight masters from the DBC's non-flight

0 commit comments

Comments
 (0)