Skip to content

Commit 84b5bec

Browse files
ShaurenOvahlord
authored andcommitted
Tools/mmaps_generator: Replace hardcoded map ids with db2 data checks
1 parent fcc4138 commit 84b5bec

2 files changed

Lines changed: 34 additions & 88 deletions

File tree

src/tools/mmaps_generator/MapBuilder.cpp

Lines changed: 32 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717

1818
#include "MapBuilder.h"
19+
#include "Containers.h"
1920
#include "IntermediateValues.h"
2021
#include "MMapDefines.h"
2122
#include "MapTree.h"
@@ -975,103 +976,30 @@ namespace MMAP
975976
return true;
976977

977978
if (m_skipJunkMaps)
978-
switch (mapID)
979-
{
980-
case 13: // test.wdt
981-
case 25: // ScottTest.wdt
982-
case 29: // Test.wdt
983-
case 42: // Colin.wdt
984-
case 169: // EmeraldDream.wdt (unused, and very large)
985-
case 451: // development.wdt
986-
case 573: // ExteriorTest.wdt
987-
case 597: // CraigTest.wdt
988-
case 605: // development_nonweighted.wdt
989-
case 606: // QA_DVD.wdt
990-
case 651: // ElevatorSpawnTest.wdt
991-
return true;
992-
default:
993-
if (isTransportMap(mapID))
994-
return true;
995-
break;
996-
}
979+
{
980+
if (isDevMap(mapID))
981+
return true;
982+
983+
if (isTransportMap(mapID))
984+
return true;
985+
}
997986

998987
if (m_skipBattlegrounds)
999-
switch (mapID)
1000-
{
1001-
case 30: // Alterac Valley
1002-
case 37: // ?
1003-
case 489: // Warsong Gulch
1004-
case 529: // Arathi Basin
1005-
case 566: // Eye of the Storm
1006-
case 607: // Strand of the Ancients
1007-
case 628: // Isle of Conquest
1008-
case 726: // Twin Peaks
1009-
case 727: // Silvershard Mines
1010-
case 761: // The Battle for Gilneas
1011-
case 968: // Rated Eye of the Storm
1012-
return true;
1013-
default:
1014-
break;
1015-
}
988+
{
989+
if (isBattlegroundMap(mapID))
990+
return true;
991+
}
1016992

1017993
return false;
1018994
}
1019995

1020996
/**************************************************************************/
1021997
bool MapBuilder::isTransportMap(uint32 mapID) const
1022998
{
1023-
switch (mapID)
1024-
{
1025-
// transport maps
1026-
case 582:
1027-
case 584:
1028-
case 586:
1029-
case 587:
1030-
case 588:
1031-
case 589:
1032-
case 590:
1033-
case 591:
1034-
case 592:
1035-
case 593:
1036-
case 594:
1037-
case 596:
1038-
case 610:
1039-
case 612:
1040-
case 613:
1041-
case 614:
1042-
case 620:
1043-
case 621:
1044-
case 622:
1045-
case 623:
1046-
case 641:
1047-
case 642:
1048-
case 647:
1049-
case 662:
1050-
case 672:
1051-
case 673:
1052-
case 674:
1053-
case 712:
1054-
case 713:
1055-
case 718:
1056-
case 738:
1057-
case 739:
1058-
case 740:
1059-
case 741:
1060-
case 742:
1061-
case 743:
1062-
case 747:
1063-
case 748:
1064-
case 749:
1065-
case 750:
1066-
case 762:
1067-
case 763:
1068-
case 765:
1069-
case 766:
1070-
case 767:
1071-
return true;
1072-
default:
1073-
return false;
1074-
}
999+
if (MapEntry const* map = Trinity::Containers::MapGetValuePtr(sMapStore, mapID))
1000+
return map->MapType == 3;
1001+
1002+
return false;
10751003
}
10761004

10771005
bool MapBuilder::isContinentMap(uint32 mapID) const
@@ -1088,6 +1016,22 @@ namespace MMAP
10881016
}
10891017
}
10901018

1019+
bool MapBuilder::isDevMap(uint32 mapID) const
1020+
{
1021+
if (MapEntry const* map = Trinity::Containers::MapGetValuePtr(sMapStore, mapID))
1022+
return (map->Flags & 0x2) != 0;
1023+
1024+
return false;
1025+
}
1026+
1027+
bool MapBuilder::isBattlegroundMap(uint32 mapID) const
1028+
{
1029+
if (MapEntry const* map = Trinity::Containers::MapGetValuePtr(sMapStore, mapID))
1030+
return map->InstanceType == 3;
1031+
1032+
return false;
1033+
}
1034+
10911035
/**************************************************************************/
10921036
bool TileBuilder::shouldSkipTile(uint32 mapID, uint32 tileX, uint32 tileY) const
10931037
{

src/tools/mmaps_generator/MapBuilder.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ namespace MMAP
184184

185185
bool shouldSkipMap(uint32 mapID) const;
186186
bool isTransportMap(uint32 mapID) const;
187+
bool isDevMap(uint32 mapID) const;
188+
bool isBattlegroundMap(uint32 mapID) const;
187189
bool isContinentMap(uint32 mapID) const;
188190

189191
rcConfig GetMapSpecificConfig(uint32 mapID, float bmin[3], float bmax[3], const TileConfig &tileConfig) const;

0 commit comments

Comments
 (0)