File(const String& filename) throw(AccessViolation, BadFileName) { cout << "Open " << filename << "\n"; if (filename == "badAccess.txt") throw AccessViolation(); if (filename == "badName.txt") throw BadFileName(); }
//updated void SaveJTRAIL(edict_t *ent, int cmd) { char *opt; char JTRAILFile[256]; char path[256]; if (TrailsBanned()) return; if (ltnodes < 1) { gi.cprintf(ent,PRINT_HIGH,"No jump trails to save!\n"); return; } if (gi.argc() != 3) { if (cmd == 1) gi.cprintf(ent,PRINT_HIGH, "Wrong syntax: jtrailsave <all/view/last> <filename>\n"); else gi.cprintf(ent,PRINT_HIGH, "Wrong syntax: tsave <all/view/last> <filename>\n"); return; } if (BadFileName(gi.args())) { gi.cprintf(ent,PRINT_HIGH,"Illegal characters found in filename. JTrail not saved.\n"); return; } opt = strtok(gi.args()," "); sprintf (path, GAMEVERSION "/jtrail"); p_mkdir(path); sprintf (JTRAILFile, GAMEVERSION "/jtrail/%s-%s.jtrail", level.mapname, strtok(NULL," ")); if (!Q_stricmp(opt,"all")) SaveJTRAIL_all(ent,JTRAILFile); else if (!Q_stricmp(opt,"view")) SaveJTRAIL_view(ent,JTRAILFile); else if (!Q_stricmp(opt,"last")) SaveJTRAIL_last(ent,JTRAILFile); else gi.cprintf(ent,PRINT_HIGH, "Unknown save option \"%s\". Valid options are \"view\", \"all\", and \"last\"\n",opt); }