From: <av...@us...> - 2009-06-30 01:11:34
|
Revision: 3160 http://sc2.svn.sourceforge.net/sc2/?rev=3160&view=rev Author: avolkov Date: 2009-06-30 01:11:27 +0000 (Tue, 30 Jun 2009) Log Message: ----------- Change hardcoded Starbase and Sa-Matra values to pretty enum values; bug #1047; from Nic Modified Paths: -------------- trunk/sc2/ChangeLog trunk/sc2/src/sc2code/planets/calc.c trunk/sc2/src/sc2code/planets/genchmmr.c trunk/sc2/src/sc2code/planets/gensam.c trunk/sc2/src/sc2code/planets/gensol.c trunk/sc2/src/sc2code/planets/gensyr.c trunk/sc2/src/sc2code/planets/plandata.h trunk/sc2/src/sc2code/planets/planets.h trunk/sc2/src/sc2code/planets/solarsys.c trunk/sc2/src/sc2code/uqmdebug.c Modified: trunk/sc2/ChangeLog =================================================================== --- trunk/sc2/ChangeLog 2009-06-30 00:07:20 UTC (rev 3159) +++ trunk/sc2/ChangeLog 2009-06-30 01:11:27 UTC (rev 3160) @@ -1,4 +1,6 @@ Changes towards version 0.7: +- Change hardcoded Starbase and Sa-Matra values to pretty enum values + (bug #1047), from Nic - Load override.cfg from user's dir to add or override menu controls - Alex - Allow addons to override any content by placing zips into their 'shadow-content' dir - Alex Modified: trunk/sc2/src/sc2code/planets/calc.c =================================================================== --- trunk/sc2/src/sc2code/planets/calc.c 2009-06-30 00:07:20 UTC (rev 3159) +++ trunk/sc2/src/sc2code/planets/calc.c 2009-06-30 01:11:27 UTC (rev 3160) @@ -235,8 +235,7 @@ { DWORD old_seed; - /* Earth Starbase */ - if (pPlanetDesc->data_index == (BYTE)~0) + if (pPlanetDesc->data_index == HIERARCHY_STARBASE) return (0); old_seed = TFB_SeedRandom (pPlanetDesc->rand_seed); Modified: trunk/sc2/src/sc2code/planets/genchmmr.c =================================================================== --- trunk/sc2/src/sc2code/planets/genchmmr.c 2009-06-30 00:07:20 UTC (rev 3159) +++ trunk/sc2/src/sc2code/planets/genchmmr.c 2009-06-30 01:11:27 UTC (rev 3160) @@ -41,7 +41,7 @@ COUNT angle; DWORD rand_val; - pSolarSysState->MoonDesc[0].data_index = (BYTE)~0; + pSolarSysState->MoonDesc[0].data_index = HIERARCHY_STARBASE; pSolarSysState->MoonDesc[0].radius = MIN_MOON_RADIUS; rand_val = TFB_Random (); angle = NORMALIZE_ANGLE (LOWORD (rand_val)); Modified: trunk/sc2/src/sc2code/planets/gensam.c =================================================================== --- trunk/sc2/src/sc2code/planets/gensam.c 2009-06-30 00:07:20 UTC (rev 3159) +++ trunk/sc2/src/sc2code/planets/gensam.c 2009-06-30 01:11:27 UTC (rev 3160) @@ -186,7 +186,7 @@ COUNT angle; DWORD rand_val; - pSolarSysState->MoonDesc[0].data_index = (BYTE)(~0 - 1); + pSolarSysState->MoonDesc[0].data_index = SA_MATRA; pSolarSysState->MoonDesc[0].radius = MIN_MOON_RADIUS + (2 * MOON_DELTA); rand_val = TFB_Random (); Modified: trunk/sc2/src/sc2code/planets/gensol.c =================================================================== --- trunk/sc2/src/sc2code/planets/gensol.c 2009-06-30 00:07:20 UTC (rev 3159) +++ trunk/sc2/src/sc2code/planets/gensol.c 2009-06-30 01:11:27 UTC (rev 3160) @@ -462,7 +462,7 @@ COUNT angle; /* Starbase: */ - pSolarSysState->MoonDesc[0].data_index = (BYTE)~0; + pSolarSysState->MoonDesc[0].data_index = HIERARCHY_STARBASE; pSolarSysState->MoonDesc[0].radius = MIN_MOON_RADIUS; angle = HALF_CIRCLE + QUADRANT; pSolarSysState->MoonDesc[0].location.x = Modified: trunk/sc2/src/sc2code/planets/gensyr.c =================================================================== --- trunk/sc2/src/sc2code/planets/gensyr.c 2009-06-30 00:07:20 UTC (rev 3159) +++ trunk/sc2/src/sc2code/planets/gensyr.c 2009-06-30 01:11:27 UTC (rev 3160) @@ -75,7 +75,7 @@ GenerateRandomIP (GENERATE_MOONS); if (pSolarSysState->pBaseDesc == &pSolarSysState->PlanetDesc[0]) { - pSolarSysState->MoonDesc[0].data_index = (BYTE)~0; + pSolarSysState->MoonDesc[0].data_index = HIERARCHY_STARBASE; pSolarSysState->MoonDesc[0].radius = MIN_MOON_RADIUS; pSolarSysState->MoonDesc[0].location.x = COSINE (QUADRANT, pSolarSysState->MoonDesc[0].radius); Modified: trunk/sc2/src/sc2code/planets/plandata.h =================================================================== --- trunk/sc2/src/sc2code/planets/plandata.h 2009-06-30 00:07:20 UTC (rev 3159) +++ trunk/sc2/src/sc2code/planets/plandata.h 2009-06-30 01:11:27 UTC (rev 3160) @@ -180,7 +180,13 @@ YEL_GAS_GIANT, LAST_GAS_GIANT = YEL_GAS_GIANT, - NUMBER_OF_PLANET_TYPES + NUMBER_OF_PLANET_TYPES, + + WORLD_TYPE_SPECIAL = 0x80, + PLANET_SHIELDED = WORLD_TYPE_SPECIAL, + + HIERARCHY_STARBASE = 127 | WORLD_TYPE_SPECIAL, + SA_MATRA = 126 | WORLD_TYPE_SPECIAL, }; #define NUMBER_OF_SMALL_ROCKY_WORLDS (LAST_SMALL_ROCKY_WORLD - FIRST_SMALL_ROCKY_WORLD + 1) Modified: trunk/sc2/src/sc2code/planets/planets.h =================================================================== --- trunk/sc2/src/sc2code/planets/planets.h 2009-06-30 00:07:20 UTC (rev 3159) +++ trunk/sc2/src/sc2code/planets/planets.h 2009-06-30 01:11:27 UTC (rev 3160) @@ -113,8 +113,6 @@ #define MIN_MOON_RADIUS 35 #define MOON_DELTA 20 -#define PLANET_SHIELDED (1 << 7) - typedef struct planet_desc { DWORD rand_seed; Modified: trunk/sc2/src/sc2code/planets/solarsys.c =================================================================== --- trunk/sc2/src/sc2code/planets/solarsys.c 2009-06-30 00:07:20 UTC (rev 3159) +++ trunk/sc2/src/sc2code/planets/solarsys.c 2009-06-30 01:11:27 UTC (rev 3160) @@ -152,15 +152,13 @@ pMoonDesc->temp_color = pCurDesc->temp_color; data_index = pMoonDesc->data_index; - if (data_index == (BYTE)~0) + if (data_index == HIERARCHY_STARBASE) { - /* Starbase */ pMoonDesc->image.frame = SetAbsFrameIndex (SpaceJunkFrame, 16); } - else if (data_index == (BYTE)(~0 - 1)) + else if (data_index == SA_MATRA) { - /* Sa-Matra */ pMoonDesc->image.frame = SetAbsFrameIndex (SpaceJunkFrame, 19); } Modified: trunk/sc2/src/sc2code/uqmdebug.c =================================================================== --- trunk/sc2/src/sc2code/uqmdebug.c 2009-06-30 00:07:20 UTC (rev 3159) +++ trunk/sc2/src/sc2code/uqmdebug.c 2009-06-30 01:11:27 UTC (rev 3160) @@ -991,11 +991,11 @@ { const char *typeStr; - if (moon->data_index == (BYTE) ~0) + if (moon->data_index == HIERARCHY_STARBASE) { typeStr = "StarBase"; } - else if (moon->data_index == (BYTE) (~0 - 1)) + else if (moon->data_index == SA_MATRA) { typeStr = "Sa-Matra"; } @@ -1014,13 +1014,11 @@ { PLANET_INFO *info; - if (world->data_index == (BYTE) ~0) { - // StarBase + if (world->data_index == HIERARCHY_STARBASE) { return; } - if (world->data_index == (BYTE)(~0 - 1)) { - // Sa-Matra + if (world->data_index == SA_MATRA) { return; } @@ -1240,13 +1238,11 @@ static void tallyResourcesWorld (TallyResourcesArg *arg, const PLANET_DESC *world) { - if (world->data_index == (BYTE) ~0) { - // StarBase + if (world->data_index == HIERARCHY_STARBASE) { return; } - if (world->data_index == (BYTE)(~0 - 1)) { - // Sa-Matra + if (world->data_index == SA_MATRA) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |