Cube  Check-in [5659be76db]

Overview
Comment:More string migrations
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5659be76dbc70d7549e3a6b4ff2a1f6b01a56f58bd77097fdda53ead13ea435d
User & Date: js on 2025-03-15 00:24:34
Other Links: manifest | tags
Context
2025-03-15
12:05
More string migrations check-in: d0e460fce1 user: js tags: trunk
00:24
More string migrations check-in: 5659be76db user: js tags: trunk
2025-03-12
23:28
Fix tab completion check-in: 2200947ce9 user: js tags: trunk
Changes

Modified src/console.mm from [40d6223ddd] to [fbd5eecbef].

35
36
37
38
39
40
41

42
43
44
45
46
47
48
49
50
	cline cl;
	// constrain the buffer size
	cl.cref = conlines.length() > 100 ? conlines.pop().cref
	                                  : (char *)calloc(_MAXDEFSTR, 1);
	// for how long to keep line on screen
	cl.outtime = lastmillis;
	conlines.insert(0, cl);

	if (highlight) // show line in a different colour, for chat etc.
	{
		cl.cref[0] = '\f';
		cl.cref[1] = 0;
		strcat_s(cl.cref, sf.UTF8String);
	} else {
		strcpy_s(cl.cref, sf.UTF8String);
	}
	puts(cl.cref);







>
|
<







35
36
37
38
39
40
41
42
43

44
45
46
47
48
49
50
	cline cl;
	// constrain the buffer size
	cl.cref = conlines.length() > 100 ? conlines.pop().cref
	                                  : (char *)calloc(_MAXDEFSTR, 1);
	// for how long to keep line on screen
	cl.outtime = lastmillis;
	conlines.insert(0, cl);
	if (highlight) {
		// show line in a different colour, for chat etc.

		cl.cref[0] = '\f';
		cl.cref[1] = 0;
		strcat_s(cl.cref, sf.UTF8String);
	} else {
		strcpy_s(cl.cref, sf.UTF8String);
	}
	puts(cl.cref);
148
149
150
151
152
153
154

155
156
157
158
159
160
161
162
}
COMMAND(saycommand, ARG_VARI)

void
mapmsg(OFString *s)
{
	@autoreleasepool {

		strn0cpy(hdr.maptitle, s.UTF8String, 128);
	}
}
COMMAND(mapmsg, ARG_1STR)

void
pasteconsole()
{







>
|







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
}
COMMAND(saycommand, ARG_VARI)

void
mapmsg(OFString *s)
{
	@autoreleasepool {
		memset(hdr.maptitle, '\0', sizeof(hdr.maptitle));
		strncpy(hdr.maptitle, s.UTF8String, 127);
	}
}
COMMAND(mapmsg, ARG_1STR)

void
pasteconsole()
{

Modified src/world.mm from [1a4fc65de4] to [f38617a638].

482
483
484
485
486
487
488
489

490
491
492
493
494
495
496
		}
		loopv(ents)
		{
			ents[i].x += ssize / 4;
			ents[i].y += ssize / 4;
		}
	} else {
		strn0cpy(hdr.maptitle, "Untitled Map by Unknown", 128);

		hdr.waterlevel = -100000;
		loopi(15) hdr.reserved[i] = 0;
		loopk(3) loopi(256) hdr.texlists[k][i] = i;
		ents.setsize(0);
		block b = { 8, 8, ssize - 16, ssize - 16 };
		edittypexy(SPACE, b);
	}







|
>







482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
		}
		loopv(ents)
		{
			ents[i].x += ssize / 4;
			ents[i].y += ssize / 4;
		}
	} else {
		char buffer[128] = "Untitled Map by Unknown";
		memcpy(hdr.maptitle, buffer, 128);
		hdr.waterlevel = -100000;
		loopi(15) hdr.reserved[i] = 0;
		loopk(3) loopi(256) hdr.texlists[k][i] = i;
		ents.setsize(0);
		block b = { 8, 8, ssize - 16, ssize - 16 };
		edittypexy(SPACE, b);
	}

Modified src/worldio.mm from [764e555a48] to [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
	[OFFileManager.defaultManager removeItemAtPath:backupname];
	[OFFileManager.defaultManager moveItemAtPath:name toPath:backupname];
}

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

static void
setnames(OFString *name_)
{
	@autoreleasepool {

		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);
		} else {
			strcpy_s(pakname, "base");
			strcpy_s(mapname, name);
		}

		cgzname = [[OFString alloc]
		    initWithFormat:@"packages/%s/%s.cgz", pakname, mapname];
		bakname =
		    [[OFString alloc] initWithFormat:@"packages/%s/%s_%d.BAK",
		                      pakname, mapname, lastmillis];
		pcfname = [[OFString alloc]
		    initWithFormat:@"packages/%s/package.cfg", pakname];
		mcfname = [[OFString alloc]
		    initWithFormat:@"packages/%s/%s.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







|


>
|
>
|
|
|
|
|

|
|



|

|


|

|







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)
{
	@autoreleasepool {
		OFCharacterSet *cs =
		    [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 {
			pakname = @"base";
			mapname = name;
		}

		cgzname = [[OFString alloc]
		    initWithFormat:@"packages/%@/%@.cgz", pakname, mapname];
		bakname =
		    [[OFString alloc] initWithFormat:@"packages/%@/%@_%d.BAK",
		                      pakname, mapname, lastmillis];
		pcfname = [[OFString alloc]
		    initWithFormat:@"packages/%@/package.cfg", pakname];
		mcfname = [[OFString alloc]
		    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