Clean up user data vs. game data
FossilOrigin-Name: d751d8b0b7ca39f458acf12116633d5ebdae0976c8241cf419b49510990f3268
This commit is contained in:
parent
2cd917c394
commit
095af0a1e7
4 changed files with 28 additions and 21 deletions
23
src/Cube.mm
23
src/Cube.mm
|
@ -135,37 +135,37 @@ VARP(minmillis, 0, 5, 1000);
|
|||
log(@"basetex");
|
||||
int xs, ys;
|
||||
if (!installtex(2,
|
||||
[_userDataIRI IRIByAppendingPathComponent:@"data/newchars.png"],
|
||||
[_gameDataIRI IRIByAppendingPathComponent:@"data/newchars.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(3,
|
||||
[_userDataIRI
|
||||
[_gameDataIRI
|
||||
IRIByAppendingPathComponent:@"data/martin/base.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(6,
|
||||
[_userDataIRI
|
||||
[_gameDataIRI
|
||||
IRIByAppendingPathComponent:@"data/martin/ball1.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(7,
|
||||
[_userDataIRI
|
||||
[_gameDataIRI
|
||||
IRIByAppendingPathComponent:@"data/martin/smoke.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(8,
|
||||
[_userDataIRI
|
||||
[_gameDataIRI
|
||||
IRIByAppendingPathComponent:@"data/martin/ball2.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(9,
|
||||
[_userDataIRI
|
||||
[_gameDataIRI
|
||||
IRIByAppendingPathComponent:@"data/martin/ball3.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(4,
|
||||
[_userDataIRI
|
||||
[_gameDataIRI
|
||||
IRIByAppendingPathComponent:@"data/explosion.jpg"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(5,
|
||||
[_userDataIRI IRIByAppendingPathComponent:@"data/items.png"],
|
||||
[_gameDataIRI IRIByAppendingPathComponent:@"data/items.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(1,
|
||||
[_userDataIRI
|
||||
[_gameDataIRI
|
||||
IRIByAppendingPathComponent:@"data/crosshair.png"],
|
||||
&xs, &ys, false))
|
||||
fatal(@"could not find core textures (hint: run cube from the "
|
||||
|
@ -182,8 +182,9 @@ VARP(minmillis, 0, 5, 1000);
|
|||
exec(@"data/prefabs.cfg");
|
||||
exec(@"data/sounds.cfg");
|
||||
exec(@"servers.cfg");
|
||||
if (!execfile(@"config.cfg"))
|
||||
execfile(@"data/defaults.cfg");
|
||||
if (!execfile([_userDataIRI IRIByAppendingPathComponent:@"config.cfg"]))
|
||||
execfile([_gameDataIRI
|
||||
IRIByAppendingPathComponent:@"data/defaults.cfg"]);
|
||||
exec(@"autoexec.cfg");
|
||||
|
||||
log(@"localconnect");
|
||||
|
|
|
@ -338,13 +338,15 @@ complete(OFString *s_)
|
|||
}
|
||||
|
||||
bool
|
||||
execfile(OFString *cfgfile)
|
||||
execfile(OFIRI *cfgfile)
|
||||
{
|
||||
@autoreleasepool {
|
||||
OFString *command;
|
||||
@try {
|
||||
command = [OFString stringWithContentsOfFile:cfgfile];
|
||||
} @catch (id e) {
|
||||
command = [OFString stringWithContentsOfIRI:cfgfile];
|
||||
} @catch (OFOpenItemFailedException *e) {
|
||||
return false;
|
||||
} @catch (OFReadFailedException *e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -356,10 +358,12 @@ execfile(OFString *cfgfile)
|
|||
void
|
||||
exec(OFString *cfgfile)
|
||||
{
|
||||
if (!execfile(cfgfile)) {
|
||||
@autoreleasepool {
|
||||
@autoreleasepool {
|
||||
if (!execfile([Cube.sharedInstance.userDataIRI
|
||||
IRIByAppendingPathComponent:cfgfile]) &&
|
||||
!execfile([Cube.sharedInstance.gameDataIRI
|
||||
IRIByAppendingPathComponent:cfgfile]))
|
||||
conoutf(@"could not read \"%@\"", cfgfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ extern bool identexists(OFString *name);
|
|||
extern bool addcommand(OFString *name, void (*fun)(), int narg);
|
||||
extern int execute(OFString *p, bool down = true);
|
||||
extern void exec(OFString *cfgfile);
|
||||
extern bool execfile(OFString *cfgfile);
|
||||
extern bool execfile(OFIRI *cfgfile);
|
||||
extern void resetcomplete();
|
||||
extern void complete(OFString *s);
|
||||
extern void alias(OFString *name, OFString *action);
|
||||
|
|
|
@ -384,8 +384,10 @@ load_world(OFString *mname) // still supports all map formats that have existed
|
|||
if (identexists(aliasname))
|
||||
alias(aliasname, @"");
|
||||
}
|
||||
execfile(@"data/default_map_settings.cfg");
|
||||
execfile(pcfname);
|
||||
execfile(mcfname);
|
||||
OFIRI *gameDataIRI = Cube.sharedInstance.gameDataIRI;
|
||||
execfile([gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/default_map_settings.cfg"]);
|
||||
execfile([gameDataIRI IRIByAppendingPathComponent:pcfname]);
|
||||
execfile([gameDataIRI IRIByAppendingPathComponent:mcfname]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue