Commits

Gennady Trafimenkov committed e5b9049

Fix warnings produced by Visual Studio 10 Express

  • Participants
  • Parent commits f8f70b6

Comments (0)

Files changed (16)

 #include "GameRes.h"
 
 #include <locale.h>
+#include <stdexcept>
 
 #include "Directories.h"
 #include "LibraryDataBase.h"
 #include "TranslationTable.h"
 #include "GameState.h"
 #include "EncodingCorrectors.h"
+#include "StrUtils.h"
 
 
 extern LanguageRes g_LanguageResDutch;
     }
   }
 
-  abort();
+  throw std::runtime_error(FormattedString("Multilanguage resource %d is not found", id));
 }

Build/Strategic/Map_Screen_Interface.cc

 
 // the list of soldiers that are moving
 static SOLDIERTYPE* pSoldierMovingList[MAX_CHARACTER_COUNT];
-static BOOLEAN      fSoldierIsMoving[MAX_CHARACTER_COUNT];
+static bool         fSoldierIsMoving[MAX_CHARACTER_COUNT];
 
 static SOLDIERTYPE* pUpdateSoldierBox[SIZE_OF_UPDATE_BOX];
 
 	{
 		if (pSoldierMovingList[i] != &s) continue;
 		// Turn the selected soldier on
-		fSoldierIsMoving[i] = TRUE;
+		fSoldierIsMoving[i] = true;
 		break;
 	}
 }
 	{
 		if (pSoldierMovingList[i] != &s) continue;
 		// Turn the selected soldier off
-		fSoldierIsMoving[i] = FALSE;
+		fSoldierIsMoving[i] = false;
 		break;
 	}
 }
 		if (slot) continue;
 		// Found a free slot
 		slot                = &s;
-		fSoldierIsMoving[i] = FALSE;
+		fSoldierIsMoving[i] = false;
 		++giNumberOfSoldiersInSectorMoving;
 		return;
 	}
 	for (INT32 i = 0; i != MAX_CHARACTER_COUNT; ++i)
 	{
 		pSoldierMovingList[i] = 0;
-		fSoldierIsMoving[i]   = FALSE;
+		fSoldierIsMoving[i]   = false;
 	}
 
 	// Init the squads
 		{
 			if ( CanMoveBoxSoldierMoveStrategically( pSoldierMovingList[ iCounter ], FALSE ) )
 			{
-				fSoldierIsMoving[ iCounter ] = TRUE;
+				fSoldierIsMoving[ iCounter ] = true;
 			}
 			else
 			{
 	{
 		if( ( pSoldierMovingList[ iCounter ] ->bAssignment >= ON_DUTY ) && ( pSoldierMovingList[ iCounter ] ->bAssignment != VEHICLE ) )
 		{
-			fSoldierIsMoving[ iCounter ] = FALSE;
+			fSoldierIsMoving[ iCounter ] = false;
 		}
 	}
 }

Build/Strategic/PreBattle_Interface.cc

 //The height of each row
 #define ROW_HEIGHT				10
 
-BOOLEAN gfDisplayPotentialRetreatPaths = FALSE;
+bool gfDisplayPotentialRetreatPaths = false;
 
 GROUP *gpBattleGroup = NULL;
 
 		// Reset the help text for mouse regions
 		gMapStatusBarsRegion.SetFastHelpText(L"");
 
-		gfDisplayPotentialRetreatPaths = FALSE;
+		gfDisplayPotentialRetreatPaths = false;
 
 		gpBattleGroup = battle_group;
 
 	fTeamPanelDirty = TRUE;
 	fMapScreenBottomDirty = TRUE;
 	fCharacterInfoPanelDirty = TRUE;
-	gfDisplayPotentialRetreatPaths = FALSE;
+	gfDisplayPotentialRetreatPaths = false;
 
 	//Enable the options button when the auto resolve  screen comes up
 	EnableDisAbleMapScreenOptionsButton( TRUE );

Build/Strategic/PreBattle_Interface.h

 void RenderPreBattleInterface(void);
 
 extern BOOLEAN gfPreBattleInterfaceActive;
-extern BOOLEAN gfDisplayPotentialRetreatPaths;
+extern bool    gfDisplayPotentialRetreatPaths;
 extern BOOLEAN gfAutomaticallyStartAutoResolve;
 extern BOOLEAN fDisableMapInterfaceDueToBattle;
 

Build/Tactical/Interface_Items.cc

 		return( fFound );
 	}
 
-	if ( (! Item[ pTestObject->usItem ].fFlags & ITEM_HIDDEN_ADDON) )
+	if ( !(Item[ pTestObject->usItem ].fFlags & ITEM_HIDDEN_ADDON) )
 	{
 		// First test attachments, which almost any type of item can have....
 		for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ )

Build/Tactical/OppList.cc

 	CFOR_EACH_IN_TEAM(i, CREATURE_TEAM)
 	{
 		SOLDIERTYPE const& tgt = *i;
-		if (!tgt.uiStatusFlags & SOLDIER_MONSTER) continue;
+		if (!(tgt.uiStatusFlags & SOLDIER_MONSTER)) continue;
 		if (!s.bOppList[tgt.ubID])                continue;
 		return true;
 	}

Build/Tactical/Overhead.cc

 
 								static const float gdRadiansForAngle[] =
 								{
-									PI,
-									PI * 3 / 4,
-									PI     / 2,
-									PI     / 4,
+									(float)PI,
+									(float)(PI * 3 / 4),
+									(float)(PI     / 2),
+									(float)(PI     / 4),
 
 									0,
-									-PI     / 4,
-									-PI     / 2,
-									-PI * 3 / 4,
+									(float)(-PI     / 4),
+									(float)(-PI     / 2),
+									(float)(-PI * 3 / 4),
 								};
 								const float dAngle = gdRadiansForAngle[pSoldier->bMovementDirection];
 

