Rename uFLData to uFLThemes qmlfrontend
authorunc0rr
Tue, 01 Dec 2015 23:40:38 +0300
branchqmlfrontend
changeset 11443 1a6148b4de3b
parent 11442 6e641b5453f9
child 11444 dd1350a475d9
Rename uFLData to uFLThemes
hedgewars/CMakeLists.txt
hedgewars/hwLibrary.pas
hedgewars/uFLData.pas
hedgewars/uFLGameConfig.pas
hedgewars/uFLThemes.pas
--- a/hedgewars/CMakeLists.txt	Tue Dec 01 23:37:10 2015 +0300
+++ b/hedgewars/CMakeLists.txt	Tue Dec 01 23:40:38 2015 +0300
@@ -107,7 +107,6 @@
     uTeams.pas
 
     uFLAmmo.pas
-    uFLData.pas
     uFLGameConfig.pas
     uFLIPC.pas
     uFLNet.pas
@@ -117,6 +116,7 @@
     uFLScripts.pas
     uFLSchemes.pas
     uFLTeams.pas
+    uFLThemes.pas
     uFLTypes.pas
     uFLUICallback.pas
     uFLUtils.pas
--- a/hedgewars/hwLibrary.pas	Tue Dec 01 23:37:10 2015 +0300
+++ b/hedgewars/hwLibrary.pas	Tue Dec 01 23:40:38 2015 +0300
@@ -42,7 +42,7 @@
     , uFLGameConfig
     , uFLIPC
     , uPhysFSLayer
-    , uFLData
+    , uFLThemes
     , uFLTeams
     , uFLScripts
     , uFLSchemes
--- a/hedgewars/uFLData.pas	Tue Dec 01 23:37:10 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-unit uFLData;
-interface
-
-function getThemesList: PPChar; cdecl;
-procedure freeThemesList(list: PPChar); cdecl;
-function getThemeIcon(themeName: PChar; buffer: PChar; buflen: Longword): Longword; cdecl;
-
-const colorsSet: array[0..8] of shortstring = (
-                                               '16712196'
-                                               , '4817089'
-                                               , '1959610'
-                                               , '11878895'
-                                               , '10526880'
-                                               , '2146048'
-                                               , '16681742'
-                                               , '6239749'
-                                               , '16776961');
-
-implementation
-uses uPhysFSLayer;
-
-function getThemesList: PPChar; cdecl;
-var list, res, tmp: PPChar;
-    i, size: Longword;
-begin
-    list:= pfsEnumerateFiles('Themes');
-    size:= 0;
-    tmp:= list;
-    while tmp^ <> nil do
-    begin
-        inc(size);
-        inc(tmp)
-    end;
-
-    res:= GetMem((3 + size) * sizeof(PChar));
-    res^:= PChar(list);
-    inc(res);
-    res^:= PChar(res + size + 2);
-    inc(res);
-
-    getThemesList:= res;
-
-    for i:= 1 to size do
-    begin
-        if pfsExists('/Themes/' + shortstring(list^) + '/icon.png') then
-        begin
-            res^:= list^;
-            inc(res)
-        end;
-
-        inc(list)
-    end;
-
-    res^:= nil
-end;
-
-procedure freeThemesList(list: PPChar); cdecl;
-var listEnd: PPChar;
-begin
-    dec(list);
-    listEnd:= PPChar(list^);
-    dec(list);
-
-    pfsFreeList(PPChar(list^));
-    freeMem(list, (listEnd - list) * sizeof(PChar))
-end;
-
-function getThemeIcon(themeName: PChar; buffer: PChar; buflen: Longword): Longword; cdecl;
-var s: shortstring;
-    f: PFSFile;
-begin
-    s:= '/Themes/' + shortstring(themeName) + '/icon@2x.png';
-
-    f:= pfsOpenRead(s);
-
-    if f = nil then
-        getThemeIcon:= 0
-    else
-    begin
-        getThemeIcon:= pfsBlockRead(f, buffer, buflen);
-        pfsClose(f)
-    end;
-end;
-
-end.
--- a/hedgewars/uFLGameConfig.pas	Tue Dec 01 23:37:10 2015 +0300
+++ b/hedgewars/uFLGameConfig.pas	Tue Dec 01 23:40:38 2015 +0300
@@ -32,7 +32,7 @@
 procedure sendConfig(config: PGameConfig);
 
 implementation
-uses uFLIPC, uFLUtils, uFLTeams, uFLData, uFLSChemes, uFLAmmo, uFLUICallback, uFLRunQueue;
+uses uFLIPC, uFLUtils, uFLTeams, uFLThemes, uFLSChemes, uFLAmmo, uFLUICallback, uFLRunQueue;
 
 var
     currentConfig: TGameConfig;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uFLThemes.pas	Tue Dec 01 23:40:38 2015 +0300
@@ -0,0 +1,85 @@
+unit uFLThemes;
+interface
+
+function getThemesList: PPChar; cdecl;
+procedure freeThemesList(list: PPChar); cdecl;
+function getThemeIcon(themeName: PChar; buffer: PChar; buflen: Longword): Longword; cdecl;
+
+const colorsSet: array[0..8] of shortstring = (
+                                               '16712196'
+                                               , '4817089'
+                                               , '1959610'
+                                               , '11878895'
+                                               , '10526880'
+                                               , '2146048'
+                                               , '16681742'
+                                               , '6239749'
+                                               , '16776961');
+
+implementation
+uses uPhysFSLayer;
+
+function getThemesList: PPChar; cdecl;
+var list, res, tmp: PPChar;
+    i, size: Longword;
+begin
+    list:= pfsEnumerateFiles('Themes');
+    size:= 0;
+    tmp:= list;
+    while tmp^ <> nil do
+    begin
+        inc(size);
+        inc(tmp)
+    end;
+
+    res:= GetMem((3 + size) * sizeof(PChar));
+    res^:= PChar(list);
+    inc(res);
+    res^:= PChar(res + size + 2);
+    inc(res);
+
+    getThemesList:= res;
+
+    for i:= 1 to size do
+    begin
+        if pfsExists('/Themes/' + shortstring(list^) + '/icon.png') then
+        begin
+            res^:= list^;
+            inc(res)
+        end;
+
+        inc(list)
+    end;
+
+    res^:= nil
+end;
+
+procedure freeThemesList(list: PPChar); cdecl;
+var listEnd: PPChar;
+begin
+    dec(list);
+    listEnd:= PPChar(list^);
+    dec(list);
+
+    pfsFreeList(PPChar(list^));
+    freeMem(list, (listEnd - list) * sizeof(PChar))
+end;
+
+function getThemeIcon(themeName: PChar; buffer: PChar; buflen: Longword): Longword; cdecl;
+var s: shortstring;
+    f: PFSFile;
+begin
+    s:= '/Themes/' + shortstring(themeName) + '/icon@2x.png';
+
+    f:= pfsOpenRead(s);
+
+    if f = nil then
+        getThemeIcon:= 0
+    else
+    begin
+        getThemeIcon:= pfsBlockRead(f, buffer, buflen);
+        pfsClose(f)
+    end;
+end;
+
+end.