MCPcopy Create free account
hub / github.com/assaultcube/AC / scallvote

Function scallvote

source/src/clientgame.cpp:1452–1501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1450}
1451
1452void scallvote(int *type, const char *arg1, const char *arg2)
1453{
1454 if(type && inmainloop)
1455 {
1456 int t = *type;
1457 switch (t)
1458 {
1459 case SA_MAP:
1460 {
1461 //FIXME: this stupid conversion of ints to strings and back should
1462 // really be replaced with a saner method
1463 defformatstring(m)("%d", nextmode);
1464 callvote(t, arg1, m, arg2);
1465 break;
1466 }
1467 case SA_PAUSE:
1468 {
1469 if (!arg1 || !isdigit(arg1[0]) || !multiplayer(NULL))
1470 {
1471 if(!multiplayer(NULL))
1472 conoutf("\f3pause is not available in singleplayer.");
1473 else if (arg1 && !isdigit(arg1[0])) conoutf("\f3invalid vote");
1474 break;
1475 }
1476 callvote(t, arg1, arg2);
1477 break;
1478 }
1479 case SA_KICK:
1480 case SA_BAN:
1481 {
1482 if (!arg1 || !isdigit(arg1[0]) || !arg2 || strlen(arg2) <= 3 || !multiplayer(NULL))
1483 {
1484 if(!multiplayer(NULL))
1485 conoutf("\f3%s is not available in singleplayer.", t == SA_BAN ? "Ban" : "Kick");
1486 else if(arg1 && !isdigit(arg1[0])) conoutf("\f3invalid vote");
1487 else conoutf("\f3invalid reason");
1488 break;
1489 }
1490 }
1491 case SA_FORCETEAM:
1492 {
1493 int team = atoi(arg2);
1494 if(team < 0) arg2 = (team == 0) ? "RVSF" : "CLA";
1495 // fall through
1496 }
1497 default:
1498 callvote(t, arg1, arg2);
1499 }
1500 }
1501}
1502
1503int vote(int v)
1504{

Callers

nothing calls this directly

Calls 3

callvoteFunction · 0.85
multiplayerFunction · 0.85
conoutfFunction · 0.70

Tested by

no test coverage detected