From 50b6823e287e504bf6f6ed7e8482e04579fdea50 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 9 Jul 2004 18:28:38 +0000 Subject: [PATCH] =?UTF-8?q?-=20http://eressea.upb.de/mantis/bug=5Fview=5Fp?= =?UTF-8?q?age.php=3Fbug=5Fid=3D0000141=20=20=20Die=20Menge=20des=20zu=20v?= =?UTF-8?q?erdienenden=20Silbers=20ist=20falsch=20berechnet,=20enn=20mehr?= =?UTF-8?q?=20als=20eine=20Einheit=20unterh=C3=A4lt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/gamecode/economy.c | 2 +- src/eressea/lua/unit.cpp | 22 +--------------------- src/scripts/samples.lua | 23 ++++++++++++++++++++++- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 59cafff0c..584d2affc 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -2647,7 +2647,7 @@ expandentertainment(region * r) change_money(u, u->n); rsetmoney(r, rmoney(r) - u->n); m -= u->n; - entertaining -= u->n; + entertaining -= o->qty; /* Nur soviel PRODUCEEXP wie auch tatsächlich gemacht wurde */ produceexp(u, SK_ENTERTAINMENT, min(u->n, u->number)); diff --git a/src/eressea/lua/unit.cpp b/src/eressea/lua/unit.cpp index e9cb941ee..e47b94085 100644 --- a/src/eressea/lua/unit.cpp +++ b/src/eressea/lua/unit.cpp @@ -318,27 +318,7 @@ unit_setmagic(unit& u, const char * type) static void unit_addorder(unit& u, const char * str) { - char buf[1024]; - char * s = buf; - boolean quote = false; - order * ord; - - while (*str) { - switch (*str) { - case '"': - quote=!quote; - break; - case ' ': - if (quote) *s++ = SPACE_REPLACEMENT; - else *s++ = ' '; - break; - default: - *s++ = *str; - } - ++str; - } - *s=0; - ord = parse_order(buf, u.faction->locale); + order * ord = parse_order(str, u.faction->locale); addlist(&u.orders, ord); u.faction->lastorders = turn; } diff --git a/src/scripts/samples.lua b/src/scripts/samples.lua index 839bb5814..72197f4bd 100644 --- a/src/scripts/samples.lua +++ b/src/scripts/samples.lua @@ -155,7 +155,28 @@ function test_monsters() process_orders() end -test_monsters() +function test_parser() + -- this script tests the changes to quotes + + plain = terraform(0, 0, "plain") + skill = 5 + + f = add_faction("enno@eressea.de", "human", "de") + f.age = 20 + u = add_unit(f, plain) + u.number = 10 + u:clear_orders() + u:add_order("Nummer Partei test") + u:add_order("BENENNE PARTEI \"Diese Partei heisst \\\"Enno's Schergen\\\".\"") + u:add_order("BENENNE EINHEIT \"Mein Name ist \\\"Enno\\\".\"") + + process_orders() + write_reports() + write_game("parser") +end + +test_parser() +-- test_monsters() -- test_combat() -- test_rewards() -- test_give()