- Proper fix to get network byte order
authorunc0rr
Tue, 20 Feb 2007 21:33:49 +0000
changeset 467 20d36f976b25
parent 466 bc45a038d47a
child 468 8403d6884707
- Proper fix to get network byte order - Fix some warnings
hedgewars/SDLh.pas
hedgewars/uConsts.pas
--- a/hedgewars/SDLh.pas	Tue Feb 20 21:08:46 2007 +0000
+++ b/hedgewars/SDLh.pas	Tue Feb 20 21:33:49 2007 +0000
@@ -398,54 +398,30 @@
 
 procedure SDLNet_Write16(value: Word; buf: pointer);
 begin
-{$IFDEF LITTLE_ENDIAN}
-  PByteArray(buf)^[0]:= value;
-  PByteArray(buf)^[1]:= value shr 8
-{$ELSE}
   PByteArray(buf)^[1]:= value;
   PByteArray(buf)^[0]:= value shr 8
-{$ENDIF}
 end;
 
 procedure SDLNet_Write32(value: LongWord; buf: pointer);
 begin
-{$IFDEF LITTLE_ENDIAN}
-  PByteArray(buf)^[0]:= value;
-  PByteArray(buf)^[1]:= value shr  8;
-  PByteArray(buf)^[2]:= value shr 16;
-  PByteArray(buf)^[3]:= value shr 24
-{$ELSE}
   PByteArray(buf)^[3]:= value;
   PByteArray(buf)^[2]:= value shr  8;
   PByteArray(buf)^[1]:= value shr 16;
   PByteArray(buf)^[0]:= value shr 24
-{$ENDIF}
 end;
 
 function SDLNet_Read16(buf: pointer): Word;
 begin
-{$IFDEF LITTLE_ENDIAN}
-  SDLNet_Read16:= PByteArray(buf)^[0] or
-                 (PByteArray(buf)^[1] shl 8)
-{$ELSE}
   SDLNet_Read16:= PByteArray(buf)^[1] or
                  (PByteArray(buf)^[0] shl 8)
-{$ENDIF}
 end;
 
 function SDLNet_Read32(buf: pointer): LongWord;
 begin
-{$IFDEF LITTLE_ENDIAN}
-  SDLNet_Read32:=  PByteArray(buf)^[0] or
-                  (PByteArray(buf)^[1] shl  8) or
-                  (PByteArray(buf)^[2] shl 16) or
-                  (PByteArray(buf)^[3] shl 24)
-{$ELSE}
   SDLNet_Read32:=  PByteArray(buf)^[3] or
                   (PByteArray(buf)^[2] shl  8) or
                   (PByteArray(buf)^[1] shl 16) or
                   (PByteArray(buf)^[0] shl 24)
-{$ENDIF}
 end;
 
 end.
--- a/hedgewars/uConsts.pas	Tue Feb 20 21:08:46 2007 +0000
+++ b/hedgewars/uConsts.pas	Tue Feb 20 21:33:49 2007 +0000
@@ -321,16 +321,16 @@
                                        id      : PMixChunk;
                                        lastChan: LongInt;
                                        end = (
-                                       (FileName: 'grenadeimpact.ogg'; Path: ptSounds  ),// sndGrenadeImpact
-                                       (FileName:     'explosion.ogg'; Path: ptSounds  ),// sndExplosion
-                                       (FileName:  'throwpowerup.ogg'; Path: ptSounds  ),// sndThrowPowerUp
-                                       (FileName:  'throwrelease.ogg'; Path: ptSounds  ),// sndThrowRelease
-                                       (FileName:        'splash.ogg'; Path: ptSounds  ),// sndSplash
-                                       (FileName: 'shotgunreload.ogg'; Path: ptSounds  ),// sndShotgunReload
-                                       (FileName:   'shotgunfire.ogg'; Path: ptSounds  ),// sndShotgunFire
-                                       (FileName:   'graveimpact.ogg'; Path: ptSounds  ),// sndGraveImpact
-                                       (FileName:      'minetick.ogg'; Path: ptSounds  ),// sndMineTicks
-                                       (FileName:    'pickhammer.ogg'; Path: ptSounds  ) // sndPickhammer
+                                       (FileName: 'grenadeimpact.ogg'; Path: ptSounds; id: nil; lastChan: 0),// sndGrenadeImpact
+                                       (FileName:     'explosion.ogg'; Path: ptSounds; id: nil; lastChan: 0),// sndExplosion
+                                       (FileName:  'throwpowerup.ogg'; Path: ptSounds; id: nil; lastChan: 0),// sndThrowPowerUp
+                                       (FileName:  'throwrelease.ogg'; Path: ptSounds; id: nil; lastChan: 0),// sndThrowRelease
+                                       (FileName:        'splash.ogg'; Path: ptSounds; id: nil; lastChan: 0),// sndSplash
+                                       (FileName: 'shotgunreload.ogg'; Path: ptSounds; id: nil; lastChan: 0),// sndShotgunReload
+                                       (FileName:   'shotgunfire.ogg'; Path: ptSounds; id: nil; lastChan: 0),// sndShotgunFire
+                                       (FileName:   'graveimpact.ogg'; Path: ptSounds; id: nil; lastChan: 0),// sndGraveImpact
+                                       (FileName:      'minetick.ogg'; Path: ptSounds; id: nil; lastChan: 0),// sndMineTicks
+                                       (FileName:    'pickhammer.ogg'; Path: ptSounds; id: nil; lastChan: 0) // sndPickhammer
                                        );
 
       Ammoz: array [TAmmoType] of record