merge
authorkoda
Mon, 11 Oct 2010 21:45:25 +0200
changeset 3966 cbec77b5f706
parent 3952 d6412423da45 (diff)
parent 3965 09eea558ba83 (current diff)
child 3967 5b9bc77acd04
merge
hedgewars/uAmmos.pas
hedgewars/uTeams.pas
hedgewars/uWorld.pas
--- a/hedgewars/PascalExports.pas	Mon Oct 11 14:55:13 2010 -0400
+++ b/hedgewars/PascalExports.pas	Mon Oct 11 21:45:25 2010 +0200
@@ -179,11 +179,16 @@
     y^:= CursorPoint.Y;
 end;
 
-function HW_isAmmoOpen: boolean; cdecl; export;
+function HW_isAmmoMenuOpen: boolean; cdecl; export;
 begin
     exit(bShowAmmoMenu);
 end;
 
+function HW_isAmmoMenuNotAllowed: boolean; cdecl; export;
+begin;
+    exit ( (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) );
+end;
+
 function HW_isPaused: boolean; cdecl; export;
 begin
     exit( isPaused );
@@ -265,6 +270,11 @@
         SetWeapon(TAmmoType(whichone+1));
 end;
 
+function HW_isWeaponAnEffect(whichone: LongInt): boolean; cdecl; export;
+begin
+    exit(Ammoz[TAmmoType(whichone+1)].Ammo.Propz and ammoprop_Effect <> 0)
+end;
+
 function HW_getAmmoCounts(counts: PLongInt): LongInt; cdecl; export;
 var a : PHHAmmo;
     slot, index: LongInt;
--- a/hedgewars/uAmmos.pas	Mon Oct 11 14:55:13 2010 -0400
+++ b/hedgewars/uAmmos.pas	Mon Oct 11 21:45:25 2010 +0200
@@ -247,7 +247,7 @@
                 end
             end
     end;
-perfExt_NewTurnBeginning;
+perfExt_AmmoUpdate;
 end;
 
 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean;
@@ -356,7 +356,6 @@
             ShowCrosshair:= (Propz and ammoprop_NoCrosshair) = 0;
         end
     end;
-perfExt_NewTurnBeginning;
 end;
 
 procedure SwitchNotHeldAmmo(var Hedgehog: THedgehog);
--- a/hedgewars/uMobile.pas	Mon Oct 11 14:55:13 2010 -0400
+++ b/hedgewars/uMobile.pas	Mon Oct 11 21:45:25 2010 +0200
@@ -41,7 +41,7 @@
 procedure perfExt_SaveFinishedSynching; inline;
 
 implementation
-uses uTeams;
+uses uTeams, uConsole;
 
 function isPhone: Boolean; inline;
 begin
--- a/hedgewars/uTeams.pas	Mon Oct 11 14:55:13 2010 -0400
+++ b/hedgewars/uTeams.pas	Mon Oct 11 21:45:25 2010 +0200
@@ -225,7 +225,6 @@
 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil);
 
 CurrentHedgehog:= @(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]);
-perfExt_AmmoUpdate
 end;
 
 procedure AfterSwitchHedgehog;
@@ -300,7 +299,9 @@
     if TurnTimeLeft > 0 then
         PlaySound(sndIllGetYou, CurrentTeam^.voicepack);
     ReadyTimeLeft:= 0
-    end
+    end;
+
+perfExt_NewTurnBeginning();
 end;
 
 function AddTeam(TeamColor: Longword): PTeam;
--- a/hedgewars/uWorld.pas	Mon Oct 11 14:55:13 2010 -0400
+++ b/hedgewars/uWorld.pas	Mon Oct 11 21:45:25 2010 +0200
@@ -190,7 +190,8 @@
     Slot, Pos, STurns: LongInt;
     Ammo: PHHAmmo;
 begin
