diff --git a/src/design.cpp b/src/design.cpp index c69e0676bc1..d74be3613d5 100644 --- a/src/design.cpp +++ b/src/design.cpp @@ -1295,9 +1295,6 @@ intChooseSystemStats( DROID_TEMPLATE *psTemplate ) return psStats; } -/* set SHOWTEMPLATENAME to 0 to show template components in edit box */ -#define SHOWTEMPLATENAME 0 - const char *GetDefaultTemplateName(DROID_TEMPLATE *psTemplate) { // NOTE: At this time, savegames can support a max of 60. We are using WIDG_MAXSTR (currently 80 )for display @@ -1310,7 +1307,8 @@ const char *GetDefaultTemplateName(DROID_TEMPLATE *psTemplate) */ if(psTemplate->droidType == DROID_TRANSPORTER) { - return _("Transport"); + sstrcpy(aCurrName, _("Transport")); + return aCurrName; } /* @@ -1336,7 +1334,7 @@ const char *GetDefaultTemplateName(DROID_TEMPLATE *psTemplate) } compIndex = psTemplate->asParts[COMP_BODY]; - ASSERT_OR_RETURN( NULL, compIndex < numBodyStats, "Invalid range referenced for numBodyStats, %d > %d", compIndex, numBodyStats); + ASSERT_OR_RETURN("", compIndex < numBodyStats, "Invalid range referenced for numBodyStats, %d > %d", compIndex, numBodyStats); psStats = (COMPONENT_STATS *) (asBodyStats + compIndex); if ( psTemplate->asParts[COMP_BODY] != 0 ) { @@ -1353,7 +1351,7 @@ const char *GetDefaultTemplateName(DROID_TEMPLATE *psTemplate) } compIndex = psTemplate->asParts[COMP_PROPULSION]; - ASSERT_OR_RETURN( NULL, compIndex < numPropulsionStats, "Invalid range referenced for numPropulsionStats, %d > %d", compIndex, numPropulsionStats); + ASSERT_OR_RETURN("", compIndex < numPropulsionStats, "Invalid range referenced for numPropulsionStats, %d > %d", compIndex, numPropulsionStats); psStats = (COMPONENT_STATS *) (asPropulsionStats + compIndex); if ( psTemplate->asParts[COMP_PROPULSION] != 0 ) { @@ -1371,13 +1369,8 @@ const char *GetDefaultTemplateName(DROID_TEMPLATE *psTemplate) return aCurrName; } - static void intSetEditBoxTextFromTemplate( DROID_TEMPLATE *psTemplate ) { -#if SHOWTEMPLATENAME - widgSetString(psWScreen, IDDES_NAMEBOX, getStatName(psTemplate)); -#else - sstrcpy(aCurrName, ""); /* show component names if default template else show stat name */ @@ -1387,11 +1380,10 @@ static void intSetEditBoxTextFromTemplate( DROID_TEMPLATE *psTemplate ) } else { - sstrcpy(aCurrName, GetDefaultTemplateName(psTemplate)); + GetDefaultTemplateName(psTemplate); // sets aCurrName } widgSetString(psWScreen, IDDES_NAMEBOX, aCurrName); -#endif } /* Set all the design bar graphs from a design template */ diff --git a/src/display.cpp b/src/display.cpp index 7f60cd1d1eb..cfec95c48a7 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -1431,8 +1431,6 @@ UDWORD dispX,dispY,dispR; return(psReturn); } -UWORD lastangle; // debugging only - // Dummy structure stats used for positioning delivery points. static STRUCTURE_STATS ReposStats; static BOOL ReposValid = false; diff --git a/src/game.cpp b/src/game.cpp index 9bb8e2d4192..3c490e619ed 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -11662,33 +11662,7 @@ static void plotFeature(char *backDropSprite) //increment to the start of the data pFileData += FEATURE_HEADER_SIZE; - // Check the file version - if (psHeader->version <= VERSION_19) - { - if (psHeader->version < VERSION_14) - { - // most (all?) maps use revision 8 - sizeOfSaveFeature = sizeof(SAVE_FEATURE_V2); - psSaveFeature = (SAVE_FEATURE_V2*) pFileData; - } - else - { - // supposedly, All versions up to 19 are compatible with SAVE_STRUCTURE_V2 - // so this isn't needed. Adding check just in case. - //sizeOfSaveFeature = sizeof(SAVE_FEATURE_V14); - //psSaveFeatureV14 = (SAVE_FEATURE_V14*) pFileData; - debug(LOG_ERROR, "Please make a new ticket and upload %s to wz2100.net. This map (>14) is not supported at this time.", psLevel->apDataFiles[0]); - return; - } - } - else - { - // AFAIK, at this time, nothing uses this size. - //sizeOfSaveFeature = sizeof(SAVE_FEATURE); - //psSaveFeature = (SAVE_FEATURE*) pFileData; - debug(LOG_ERROR, "Please make a new ticket and upload %s to wz2100.net. This map (>19) is not supported at this time.", psLevel->apDataFiles[0]); - return; - } + sizeOfSaveFeature = sizeof(SAVE_FEATURE_V2); if ((sizeOfSaveFeature * psHeader->quantity + FEATURE_HEADER_SIZE) > fileSize) { @@ -11700,7 +11674,7 @@ static void plotFeature(char *backDropSprite) for (count = 0; count < psHeader->quantity; count++, pFileData += sizeOfSaveFeature) { // All versions up to 19 are compatible with V2. - memcpy(psSaveFeature, pFileData, sizeof(SAVE_STRUCTURE_V2)); + psSaveFeature = (SAVE_FEATURE_V2*) pFileData; // we only care about oil if (strncmp(psSaveFeature->name, "OilResource", 11) == 0) @@ -11722,4 +11696,3 @@ static void plotFeature(char *backDropSprite) backDropSprite[3 * ((yy * BACKDROP_HACK_WIDTH) + xx) + 2] = color.byte.b; } } - diff --git a/src/projectile.cpp b/src/projectile.cpp index 9f96fae3149..633ab447a93 100644 --- a/src/projectile.cpp +++ b/src/projectile.cpp @@ -385,13 +385,14 @@ bool proj_SendProjectile(WEAPON *psWeap, SIMPLE_OBJECT *psAttacker, int player, bool proj_SendProjectileAngled(WEAPON *psWeap, SIMPLE_OBJECT *psAttacker, int player, Vector3i target, BASE_OBJECT *psTarget, bool bVisible, int weapon_slot, int min_angle) { - PROJECTILE * psProj = new PROJECTILE(ProjectileTrackerID |(gameTime2 >>4), player); WEAPON_STATS *psStats = &asWeaponStats[psWeap->nStat]; ASSERT_OR_RETURN( false, psWeap->nStat < numWeaponStats, "Invalid range referenced for numWeaponStats, %d > %d", psWeap->nStat, numWeaponStats); ASSERT_OR_RETURN( false, psStats != NULL, "Invalid weapon stats" ); ASSERT_OR_RETURN( false, psTarget == NULL || !psTarget->died, "Aiming at dead target!" ); + PROJECTILE *psProj = new PROJECTILE(ProjectileTrackerID | (realTime >> 4), player); + /* get muzzle offset */ if (psAttacker == NULL) {