Merge pull request #600 from ennorehling/develop

bug and crash fixes
This commit is contained in:
Enno Rehling 2016-11-05 18:33:49 +01:00 committed by GitHub
commit 570491808b
27 changed files with 47 additions and 27 deletions

View File

@ -1,5 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<messages> <messages>
<message name="parse_error" section="errors">
<type>
<arg name="unit" type="unit"/>
<arg name="command" type="string"/>
</type>
<text locale="de">"$unit($unit): '$command' - Dieser Befehl ist unbekannt."</text>
<text locale="en">"$unit($unit): '$command' - Parse error, unknown command."</text>
</message>
<message name="reduced_production"> <message name="reduced_production">
<text locale="de">Die Region ist verwüstet, der Boden karg.</text> <text locale="de">Die Region ist verwüstet, der Boden karg.</text>
<text locale="en">The region is ravaged, the ground infertile.</text> <text locale="en">The region is ravaged, the ground infertile.</text>

View File

@ -21,10 +21,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "battle.h" #include "battle.h"
#include "alchemy.h" #include "alchemy.h"
#include "chaos.h" #include "chaos.h"
#include "move.h" #include "guard.h"
#include "laws.h" #include "laws.h"
#include "skill.h"
#include "monster.h" #include "monster.h"
#include "move.h"
#include "skill.h"
#include <kernel/ally.h> #include <kernel/ally.h>
#include <kernel/alliance.h> #include <kernel/alliance.h>
@ -2763,7 +2764,7 @@ static void aftermath(battle * b)
/* Distribute Loot */ /* Distribute Loot */
loot_items(df); loot_items(df);
setguard(du, true); setguard(du, false);
scale_number(du, 0); scale_number(du, 0);
} }
else { else {

View File

@ -1,4 +1,4 @@
/* /*
+-------------------+ Enno Rehling <enno@eressea.de> +-------------------+ Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de> | Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de> | (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
@ -11,6 +11,7 @@ without prior permission by the authors of Eressea.
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/version.h> #include <kernel/version.h>
#include "creport.h" #include "creport.h"
#include "guard.h"
#include "travelthru.h" #include "travelthru.h"
/* tweakable features */ /* tweakable features */
@ -185,9 +186,9 @@ cr_output_curses(stream *out, const faction * viewer, const void *obj, objtype_t
region *r; region *r;
/* Die Sichtbarkeit eines Zaubers und die Zaubermeldung sind bei /* Die Sichtbarkeit eines Zaubers und die Zaubermeldung sind bei
* Gebäuden und Schiffen je nach, ob man Besitzer ist, verschieden. * Gebaeuden und Schiffen je nach, ob man Besitzer ist, verschieden.
* Bei Einheiten sieht man Wirkungen auf eigene Einheiten immer. * Bei Einheiten sieht man Wirkungen auf eigene Einheiten immer.
* Spezialfälle (besonderes Talent, verursachender Magier usw. werde * Spezialfaelle (besonderes Talent, verursachender Magier usw. werde
* bei jedem curse gesondert behandelt. */ * bei jedem curse gesondert behandelt. */
if (typ == TYP_SHIP) { if (typ == TYP_SHIP) {
ship *sh = (ship *)obj; ship *sh = (ship *)obj;

View File

@ -24,6 +24,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "alchemy.h" #include "alchemy.h"
#include "direction.h" #include "direction.h"
#include "donations.h" #include "donations.h"
#include "guard.h"
#include "give.h" #include "give.h"
#include "laws.h" #include "laws.h"
#include "randenc.h" #include "randenc.h"
@ -340,8 +341,8 @@ static int do_recruiting(recruitment * recruits, int available)
/* unit is empty, dead, and cannot recruit */ /* unit is empty, dead, and cannot recruit */
number = 0; number = 0;
} }
if (number > 0) {
add_recruits(u, number, req->qty); add_recruits(u, number, req->qty);
if (number > 0) {
dec = (int)(number * multi); dec = (int)(number * multi);
if ((rc->ec_flags & ECF_REC_ETHEREAL) == 0) { if ((rc->ec_flags & ECF_REC_ETHEREAL) == 0) {
recruited += dec; recruited += dec;

View File

@ -1,4 +1,4 @@
/* /*
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de> +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea.de> | | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de> | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>

View File

@ -1,4 +1,4 @@
/* /*
Copyright (c) 1998-2015, Copyright (c) 1998-2015,
Enno Rehling <enno@eressea.de> Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de Katja Zedel <katze@felidae.kn-bremen.de
@ -37,7 +37,7 @@ guard_t can_start_guarding(const unit * u)
{ {
if (u->status >= ST_FLEE || fval(u, UFL_FLEEING)) if (u->status >= ST_FLEE || fval(u, UFL_FLEEING))
return E_GUARD_FLEEING; return E_GUARD_FLEEING;
/* Monster der Monsterpartei dürfen immer bewachen */ /* Monster der Monsterpartei duerfen immer bewachen */
if (is_monsters(u->faction) || fval(u_race(u), RCF_UNARMEDGUARD)) if (is_monsters(u->faction) || fval(u_race(u), RCF_UNARMEDGUARD))
return E_GUARD_OK; return E_GUARD_OK;
if (!armedmen(u, true)) if (!armedmen(u, true))

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#ifndef H_GUARD #ifndef H_GUARD
#define H_GUARD #define H_GUARD

View File

@ -1,4 +1,4 @@
#include "reports.h" #include "reports.h"
#include "jsreport.h" #include "jsreport.h"
#include <kernel/faction.h> #include <kernel/faction.h>
#include <kernel/region.h> #include <kernel/region.h>

View File

@ -24,6 +24,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "direction.h" #include "direction.h"
#include "move.h" #include "move.h"
#include "study.h" #include "study.h"
#include "guard.h"
#include "laws.h" #include "laws.h"
#include "skill.h" #include "skill.h"
#include "lighthouse.h" #include "lighthouse.h"

View File

@ -285,7 +285,7 @@ static order *create_order_i(keyword_t kwd, const char *sptr, bool persistent,
order *ord = NULL; order *ord = NULL;
int lindex; int lindex;
if ((int)kwd > 0 && keyword_disabled(kwd)) { if (kwd == NOKEYWORD || keyword_disabled(kwd)) {
log_error("trying to create an order for disabled keyword %s.", keyword(kwd)); log_error("trying to create an order for disabled keyword %s.", keyword(kwd));
return NULL; return NULL;
} }
@ -407,9 +407,9 @@ order *parse_order(const char *s, const struct locale * lang)
if (kwd != NOKEYWORD) { if (kwd != NOKEYWORD) {
while (isxspace(*(unsigned char *)sptr)) ++sptr; while (isxspace(*(unsigned char *)sptr)) ++sptr;
s = sptr; s = sptr;
}
return create_order_i(kwd, s, persistent, lang); return create_order_i(kwd, s, persistent, lang);
} }
}
return NULL; return NULL;
} }

View File

@ -206,12 +206,14 @@ static unit *unitorders(FILE * F, int enc, struct faction *f)
if (*ordp) { if (*ordp) {
ordp = &(*ordp)->next; ordp = &(*ordp)->next;
} }
else {
ADDMSG(&f->msgs, msg_message("parse_error", "unit command", u, s));
}
} }
} }
} }
else { else {
/* cmistake(?, buf, 160, MSG_EVENT); */
return NULL; return NULL;
} }
return u; return u;

