Cube  Diff

Differences From Artifact [764e555a48]:

To Artifact [f3a87aa011]:


8
9
10
11
12
13
14
15

16
17

18
19
20
21
22
23







24
25
26


27
28
29
30

31
32

33
34
35

36
37

38
39
40
41
42
43
44
8
9
10
11
12
13
14

15
16
17
18






19
20
21
22
23
24
25
26


27
28
29
30
31

32
33

34
35
36

37
38

39
40
41
42
43
44
45
46







-
+


+
-
-
-
-
-
-
+
+
+
+
+
+
+

-
-
+
+



-
+

-
+


-
+

-
+







	[OFFileManager.defaultManager removeItemAtPath:backupname];
	[OFFileManager.defaultManager moveItemAtPath:name toPath:backupname];
}

static OFString *cgzname, *bakname, *pcfname, *mcfname;

static void
setnames(OFString *name_)
setnames(OFString *name)
{
	@autoreleasepool {
		OFCharacterSet *cs =
		const char *name = name_.UTF8String;
		string pakname, mapname;
		const char *slash = strpbrk(name, "/\\");
		if (slash) {
			strn0cpy(pakname, name, slash - name + 1);
			strcpy_s(mapname, slash + 1);
		    [OFCharacterSet characterSetWithCharactersInString:@"/\\"];
		OFRange range = [name rangeOfCharacterFromSet:cs];
		OFString *pakname, *mapname;

		if (range.location != OFNotFound) {
			pakname = [name substringToIndex:range.location];
			mapname = [name substringFromIndex:range.location + 1];
		} else {
			strcpy_s(pakname, "base");
			strcpy_s(mapname, name);
			pakname = @"base";
			mapname = name;
		}

		cgzname = [[OFString alloc]
		    initWithFormat:@"packages/%s/%s.cgz", pakname, mapname];
		    initWithFormat:@"packages/%@/%@.cgz", pakname, mapname];
		bakname =
		    [[OFString alloc] initWithFormat:@"packages/%s/%s_%d.BAK",
		    [[OFString alloc] initWithFormat:@"packages/%@/%@_%d.BAK",
		                      pakname, mapname, lastmillis];
		pcfname = [[OFString alloc]
		    initWithFormat:@"packages/%s/package.cfg", pakname];
		    initWithFormat:@"packages/%@/package.cfg", pakname];
		mcfname = [[OFString alloc]
		    initWithFormat:@"packages/%s/%s.cfg", pakname, mapname];
		    initWithFormat:@"packages/%@/%@.cfg", pakname, mapname];
	}
}

// the optimize routines below are here to reduce the detrimental effects of
// messy mapping by setting certain properties (vdeltas and textures) to
// neighbouring values wherever there is no visible difference. This allows the
// mipmapper to generate more efficient mips. the reason it is done on save is