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

Method StartServerActionFunc

client/src/main/java/jake2/client/Menu.java:2516–2589  ·  view source on GitHub ↗
(Object self)

Source from the content-addressed store, hash-verified

2514 }
2515
2516 private static void StartServerActionFunc(Object self) {
2517 //char startmap[1024];
2518 String startmap;
2519 int timelimit;
2520 int fraglimit;
2521 int maxclients;
2522 String spot;
2523
2524 //strcpy(startmap, strchr(mapnames[s_startmap_list.curvalue], '\n') +
2525 // 1);
2526 String x = mapnames[s_startmap_list.curvalue];
2527
2528 int pos = x.indexOf('\n');
2529 if (pos == -1)
2530 startmap = x;
2531 else
2532 startmap = x.substring(pos + 1, x.length());
2533
2534 maxclients = Lib.atoi(s_maxclients_field.buffer.toString());
2535 timelimit = Lib.atoi(s_timelimit_field.buffer.toString());
2536 fraglimit = Lib.atoi(s_fraglimit_field.buffer.toString());
2537
2538 Cvar.getInstance().SetValue("maxclients", ClampCvar(0, maxclients, maxclients));
2539 Cvar.getInstance().SetValue("timelimit", ClampCvar(0, timelimit, timelimit));
2540 Cvar.getInstance().SetValue("fraglimit", ClampCvar(0, fraglimit, fraglimit));
2541 Cvar.getInstance().Set("hostname", s_hostname_field.buffer.toString());
2542 // Cvar.SetValue ("deathmatch", !s_rules_box.curvalue );
2543 // Cvar.SetValue ("coop", s_rules_box.curvalue );
2544
2545 // PGM
2546 if ((s_rules_box.curvalue < 2) || (FS.Developer_searchpath() != 2)) {
2547 Cvar.getInstance().SetValue("deathmatch", 1 - (int) (s_rules_box.curvalue));
2548 Cvar.getInstance().SetValue("coop", s_rules_box.curvalue);
2549 Cvar.getInstance().SetValue("gamerules", 0);
2550 } else {
2551 Cvar.getInstance().SetValue("deathmatch", 1);
2552 // deathmatch is always true for rogue games, right?
2553 Cvar.getInstance().SetValue("coop", 0);
2554 // FIXME - this might need to depend on which game we're running
2555 Cvar.getInstance().SetValue("gamerules", s_rules_box.curvalue);
2556 }
2557 // PGM
2558
2559 spot = null;
2560 if (s_rules_box.curvalue == 1) // PGM
2561 {
2562 if (Lib.Q_stricmp(startmap, "bunk1") == 0)
2563 spot = "start";
2564 else if (Lib.Q_stricmp(startmap, "mintro") == 0)
2565 spot = "start";
2566 else if (Lib.Q_stricmp(startmap, "fact1") == 0)
2567 spot = "start";
2568 else if (Lib.Q_stricmp(startmap, "power1") == 0)
2569 spot = "pstart";
2570 else if (Lib.Q_stricmp(startmap, "biggun") == 0)
2571 spot = "bstart";
2572 else if (Lib.Q_stricmp(startmap, "hangar1") == 0)
2573 spot = "unitstart";

Callers 1

executeMethod · 0.95

Calls 10

atoiMethod · 0.95
getInstanceMethod · 0.95
ClampCvarMethod · 0.95
Developer_searchpathMethod · 0.95
Q_stricmpMethod · 0.95
AddTextMethod · 0.95
ForceMenuOffMethod · 0.95
SetValueMethod · 0.80
SetMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected