parent
70fb4979a7
commit
f016bd7cee
@ -45,10 +45,21 @@ namespace spades {
|
||||
* Indicates whether the server does not provide the game properties in a way OpenSpades
|
||||
* can reliably parse and it must speculate them using non-program friendly information
|
||||
* (e.g., server message).
|
||||
*
|
||||
* Reserved for a future extension.
|
||||
*/
|
||||
bool useHeuristics = true;
|
||||
|
||||
bool clearCorpseOnRespawn = false;
|
||||
|
||||
/**
|
||||
* Raises the upper limit of the number of player slots to 128.
|
||||
*
|
||||
* Reserved for a future extension.
|
||||
*/
|
||||
bool manyPlayers = false;
|
||||
|
||||
int GetMaxNumPlayerSlots() const { return manyPlayers ? 128 : 32; }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -372,10 +372,10 @@ namespace spades {
|
||||
lastPlayerInput = 0;
|
||||
lastWeaponInput = 0;
|
||||
|
||||
savedPlayerPos.resize(32);
|
||||
savedPlayerFront.resize(32);
|
||||
savedPlayerTeam.resize(32);
|
||||
playerPosRecords.resize(32);
|
||||
savedPlayerPos.resize(128);
|
||||
savedPlayerFront.resize(128);
|
||||
savedPlayerTeam.resize(128);
|
||||
playerPosRecords.resize(128);
|
||||
|
||||
std::fill(savedPlayerTeam.begin(), savedPlayerTeam.end(), -1);
|
||||
|
||||
@ -751,7 +751,7 @@ namespace spades {
|
||||
int idx = i;
|
||||
if (protocolVersion == 4) {
|
||||
idx = reader.ReadByte();
|
||||
if (idx < 0 || idx >= 32) {
|
||||
if (idx < 0 || idx >= properties->GetMaxNumPlayerSlots()) {
|
||||
SPRaise("Invalid player number %d received with WorldUpdate", idx);
|
||||
}
|
||||
}
|
||||
@ -996,8 +996,9 @@ namespace spades {
|
||||
std::string name = reader.ReadRemainingString();
|
||||
// TODO: decode name?
|
||||
|
||||
if (pId < 0 || pId >= 32) {
|
||||
SPLog("Ignoring player 32 (bug in pyspades?: %s)", name.c_str());
|
||||
if (pId < 0 || pId >= properties->GetMaxNumPlayerSlots()) {
|
||||
SPLog("Ignoring invalid player number %d (bug in pyspades?: %s)", pId,
|
||||
name.c_str());
|
||||
break;
|
||||
}
|
||||
WeaponType wType;
|
||||
@ -1248,12 +1249,7 @@ namespace spades {
|
||||
case PacketTypeChatMessage: {
|
||||
// might be wrong player id for server message
|
||||
uint8_t pId = reader.ReadByte();
|
||||
Player *p;
|
||||
if (pId < 32) {
|
||||
p = GetPlayerOrNull(pId);
|
||||
} else {
|
||||
p = NULL;
|
||||
}
|
||||
Player *p = GetPlayerOrNull(pId);
|
||||
int type = reader.ReadByte();
|
||||
std::string txt = reader.ReadRemainingString();
|
||||
if (p) {
|
||||
|
@ -52,7 +52,7 @@ namespace spades {
|
||||
mapWrapper = NULL;
|
||||
|
||||
localPlayerIndex = -1;
|
||||
for (int i = 0; i < 32; i++) {
|
||||
for (int i = 0; i < 128; i++) {
|
||||
players.push_back((Player *)NULL);
|
||||
playerPersistents.push_back(PlayerPersistent());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user