forked from github/server
Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
4984d8e8c5
|
@ -24,7 +24,13 @@ try:
|
|||
except:
|
||||
print "%s: reports.txt file does not exist" % (argv[0], )
|
||||
exit(0)
|
||||
|
||||
|
||||
extras = [ '../wochenbericht.txt' ]
|
||||
express='../express-%s.txt' % turn
|
||||
if os.path.isfile(express):
|
||||
os.symlink(express, 'express.txt')
|
||||
extras.append('express.txt')
|
||||
|
||||
for line in infile.readlines():
|
||||
settings = line[:-1].split(":")
|
||||
options = { "turn" : turn}
|
||||
|
@ -38,7 +44,6 @@ for line in infile.readlines():
|
|||
if not options.has_key("reports"):
|
||||
continue
|
||||
reports = options["reports"].split(",")
|
||||
# reports = reports + [ "iso.cr" ]
|
||||
prefix = "%(turn)s-%(faction)s." % options
|
||||
if options["compression"]=="zip":
|
||||
output = prefix+"zip"
|
||||
|
@ -61,7 +66,6 @@ for line in infile.readlines():
|
|||
if os.path.isfile(output):
|
||||
continue
|
||||
os.system("bzip2 %s" % filename)
|
||||
extras = [ '../wochenbericht.txt', '../express.txt' ]
|
||||
for extra in extras:
|
||||
if os.path.isfile(extra):
|
||||
files = files + [extra]
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<requirement type="mallorn" quantity="1"/>
|
||||
</construction>
|
||||
<weapon armorpiercing="true" pierce="true" missile="true" skill="crossbow" offmod="0" defmod="0" reload="2" magres="0.15">
|
||||
<damage type="rider" value="3d3+5"/>
|
||||
<damage type="footman" value="3d3+5"/>
|
||||
<damage type="rider" value="3d3+6"/>
|
||||
<damage type="footman" value="3d3+6"/>
|
||||
<modifier type="missile_target" value="0"/>
|
||||
</weapon>
|
||||
</item>
|
||||
|
|
|
@ -29,4 +29,5 @@ function test_store_unit()
|
|||
os.remove(filename)
|
||||
assert_not_nil(u)
|
||||
assert_equal(u:get_item("money"), u.number * 100)
|
||||
os.remove(filename)
|
||||
end
|
||||
|
|
|
@ -1691,9 +1691,9 @@ void do_combatmagic(battle * b, combatmagic_t was)
|
|||
if (was == DO_PRECOMBATSPELL) {
|
||||
for (s = b->sides; s != b->sides + b->nsides; ++s) {
|
||||
fighter *fig = 0;
|
||||
if (s->bf->attacker) {
|
||||
if (fval(s->faction, FFL_CURSED) && s->bf->attacker) {
|
||||
spell *sp = find_spell("igjarjuk");
|
||||
if (sp && fval(s->faction, FFL_CURSED)) {
|
||||
if (sp) {
|
||||
int si;
|
||||
for (si = 0; s->enemies[si]; ++si) {
|
||||
side *se = s->enemies[si];
|
||||
|
|
|
@ -1530,7 +1530,7 @@ report_computer(const char *filename, report_context * ctx, const char *charset)
|
|||
fprintf(F, "\"%s\";charset\n", charset);
|
||||
fprintf(F, "\"%s\";locale\n", locale_name(f->locale));
|
||||
fprintf(F, "%d;noskillpoints\n", 1);
|
||||
fprintf(F, "%ld;date\n", ctx->report_time);
|
||||
fprintf(F, "%lld;date\n", (long long)ctx->report_time);
|
||||
fprintf(F, "\"%s\";Spiel\n", game_name());
|
||||
fprintf(F, "\"%s\";Konfiguration\n", "Standard");
|
||||
fprintf(F, "\"%s\";Koordinaten\n", "Hex");
|
||||
|
|
|
@ -1204,7 +1204,7 @@ faction *readfaction(struct gamedata * data)
|
|||
READ_STR(data->store, name, sizeof(name));
|
||||
f->banner = _strdup(name);
|
||||
|
||||
log_printf(stdout, " - Lese Partei %s (%s)\n", f->name, factionid(f));
|
||||
log_debug(" - Lese Partei %s (%s)", f->name, factionid(f));
|
||||
|
||||
READ_STR(data->store, name, sizeof(name));
|
||||
if (set_email(&f->email, name) != 0) {
|
||||
|
@ -1385,7 +1385,7 @@ int readgame(const char *filename, bool backup)
|
|||
FILE *F;
|
||||
|
||||
init_locales();
|
||||
log_printf(stdout, "- reading game data from %s\n", filename);
|
||||
log_debug("- reading game data from %s\n", filename);
|
||||
sprintf(path, "%s/%s", datapath(), filename);
|
||||
|
||||
if (backup) {
|
||||
|
@ -1433,7 +1433,7 @@ int readgame(const char *filename, bool backup)
|
|||
a_read(&store, &global.attribs, NULL);
|
||||
READ_INT(&store, &turn);
|
||||
global.data_turn = turn;
|
||||
log_printf(stdout, " - reading turn %d\n", turn);
|
||||
log_debug(" - reading turn %d\n", turn);
|
||||
rng_init(turn);
|
||||
++global.cookie;
|
||||
READ_INT(&store, &nread); /* max_unique_id = ignore */
|
||||
|
@ -1501,7 +1501,7 @@ int readgame(const char *filename, bool backup)
|
|||
/* Read factions */
|
||||
read_alliances(&store);
|
||||
READ_INT(&store, &nread);
|
||||
log_printf(stdout, " - Einzulesende Parteien: %d\n", nread);
|
||||
log_debug(" - Einzulesende Parteien: %d\n", nread);
|
||||
fp = &factions;
|
||||
while (*fp)
|
||||
fp = &(*fp)->next;
|
||||
|
@ -1522,7 +1522,7 @@ int readgame(const char *filename, bool backup)
|
|||
if (rmax < 0) {
|
||||
rmax = nread;
|
||||
}
|
||||
log_printf(stdout, " - Einzulesende Regionen: %d/%d\r", rmax, nread);
|
||||
log_debug(" - Einzulesende Regionen: %d/%d\r", rmax, nread);
|
||||
while (--nread >= 0) {
|
||||
unit **up;
|
||||
int x, y;
|
||||
|
@ -1530,7 +1530,7 @@ int readgame(const char *filename, bool backup)
|
|||
READ_INT(&store, &y);
|
||||
|
||||
if ((nread & 0x3FF) == 0) { /* das spart extrem Zeit */
|
||||
log_printf(stdout, " - Einzulesende Regionen: %d/%d * %d,%d \r", rmax, nread, x, y);
|
||||
log_debug(" - Einzulesende Regionen: %d/%d * %d,%d \r", rmax, nread, x, y);
|
||||
}
|
||||
--rmax;
|
||||
|
||||
|
@ -1635,16 +1635,15 @@ int readgame(const char *filename, bool backup)
|
|||
update_interval(u->faction, u->region);
|
||||
}
|
||||
}
|
||||
log_printf(stdout, "\n");
|
||||
read_borders(&store);
|
||||
|
||||
binstore_done(&store);
|
||||
fstream_done(&strm);
|
||||
/* Unaufgeloeste Zeiger initialisieren */
|
||||
log_printf(stdout, "fixing unresolved references.\n");
|
||||
log_debug("fixing unresolved references.\n");
|
||||
resolve();
|
||||
|
||||
log_printf(stdout, "updating area information for lighthouses.\n");
|
||||
log_debug("updating area information for lighthouses.\n");
|
||||
for (r = regions; r; r = r->next) {
|
||||
if (r->flags & RF_LIGHTHOUSE) {
|
||||
building *b;
|
||||
|
@ -1652,7 +1651,7 @@ int readgame(const char *filename, bool backup)
|
|||
update_lighthouse(b);
|
||||
}
|
||||
}
|
||||
log_printf(stdout, "marking factions as alive.\n");
|
||||
log_debug("marking factions as alive.\n");
|
||||
for (f = factions; f; f = f->next) {
|
||||
if (f->flags & FFL_NPC) {
|
||||
f->alive = 1;
|
||||
|
@ -1699,7 +1698,7 @@ int readgame(const char *filename, bool backup)
|
|||
if (loadplane || maxregions >= 0) {
|
||||
remove_empty_factions();
|
||||
}
|
||||
log_printf(stdout, "Done loading turn %d.\n", turn);
|
||||
log_debug("Done loading turn %d.\n", turn);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1805,7 +1804,7 @@ int writegame(const char *filename)
|
|||
WRITE_INT(&store, n);
|
||||
WRITE_SECTION(&store);
|
||||
|
||||
log_printf(stdout, " - Schreibe %d Parteien...\n", n);
|
||||
log_debug(" - Schreibe %d Parteien...\n", n);
|
||||
for (f = factions; f; f = f->next) {
|
||||
if (fval(f, FFL_NPC)) {
|
||||
clear_npc_orders(f);
|
||||
|
@ -1819,13 +1818,12 @@ int writegame(const char *filename)
|
|||
n = listlen(regions);
|
||||
WRITE_INT(&store, n);
|
||||
WRITE_SECTION(&store);
|
||||
log_printf(stdout, " - Schreibe Regionen: %d \r", n);
|
||||
log_debug(" - Schreibe Regionen: %d", n);
|
||||
|
||||
for (r = regions; r; r = r->next, --n) {
|
||||
/* plus leerzeile */
|
||||
if ((n % 1024) == 0) { /* das spart extrem Zeit */
|
||||
log_printf(stdout, " - Schreibe Regionen: %d \r", n);
|
||||
fflush(stdout);
|
||||
log_debug(" - Schreibe Regionen: %d", n);
|
||||
}
|
||||
WRITE_SECTION(&store);
|
||||
WRITE_INT(&store, r->x);
|
||||
|
@ -1876,7 +1874,6 @@ int writegame(const char *filename)
|
|||
binstore_done(&store);
|
||||
fstream_done(&strm);
|
||||
|
||||
log_printf(stdout, "\nOk.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1992,7 +1992,7 @@ int mail_cmd(unit * u, struct order *ord)
|
|||
}
|
||||
|
||||
s = getstrtoken();
|
||||
if (!s[0]) {
|
||||
if (!s || !s[0]) {
|
||||
cmistake(u, ord, 30, MSG_MESSAGE);
|
||||
break;
|
||||
}
|
||||
|
@ -2015,7 +2015,7 @@ int mail_cmd(unit * u, struct order *ord)
|
|||
}
|
||||
|
||||
s = getstrtoken();
|
||||
if (!s[0]) {
|
||||
if (!s || !s[0]) {
|
||||
cmistake(u, ord, 30, MSG_MESSAGE);
|
||||
break;
|
||||
}
|
||||
|
@ -2047,7 +2047,7 @@ int mail_cmd(unit * u, struct order *ord)
|
|||
|
||||
s = getstrtoken();
|
||||
|
||||
if (!s[0]) {
|
||||
if (!s || !s[0]) {
|
||||
cmistake(u, ord, 30, MSG_MESSAGE);
|
||||
break;
|
||||
}
|
||||
|
@ -2076,7 +2076,7 @@ int mail_cmd(unit * u, struct order *ord)
|
|||
|
||||
s = getstrtoken();
|
||||
|
||||
if (!s[0]) {
|
||||
if (!s || !s[0]) {
|
||||
cmistake(u, ord, 30, MSG_MESSAGE);
|
||||
break;
|
||||
}
|
||||
|
|
104
src/laws.test.c
104
src/laws.test.c
|
@ -970,7 +970,7 @@ static void test_ally_cmd(CuTest *tc) {
|
|||
test_cleanup();
|
||||
}
|
||||
|
||||
void test_nmr_warnings(CuTest *tc) {
|
||||
static void test_nmr_warnings(CuTest *tc) {
|
||||
faction *f1, *f2;
|
||||
test_cleanup();
|
||||
set_param(&global.parameters, "nmr.timeout", "3");
|
||||
|
@ -989,6 +989,101 @@ void test_nmr_warnings(CuTest *tc) {
|
|||
test_cleanup();
|
||||
}
|
||||
|
||||
static unit * setup_mail_cmd(void) {
|
||||
faction *f;
|
||||
struct locale *lang;
|
||||
|
||||
test_cleanup();
|
||||
f = test_create_faction(0);
|
||||
f->locale = lang = get_or_create_locale("de");
|
||||
locale_setstring(lang, parameters[P_UNIT], "EINHEIT");
|
||||
locale_setstring(lang, parameters[P_REGION], "REGION");
|
||||
locale_setstring(lang, parameters[P_FACTION], "PARTEI");
|
||||
init_parameters(lang);
|
||||
return test_create_unit(f, test_create_region(0, 0, 0));
|
||||
}
|
||||
|
||||
static void test_mail_unit(CuTest *tc) {
|
||||
order *ord;
|
||||
unit *u;
|
||||
|
||||
u = setup_mail_cmd();
|
||||
ord = create_order(K_MAIL, u->faction->locale, "EINHEIT %s 'Hodor!'", itoa36(u->no));
|
||||
mail_cmd(u, ord);
|
||||
CuAssertPtrNotNull(tc, test_find_messagetype(u->faction->msgs, "unitmessage"));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_mail_faction(CuTest *tc) {
|
||||
order *ord;
|
||||
unit *u;
|
||||
|
||||
u = setup_mail_cmd();
|
||||
ord = create_order(K_MAIL, u->faction->locale, "PARTEI %s 'Hodor!'", itoa36(u->faction->no));
|
||||
mail_cmd(u, ord);
|
||||
CuAssertPtrNotNull(tc, test_find_messagetype(u->faction->msgs, "regionmessage"));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_mail_region(CuTest *tc) {
|
||||
order *ord;
|
||||
unit *u;
|
||||
|
||||
u = setup_mail_cmd();
|
||||
ord = create_order(K_MAIL, u->faction->locale, "REGION 'Hodor!'", itoa36(u->no));
|
||||
mail_cmd(u, ord);
|
||||
CuAssertPtrNotNull(tc, test_find_messagetype(u->region->msgs, "mail_result"));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_mail_unit_no_msg(CuTest *tc) {
|
||||
unit *u;
|
||||
order *ord;
|
||||
|
||||
u = setup_mail_cmd();
|
||||
ord = create_order(K_MAIL, u->faction->locale, "EINHEIT %s", itoa36(u->no));
|
||||
mail_cmd(u, ord);
|
||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(u->faction->msgs, "unitmessage"));
|
||||
CuAssertPtrNotNull(tc, test_find_messagetype(u->faction->msgs, "error30"));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_mail_faction_no_msg(CuTest *tc) {
|
||||
unit *u;
|
||||
order *ord;
|
||||
|
||||
u = setup_mail_cmd();
|
||||
ord = create_order(K_MAIL, u->faction->locale, "PARTEI %s", itoa36(u->faction->no));
|
||||
mail_cmd(u, ord);
|
||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(u->faction->msgs, "regionmessage"));
|
||||
CuAssertPtrNotNull(tc, test_find_messagetype(u->faction->msgs, "error30"));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_mail_faction_no_target(CuTest *tc) {
|
||||
unit *u;
|
||||
order *ord;
|
||||
|
||||
u = setup_mail_cmd();
|
||||
ord = create_order(K_MAIL, u->faction->locale, "PARTEI %s", itoa36(u->faction->no+1));
|
||||
mail_cmd(u, ord);
|
||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(u->faction->msgs, "regionmessage"));
|
||||
CuAssertPtrNotNull(tc, test_find_messagetype(u->faction->msgs, "error66"));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_mail_region_no_msg(CuTest *tc) {
|
||||
unit *u;
|
||||
order *ord;
|
||||
|
||||
u = setup_mail_cmd();
|
||||
ord = create_order(K_MAIL, u->faction->locale, "REGION");
|
||||
mail_cmd(u, ord);
|
||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(u->region->msgs, "mail_result"));
|
||||
CuAssertPtrNotNull(tc, test_find_messagetype(u->faction->msgs, "error30"));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
CuSuite *get_laws_suite(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
|
@ -1033,6 +1128,13 @@ CuSuite *get_laws_suite(void)
|
|||
SUITE_ADD_TEST(suite, test_force_leave_ships);
|
||||
SUITE_ADD_TEST(suite, test_force_leave_ships_on_ocean);
|
||||
SUITE_ADD_TEST(suite, test_peasant_luck_effect);
|
||||
SUITE_ADD_TEST(suite, test_mail_unit);
|
||||
SUITE_ADD_TEST(suite, test_mail_faction);
|
||||
SUITE_ADD_TEST(suite, test_mail_region);
|
||||
SUITE_ADD_TEST(suite, test_mail_unit_no_msg);
|
||||
SUITE_ADD_TEST(suite, test_mail_faction_no_msg);
|
||||
SUITE_ADD_TEST(suite, test_mail_region_no_msg);
|
||||
SUITE_ADD_TEST(suite, test_mail_faction_no_target);
|
||||
(void)test_luck_message; /* disabled, breaks on travis */
|
||||
|
||||
return suite;
|
||||
|
|
|
@ -870,9 +870,9 @@ int eff_spelllevel(unit * u, const spell * sp, int cast_level, int range)
|
|||
/* Ein Spruch mit Fixkosten wird immer mit der Stufe des Spruchs und
|
||||
* nicht auf der Stufe des Magiers gezaubert */
|
||||
if (costtyp == SPC_FIX) {
|
||||
spellbook * spells = unit_get_spellbook(u);
|
||||
if (spells) {
|
||||
spellbook_entry * sbe = spellbook_get(spells, sp);
|
||||
spellbook * sb = unit_get_spellbook(u);
|
||||
if (sb) {
|
||||
spellbook_entry * sbe = spellbook_get(sb, sp);
|
||||
if (sbe) {
|
||||
return _min(cast_level, sbe->level);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,16 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
# undef MOUSE_MOVED
|
||||
# define STDIO_CP 1252 /* log.c, convert to console character set */
|
||||
# pragma warning (disable: 4201 4214 4514 4115 4711)
|
||||
#if _MSC_VER >= 1900
|
||||
# pragma warning(disable: 4710)
|
||||
/* warning C4710: function not inlined */
|
||||
# pragma warning(disable: 4456)
|
||||
/* warning C4456 : declaration of <name> hides previous local declaration */
|
||||
# pragma warning(disable: 4457)
|
||||
/* warning C4457: declaration of <name> hides function parameter */
|
||||
# pragma warning(disable: 4459)
|
||||
/* warning C4459: declaration of <name> hides global declaration */
|
||||
#endif
|
||||
# pragma warning(disable: 4056)
|
||||
/* warning C4056: overflow in floating point constant arithmetic */
|
||||
# pragma warning(disable: 4201)
|
||||
|
|
|
@ -97,6 +97,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
# pragma warning(disable: 4774) // TODO: remove this
|
||||
#endif
|
||||
|
||||
extern int *storms;
|
||||
extern int weeks_per_month;
|
||||
extern int months_per_year;
|
||||
|
|
|
@ -75,6 +75,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#include "move.h"
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
# pragma warning(disable: 4774) // TODO: remove this
|
||||
#endif
|
||||
|
||||
#define SCALEWEIGHT 100 /* Faktor, um den die Anzeige von Gewichten skaliert wird */
|
||||
|
||||
bool nocr = false;
|
||||
|
|
|
@ -101,6 +101,10 @@
|
|||
#include <attributes/hate.h>
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
# pragma warning(disable: 4774) // TODO: remove this
|
||||
#endif
|
||||
|
||||
static double zero_effect = 0.0;
|
||||
|
||||
attrib_type at_wdwpyramid = {
|
||||
|
|
|
@ -270,7 +270,7 @@ const char * test_get_messagetype(const message *msg) {
|
|||
|
||||
struct message * test_find_messagetype(struct message_list *msgs, const char *name) {
|
||||
struct mlist *ml;
|
||||
assert(msgs);
|
||||
if (!msgs) return 0;
|
||||
for (ml = msgs->begin; ml; ml = ml->next) {
|
||||
if (strcmp(name, test_get_messagetype(ml->msg)) == 0) {
|
||||
return ml->msg;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
@ECHO OFF
|
||||
SET BUILD=..\build-vs12\eressea\Debug\
|
||||
IF EXIST ..\build-vs10 SET BUILD=..\build-vs10\eressea\Debug
|
||||
IF EXIST ..\build-vs11 SET BUILD=..\build-vs11\eressea\Debug
|
||||
IF EXIST ..\build-vs12 SET BUILD=..\build-vs12\eressea\Debug
|
||||
IF EXIST ..\build-vs14 SET BUILD=..\build-vs14\eressea\Debug
|
||||
SET SERVER=%BUILD%\eressea.exe
|
||||
%BUILD%\test_eressea.exe
|
||||
%SERVER% ..\scripts\run-tests.lua
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
@ECHO OFF
|
||||
SET VSVERSION=14
|
||||
SET SRCDIR=%CD%
|
||||
CD ..
|
||||
SET ERESSEA=%CD%
|
||||
|
||||
CD %SRCDIR%
|
||||
mkdir build-vs%VSVERSION%
|
||||
cd build-vs%VSVERSION%
|
||||
"%ProgramFiles(x86)%\CMake\bin\cmake.exe" -G "Visual Studio %VSVERSION%" -DCMAKE_PREFIX_PATH="%ProgramFiles(x86)%/Lua/5.1;%ERESSEA%/dependencies-win32" -DCMAKE_MODULE_PATH="%SRCDIR%/cmake/Modules" -DCMAKE_SUPPRESS_REGENERATION=TRUE ..
|
||||
PAUSE
|
Loading…
Reference in New Issue