- added more error checking in case segfault reproduced from: https://forum.megaglest.org/index.php?topic=9612.0;topicseen
This commit is contained in:
parent
b0f7b078f6
commit
e65ad1b69c
|
@ -170,11 +170,25 @@ bool SurfaceCell::decAmount(int value) {
|
||||||
return object->getResource()->decAmount(value);
|
return object->getResource()->decAmount(value);
|
||||||
}
|
}
|
||||||
void SurfaceCell::setExplored(int teamIndex, bool explored) {
|
void SurfaceCell::setExplored(int teamIndex, bool explored) {
|
||||||
|
if(teamIndex < 0 || teamIndex >= GameConstants::maxPlayers + GameConstants::specialFactions) {
|
||||||
|
char szBuf[8096]="";
|
||||||
|
snprintf(szBuf,8096,"Invalid value for teamIndex [%d]",teamIndex);
|
||||||
|
printf("%s\n",szBuf);
|
||||||
|
throw megaglest_runtime_error(szBuf);
|
||||||
|
}
|
||||||
|
|
||||||
this->explored[teamIndex]= explored;
|
this->explored[teamIndex]= explored;
|
||||||
//printf("Setting explored to %d for teamIndex %d\n",explored,teamIndex);
|
//printf("Setting explored to %d for teamIndex %d\n",explored,teamIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceCell::setVisible(int teamIndex, bool visible) {
|
void SurfaceCell::setVisible(int teamIndex, bool visible) {
|
||||||
|
if(teamIndex < 0 || teamIndex >= GameConstants::maxPlayers + GameConstants::specialFactions) {
|
||||||
|
char szBuf[8096]="";
|
||||||
|
snprintf(szBuf,8096,"Invalid value for teamIndex [%d]",teamIndex);
|
||||||
|
printf("%s\n",szBuf);
|
||||||
|
throw megaglest_runtime_error(szBuf);
|
||||||
|
}
|
||||||
|
|
||||||
this->visible[teamIndex]= visible;
|
this->visible[teamIndex]= visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue