- Pass also userPath to LoadLocaleWrapper
authorantonc27 <antonc27@mail.ru>
Tue, 03 May 2016 01:13:41 +0200
changeset 11790 ac93cfc17365
parent 11789 e2de320aaf69
child 11791 3127b0fece81
- Pass also userPath to LoadLocaleWrapper TODO: Find a way to simplify all of this...
hedgewars/uLocale.pas
project_files/HedgewarsMobile/Classes/PascalImports.h
project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m
--- a/hedgewars/uLocale.pas	Tue May 03 01:09:36 2016 +0200
+++ b/hedgewars/uLocale.pas	Tue May 03 01:13:41 2016 +0200
@@ -30,7 +30,7 @@
 function  GetEventString(e: TEventId): ansistring;
 
 {$IFDEF HWLIBRARY}
-procedure LoadLocaleWrapper(path: pchar; filename: pchar); cdecl; export;
+procedure LoadLocaleWrapper(path: pchar; userpath: pchar; filename: pchar); cdecl; export;
 {$ENDIF}
 
 implementation
@@ -134,13 +134,14 @@
 end;
 
 {$IFDEF HWLIBRARY}
-procedure LoadLocaleWrapper(path: pchar; filename: pchar); cdecl; export;
+procedure LoadLocaleWrapper(path: pchar; userpath: pchar; filename: pchar); cdecl; export;
 begin
     PathPrefix := Strpas(path);
+    UserPathPrefix := Strpas(userpath);
  
-    uUtils.initModule(false);
-    uVariables.initModule;
-
+    //normally this var set in preInit of engine
+    allOK := true;
+    
     PathPrefix:= PathPrefix + #0;
     UserPathPrefix:= UserPathPrefix + #0;
     uPhysFSLayer.initModule(@PathPrefix[1], @UserPathPrefix[1]);
@@ -150,8 +151,6 @@
     LoadLocale(Strpas(filename));
  
     uPhysFSLayer.freeModule;
-    uVariables.freeModule;
-    uUtils.freeModule;
 end;
 {$ENDIF}
 
--- a/project_files/HedgewarsMobile/Classes/PascalImports.h	Tue May 03 01:09:36 2016 +0200
+++ b/project_files/HedgewarsMobile/Classes/PascalImports.h	Tue May 03 01:13:41 2016 +0200
@@ -29,7 +29,7 @@
      */
 
     void RunEngine(const int argc, const char *argv[]);
-    void LoadLocaleWrapper(const char *filepath, const char *filename);
+    void LoadLocaleWrapper(const char *filepath, const char *userpath, const char *filename);
 
     void HW_versionInfo(int *protoNum, char **versionStr);
     void *HW_getSDLWindow(void);
--- a/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m	Tue May 03 01:09:36 2016 +0200
+++ b/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m	Tue May 03 01:13:41 2016 +0200
@@ -39,7 +39,7 @@
     self.trPath = [NSString stringWithFormat:@"%@", LOCALE_DIRECTORY()];
     self.trFileName = [NSString stringWithFormat:@"%@.txt", [HWUtils languageID]];
     // fill the data structure that we are going to read
-    LoadLocaleWrapper([self.trPath UTF8String], [self.trFileName UTF8String]);
+    LoadLocaleWrapper([self.trPath UTF8String], [DOCUMENTS_FOLDER() UTF8String], [self.trFileName UTF8String]);
 
     quantity = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
     probability = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));