project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m
branchios-revival
changeset 11141 01e8e5a6a8c1
parent 10108 c68cf030eded
child 11204 08c6ccc28007
--- a/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m	Thu Aug 27 23:19:29 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m	Thu Aug 27 23:21:07 2015 +0200
@@ -19,6 +19,10 @@
 
 #import "SingleWeaponViewController.h"
 
+@interface SingleWeaponViewController ()
+@property (nonatomic, retain) NSString *trPath;
+@property (nonatomic, retain) NSString *trFileName;
+@end
 
 @implementation SingleWeaponViewController
 @synthesize weaponName, description, ammoStoreImage;
@@ -32,9 +36,10 @@
 -(void) viewDidLoad {
     [super viewDidLoad];
 
-    NSString *trFilePath = [NSString stringWithFormat:@"%@/%@.txt",LOCALE_DIRECTORY(),[[NSLocale preferredLanguages] objectAtIndex:0]];
+    self.trPath = [NSString stringWithFormat:@"%@", LOCALE_DIRECTORY()];
+    self.trFileName = [NSString stringWithFormat:@"%@.txt", [[NSLocale preferredLanguages] firstObject]];
     // fill the data structure that we are going to read
-    LoadLocaleWrapper([trFilePath UTF8String]);
+    LoadLocaleWrapper([self.trPath UTF8String], [self.trFileName UTF8String]);
 
     quantity = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
     probability = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
@@ -261,6 +266,9 @@
 
 
 -(void) dealloc {
+    releaseAndNil(_trPath);
+    releaseAndNil(_trFileName);
+    
     releaseAndNil(weaponName);
     releaseAndNil(description);
     releaseAndNil(ammoStoreImage);