()
| 1064 | } |
| 1065 | |
| 1066 | private boolean initializeServerCvars() { |
| 1067 | // get any latched variable changes (maxclients, etc) |
| 1068 | Cvar.getInstance().updateLatchedVars(); |
| 1069 | |
| 1070 | if (Cvar.getInstance().VariableValue("coop") != 0 && Cvar.getInstance().VariableValue("deathmatch") != 0) { |
| 1071 | Com.Printf("Deathmatch and Coop both set, disabling Coop\n"); |
| 1072 | Cvar.getInstance().FullSet("coop", "0", Defines.CVAR_SERVERINFO | Defines.CVAR_LATCH); |
| 1073 | } |
| 1074 | |
| 1075 | // dedicated servers are can't be single player and are usually DM |
| 1076 | // so unless they explicity set coop, force it to deathmatch |
| 1077 | if (Cvar.getInstance().Get("dedicated", "0", 0).value != 0) { |
| 1078 | if (0 == Cvar.getInstance().VariableValue("coop")) |
| 1079 | Cvar.getInstance().FullSet("deathmatch", "1", Defines.CVAR_SERVERINFO | Defines.CVAR_LATCH); |
| 1080 | } |
| 1081 | |
| 1082 | |
| 1083 | // set max clients based on game mode |
| 1084 | final cvar_t maxclients = Cvar.getInstance().Get("maxclients", "1", Defines.CVAR_SERVERINFO | Defines.CVAR_LATCH); |
| 1085 | |
| 1086 | if (Cvar.getInstance().VariableValue("deathmatch") != 0) { |
| 1087 | if (maxclients.value <= 1) |
| 1088 | Cvar.getInstance().FullSet("maxclients", "8", Defines.CVAR_SERVERINFO | Defines.CVAR_LATCH); |
| 1089 | else if (maxclients.value > Defines.MAX_CLIENTS) |
| 1090 | Cvar.getInstance().FullSet("maxclients", "" + Defines.MAX_CLIENTS, Defines.CVAR_SERVERINFO | Defines.CVAR_LATCH); |
| 1091 | } else if (Cvar.getInstance().VariableValue("coop") != 0) { |
| 1092 | if (maxclients.value <= 1 || maxclients.value > 4) |
| 1093 | Cvar.getInstance().FullSet("maxclients", "4", Defines.CVAR_SERVERINFO | Defines.CVAR_LATCH); |
| 1094 | |
| 1095 | } else { |
| 1096 | // non-deathmatch, non-coop is one player |
| 1097 | Cvar.getInstance().FullSet("maxclients", "1", Defines.CVAR_SERVERINFO | Defines.CVAR_LATCH); |
| 1098 | } |
| 1099 | return maxclients.value > 1; |
| 1100 | } |
| 1101 | |
| 1102 | /** |
| 1103 | * Find and create an instance of the game subsystem |
no test coverage detected