[Fix] Sanitize player faction standing.
This commit is contained in:
parent
71e0803b1a
commit
f2702222d4
@ -70,6 +70,12 @@ char* faction_longname(int f) {
|
|||||||
void faction_modPlayer(int f, int mod) {
|
void faction_modPlayer(int f, int mod) {
|
||||||
if(faction_isFaction(f)) {
|
if(faction_isFaction(f)) {
|
||||||
faction_stack[f].player += mod;
|
faction_stack[f].player += mod;
|
||||||
|
|
||||||
|
/* Sanitize. */
|
||||||
|
if(faction_stack[f].player > 100)
|
||||||
|
faction_stack[f].player = 100;
|
||||||
|
else if(faction_stack[f].player < -100)
|
||||||
|
faction_stack[f].player = -100;
|
||||||
} else {
|
} else {
|
||||||
DEBUG("%d is an invalid faction/alliance", f);
|
DEBUG("%d is an invalid faction/alliance", f);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user