src/game/TileEngine/SaveLoadMap.cc
FOR_EACH_STRUCTURE(pCurrent, cnt, STRUCTURE_BASE_TILE)
			{
				//if the structure has been damaged
				if( pCurrent->ubHitPoints < pCurrent->pDBStructureRef->pDBStructure->ubHitPoints )
				{
					UINT8	ubBitToSet = 0x80;
					UINT8	ubLevel=0;

					if( pCurrent->sCubeOffset != 0 )
						ubLevel |= ubBitToSet;

					Map = MODIFY_MAP{};

					// Save the Damaged value
					Map.usGridNo	= cnt;
//					Map.usIndex			= StructureFlagToType( pCurrent->fFlags ) | ( pCurrent->ubHitPoints << 8 );
					Map.usImageType = StructureFlagToType( pCurrent->fFlags );
					Map.usSubImageIndex = pCurrent->ubHitPoints;


					Map.ubType			= SLM_DAMAGED_STRUCT;
					Map.ubExtra			= pCurrent->ubWallOrientation | ubLevel;

					//Save the change to the map file
					SaveModifiedMapStructToMapTempFile(&Map, *tempFile);
				}
			}
//loop through all the structures and add all that are damaged
loop through all the structures and add all that are damaged
loop through all the structures and add all that are damaged
FOR_EACH_STRUCTURE(pCurrent, cnt, STRUCTURE_BASE_TILE)
			{
				if( pCurrent->ubHitPoints < pCurrent->pDBStructureRef->pDBStructure->ubHitPoints )
				{
					UINT8	ubBitToSet = 0x80;
					UINT8	ubLevel=0;
					if( pCurrent->sCubeOffset != 0 )
						ubLevel |= ubBitToSet;
					Map = MODIFY_MAP{};
					Map.usGridNo	= cnt;
					Map.usImageType = StructureFlagToType( pCurrent->fFlags );
					Map.usSubImageIndex = pCurrent->ubHitPoints;
					Map.ubType			= SLM_DAMAGED_STRUCT;
					Map.ubExtra			= pCurrent->ubWallOrientation | ubLevel;
					SaveModifiedMapStructToMapTempFile(&Map, *tempFile);
				}
			}
FOR_EACH_STRUCTURE ( pCurrent , cnt , STRUCTURE_BASE_TILE ) { if ( pCurrent -> ubHitPoints < pCurrent -> pDBStructureRef -> pDBStructure -> ubHitPoints ) { UINT8 ubBitToSet = 0x80 ; UINT8 ubLevel = 0 ; if ( pCurrent -> sCubeOffset != 0 ) ubLevel |= ubBitToSet ; Map = MODIFY_MAP { } ; Map . usGridNo = cnt ; Map . usImageType = StructureFlagToType ( pCurrent -> fFlags ) ; Map . usSubImageIndex = pCurrent -> ubHitPoints ; Map . ubType = SLM_DAMAGED_STRUCT ; Map . ubExtra = pCurrent -> ubWallOrientation | ubLevel ; SaveModifiedMapStructToMapTempFile ( & Map , * tempFile ) ; } }
loop through all the structures and add all that are damaged
loop through all the structures and add all that are damaged
//if the structure has been damaged // Save the Damaged value //					Map.usIndex			= StructureFlagToType( pCurrent->fFlags ) | ( pCurrent->ubHitPoints << 8 ); //Save the change to the map file