Browse Source

Added const support to mob race2 db

Lemongrass3110 9 years ago
parent
commit
2534588af6
3 changed files with 28 additions and 23 deletions
  1. 10 10
      db/pre-re/mob_race2_db.txt
  2. 12 12
      db/re/mob_race2_db.txt
  3. 6 1
      src/map/mob.c

+ 10 - 10
db/pre-re/mob_race2_db.txt

@@ -1,23 +1,23 @@
 // Monster Racial Groups Database
 //
 // Structure of Database:
-// Race2ID,MobID1,MobID2,MobID3,...,MobID50
+// Race2ID,MobID1,MobID2,MobID3,...,MobID100
 
 // Goblins
-1,1122,1123,1124,1125,1126,1258,1299
+RC2_GOBLIN,1122,1123,1124,1125,1126,1258,1299
 // Kobolds
-2,1133,1134,1135,1282,1296
+RC2_KOBOLD,1133,1134,1135,1282,1296
 // Orcs
-3,1023,1152,1153,1189,1213,1273
+RC2_ORC,1023,1152,1153,1189,1213,1273
 // Golems
-4,1040,1278,1366,1497,2024
+RC2_GOLEM,1040,1278,1366,1497,2024
 // Guardians
-5,1285,1286,1287,2081
+RC2_GUARDIAN,1285,1286,1287,2081
 // Ninja Classes (Pirate's_Pride)
-6,1315,1364,1401,1560
+RC2_NINJA,1315,1364,1401,1560
 // GvG
-7,1143,1905,1906,1907
+RC2_GVG,1143,1905,1906,1907
 // Battlefield
-8,1906,1909,1914,1915
+RC2_BATTLEFIELD,1906,1909,1914,1915
 // Treasure Chests
-9,1324,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1938,1939,1940,1941,1942,1943,1944,1945,1946
+RC2_TREASURE,1324,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1938,1939,1940,1941,1942,1943,1944,1945,1946

+ 12 - 12
db/re/mob_race2_db.txt

@@ -4,27 +4,27 @@
 // Race2ID,MobID1,MobID2,MobID3,...,MobID100
 
 // Goblins
-1,1122,1123,1124,1125,1126,1258,1299
+RC2_GOBLIN,1122,1123,1124,1125,1126,1258,1299
 // Kobolds
-2,1133,1134,1135,1282,1296
+RC2_KOBOLD,1133,1134,1135,1282,1296
 // Orcs
-3,1023,1152,1153,1189,1213,1273
+RC2_ORC,1023,1152,1153,1189,1213,1273
 // Golems
-4,1040,1278,1366,1497,2024
+RC2_GOLEM,1040,1278,1366,1497,2024
 // Guardians
-5,1285,1286,1287,2081
+RC2_GUARDIAN,1285,1286,1287,2081
 // Ninja Classes (Pirate's_Pride)
-6,1315,1364,1401,1560
+RC2_NINJA,1315,1364,1401,1560
 // GvG
-7,1143,1905,1906,1907
+RC2_GVG,1143,1905,1906,1907
 // Battlefield
-8,1906,1909,1914,1915
+RC2_BATTLEFIELD,1906,1909,1914,1915
 // Treasure Chests
-9,1324,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1938,1939,1940,1941,1942,1943,1944,1945,1946
+RC2_TREASURE,1324,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1938,1939,1940,1941,1942,1943,1944,1945,1946
 // Bio Labs
 // TODO : Monsters in lhz_dun_n not implemented yet. [secretdataz]
-10,1634,1635,1636,1637,1638,1639,1640,1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,1656,1657,1658,1659,1660,1661,1662,1663,2221,2222,2223,2224,2225,2226,2227,2228,2229,2230,2231,2232,2233,2234,2235,2236,2237,2238,2239,2240,2241
+RC2_BIOLAB,1634,1635,1636,1637,1638,1639,1640,1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,1656,1657,1658,1659,1660,1661,1662,1663,2221,2222,2223,2224,2225,2226,2227,2228,2229,2230,2231,2232,2233,2234,2235,2236,2237,2238,2239,2240,2241
 // Manuk
-11,1986,1987,1988,1989,1990,1997,1998,1999
+RC2_MANUK,1986,1987,1988,1989,1990,1997,1998,1999
 // Splendide
-12,1991,1992,1993,1994,1995
+RC2_SPLENDIDE,1991,1992,1993,1994,1995

+ 6 - 1
src/map/mob.c

@@ -4568,7 +4568,12 @@ static bool mob_readdb_race2(char* fields[], int columns, int current)
 {
 	int race, i;
 
-	race = atoi(fields[0]);
+	if( ISDIGIT(fields[0][0]) )
+		race = atoi(fields[0]);
+	else if( !script_get_constant( fields[0], &race ) ){
+		ShowWarning("mob_readdb_race2: Unknown race2 constant \"%s\".\n", fields[0]);
+		return false;
+	}
 
 	if (!CHK_RACE2(race)) {
 		ShowWarning("mob_readdb_race2: Unknown race2 %d.\n", race);