merge with trunk (sound fade tweak, iOS changes) 0.9.17
authornemo
Mon, 14 Nov 2011 13:14:32 -0500
branch0.9.17
changeset 6372 b392132a588c
parent 6371 c6f73d8e87e2 (current diff)
parent 6367 a7fbf18b2d55 (diff)
child 6373 67de1f88d8f9
child 6375 fcea0c053bc1
merge with trunk (sound fade tweak, iOS changes)
--- a/hedgewars/uSound.pas	Mon Nov 14 13:13:38 2011 -0500
+++ b/hedgewars/uSound.pas	Mon Nov 14 13:14:32 2011 -0500
@@ -307,7 +307,7 @@
     if (not isSoundEnabled) or fastUntilLag or ((LastVoice.snd = snd) and  (LastVoice.voicepack = voicepack)) then exit;
     if (snd = sndVictory) or (snd = sndFlawless) then
         begin
-        Mix_HaltChannel(-1);
+        Mix_FadeOutChannel(-1, 800);
         for i:= 0 to 7 do VoiceList[i].snd:= sndNone;
         LastVoice.snd:= sndNone;
         end;
--- a/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.h	Mon Nov 14 13:13:38 2011 -0500
+++ b/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.h	Mon Nov 14 13:14:32 2011 -0500
@@ -24,13 +24,13 @@
 
 
 @interface EngineProtocolNetwork : NSObject {
-    NSArray *statsArray;
+    NSMutableArray *statsArray;
     NSOutputStream *stream;
     TCPsocket csd;
     NSInteger enginePort;
 }
 
-@property (nonatomic,assign) NSArray *statsArray;
+@property (nonatomic,assign) NSMutableArray *statsArray;
 @property (nonatomic,retain) NSOutputStream *stream;
 @property (assign) TCPsocket csd;
 @property (assign) NSInteger enginePort;
--- a/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m	Mon Nov 14 13:13:38 2011 -0500
+++ b/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m	Mon Nov 14 13:14:32 2011 -0500
@@ -222,7 +222,6 @@
 -(void) engineProtocol:(id) object {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     NSDictionary *gameConfig = (NSDictionary *)object;
-    NSMutableArray *tempStats = nil;
     TCPsocket sd;
     IPaddress ip;
     int eProto;
@@ -337,10 +336,10 @@
                 }
                 break;
             case 'i':
-                if (tempStats == nil) {
-                    tempStats = [[NSMutableArray alloc] initWithCapacity:10 - 2];
+                if (self.statsArray == nil) {
+                    self.statsArray = [[NSMutableArray alloc] initWithCapacity:10 - 2];
                     NSMutableArray *ranking = [[NSMutableArray alloc] initWithCapacity:4];
-                    [tempStats insertObject:ranking atIndex:0];
+                    [self.statsArray insertObject:ranking atIndex:0];
                     [ranking release];
                 }
                 NSString *tempStr = [NSString stringWithUTF8String:&buffer[2]];
@@ -349,16 +348,16 @@
                 int index = [arg length] + 3;
                 switch (buffer[1]) {
                     case 'r':           // winning team
-                        [tempStats insertObject:[NSString stringWithUTF8String:&buffer[2]] atIndex:1];
+                        [self.statsArray insertObject:[NSString stringWithUTF8String:&buffer[2]] atIndex:1];
                         break;
                     case 'D':           // best shot
-                        [tempStats addObject:[NSString stringWithFormat:@"The best shot award won by %s (with %@ points)", &buffer[index], arg]];
+                        [self.statsArray addObject:[NSString stringWithFormat:@"The best shot award won by %s (with %@ points)", &buffer[index], arg]];
                         break;
                     case 'k':           // best hedgehog
-                        [tempStats addObject:[NSString stringWithFormat:@"The best killer is %s with %@ kills in a turn", &buffer[index], arg]];
+                        [self.statsArray addObject:[NSString stringWithFormat:@"The best killer is %s with %@ kill(s) in a turn", &buffer[index], arg]];
                         break;
                     case 'K':           // number of hogs killed
-                        [tempStats addObject:[NSString stringWithFormat:@"%@ hedgehog(s) were killed during this round", arg]];
+                        [self.statsArray addObject:[NSString stringWithFormat:@"%@ hedgehog(s) were killed during this round", arg]];
                         break;
                     case 'H':           // team health/graph
                         break;
@@ -366,16 +365,16 @@
                         // still WIP in statsPage.cpp
                         break;
                     case 'P':           // teams ranking
-                        [[tempStats objectAtIndex:0] addObject:tempStr];
+                        [[self.statsArray objectAtIndex:0] addObject:tempStr];
                         break;
                     case 's':           // self damage
-                        [tempStats addObject:[NSString stringWithFormat:@"%s thought it's good to shoot his own hedgehogs with %@ points", &buffer[index], arg]];
+                        [self.statsArray addObject:[NSString stringWithFormat:@"%s thought it's good to shoot his own hedgehogs with %@ points", &buffer[index], arg]];
                         break;
                     case 'S':           // friendly fire
-                        [tempStats addObject:[NSString stringWithFormat:@"%s killed %@ of his own hedgehogs", &buffer[index], arg]];
+                        [self.statsArray addObject:[NSString stringWithFormat:@"%s killed %@ of his own hedgehogs", &buffer[index], arg]];
                         break;
                     case 'B':           // turn skipped
-                        [tempStats addObject:[NSString stringWithFormat:@"%s was scared and skipped turn %@ times", &buffer[index], arg]];
+                        [self.statsArray addObject:[NSString stringWithFormat:@"%s was scared and skipped turn %@ times", &buffer[index], arg]];
                         break;
                     default:
                         DLog(@"Unhandled stat message, see statsPage.cpp");
@@ -385,7 +384,6 @@
             case 'q':
                 // game ended and match finished, statsArray is full of delicious statistics
                 [HWUtils setGameStatus:gsEnded];
-                self.statsArray = [[NSArray arrayWithArray:tempStats] retain];
                 // closing connection here would trigger a "IPC connection lost" error, so we have to wait until recv fails
                 break;
             case 'Q':
@@ -402,7 +400,6 @@
 
     [self.stream close];
     [self.stream release];
-    [tempStats release];
 
     // Close the client socket
     SDLNet_TCP_Close(csd);
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Mon Nov 14 13:13:38 2011 -0500
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Mon Nov 14 13:14:32 2011 -0500
@@ -89,8 +89,8 @@
     [[OverlayViewController mainOverlay] removeOverlay];
 
     // engine thread *should* be done by now
-    NSArray *stats = self.proto.statsArray;
-    if (stats != nil) {
+    NSArray *stats = [[NSArray alloc] initWithArray:self.proto.statsArray copyItems:YES];
+    if ([HWUtils gameStatus] == gsEnded && stats != nil) {
         StatsPageViewController *statsPage = [[StatsPageViewController alloc] initWithStyle:UITableViewStyleGrouped];
         statsPage.statsArray = stats;
         statsPage.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
@@ -100,7 +100,7 @@
         [callingController presentModalViewController:statsPage animated:YES];
         [statsPage release];
     }
-    [stats release];    // we retained the array before
+    [stats release];
 
     // can remove the savefile if the replay has ended
     if ([HWUtils gameType] == gtSave)