MCPcopy Create free account
hub / github.com/demoth/jake2 / StartServer_MenuInit

Method StartServer_MenuInit

client/src/main/java/jake2/client/Menu.java:2595–2776  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2593 private static String dm_coop_names_rogue[] = { "deathmatch", "cooperative", "tag" };
2594
2595 private static void StartServer_MenuInit() {
2596
2597 // =======
2598 // PGM
2599 // =======
2600
2601 byte[] buffer = null;
2602 String mapsname;
2603 String s;
2604 int i;
2605 RandomAccessFile fp;
2606
2607 /*
2608 * * load the list of map names
2609 */
2610 mapsname = FS.getWriteDir() + "/maps.lst";
2611
2612 if ((fp = Lib.fopen(mapsname, "r")) == null) {
2613 buffer = FS.LoadFile("maps.lst");
2614 if (buffer == null)
2615 //if ((length = FS_LoadFile("maps.lst", (Object *) & buffer))
2616 // == -1)
2617 Com.Error(ERR_DROP, "couldn't find maps.lst\n");
2618 } else {
2619 try {
2620 int len = (int) fp.length();
2621 buffer = new byte[len];
2622 fp.readFully(buffer);
2623 } catch (Exception e) {
2624 Com.Error(ERR_DROP, "couldn't load maps.lst\n");
2625 }
2626 }
2627
2628 s = new String(buffer);
2629 String lines[] = s.split("\r\n");
2630
2631 nummaps = lines.length;
2632
2633 if (nummaps == 0)
2634 Com.Error(ERR_DROP, "no maps in maps.lst\n");
2635
2636 mapnames = new String[nummaps];
2637
2638 for (i = 0; i < nummaps; i++) {
2639 String shortname, longname, scratch;
2640
2641 Com.ParseHelp ph = new Com.ParseHelp(lines[i]);
2642
2643 shortname = Com.Parse(ph).toUpperCase();
2644 longname = Com.Parse(ph);
2645 scratch = longname + "\n" + shortname;
2646 mapnames[i] = scratch;
2647 }
2648
2649 if (fp != null) {
2650 Lib.fclose(fp);
2651 fp = null;
2652

Callers 1

Menu_StartServer_fMethod · 0.95

Calls 14

getWriteDirMethod · 0.95
fopenMethod · 0.95
LoadFileMethod · 0.95
ErrorMethod · 0.95
ParseMethod · 0.95
fcloseMethod · 0.95
Developer_searchpathMethod · 0.95
getInstanceMethod · 0.95
Menu_AddItemMethod · 0.95
Menu_CenterMethod · 0.95
RulesChangeFuncMethod · 0.95
getWidthMethod · 0.80

Tested by

no test coverage detected