-if  (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then bShowAmmoMenu:= false;
+if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then
+    bShowAmmoMenu:= false;
 if bShowAmmoMenu then
    begin
    FollowGear:= nil;
--- a/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m	Mon Oct 11 14:55:13 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m	Mon Oct 11 21:45:25 2010 +0200
@@ -25,6 +25,8 @@
 #import "UIImageExtra.h"
 #import "PascalImports.h"
 
+#define BTNS_PER_ROW 9
+
 @implementation AmmoMenuViewController
 @synthesize weaponsImage, buttonsArray, isVisible;
 
@@ -46,7 +48,8 @@
     self.view.layer.borderWidth = 1.3f;
     [self.view.layer setCornerRadius:10];
     [self.view.layer setMasksToBounds:YES];
-
+    self.view.autoresizingMask = UIViewAutoresizingNone;
+    
     self.isVisible = NO;
     delay = (uint8_t *) calloc(HW_getNumberOfWeapons(), sizeof(uint8_t));
     HW_getAmmoDelays(delay);
@@ -62,7 +65,15 @@
 -(void) appearInView:(UIView *)container {
     [self viewWillAppear:YES];
     [container addSubview:self.view];
-    self.view.center = CGPointMake(container.center.y, container.center.x);
+    if (IS_DUALHEAD() == NO)
+        self.view.center = CGPointMake(container.center.y, container.center.x);
+    else {
+        UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
+        if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight)
+            self.view.center = CGPointMake(container.center.y, container.center.x);
+        else
+            self.view.center = CGPointMake(container.center.x, container.center.y);
+    }
     self.isVisible = YES;
 }
 
@@ -83,18 +94,33 @@
     [ammoStoreImage release];
 
     NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:HW_getNumberOfWeapons()];
-    for (int i = 0; i < HW_getNumberOfWeapons(); i++) {
-        int x_dst = 10+(i%10)*44;
-        int y_dst = 10+(i/10)*44;
+    int i, j, e;
+    for (i = 0, j = 0, e = 0; i < HW_getNumberOfWeapons(); i++) {
+        int x, y;
+        float w, radius;
         
-        if (i / 10 % 2 != 0)
-            x_dst += 20;
+        // move utilities aside and make 'em rounded
+        if (HW_isWeaponAnEffect(i)) {
+            x = 432;
+            y = 20 + 48*e++;
+            w = 1.5;
+            radius = 22;
+        } else {
+            x = 10+(j%BTNS_PER_ROW)*44;
+            y = 10+(j/BTNS_PER_ROW)*44;
+            if (j / BTNS_PER_ROW % 2 != 0)
+                x += 20;
+            w = 1;
+            radius = 6;
+            j++;
+        }
+
         UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
-        button.frame = CGRectMake(x_dst, y_dst, 40, 40);
+        button.frame = CGRectMake(x, y, 40, 40);
         button.tag = i;
-        button.layer.borderWidth = 1;
         button.layer.borderColor = [UICOLOR_HW_YELLOW_TEXT CGColor];
-        [button.layer setCornerRadius:6];
+        button.layer.borderWidth = w;
+        [button.layer setCornerRadius:radius];
         [button.layer setMasksToBounds:YES];
         [button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
         [button setTitleColor:UICOLOR_HW_YELLOW_TEXT forState:UIControlStateNormal];
@@ -106,6 +132,7 @@
         button.titleLabel.layer.borderWidth = 1;
         [self.view addSubview:button];
         [array addObject:button];
+        
     }
     [self performSelectorOnMainThread:@selector(setButtonsArray:) withObject:array waitUntilDone:NO];
     [array release];
--- a/project_files/HedgewarsMobile/Classes/FlagsViewController.h	Mon Oct 11 14:55:13 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/FlagsViewController.h	Mon Oct 11 21:45:25 2010 +0200
@@ -26,11 +26,13 @@
     NSDictionary *teamDictionary;
 
     NSArray *flagArray;
+    NSArray *communityArray;
     NSIndexPath *lastIndexPath;
 }
 
 @property (nonatomic,retain) NSDictionary * teamDictionary;
 @property (nonatomic,retain) NSArray *flagArray;
+@property (nonatomic,retain) NSArray *communityArray;
 @property (nonatomic,retain) NSIndexPath *lastIndexPath;
 
 @end
--- a/project_files/HedgewarsMobile/Classes/FlagsViewController.m	Mon Oct 11 14:55:13 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/FlagsViewController.m	Mon Oct 11 21:45:25 2010 +0200
@@ -23,7 +23,7 @@
 #import "CommodityFunctions.h"
 
 @implementation FlagsViewController
-@synthesize teamDictionary, flagArray, lastIndexPath;
+@synthesize teamDictionary, flagArray, communityArray, lastIndexPath;
 
 
 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
@@ -36,48 +36,73 @@
 -(void) viewDidLoad {
     [super viewDidLoad];
 
-    self.flagArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:FLAGS_DIRECTORY() error:NULL];
+    NSMutableArray *array_na = [[NSMutableArray alloc] init];
+    NSMutableArray *array_cm = [[NSMutableArray alloc] init];
+    
+    for (NSString *name in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:FLAGS_DIRECTORY() error:NULL]) {
+        if ([name hasPrefix:@"cm_"]) {
+            NSString *processed = [name substringFromIndex:3];
+            [array_cm addObject:processed];
+        } else
+             [array_na addObject:name];
+    }
+    
+    self.flagArray = array_na;
+    [array_na release];
+    self.communityArray = array_cm;
+    [array_cm release];
 
     self.title = NSLocalizedString(@"Set team flag",@"");
 }
 
 -(void) viewWillAppear:(BOOL)animated {
     [super viewWillAppear:animated];
+    // reloadData needed because team might change
     [self.tableView reloadData];
-    [self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
+    //[self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
 }
 
 
 #pragma mark -
 #pragma mark Table view data source
 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
-    return 1;
+    return 2;
 }
 
 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    return [flagArray count];