Build/Tactical/PathAI.cc

      }
 
 		// FIRST, add up "startup" additional costs - such as intermediate animations, etc.
-		switch(pSold->usAnimState)
+		// switch(pSold->usAnimState)
 		{
 			//case START_AID   :
 			//case GIVING_AID  :	sAnimCost = AP_STOP_FIRST_AID;

Build/Tactical/Points.cc

 
 	// Make sure the guy's actually got a throwable item in his hand
 	UINT16 const in_hand = s.inv[HANDPOS].usItem;
-	if (!Item[in_hand].usItemClass & IC_GRENADE)
+	if (!(Item[in_hand].usItemClass & IC_GRENADE))
 	{
 #ifdef JA2TESTVERSION
 		ScreenMsg(MSG_FONT_YELLOW, MSG_DEBUG, L"MinAPsToThrow - Called when in-hand item is %s", in_hand);

Build/TacticalAI/AIUtils.cc

 	{
 		if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bAlertStatus == STATUS_RED )
 		{
-			switch( pSoldier->bAction )
+			// switch( pSoldier->bAction )
 			{
 				/*
 				case AI_ACTION_MOVE_TO_CLIMB:
 					pSoldier->usUIMovementMode = DetermineMovementMode( pSoldier, pSoldier->bAction );
 					fSet = TRUE;
 					break;*/
-				default:
+				// default:
 					if ( PreRandom( 5 - SoldierDifficultyLevel( pSoldier ) ) == 0 )
 					{
 						INT16 sClosestNoise = (INT16) MostImportantNoiseHeard( pSoldier, NULL, NULL, NULL );
 						pSoldier->usUIMovementMode = DetermineMovementMode( pSoldier, pSoldier->bAction );
 						fSet = TRUE;
 					}
-					break;
+					// break;
 			}
 
 		}

Build/TileEngine/Physics.cc

 	o->InitialForce.x          = SCALE_VERT_VAL_TO_HORZ(xForce);
 	o->InitialForce.y          = SCALE_VERT_VAL_TO_HORZ(yForce);
 	o->InitialForce.z          = zForce;
-	o->InitialForce            = VMultScalar(&o->InitialForce, 1.5 / TIME_MULTI);
+	o->InitialForce            = VMultScalar(&o->InitialForce, (float)(1.5 / TIME_MULTI));
 	o->sGridNo                 = MAPROWCOLTOPOS(((INT16)yPos / CELL_Y_SIZE), ((INT16)xPos / CELL_X_SIZE));
 	o->pNode                   = 0;
 	o->pShadow                 = 0;

sgp/Button_System.cc

 	}
 
 	bool    StateBefore = b->Clicked();
-	BOOLEAN StateAfter  = TRUE; // XXX HACK000E
+	bool    StateAfter  = true; // XXX HACK000E
 
 	if (b->uiFlags & BUTTON_NEWTOGGLE)
 	{

sgp/LibraryDataBase.cc

 
 		// check to see if the file is not longer than it should be
 		if (strlen(DirEntry.sFileName) + 1 >= FILENAME_SIZE)
+    {
 			FastDebugMsg(String("\n*******InitializeLibrary():  Warning!:  '%s' from the library '%s' has name whose size (%d) is bigger then it should be (%s)", DirEntry.sFileName, lib->sLibraryPath, strlen(DirEntry.sFileName) + 1, FILENAME_SIZE));
+    }
 
 		FileHeaderStruct* const fh = &fhs[used_entries++];
 
 static int CompareDirEntryFileNames(const void* key, const void* member);
 
 
+#if 1 // XXX TODO UNIMPLEMENTED
+#else
 BOOLEAN GetLibraryFileTime(LibraryFile const* const f, SGP_FILETIME* const pLastWriteTime)
 try
 {
-#if 1 // XXX TODO
-	UNIMPLEMENTED
-#else
 	LibraryHeaderStruct const* const lib = f->lib;
 	if (!lib) return FALSE;
 
 	pAllEntries = NULL;
 
 	return( TRUE );
-#endif
 }
 catch (...) { return FALSE; }
+#endif
 
 
 static int CompareDirEntryFileNames(const void* key, const void* member)

sgp/LibraryDataBase.h

 BOOLEAN LoadDataFromLibrary(LibraryFile*, void* pData, UINT32 uiBytesToRead);
 BOOLEAN LibraryFileSeek(LibraryFile*, INT32 distance, FileSeekMode);
 
+#if 0
 BOOLEAN GetLibraryFileTime(LibraryFile const*, SGP_FILETIME* pLastWriteTime);
+#endif
 
 #endif
 UINT16 IntensityTable[65536];
 UINT16 ShadeTable[65536];
 UINT16 White16BPPPalette[256];
-static float guiShadePercent = 0.48;
+static float guiShadePercent = 0.48f;
 
 
 /* Builds a 16-bit color shading table. This function should be called only
 SGPVObject::SGPVObject(SGPImage const* const img) :
 	flags_(),
 	palette16_(),
-	pShades(),
 	current_shade_(),
 	ppZStripInfo(),
 #ifdef SGP_VIDEO_DEBUGGING
 #endif
 	next_(gpVObjectHead)
 {
+  memset(&pShades[0], 0, sizeof(pShades));
+
 	if (!(img->fFlags & IMAGE_TRLECOMPRESSED))
 	{
 		throw std::runtime_error("Image for video object creation must be TRLE compressed");