From 87720c2b9cba9cc6f0f830214ae233adecfb015c Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 24 Aug 2014 12:41:39 +0200 Subject: [PATCH 1/3] segmentation fault --- src/economy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/economy.c b/src/economy.c index bd75c1049..8819f0fd4 100644 --- a/src/economy.c +++ b/src/economy.c @@ -2777,7 +2777,7 @@ static void breed_cmd(unit * u, struct order *ord) m = INT_MAX; } - if (!s[0]) { + if (!s || !s[0]) { p = P_ANY; } else { From 2246ce9d7aa08ac02a7833153e5661c40e8d1175 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 24 Aug 2014 12:40:00 +0200 Subject: [PATCH 2/3] segmentation fault caused by new getstrtoken semantics Conflicts: src/laws.c --- src/economy.c | 2 +- src/laws.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/economy.c b/src/economy.c index 8819f0fd4..86fb14a3d 100644 --- a/src/economy.c +++ b/src/economy.c @@ -2768,7 +2768,7 @@ static void breed_cmd(unit * u, struct order *ord) skip_token(); s = getstrtoken(); - m = atoi((const char *)s); + m = s ? atoi((const char *)s) : 0; if (m != 0) { /* first came a want-paramter */ s = getstrtoken(); diff --git a/src/laws.c b/src/laws.c index fe2ec329b..505dd91a7 100755 --- a/src/laws.c +++ b/src/laws.c @@ -3942,11 +3942,14 @@ void defaultorders(void) order *ord = *ordp; if (getkeyword(ord) == K_DEFAULT) { char lbuf[8192]; - order *new_order; - init_tokens(ord); - skip_token(); /* skip the keyword */ - strcpy(lbuf, getstrtoken()); - new_order = parse_order(lbuf, u->faction->locale); + order *new_order = 0; + const char *s; + init_order(ord); + s = getstrtoken(); + if (s) { + strcpy(lbuf, s); + new_order = parse_order(lbuf, u->faction->locale); + } *ordp = ord->next; ord->next = NULL; free_order(ord); From 9e81de406bec3dccf75a5c5b7f0d48054965b6c3 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 2 Sep 2014 07:24:55 +0200 Subject: [PATCH 3/3] version 3.2 remove regatta plane, it crashes all of a sudden. why is there a use of init_order here? that is a future feature. --- src/build.h | 4 ++-- src/kernel/save.c | 4 +++- src/laws.c | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/build.h b/src/build.h index bfc11ffe7..8be9fc2e8 100644 --- a/src/build.h +++ b/src/build.h @@ -1,3 +1,3 @@ #define VERSION_MAJOR 3 -#define VERSION_MINOR 1 -#define VERSION_BUILD 683 +#define VERSION_MINOR 2 +#define VERSION_BUILD 684 diff --git a/src/kernel/save.c b/src/kernel/save.c index af608f4b1..e16e61161 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -1571,7 +1571,9 @@ int readgame(const char *filename, int backup) } } a_read(&store, &pl->attribs, pl); - addlist(&planes, pl); + if (pl->id != 1094969858) { // Regatta + addlist(&planes, pl); + } } /* Read factions */ diff --git a/src/laws.c b/src/laws.c index 505dd91a7..34f8ca08b 100755 --- a/src/laws.c +++ b/src/laws.c @@ -3944,7 +3944,8 @@ void defaultorders(void) char lbuf[8192]; order *new_order = 0; const char *s; - init_order(ord); + init_tokens(ord); + skip_token(); s = getstrtoken(); if (s) { strcpy(lbuf, s);