project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m
branchios-revival
changeset 11141 01e8e5a6a8c1
parent 10108 c68cf030eded
child 11200 08c6ccc28007
equal deleted inserted replaced
11140:3fbe54013b2b 11141:01e8e5a6a8c1
    17  */
    17  */
    18 
    18 
    19 
    19 
    20 #import "SingleWeaponViewController.h"
    20 #import "SingleWeaponViewController.h"
    21 
    21 
       
    22 @interface SingleWeaponViewController ()
       
    23 @property (nonatomic, retain) NSString *trPath;
       
    24 @property (nonatomic, retain) NSString *trFileName;
       
    25 @end
    22 
    26 
    23 @implementation SingleWeaponViewController
    27 @implementation SingleWeaponViewController
    24 @synthesize weaponName, description, ammoStoreImage;
    28 @synthesize weaponName, description, ammoStoreImage;
    25 
    29 
    26 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
    30 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
    30 #pragma mark -
    34 #pragma mark -
    31 #pragma mark View lifecycle
    35 #pragma mark View lifecycle
    32 -(void) viewDidLoad {
    36 -(void) viewDidLoad {
    33     [super viewDidLoad];
    37     [super viewDidLoad];
    34 
    38 
    35     NSString *trFilePath = [NSString stringWithFormat:@"%@/%@.txt",LOCALE_DIRECTORY(),[[NSLocale preferredLanguages] objectAtIndex:0]];
    39     self.trPath = [NSString stringWithFormat:@"%@", LOCALE_DIRECTORY()];
       
    40     self.trFileName = [NSString stringWithFormat:@"%@.txt", [[NSLocale preferredLanguages] firstObject]];
    36     // fill the data structure that we are going to read
    41     // fill the data structure that we are going to read
    37     LoadLocaleWrapper([trFilePath UTF8String]);
    42     LoadLocaleWrapper([self.trPath UTF8String], [self.trFileName UTF8String]);
    38 
    43 
    39     quantity = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
    44     quantity = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
    40     probability = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
    45     probability = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
    41     delay = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
    46     delay = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
    42     crateness = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
    47     crateness = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
   259     [super viewDidUnload];
   264     [super viewDidUnload];
   260 }
   265 }
   261 
   266 
   262 
   267 
   263 -(void) dealloc {
   268 -(void) dealloc {
       
   269     releaseAndNil(_trPath);
       
   270     releaseAndNil(_trFileName);
       
   271     
   264     releaseAndNil(weaponName);
   272     releaseAndNil(weaponName);
   265     releaseAndNil(description);
   273     releaseAndNil(description);
   266     releaseAndNil(ammoStoreImage);
   274     releaseAndNil(ammoStoreImage);
   267     [super dealloc];
   275     [super dealloc];
   268 }
   276 }