[Freeciv-Dev] Re: (PR#17775) pubserver 2.0 crash in maybe_cause_incident
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=17775 >
Fix attached. Problem was caused by missing catch in a switch statement,
hidden by "clever" use of the default catch. Please do not use default in
switch statements using enums.
- Per
Index: server/diplomats.c
===================================================================
--- server/diplomats.c (revision 12022)
+++ server/diplomats.c (working copy)
@@ -1375,10 +1375,12 @@
punishment = GAME_MAX_REPUTATION/10;
break;
case DS_ALLIANCE:
+ case DS_TEAM:
punishment = GAME_MAX_REPUTATION/5;
break;
- default:
- die("Illegal diplstate in maybe_cause_incident.");
+ case DS_LAST:
+ assert(FALSE);
+ break;
}
offender->reputation = MAX(offender->reputation - punishment, 0);
victim_player->diplstates[offender->player_no].has_reason_to_cancel = 2;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Re: (PR#17775) pubserver 2.0 crash in maybe_cause_incident,
Per I. Mathisen <=
|
|