+    if (section == 0)
+        return [self.flagArray count];
+    else
+        return [self.communityArray count];
 }
 
 // Customize the appearance of table view cells.
 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-
     static NSString *CellIdentifier = @"Cell";
+    NSInteger row = [indexPath row];
 
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
     if (cell == nil) {
         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
     }
 
-    NSString *flag = [flagArray objectAtIndex:[indexPath row]];
-
-    NSString *flagFile = [[NSString alloc] initWithFormat:@"%@/%@", FLAGS_DIRECTORY(), flag];
+    NSString *flagName = nil;
+    NSArray *source = nil;
+    if ([indexPath section] == 0) {
+        source = self.flagArray;
+        flagName = [source objectAtIndex:row];
+    } else {
+        source = self.communityArray;
+        flagName = [NSString stringWithFormat:@"cm_%@",[source objectAtIndex:row]];
+    }
+    NSString *flagFile = [[NSString alloc] initWithFormat:@"%@/%@", FLAGS_DIRECTORY(), flagName];
     UIImage *flagSprite = [[UIImage alloc] initWithContentsOfFile:flagFile];
     [flagFile release];
     cell.imageView.image = flagSprite;
     [flagSprite release];
 
-    cell.textLabel.text = [flag stringByDeletingPathExtension];
-    if ([cell.textLabel.text isEqualToString:[self.teamDictionary objectForKey:@"flag"]]) {
+    cell.textLabel.text = [[source objectAtIndex:row] stringByDeletingPathExtension];
+    if ([[flagName stringByDeletingPathExtension] isEqualToString:[self.teamDictionary objectForKey:@"flag"]]) {
         cell.accessoryType = UITableViewCellAccessoryCheckmark;
         self.lastIndexPath = indexPath;
     } else {
@@ -87,16 +112,40 @@
     return cell;
 }
 
+-(NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section {
+    NSString *sectionTitle = nil;
+    switch (section) {
+        case 0:
+            sectionTitle = NSLocalizedString(@"Worldwide", @"");
+            break;
+        case 1:
+            sectionTitle = NSLocalizedString(@"Community", @"");
+            break;
+        default:
+            DLog(@"nope");
+            break;
+    }
+    return sectionTitle;
+}
+
 
 #pragma mark -
 #pragma mark Table view delegate
 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     int newRow = [indexPath row];
     int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
-
-    if (newRow != oldRow) {
+    int newSection = [indexPath section];
+    int oldSection = (lastIndexPath != nil) ? [lastIndexPath section] : -1;
+    
+    if (newRow != oldRow || newSection != oldSection) {
+        NSString *flag = nil;
+        if ([indexPath section] == 0)
+            flag = [self.flagArray objectAtIndex:newRow];
+        else
+            flag = [NSString stringWithFormat:@"cm_%@",[self.communityArray objectAtIndex:newRow]];
+        
         // if the two selected rows differ update data on the hog dictionary and reload table content
-        [self.teamDictionary setValue:[[flagArray objectAtIndex:newRow] stringByDeletingPathExtension] forKey:@"flag"];
+        [self.teamDictionary setValue:[flag stringByDeletingPathExtension] forKey:@"flag"];
 
         // tell our boss to write this new stuff on disk
         [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
@@ -117,14 +166,17 @@
 #pragma mark Memory management
 -(void) didReceiveMemoryWarning {
     // Releases the view if it doesn't have a superview.
+    // Relinquish ownership any cached data, images, etc that aren't in use.
+    self.lastIndexPath = nil;
+    MSG_MEMCLEAN();
     [super didReceiveMemoryWarning];
-    // Relinquish ownership any cached data, images, etc that aren't in use.
 }
 
 -(void) viewDidUnload {
     self.teamDictionary = nil;
     self.lastIndexPath = nil;
     self.flagArray = nil;
+    self.communityArray = nil;
     MSG_DIDUNLOAD();
     [super viewDidUnload];
 }
@@ -133,6 +185,7 @@
     [teamDictionary release];
     [lastIndexPath release];
     [flagArray release];
+    [communityArray release];
     [super dealloc];
 }
 
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Mon Oct 11 14:55:13 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Mon Oct 11 21:45:25 2010 +0200
@@ -61,21 +61,33 @@
     switch (orientation) {
         case UIDeviceOrientationLandscapeLeft:
             if (IS_DUALHEAD() == NO)
-                sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(0));
+                sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(180));
             self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
             break;
         case UIDeviceOrientationLandscapeRight:
             if (IS_DUALHEAD() == NO)
-                sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(180));
+                sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(0));
             self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90));
             break;
+        case UIDeviceOrientationPortrait:
+            if (IS_DUALHEAD())
+                self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(0));
+            break;
+        case UIDeviceOrientationPortraitUpsideDown:
+            if (IS_DUALHEAD())
+                self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(180));
+            break;
         default:
             // a debug log would spam too much
             break;
     }
+    if (self.amvc.isVisible)
+        [self.amvc appearInView:self.view];
     self.view.frame = usefulRect;
-    //sdlView.frame = usefulRect;
     [UIView commitAnimations];
+    
+    // for single screens only landscape mode is supported
+    // for dual screen mode the sdlview is not modified, but you can rotate the pad in any direction
 }
 
 #pragma mark -
@@ -93,6 +105,26 @@
 
     initialScreenCount = [[UIScreen screens] count];
 
+    if (IS_DUALHEAD()) {
+        // set initial orientation wrt the controller orientation
+        switch (self.interfaceOrientation) {
+            case UIDeviceOrientationLandscapeLeft:
+                self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
+                break;
+            case UIDeviceOrientationLandscapeRight:
+                self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90));
+                break;
+            case UIDeviceOrientationPortrait:
+                self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(0));
+                break;
+            case UIDeviceOrientationPortraitUpsideDown:
+                self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(180));
+                break;
+            default:
+                DLog(@"Nope");
+                break;
+        }
+    }
     CGRect screenRect = [[UIScreen mainScreen] bounds];
     self.view.frame = CGRectMake(0, 0, screenRect.size.width, screenRect.size.height);
 
@@ -103,7 +135,7 @@
                                         userInfo:nil
                                          repeats:YES];
 
-    // add timer too runloop, otherwise it doesn't work
+    // add timer to runloop, otherwise it doesn't work
     [[NSRunLoop currentRunLoop] addTimer:dimTimer forMode:NSDefaultRunLoopMode];
 
     [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
@@ -323,13 +355,15 @@
             if (IS_DUALHEAD() || self.useClassicMenu == NO) {
                 if (self.amvc == nil)
                     self.amvc = [[AmmoMenuViewController alloc] init];
-                
+
                 if (self.amvc.isVisible) {
                     doDim();
                     [self.amvc disappear];
                 } else {
-                    doNotDim();
-                    [self.amvc appearInView:self.view];
+                    if (HW_isAmmoMenuNotAllowed() == NO) {
+                        doNotDim();
+                        [self.amvc appearInView:self.view];
+                    }
                 }
             } else {
                 HW_ammoMenu();
@@ -452,7 +486,7 @@
     switch ([allTouches count]) {
         case 1:
             // if we're in the menu we just click in the point
-            if (HW_isAmmoOpen()) {
+            if (HW_isAmmoMenuOpen()) {
                 HW_setCursor(HWXZ(currentPosition.x), HWYZ(currentPosition.y));
                 // this click doesn't need any wrapping because the ammoMenu already limits the cursor
                 HW_click();
@@ -560,7 +594,7 @@
             touch = [[allTouches allObjects] objectAtIndex:0];
             CGPoint currentPosition = [touch locationInView:self.view];
 
-            if (HW_isAmmoOpen()) {
+            if (HW_isAmmoMenuOpen()) {
                 // no zoom consideration for this
                 HW_setCursor(HWXZ(currentPosition.x), HWYZ(currentPosition.y));
             } else
--- a/project_files/HedgewarsMobile/Classes/PascalImports.h	Mon Oct 11 14:55:13 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/PascalImports.h	Mon Oct 11 21:45:25 2010 +0200
@@ -70,7 +70,8 @@
     void HW_setCursor(int x, int y);
     void HW_getCursor(int *x, int *y);
 
-    BOOL HW_isAmmoOpen(void);
+    BOOL HW_isAmmoMenuOpen(void);
+    BOOL HW_isAmmoMenuNotAllowed(void);
     BOOL HW_isPaused(void);
     BOOL HW_isWeaponRequiringClick(void);
     BOOL HW_isWeaponTimerable(void);
@@ -81,11 +82,14 @@
     void HW_setPianoSound(int snd);
     
     void HW_setWeapon(int whichone);
-    void HW_getAmmoDelays(unsigned char *);
-    int  HW_getAmmoCounts(int *);
+    BOOL HW_isWeaponAnEffect(int whichone);
+    char *HW_getWeaponNameByIndex(int whichone);
+
+    void HW_getAmmoDelays(unsigned char *pointer);
+    int  HW_getAmmoCounts(int *pointer);
+    
+    int  HW_getNumberOfWeapons(void);
     int  HW_getTurnsForCurrentTeam(void);
-    int  HW_getNumberOfWeapons(void);
-    char *HW_getWeaponNameByIndex(int whichone);
     int  HW_getMaxNumberOfHogs(void);
     int  HW_getMaxNumberOfTeams(void);
     
--- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Mon Oct 11 14:55:13 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Mon Oct 11 21:45:25 2010 +0200
@@ -129,7 +129,7 @@
 
     // since the sdlwindow is not yet created, we add the overlayController with a delay
     NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:isNetGameNum,@"net",menuStyle,@"menu",nil];
-    [self performSelector:@selector(displayOverlayLater:) withObject:dict afterDelay:0.1];
+    [self performSelector:@selector(displayOverlayLater:) withObject:dict afterDelay:1];
 
     // this is the pascal fuction that starts the game (wrapped around isInGame)
     isInGame = YES;
--- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m	Mon Oct 11 14:55:13 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m	Mon Oct 11 21:45:25 2010 +0200
@@ -53,15 +53,15 @@
     NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCHEMES_DIRECTORY() error:NULL];
     self.listOfSchemes = contentsOfDir;
 
-    if ([listOfSchemes containsObject:@"Default.plist"])
-         self.selectedScheme = @"Default.plist";
-
+    if ([self.selectedScheme isEqualToString:@""] && [listOfSchemes containsObject:@"Default.plist"])
+        self.selectedScheme = @"Default.plist";
+    
     contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:WEAPONS_DIRECTORY() error:NULL];
     self.listOfWeapons = contentsOfDir;
-
-    if ([listOfWeapons containsObject:@"Default.plist"])
-         self.selectedWeapon = @"Default.plist";
-
+    
+    if ([self.selectedWeapon isEqualToString:@""] && [listOfWeapons containsObject:@"Default.plist"])
+        self.selectedWeapon = @"Default.plist";
+    
     [self.tableView reloadData];
 }