2
src/laws.c Executable file → Normal file
View File

@ -1,4 +1,4 @@
/* /*
Copyright (c) 1998-2014, Copyright (c) 1998-2014,
Enno Rehling <enno@eressea.de> Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de Katja Zedel <katze@felidae.kn-bremen.de

View File

@ -20,7 +20,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define H_GC_LAWS #define H_GC_LAWS
#include <kernel/types.h> #include <kernel/types.h>
#include "guard.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -1,6 +1,7 @@
#include <platform.h> #include <platform.h>
#include "laws.h" #include "laws.h"
#include "battle.h" #include "battle.h"
#include "guard.h"
#include "monster.h" #include "monster.h"
#include <kernel/ally.h> #include <kernel/ally.h>

View File

@ -1,4 +1,4 @@
/* /*
Copyright (c) 1998-2014, Copyright (c) 1998-2014,
Enno Rehling <enno@eressea.de> Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de Katja Zedel <katze@felidae.kn-bremen.de

View File

@ -25,6 +25,7 @@
#include "economy.h" #include "economy.h"
#include "chaos.h" #include "chaos.h"
#include "give.h" #include "give.h"
#include "guard.h"
#include "monster.h" #include "monster.h"
#include "laws.h" #include "laws.h"
#include "keyword.h" #include "keyword.h"

View File

@ -1,4 +1,4 @@
/* /*
Copyright (c) 1998-2014, Copyright (c) 1998-2014,
Enno Rehling <enno@eressea.de> Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de Katja Zedel <katze@felidae.kn-bremen.de
@ -20,6 +20,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <platform.h> #include <platform.h>
#include <kernel/config.h> #include <kernel/config.h>
#include "move.h" #include "move.h"
#include "guard.h"
#include "laws.h" #include "laws.h"
#include "reports.h" #include "reports.h"
#include "study.h" #include "study.h"

View File

@ -1,4 +1,4 @@
/* /*
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de> Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de> Christian Schlittchen <corwin@amber.kn-bremen.de>
@ -23,6 +23,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "report.h" #include "report.h"
#include "reports.h" #include "reports.h"
#include "guard.h"
#include "laws.h" #include "laws.h"
#include "travelthru.h" #include "travelthru.h"
#include "monster.h" #include "monster.h"

View File

@ -19,6 +19,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <platform.h> #include <platform.h>
#include <kernel/config.h> #include <kernel/config.h>
#include "reports.h" #include "reports.h"
#include "guard.h"
#include "laws.h" #include "laws.h"
#include "travelthru.h" #include "travelthru.h"
#include "lighthouse.h" #include "lighthouse.h"

View File

@ -15,6 +15,7 @@
#include <platform.h> #include <platform.h>
#include <kernel/config.h> #include <kernel/config.h>
#include "guard.h"
#include "spy.h" #include "spy.h"
#include "vortex.h" #include "vortex.h"
#include "laws.h" #include "laws.h"

View File

@ -1,4 +1,4 @@
/* /*
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de> Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de> Christian Schlittchen <corwin@amber.kn-bremen.de>
@ -19,6 +19,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <platform.h> #include <platform.h>
#include <kernel/config.h> #include <kernel/config.h>
#include "spy.h" #include "spy.h"
#include "guard.h"
#include "laws.h" #include "laws.h"
#include "move.h" #include "move.h"
#include "reports.h" #include "reports.h"

View File

@ -1,4 +1,4 @@
/* /*
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de> Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de> Christian Schlittchen <corwin@amber.kn-bremen.de>

View File

@ -1,4 +1,4 @@
/* /*
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de> * +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
* | | Enno Rehling <enno@eressea.de> * | | Enno Rehling <enno@eressea.de>
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de> * | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>

View File

@ -1,4 +1,4 @@
/* /*
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de> Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de> Christian Schlittchen <corwin@amber.kn-bremen.de>

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#ifndef H_TRAVELTHRU #ifndef H_TRAVELTHRU
#define H_TRAVELTHRU #define H_TRAVELTHRU

View File

@ -1,4 +1,4 @@
#include <platform.h> #include <platform.h>
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/region.h> #include <kernel/region.h>
#include <kernel/unit.h> #include <kernel/unit.h>

View File

@ -1,4 +1,4 @@
#include <platform.h> #include <platform.h>
#include "upkeep.h" #include "upkeep.h"
#include <kernel/config.h> #include <kernel/config.h>