More string migrations
FossilOrigin-Name: 5659be76dbc70d7549e3a6b4ff2a1f6b01a56f58bd77097fdda53ead13ea435d
This commit is contained in:
parent
d4b7da3740
commit
bc8e7c17cc
3 changed files with 21 additions and 17 deletions
|
@ -39,8 +39,8 @@ conline(OFString *sf, bool highlight) // add a line to the console buffer
|
||||||
// for how long to keep line on screen
|
// for how long to keep line on screen
|
||||||
cl.outtime = lastmillis;
|
cl.outtime = lastmillis;
|
||||||
conlines.insert(0, cl);
|
conlines.insert(0, cl);
|
||||||
if (highlight) // show line in a different colour, for chat etc.
|
if (highlight) {
|
||||||
{
|
// show line in a different colour, for chat etc.
|
||||||
cl.cref[0] = '\f';
|
cl.cref[0] = '\f';
|
||||||
cl.cref[1] = 0;
|
cl.cref[1] = 0;
|
||||||
strcat_s(cl.cref, sf.UTF8String);
|
strcat_s(cl.cref, sf.UTF8String);
|
||||||
|
@ -152,7 +152,8 @@ void
|
||||||
mapmsg(OFString *s)
|
mapmsg(OFString *s)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
strn0cpy(hdr.maptitle, s.UTF8String, 128);
|
memset(hdr.maptitle, '\0', sizeof(hdr.maptitle));
|
||||||
|
strncpy(hdr.maptitle, s.UTF8String, 127);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
COMMAND(mapmsg, ARG_1STR)
|
COMMAND(mapmsg, ARG_1STR)
|
||||||
|
|
|
@ -486,7 +486,8 @@ empty_world(int factor, bool force)
|
||||||
ents[i].y += ssize / 4;
|
ents[i].y += ssize / 4;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strn0cpy(hdr.maptitle, "Untitled Map by Unknown", 128);
|
char buffer[128] = "Untitled Map by Unknown";
|
||||||
|
memcpy(hdr.maptitle, buffer, 128);
|
||||||
hdr.waterlevel = -100000;
|
hdr.waterlevel = -100000;
|
||||||
loopi(15) hdr.reserved[i] = 0;
|
loopi(15) hdr.reserved[i] = 0;
|
||||||
loopk(3) loopi(256) hdr.texlists[k][i] = i;
|
loopk(3) loopi(256) hdr.texlists[k][i] = i;
|
||||||
|
|
|
@ -12,29 +12,31 @@ backup(OFString *name, OFString *backupname)
|
||||||
static OFString *cgzname, *bakname, *pcfname, *mcfname;
|
static OFString *cgzname, *bakname, *pcfname, *mcfname;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setnames(OFString *name_)
|
setnames(OFString *name)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
const char *name = name_.UTF8String;
|
OFCharacterSet *cs =
|
||||||
string pakname, mapname;
|
[OFCharacterSet characterSetWithCharactersInString:@"/\\"];
|
||||||
const char *slash = strpbrk(name, "/\\");
|
OFRange range = [name rangeOfCharacterFromSet:cs];
|
||||||
if (slash) {
|
OFString *pakname, *mapname;
|
||||||
strn0cpy(pakname, name, slash - name + 1);
|
|
||||||
strcpy_s(mapname, slash + 1);
|
if (range.location != OFNotFound) {
|
||||||
|
pakname = [name substringToIndex:range.location];
|
||||||
|
mapname = [name substringFromIndex:range.location + 1];
|
||||||
} else {
|
} else {
|
||||||
strcpy_s(pakname, "base");
|
pakname = @"base";
|
||||||
strcpy_s(mapname, name);
|
mapname = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
cgzname = [[OFString alloc]
|
cgzname = [[OFString alloc]
|
||||||
initWithFormat:@"packages/%s/%s.cgz", pakname, mapname];
|
initWithFormat:@"packages/%@/%@.cgz", pakname, mapname];
|
||||||
bakname =
|
bakname =
|
||||||
[[OFString alloc] initWithFormat:@"packages/%s/%s_%d.BAK",
|
[[OFString alloc] initWithFormat:@"packages/%@/%@_%d.BAK",
|
||||||
pakname, mapname, lastmillis];
|
pakname, mapname, lastmillis];
|
||||||
pcfname = [[OFString alloc]
|
pcfname = [[OFString alloc]
|
||||||
initWithFormat:@"packages/%s/package.cfg", pakname];
|
initWithFormat:@"packages/%@/package.cfg", pakname];
|
||||||
mcfname = [[OFString alloc]
|
mcfname = [[OFString alloc]
|
||||||
initWithFormat:@"packages/%s/%s.cfg", pakname, mapname];
|
initWithFormat:@"packages/%@/%@.cfg", pakname, mapname];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue