[Freeciv-Dev] Re: (PR#9310) startunits
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9310 >
Genevieve Gracian wrote:
> The string for startunits is limited to 15 characters, makes 15 units
> max but on stable version it's possible to have 20 units (10 settlers
> and 10 explos). Is the new max number of units wanted?
Attached patch takes care of the most critical part of this ticket;
savegame loading was not checking array bounds when loading old saves,
so loading such an old game with > 15 startunits got out of bounds.
- Caz
diff -Nurd -X.diff_ignore freeciv/server/savegame.c freeciv/server/savegame.c
--- freeciv/server/savegame.c 2004-09-19 17:15:43.687500000 +0300
+++ freeciv/server/savegame.c 2004-09-19 22:15:23.187500000 +0300
@@ -3072,10 +3072,10 @@
int settlers = secfile_lookup_int(file, "game.settlers");
int explorer = secfile_lookup_int(file, "game.explorer");
int i;
- for (i = 0; settlers>0; i++, settlers--) {
+ for (i = 0; settlers > 0 && i < MAX_LEN_STARTUNIT ; i++, settlers--) {
game.start_units[i] = 'c';
}
- for (; explorer>0; i++, explorer--) {
+ for (; explorer > 0 && i < MAX_LEN_STARTUNIT ; i++, explorer--) {
game.start_units[i] = 'x';
}
game.start_units[i] = '\0';
- [Freeciv-Dev] Re: (PR#9310) startunits,
Marko Lindqvist <=
|
|