|
26 | 26 | DirDelete(PATH + 'masks', False); |
27 | 27 | end; |
28 | 28 |
|
29 | | - FileDelete(PATH + 'data' + PATH_SEP + 'hash.txt'); |
30 | | - FileDelete(PATH + 'masks.zip'); |
| 29 | + if FileExists(PATH + 'data' + PATH_SEP + 'hash.txt') then |
| 30 | + if not FileDelete(PATH + 'data' + PATH_SEP + 'hash.txt') then |
| 31 | + raise 'Couldn''t delete ' + PATH + 'data' + PATH_SEP + 'hash.txt'; |
31 | 32 |
|
32 | 33 | files := DirList(PATH + 'items-imgs', True); |
33 | 34 | if files = [] then |
|
54 | 55 | tpa: TPointArray; |
55 | 56 | begin |
56 | 57 | if SINGLE_ITEM <> '' then |
57 | | - if not filename.Contains(SINGLE_ITEM + '.png') then Exit; |
| 58 | + if not filename.EndsWith(SINGLE_ITEM + '.png') then Exit; |
58 | 59 |
|
59 | 60 | img := new TImage(filename); |
| 61 | + |
60 | 62 | img.FillWithAlpha($FF); //ensure there's no weird alphas. |
61 | 63 | img.ReplaceColor($202030, $0); //remove the item shadow |
62 | 64 |
|
@@ -99,14 +101,21 @@ begin |
99 | 101 | for itemData in ITEM_DATA_ARRAY do |
100 | 102 | FileAppend(PATH + 'data' + PATH_SEP + 'hash.txt', itemData.ItemHash + LINE_SEP); |
101 | 103 |
|
102 | | - FileDelete(PATH + 'items.bin'); |
| 104 | + if FileExists(PATH + 'items.bin') then |
| 105 | + if not FileDelete(PATH + 'items.bin') then |
| 106 | + raise 'Couldn''t delete ' + PATH + 'items.bin'; |
| 107 | + |
103 | 108 | writer := new TResourceWriter(); |
104 | 109 | writer.AddImages(PATH + 'items-imgs', '*.png', False); |
105 | 110 | writer.AddImages(PATH + 'masks', '*.bmp', False); |
106 | 111 | writer.Save(PATH + 'items.bin'); |
107 | 112 |
|
108 | | - FileDelete(PATH + 'items.zip'); |
109 | | - ZipFiles(PATH + 'items.zip', [PATH + 'items.bin']); |
| 113 | + if FileExists(PATH + 'items.zip') then |
| 114 | + if not FileDelete(PATH + 'items.zip') then |
| 115 | + raise 'Couldn''t delete ' + PATH + 'items.zip'; |
| 116 | + |
| 117 | + if not ZipFiles(PATH + 'items.zip', [PATH + 'items.bin']) then |
| 118 | + raise 'Couldn''t zip ' + PATH + 'items.bin'; |
110 | 119 |
|
111 | 120 | if RESET then |
112 | 121 | begin |
|
0 commit comments