platform.h is only for WIN32 now.

replace MIN and MAX macros, they are BAD.
This commit is contained in:
Enno Rehling 2017-12-29 06:13:28 +01:00
parent f82fe6e963
commit f98eab56c4
108 changed files with 540 additions and 398 deletions

View file

@ -214,8 +214,8 @@ end
function test_can_give_person()
local r = region.create(0, 0, "plain")
local f1 = faction.create("human", "noreply@eressea.de", "de")
local f2 = faction.create("human", "noreply@eressea.de", "de")
local f1 = faction.create("human")
local f2 = faction.create("human")
local u1 = unit.create(f1, r, 10)
local u2 = unit.create(f2, r, 10)
u1.faction.age = 10

View file

@ -1,3 +1,4 @@
require 'tests.e2.e2features'
require 'tests.e2.insects'
require 'tests.e2.spells'
require 'tests.e2.buildings'
@ -5,7 +6,6 @@ require 'tests.e2.production'
require 'tests.e2.adamantium'
require 'tests.e2.undead'
require 'tests.e2.shiplanding'
require 'tests.e2.e2features'
require 'tests.e2.movement'
require 'tests.e2.destroy'
require 'tests.e2.guard'

View file

@ -165,6 +165,7 @@ function test_troll_example()
u1:clear_orders()
-- 3 trolls - 1 cart = 320, but not allowed?
u1.name='XXX'
assert_nomove("3 trolls", u1)
u1.number = 4

View file

@ -56,7 +56,6 @@ function test_speedy_ship_slow()
u2.ship = u1.ship
u1:set_skill("sailing", 2) -- cptskill = 2^1
u2:set_skill("sailing", 24) -- sumskill = 50
u1.name = "XXX"
u1:add_order("NACH O O O O O O O O O O")
process_orders()
assert_equal(5, u1.region.x)

View file

@ -28,7 +28,7 @@ IF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89")
ELSEIF(MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 /WX /MP /D_CRT_SECURE_NO_WARNINGS /D_USE_MATH_DEFINES")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 /WX /MP /Za /D_CRT_SECURE_NO_WARNINGS /D_USE_MATH_DEFINES")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrt.lib")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE

View file

@ -37,6 +37,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/gamedata.h>
#include <util/base36.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/rand.h>
#include <storage.h>

View file

@ -56,6 +56,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/attrib.h>
#include <util/event.h>
#include <util/gamedata.h>
#include <util/macros.h>
#include <util/resolve.h>
#include <storage.h>

View file

@ -24,6 +24,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/attrib.h>
#include <util/gamedata.h>
#include <util/macros.h>
#include <util/resolve.h>
#include <storage.h>

View file

@ -22,6 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/attrib.h>
#include <util/gamedata.h>
#include <util/macros.h>
#include <storage.h>

View file

@ -22,6 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/attrib.h>
#include <util/gamedata.h>
#include <util/macros.h>
#include <storage.h>

View file

@ -68,12 +68,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/language.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/parser.h>
#include <util/strings.h>
#include <selist.h>
#include <util/rand.h>
#include <util/rng.h>
#include <selist.h>
/* libc includes */
#include <ctype.h>
#include <limits.h>

View file

@ -1,14 +1,6 @@
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
| | Henning Peters <faroul@beyond.kn-bremen.de>
+-------------------+
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "bind_building.h"
#include "bind_unit.h"

View file

@ -1,6 +1,9 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "bind_config.h"
#include <platform.h>
#include <kernel/config.h>
#include <kernel/jsonconf.h>
#include <util/bsdstring.h>

View file

@ -1,3 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "bind_eressea.h"
#include <platform.h>

View file

@ -10,6 +10,10 @@ This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "bind_faction.h"
#include "bind_unit.h"
#include "bindings.h"

View file

@ -1,3 +1,7 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <curses.h>
#include "bind_gmtool.h"

View file

@ -1,3 +1,7 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "bind_locale.h"
#include "util/language.h"
#include "direction.h"

View file

@ -1,3 +1,7 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "spells.h"
/* kernel includes */

View file

@ -1,3 +1,7 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "spells/shipcurse.h"
#include "monsters.h"

View file

@ -1,3 +1,7 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
/* kernel includes */
#include <kernel/order.h>
#include <util/parser.h>

View file

@ -1,6 +1,9 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "bind_process.h"
#include <platform.h>
#include <kernel/alliance.h>
#include <kernel/config.h>
#include <kernel/order.h>

View file

@ -1,14 +1,6 @@
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
| | Henning Peters <faroul@beyond.kn-bremen.de>
+-------------------+
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "bind_region.h"
#include "bind_unit.h"

View file

@ -1,14 +1,6 @@
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
| | Henning Peters <faroul@beyond.kn-bremen.de>
+-------------------+
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "bind_ship.h"
#include "bind_unit.h"

View file

@ -1,14 +1,6 @@
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
| | Henning Peters <faroul@beyond.kn-bremen.de>
+-------------------+
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "bind_unit.h"
#include "bindings.h"

View file

@ -1,14 +1,6 @@
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
| | Henning Peters <faroul@beyond.kn-bremen.de>
+-------------------+
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "bind_storage.h"

View file

@ -1,4 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#pragma warning(push)
#pragma warning(disable: 4100)
#include "config.pkg.c"

View file

@ -1,14 +1,6 @@
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
| | Henning Peters <faroul@beyond.kn-bremen.de>
+-------------------+
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "bind_unit.h"
#include "alchemy.h"

View file

@ -1,14 +1,6 @@
/*
+-------------------+
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
| | Henning Peters <faroul@beyond.kn-bremen.de>
+-------------------+
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "bindings.h"
#include "bind_unit.h"

View file

@ -1,4 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "calendar.h"
#include "move.h" /* storms */
@ -36,15 +38,15 @@ int first_turn(void)
return config_get_int("game.start", 0);
}
const gamedate *get_gamedate(int turn, gamedate * gd)
const gamedate *get_gamedate(int turn_now, gamedate * gd)
{
int weeks_per_year = months_per_year * weeks_per_month;
int t = turn - first_turn();
int t = turn_now - first_turn();
assert(gd);
assert(t>=0);
gd->turn = turn;
gd->turn = turn_now;
gd->week = t % weeks_per_month; /* 0 - weeks_per_month-1 */
gd->month = (t / weeks_per_month + first_month) % months_per_year; /* 0 - months_per_year-1 */
gd->year = 1 + t / weeks_per_year;

View file

@ -1,4 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "console.h"
/* lua includes */

View file

@ -68,6 +68,7 @@ without prior permission by the authors of Eressea.
#include <util/strings.h>
#include <util/language.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/message.h>
#include <util/nrmessage.h>
#include <selist.h>
@ -620,6 +621,26 @@ static void cr_output_messages(FILE * F, message_list * msgs, faction * f)
render_messages(F, f, msgs);
}
static void cr_output_battles(FILE * F, faction * f)
{
struct bmsg *bm;
for (bm = f->battles; bm; bm = bm->next) {
region *rb = bm->r;
plane *pl = rplane(rb);
int plid = plane_id(pl);
int nx = rb->x, ny = rb->y;
pnormalize(&nx, &ny, pl);
adjust_coordinates(f, &nx, &ny, pl);
if (!plid)
fprintf(F, "BATTLE %d %d\n", nx, ny);
else {
fprintf(F, "BATTLE %d %d %d\n", nx, ny, plid);
}
cr_output_messages(F, bm->msgs, f);
}
}
/* prints a building */
static void cr_output_building(struct stream *out, building *b,
const unit *owner, int fno, faction *f)
@ -947,7 +968,7 @@ void cr_output_unit(stream *out, const faction * f,
/* spells that this unit can cast */
mage = get_mage_depr(u);
if (mage) {
int i, maxlevel = effskill(u, SK_MAGIC, 0);
int maxlevel = effskill(u, SK_MAGIC, 0);
cr_output_spells(out, u, maxlevel);
for (i = 0; i != MAXCOMBATSPELLS; ++i) {
@ -1100,7 +1121,7 @@ static void cr_reportspell(FILE * F, spell * sp, int level, const struct locale
int itemanz = sp->components[k].amount;
int costtyp = sp->components[k].cost;
if (itemanz > 0) {
const char *name = resourcename(rtype, 0);
name = resourcename(rtype, 0);
fprintf(F, "%d %d;%s\n", itemanz, costtyp == SPC_LEVEL
|| costtyp == SPC_LINEAR, translate(name, LOC(lang, name)));
}
@ -1432,14 +1453,15 @@ static void cr_output_region(FILE * F, report_context * ctx, region * r)
if (rl) {
region_list *rl2 = rl;
while (rl2) {
region *r = rl2->data;
int nx = r->x, ny = r->y;
plane *plx = rplane(r);
region *r2 = rl2->data;
plane *plx = rplane(r2);
nx = r2->x;
ny = r2->y;
pnormalize(&nx, &ny, plx);
adjust_coordinates(f, &nx, &ny, plx);
fprintf(F, "SCHEMEN %d %d\n", nx, ny);
fprintf(F, "\"%s\";Name\n", rname(r, f->locale));
fprintf(F, "\"%s\";Name\n", rname(r2, f->locale));
rl2 = rl2->next;
}
free_regionlist(rl);
@ -1619,24 +1641,7 @@ report_computer(const char *filename, report_context * ctx, const char *bom)
}
cr_output_messages(F, f->msgs, f);
{
struct bmsg *bm;
for (bm = f->battles; bm; bm = bm->next) {
plane *pl = rplane(bm->r);
int plid = plane_id(pl);
region *r = bm->r;
int nx = r->x, ny = r->y;
pnormalize(&nx, &ny, pl);
adjust_coordinates(f, &nx, &ny, pl);
if (!plid)
fprintf(F, "BATTLE %d %d\n", nx, ny);
else {
fprintf(F, "BATTLE %d %d %d\n", nx, ny, plid);
}
cr_output_messages(F, bm->msgs, f);
}
}
cr_output_battles(F, f);
cr_find_address(F, f, ctx->addresses);
a = a_find(f->attribs, &at_reportspell);

View file

@ -86,7 +86,6 @@ static econ_request entertainers[1024];
static econ_request *nextentertainer;
static int entertaining;
static unsigned int norders;
static econ_request *g_requests;
#define RECRUIT_MERGE 1
@ -179,16 +178,16 @@ unsigned int expand_production(region * r, econ_request * requests, econ_request
*results = NULL;
}
while (requests) {
econ_request *o = requests->next;
econ_request *req = requests->next;
free_order(requests->ord);
free(requests);
requests = o;
requests = req;
}
return norders;
}
static void expandorders(region * r, econ_request * requests) {
norders = expand_production(r, requests, &g_requests);
static unsigned int expandorders(region * r, econ_request * requests) {
return expand_production(r, requests, &g_requests);
}
/* ------------------------------------------------------------- */
@ -802,12 +801,12 @@ void economics(region * r)
}
static void mod_skill(const resource_mod *mod, skill_t sk, int *skill) {
static void mod_skill(const resource_mod *mod, skill_t sk, int *value) {
skill_t msk;
assert(mod->type == RMT_PROD_SKILL);
msk = (skill_t)mod->value.sa[0];
if (msk == NOSKILL || msk == sk) {
*skill += mod->value.sa[1];
*value += mod->value.sa[1];
}
}
@ -1023,8 +1022,9 @@ static void allocate_resource(unit * u, const resource_type * rtype, int want)
/* mit Flinkfingerring verzehnfacht sich die Produktion */
rring = get_resourcetype(R_RING_OF_NIMBLEFINGER);
if (rring) {
int dm = i_get(u->items, rring->itype);
amount += skill * MIN(u->number, dm) * (roqf_factor() - 1);
int more = i_get(u->items, rring->itype);
if (more > u->number) more = u->number;
amount += skill * more * (roqf_factor() - 1);
}
/* Schaffenstrunk: */
@ -1117,9 +1117,9 @@ leveled_allocation(const resource_type * rtype, region * r, allocation * alist)
if (avail > 0) {
int want = required(al->want - al->get, al->save);
int x = avail * want / nreq;
int r = (avail * want) % nreq;
int req = (avail * want) % nreq;
/* Wenn Rest, dann wuerfeln, ob ich etwas bekomme: */
if (r > 0 && rng_int() % nreq < r) ++x;
if (req > 0 && rng_int() % nreq < req) ++x;
avail -= x;
use += x;
nreq -= want;
@ -1285,7 +1285,7 @@ void make_item(unit * u, const item_type * itype, int want)
int make_cmd(unit * u, struct order *ord)
{
char token[128];
char token[32];
region *r = u->region;
const building_type *btype = 0;
const ship_type *stype = 0;
@ -1322,7 +1322,7 @@ int make_cmd(unit * u, struct order *ord)
cmistake(u, ord, 275, MSG_PRODUCE);
}
else {
const char * s = gettoken(token, sizeof(token));
s = gettoken(token, sizeof(token));
direction_t d = s ? get_direction(s, u->faction->locale) : NODIRECTION;
if (d != NODIRECTION) {
build_road(u, m, d);
@ -1471,7 +1471,7 @@ static void expandbuying(region * r, econ_request * buyorders)
* gehandelten Produktes. */
if (max_products > 0) {
unsigned int j;
expandorders(r, buyorders);
unsigned int norders = expandorders(r, buyorders);
if (!norders)
return;
@ -1486,18 +1486,20 @@ static void expandbuying(region * r, econ_request * buyorders)
if (get_pooled(g_requests[j].unit, rsilver, GET_DEFAULT,
price) >= price) {
unit *u = g_requests[j].unit;
item *items;
/* litems z<>hlt die G<>ter, die verkauft wurden, u->n das Geld, das
* verdient wurde. Dies mu<EFBFBD> gemacht werden, weil der Preis st<EFBFBD>ndig sinkt,
* man sich also das verdiente Geld und die verkauften Produkte separat
* merken mu<EFBFBD>. */
attrib *a = a_find(u->attribs, &at_luxuries);
if (a == NULL)
a = a_add(&u->attribs, a_new(&at_luxuries));
attrib *a;
u = g_requests[j].unit;
a = a_find(u->attribs, &at_luxuries);
if (a == NULL) {
a = a_add(&u->attribs, a_new(&at_luxuries));
}
items = a->data.v;
i_change(&items, ltype->itype, 1);
a->data.v = items;
i_change(&g_requests[j].unit->items, ltype->itype, 1);
@ -1667,7 +1669,7 @@ static int tax_per_size[7] = { 0, 6, 12, 18, 24, 30, 36 };
static void expandselling(region * r, econ_request * sellorders, int limit)
{
int money, price, max_products;
unsigned int j;
unsigned int j, norders;
/* int m, n = 0; */
int maxsize = 0, maxeffsize = 0;
int taxcollected = 0;
@ -1742,9 +1744,10 @@ static void expandselling(region * r, econ_request * sellorders, int limit)
/* Verkauf: so programmiert, dass er leicht auf mehrere Gueter pro
* Runde erweitert werden kann. */
expandorders(r, sellorders);
if (!norders)
norders = expandorders(r, sellorders);
if (norders == 0) {
return;
}
for (j = 0; j != norders; j++) {
const luxury_type *search = NULL;
@ -1763,19 +1766,22 @@ static void expandselling(region * r, econ_request * sellorders, int limit)
price = ltype->price * multi;
if (money >= price) {
unit *u = g_requests[j].unit;
item *itm;
attrib *a = a_find(u->attribs, &at_luxuries);
if (a == NULL)
attrib *a;
u = g_requests[j].unit;
a = a_find(u->attribs, &at_luxuries);
if (!a) {
a = a_add(&u->attribs, a_new(&at_luxuries));
}
itm = (item *)a->data.v;
i_change(&itm, ltype->itype, 1);
a->data.v = itm;
++use;
if (u->n < 0)
if (u->n < 0) {
u->n = 0;
}
if (hafenowner != NULL) {
if (hafenowner) {
if (hafenowner->faction != u->faction) {
int abgezogenhafen = price / 10;
hafencollected += abgezogenhafen;
@ -1783,7 +1789,7 @@ static void expandselling(region * r, econ_request * sellorders, int limit)
money -= abgezogenhafen;
}
}
if (maxb != NULL) {
if (maxb) {
if (maxowner->faction != u->faction) {
int abgezogensteuer = price * tax_per_size[maxeffsize] / 100;
taxcollected += abgezogensteuer;
@ -2423,9 +2429,9 @@ expandwork(region * r, econ_request * work_begin, econ_request * work_end, int m
if (jobs >= working)
workers = u->number;
else {
int r = (u->number * jobs) % working;
int req = (u->number * jobs) % working;
workers = u->number * jobs / working;
if (r > 0 && rng_int() % working < r)
if (req > 0 && rng_int() % working < req)
workers++;
}
@ -2491,37 +2497,38 @@ static int do_work(unit * u, order * ord, econ_request * o)
static void expandloot(region * r, econ_request * lootorders)
{
unit *u;
unsigned int i;
int m, looted = 0;
int startmoney = rmoney(r);
unsigned int norders;
expandorders(r, lootorders);
if (!norders)
return;
norders = expandorders(r, lootorders);
if (norders > 0) {
unit *u;
unsigned int i;
int m, looted = 0;
int startmoney = rmoney(r);
for (i = 0; i != norders && startmoney > looted + TAXFRACTION * 2; i++) {
change_money(g_requests[i].unit, TAXFRACTION);
g_requests[i].unit->n += TAXFRACTION;
/*Looting destroys double the money*/
looted += TAXFRACTION * 2;
}
rsetmoney(r, startmoney - looted);
free(g_requests);
/* Lowering morale by 1 depending on the looted money (+20%) */
m = region_get_morale(r);
if (m && startmoney > 0) {
if (rng_int() % 100 < 20 + (looted * 80) / startmoney) {
/*Nur Moral -1, turns is not changed, so the first time nothing happens if the morale is good*/
region_set_morale(r, m - 1, -1);
for (i = 0; i != norders && startmoney > looted + TAXFRACTION * 2; i++) {
change_money(g_requests[i].unit, TAXFRACTION);
g_requests[i].unit->n += TAXFRACTION;
/*Looting destroys double the money*/
looted += TAXFRACTION * 2;
}
}
rsetmoney(r, startmoney - looted);
free(g_requests);
for (u = r->units; u; u = u->next) {
if (u->n >= 0) {
add_income(u, IC_LOOT, u->wants, u->n);
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
/* Lowering morale by 1 depending on the looted money (+20%) */
m = region_get_morale(r);
if (m && startmoney > 0) {
if (rng_int() % 100 < 20 + (looted * 80) / startmoney) {
/*Nur Moral -1, turns is not changed, so the first time nothing happens if the morale is good*/
region_set_morale(r, m - 1, -1);
}
}
for (u = r->units; u; u = u->next) {
if (u->n >= 0) {
add_income(u, IC_LOOT, u->wants, u->n);
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
}
}
}
}
@ -2529,23 +2536,23 @@ static void expandloot(region * r, econ_request * lootorders)
void expandtax(region * r, econ_request * taxorders)
{
unit *u;
unsigned int i;
unsigned int norders;
expandorders(r, taxorders);
if (!norders)
return;
norders = expandorders(r, taxorders);
if (norders > 0) {
unsigned int i;
for (i = 0; i != norders && rmoney(r) > TAXFRACTION; i++) {
change_money(g_requests[i].unit, TAXFRACTION);
g_requests[i].unit->n += TAXFRACTION;
rsetmoney(r, rmoney(r) - TAXFRACTION);
}
free(g_requests);
for (i = 0; i != norders && rmoney(r) > TAXFRACTION; i++) {
change_money(g_requests[i].unit, TAXFRACTION);
g_requests[i].unit->n += TAXFRACTION;
rsetmoney(r, rmoney(r) - TAXFRACTION);
}
free(g_requests);
for (u = r->units; u; u = u->next) {
if (u->n >= 0) {
add_income(u, IC_TAX, u->wants, u->n);
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
for (u = r->units; u; u = u->next) {
if (u->n >= 0) {
add_income(u, IC_TAX, u->wants, u->n);
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
}
}
}
}

View file

@ -1,4 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <kernel/config.h>
#include "economy.h"
@ -19,6 +21,7 @@
#include <util/attrib.h>
#include <util/language.h>
#include <util/macros.h>
#include <CuTest.h>
#include <tests.h>

View file

@ -10,7 +10,9 @@
without prior permission by the authors of Eressea.
*/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <kernel/config.h>
#include "give.h"
@ -43,6 +45,7 @@
#include <util/base36.h>
#include <util/event.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/parser.h>
/* libc includes */
@ -176,6 +179,7 @@ static void
give_horses(unit * s, const item_type * itype, int n)
{
region *r = s->region;
UNUSED_ARG(itype);
if (r->land) {
rsethorses(r, rhorses(r) + n);
}
@ -185,6 +189,7 @@ static void
give_money(unit * s, const item_type * itype, int n)
{
region *r = s->region;
UNUSED_ARG(itype);
if (r->land) {
rsetmoney(r, rmoney(r) + n);
}
@ -192,14 +197,14 @@ give_money(unit * s, const item_type * itype, int n)
int
give_item(int want, const item_type * itype, unit * src, unit * dest,
struct order *ord)
struct order *ord)
{
short error = 0;
int n, delta;
assert(itype != NULL);
n = get_pooled(src, item2resource(itype), GET_SLACK | GET_POOLED_SLACK, want);
n = MIN(want, n);
if (n > want) n = want;
delta = n;
if (dest && src->faction != dest->faction
&& src->faction->age < GiveRestriction()) {
@ -271,6 +276,7 @@ static bool unit_has_cursed_item(const unit * u)
}
static bool can_give_men(const unit *u, const unit *dst, order *ord, message **msg) {
UNUSED_ARG(dst);
if (unit_has_cursed_item(u)) {
if (msg) *msg = msg_error(u, ord, 78);
}
@ -435,9 +441,8 @@ message * give_men(int n, unit * u, unit * u2, struct order *ord)
return msg_error(u, ord, error);
}
else if (u2->faction != u->faction) {
message *msg = msg_message("give_person", "unit target amount", u, u2, n);
add_message(&u2->faction->msgs, msg);
return msg;
return add_message(&u2->faction->msgs,
msg_message("give_person", "unit target amount", u, u2, n));
}
return NULL;
}
@ -615,6 +620,79 @@ bool can_give_to(unit *u, unit *u2) {
return true;
}
static void give_all_items(unit *u, unit *u2, order *ord) {
char token[128];
const char *s;
if (!can_give(u, u2, NULL, GIVE_ALLITEMS)) {
feedback_give_not_allowed(u, ord);
return;
}
s = gettoken(token, sizeof(token));
if (!s || *s == 0) { /* GIVE ALL items that you have */
/* do these checks once, not for each item we have: */
if (u2 && !(u_race(u2)->ec_flags & ECF_GETITEM)) {
ADDMSG(&u->faction->msgs,
msg_feedback(u, ord, "race_notake", "race", u_race(u2)));
return;
}
/* für alle items einmal prüfen, ob wir mehr als von diesem Typ
* reserviert ist besitzen und diesen Teil dann übergeben */
if (u->items) {
item **itmp = &u->items;
while (*itmp) {
item *itm = *itmp;
const item_type *itype = itm->type;
if (itm->number > 0
&& itm->number - get_reservation(u, itype) > 0) {
int n = itm->number - get_reservation(u, itype);
if (give_item(n, itype, u, u2, ord) == 0) {
if (*itmp != itm)
continue;
}
}
itmp = &itm->next;
}
}
}
else {
if (isparam(s, u->faction->locale, P_PERSON)) {
if (!(u_race(u)->ec_flags & ECF_GIVEPERSON)) {
ADDMSG(&u->faction->msgs,
msg_feedback(u, ord, "race_noregroup", "race", u_race(u)));
}
else {
message * msg;
msg = u2 ? give_men(u->number, u, u2, ord) : disband_men(u->number, u, ord);
if (msg) {
ADDMSG(&u->faction->msgs, msg);
}
}
}
else if (u2 && !(u_race(u2)->ec_flags & ECF_GETITEM)) {
ADDMSG(&u->faction->msgs,
msg_feedback(u, ord, "race_notake", "race", u_race(u2)));
}
else {
const item_type *itype = finditemtype(s, u->faction->locale);
if (itype != NULL) {
item *i = *i_find(&u->items, itype);
if (i != NULL) {
if (can_give(u, u2, itype, 0)) {
int n = i->number - get_reservation(u, itype);
give_item(n, itype, u, u2, ord);
}
else {
feedback_give_not_allowed(u, ord);
}
}
}
}
}
}
void give_cmd(unit * u, order * ord)
{
char token[128];
@ -689,8 +767,7 @@ void give_cmd(unit * u, order * ord)
item **itmp = &u->items;
while (*itmp) {
item *itm = *itmp;
const item_type *itype = itm->type;
if (fval(itype, ITF_HERB) && itm->number > 0) {
if (fval(itm->type, ITF_HERB) && itm->number > 0) {
/* give_item ändert im fall,das man alles übergibt, die
* item-liste der unit, darum continue vor pointerumsetzten */
if (give_item(itm->number, itm->type, u, u2, ord) == 0) {
@ -724,75 +801,7 @@ void give_cmd(unit * u, order * ord)
}
else if (p == P_ANY) {
const char *s;
if (!can_give(u, u2, NULL, GIVE_ALLITEMS)) {
feedback_give_not_allowed(u, ord);
return;
}
s = gettoken(token, sizeof(token));
if (!s || *s == 0) { /* GIVE ALL items that you have */
/* do these checks once, not for each item we have: */
if (u2 && !(u_race(u2)->ec_flags & ECF_GETITEM)) {
ADDMSG(&u->faction->msgs,
msg_feedback(u, ord, "race_notake", "race", u_race(u2)));
return;
}
/* für alle items einmal prüfen, ob wir mehr als von diesem Typ
* reserviert ist besitzen und diesen Teil dann übergeben */
if (u->items) {
item **itmp = &u->items;
while (*itmp) {
item *itm = *itmp;
const item_type *itype = itm->type;
if (itm->number > 0
&& itm->number - get_reservation(u, itype) > 0) {
n = itm->number - get_reservation(u, itype);
if (give_item(n, itype, u, u2, ord) == 0) {
if (*itmp != itm)
continue;
}
}
itmp = &itm->next;
}
}
}
else {
if (isparam(s, u->faction->locale, P_PERSON)) {
if (!(u_race(u)->ec_flags & ECF_GIVEPERSON)) {
ADDMSG(&u->faction->msgs,
msg_feedback(u, ord, "race_noregroup", "race", u_race(u)));
}
else {
message * msg;
msg = u2 ? give_men(u->number, u, u2, ord) : disband_men(u->number, u, ord);
if (msg) {
ADDMSG(&u->faction->msgs, msg);
}
}
}
else if (u2 && !(u_race(u2)->ec_flags & ECF_GETITEM)) {
ADDMSG(&u->faction->msgs,
msg_feedback(u, ord, "race_notake", "race", u_race(u2)));
}
else {
itype = finditemtype(s, u->faction->locale);
if (itype != NULL) {
item *i = *i_find(&u->items, itype);
if (i != NULL) {
if (can_give(u, u2, itype, 0)) {
n = i->number - get_reservation(u, itype);
give_item(n, itype, u, u2, ord);
}
else {
feedback_give_not_allowed(u, ord);
}
}
}
}
}
give_all_items(u, u2, ord);
return;
}
else if (p == P_EACH) {
@ -813,13 +822,12 @@ void give_cmd(unit * u, order * ord)
}
if (isparam(s, u->faction->locale, P_PERSON)) {
message * msg;
if (!(u_race(u)->ec_flags & ECF_GIVEPERSON)) {
ADDMSG(&u->faction->msgs,
msg_feedback(u, ord, "race_noregroup", "race", u_race(u)));
return;
}
n = MIN(u->number, n);
if (n > u->number) n = u->number;
msg = u2 ? give_men(n, u, u2, ord) : disband_men(n, u, ord);
if (msg) {
ADDMSG(&u->faction->msgs, msg);

View file

@ -210,6 +210,21 @@ static void test_give_men_too_many(CuTest * tc) {
test_teardown();
}
static void test_give_cmd_limit(CuTest * tc) {
struct give env = { 0 };
unit *u;
test_setup_ex(tc);
env.f2 = env.f1 = test_create_faction(0);
setup_give(&env);
u = env.src;
scale_number(u, 2);
u->thisorder = create_order(K_GIVE, u->faction->locale, "%s 1 PERSON", itoa36(env.dst->no));
give_cmd(u, u->thisorder);
CuAssertIntEquals(tc, 2, env.dst->number);
CuAssertIntEquals(tc, 1, env.src->number);
test_teardown();
}
static void test_give_men_none(CuTest * tc) {
struct give env = { 0 };
message * msg;
@ -436,6 +451,7 @@ CuSuite *get_give_suite(void)
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_give);
SUITE_ADD_TEST(suite, test_give_cmd);
SUITE_ADD_TEST(suite, test_give_cmd_limit);
SUITE_ADD_TEST(suite, test_give_men);
SUITE_ADD_TEST(suite, test_give_men_magicians);
SUITE_ADD_TEST(suite, test_give_men_limit);

View file

@ -8,7 +8,10 @@
*
*/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <curses.h>
#include <kernel/config.h>
@ -45,11 +48,12 @@
#include <triggers/triggers.h>
#include <util/attrib.h>
#include <util/log.h>
#include <util/unicode.h>
#include <util/lists.h>
#include <util/rng.h>
#include <util/base36.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/rng.h>
#include <util/unicode.h>
#include <storage.h>
#include <lua.h>

View file

@ -11,6 +11,9 @@
#ifndef H_GMTOOL
#define H_GMTOOL
#include <stddef.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif

View file

@ -10,6 +10,10 @@ This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "helpers.h"
#include "vortex.h"
#include "alchemy.h"

View file

@ -34,6 +34,7 @@
#include <util/attrib.h>
#include <util/event.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/parser.h>
#include <util/rand.h>
#include <util/rng.h>

View file

@ -33,6 +33,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* util includes */
#include <util/attrib.h>
#include <util/log.h>
#include <util/macros.h>
/* libc includes */
#include <assert.h>

View file

@ -16,8 +16,11 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifdef _MSC_VER
#include <platform.h>
#include <kernel/config.h>
#endif
#include "config.h"
/* kernel includes */
#include "alliance.h"
@ -48,10 +51,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "types.h"
#include "unit.h"
#include <kernel/spell.h>
#include <kernel/spellbook.h>
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
@ -62,6 +61,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/functions.h>
#include <util/log.h>
#include <util/lists.h>
#include <util/macros.h>
#include <util/parser.h>
#include <util/rand.h>
#include <util/rng.h>
@ -90,8 +90,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <limits.h>
#include <time.h>
#include <errno.h>
#include <sys/stat.h>
#ifdef WIN32
#include <direct.h>
#else
#include <sys/stat.h>
#endif
struct settings global;
int turn = 0;
@ -576,14 +580,23 @@ void set_reportpath(const char *path)
g_reportdir = path;
}
static int sys_mkdir(const char *path, int mode) {
#ifdef WIN32
UNUSED_ARG(mode);
return _mkdir(path);
#else
return mkdir(path, mode);
#endif
}
int create_directories(void) {
int err;
err = mkdir(datapath(), 0777);
err = sys_mkdir(datapath(), 0777);
if (err) {
if (errno == EEXIST) errno = 0;
else return err;
}
err = mkdir(reportpath(), 0777);
err = sys_mkdir(reportpath(), 0777);
if (err && errno == EEXIST) {
errno = 0;
}

View file

@ -29,6 +29,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/gamedata.h>
#include <util/language.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/rng.h>
#include <util/strings.h>

View file

@ -38,6 +38,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/goodies.h>
#include <util/language.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/nrmessage.h>
#include <util/rand.h>
#include <util/resolve.h>

View file

@ -41,6 +41,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/goodies.h>
#include <util/log.h>
#include <util/language.h>
#include <util/macros.h>
#include <util/message.h>
#include <util/rng.h>
#include <util/strings.h>

View file

@ -32,6 +32,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/base36.h>
#include <util/goodies.h>
#include <util/language.h>
#include <util/macros.h>
#include <util/message.h>
#include <util/nrmessage.h>
#include <util/crmessage.h>

View file

@ -54,8 +54,8 @@ extern "C" {
void addmessage(struct region *r, struct faction *f, const char *s,
msg_t mtype, int level);
struct mlist ** merge_messages(message_list *mlist, message_list *append);
void split_messages(message_list *mlist, struct mlist **split);
struct mlist ** merge_messages(message_list *ml, message_list *append);
void split_messages(message_list *ml, struct mlist **split);
#define ADDMSG(msgs, mcreate) { message * mx = mcreate; if (mx) { assert(mx->refcount>=1); add_message(msgs, mx); msg_release(mx); } }

View file

@ -24,5 +24,5 @@ struct message;
/* TODO: this could be nicer and faster
* call with MSG(("msg_name", "param", p), buf, faction). */
#define MSG(makemsg, buf, size, loc, ud) { struct message * m = msg_message makemsg; nr_render(m, loc, buf, size, ud); msg_release(m); }
#define RENDER(f, buf, size, mcreate) { struct message * m = msg_message mcreate; nr_render(m, f->locale, buf, size, f); msg_release(m); }
#define MSG(makemsg, buf, size, loc, ud) { struct message * mm = msg_message makemsg; nr_render(mm, loc, buf, size, ud); msg_release(mm); }
#define RENDER(f, buf, size, mcreate) { struct message * mr = msg_message mcreate; nr_render(mr, f->locale, buf, size, f); msg_release(mr); }

View file

@ -21,6 +21,7 @@
#include "region.h"
#include "terrain.h"
#include <util/macros.h>
#include <util/rand.h>
#include <util/rng.h>

View file

@ -126,12 +126,12 @@ extern "C" {
extern void free_ship(struct ship *s);
extern void free_ships(void);
const char *ship_getname(const struct ship *self);
const char *ship_getname(const struct ship *sh);
void ship_setname(struct ship *self, const char *name);
int shipspeed(const struct ship *sh, const struct unit *u);
int crew_skill(const struct ship *sh);
int ship_damage_percent(const struct ship *ship);
int ship_damage_percent(const struct ship *sh);
#ifdef __cplusplus
}
#endif

View file

@ -16,8 +16,9 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifdef _MSC_VER
#include <platform.h>
#include <kernel/config.h>
#endif
#include "spell.h"
/* util includes */

View file

@ -5,6 +5,7 @@
#include <util/log.h>
#include <util/lists.h>
#include <util/macros.h>
#include <CuTest.h>
#include <tests.h>

View file

@ -1,4 +1,6 @@
#include <kernel/config.h>
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <kernel/spell.h>
#include <util/log.h>

View file

@ -57,6 +57,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/language.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/parser.h>
#include <util/rand.h>
#include <util/resolve.h>

View file

@ -12,8 +12,9 @@
#include <util/attrib.h>
#include <util/base36.h>
#include <util/language.h>
#include <util/rng.h>
#include <util/macros.h>
#include <util/strings.h>
#include <util/rng.h>
#include <spells/regioncurse.h>
#include <alchemy.h>
#include <laws.h>

View file

@ -1,4 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "version.h"
#include <stdio.h>

View file

@ -85,6 +85,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/language.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/message.h>
#include <util/parser.h>
#include <util/password.h>
@ -1586,17 +1587,17 @@ int display_cmd(unit * u, struct order *ord)
free(*s);
if (s2) {
char * str = str_strdup(s2);
if (unicode_utf8_trim(str) != 0) {
char * sdup = str_strdup(s2);
if (unicode_utf8_trim(sdup) != 0) {
log_info("trimming info: %s", s2);
}
if (strlen(str) >= DISPLAYSIZE) {
str[DISPLAYSIZE-1] = 0;
if (strlen(sdup) >= DISPLAYSIZE) {
sdup[DISPLAYSIZE-1] = 0;
}
*s = str;
*s = sdup;
}
else {
*s = 0;
*s = NULL;
}
}

View file

@ -8,8 +8,10 @@
*
*/
/* wenn platform.h nicht vor curses included wird, kompiliert es unter windows nicht */
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <curses.h>
#include <kernel/config.h>

View file

@ -17,7 +17,9 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#include <kernel/config.h>
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "magic.h"
#include "skill.h"
@ -40,6 +42,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <kernel/ally.h>
#include <kernel/building.h>
#include <kernel/callbacks.h>
#include <kernel/config.h>
#include <kernel/curse.h>
#include <kernel/equipment.h>
#include <kernel/faction.h>

View file

@ -16,7 +16,10 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <util/log.h>
#include <kernel/config.h>

View file

@ -44,6 +44,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/gamedata.h>
#include <util/strings.h>
#include <util/language.h>
#include <util/macros.h>
#include <storage.h>

View file

@ -786,7 +786,7 @@ void plan_monsters(faction * f)
/* Einheiten mit Bewegungsplan kriegen ein NACH: */
if (long_order == NULL) {
attrib *ta = a_find(u->attribs, &at_targetregion);
ta = a_find(u->attribs, &at_targetregion);
if (ta) {
if (u->region == (region *)ta->data.v) {
a_remove(&u->attribs, ta);

View file

@ -17,7 +17,9 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <kernel/config.h>
#include "move.h"
#include "guard.h"
@ -75,6 +77,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/language.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/parser.h>
#include <util/rand.h>
#include <util/rng.h>
@ -262,6 +265,7 @@ static int ridingcapacity(const unit * u)
{
int vehicles = 0, vcap = 0;
int animals = 0, acap = 0;
int horses;
get_transporters(u->items, &animals, &acap, &vehicles, &vcap);
@ -269,19 +273,22 @@ static int ridingcapacity(const unit * u)
** tragen nichts (siehe walkingcapacity). Ein Wagen zählt nur, wenn er
** von zwei Pferden gezogen wird */
animals = MIN(animals, effskill(u, SK_RIDING, 0) * u->number * 2);
horses = effskill(u, SK_RIDING, 0) * u->number * 2;
if (animals > horses) animals = horses;
if (fval(u_race(u), RCF_HORSE))
animals += u->number;
/* maximal diese Pferde können zum Ziehen benutzt werden */
vehicles = MIN(animals / HORSESNEEDED, vehicles);
horses = animals / HORSES_PER_CART;
if (horses < vehicles) vehicles = horses;
return vehicles * vcap + animals * acap;
}
int walkingcapacity(const struct unit *u)
{
int n, people, pferde_fuer_wagen;
int n, people, pferde_fuer_wagen, horses;
int wagen_ohne_pferde, wagen_mit_pferden, wagen_mit_trollen;
int vehicles = 0, vcap = 0;
int animals = 0, acap = 0;
@ -293,7 +300,8 @@ int walkingcapacity(const struct unit *u)
/* Das Gewicht, welches die Pferde tragen, plus das Gewicht, welches
* die Leute tragen */
pferde_fuer_wagen = MIN(animals, effskill(u, SK_RIDING, 0) * u->number * 4);
horses = effskill(u, SK_RIDING, 0) * u->number * 4;
pferde_fuer_wagen = (animals < horses) ? animals : horses;
if (fval(u_race(u), RCF_HORSE)) {
animals += u->number;
people = 0;
@ -303,7 +311,8 @@ int walkingcapacity(const struct unit *u)
}
/* maximal diese Pferde können zum Ziehen benutzt werden */
wagen_mit_pferden = MIN(vehicles, pferde_fuer_wagen / HORSESNEEDED);
horses = pferde_fuer_wagen / HORSES_PER_CART;
wagen_mit_pferden = (vehicles < horses) ? vehicles : horses;
n = wagen_mit_pferden * vcap;
@ -313,7 +322,8 @@ int walkingcapacity(const struct unit *u)
wagen_ohne_pferde = vehicles - wagen_mit_pferden;
/* Genug Trolle, um die Restwagen zu ziehen? */
wagen_mit_trollen = MIN(u->number / 4, wagen_ohne_pferde);
wagen_mit_trollen = u->number / 4;
if (wagen_mit_trollen > wagen_ohne_pferde) wagen_mit_trollen = wagen_ohne_pferde;
/* Wagenkapazität hinzuzählen */
n += wagen_mit_trollen * vcap;
@ -337,7 +347,8 @@ int walkingcapacity(const struct unit *u)
int belts = i_get(u->items, rbelt->itype);
if (belts) {
int multi = config_get_int("rules.trollbelt.multiplier", STRENGTHMULTIPLIER);
n += MIN(people, belts) * (multi - 1) * u_race(u)->capacity;
if (belts > people) belts = people;
n += belts * (multi - 1) * u_race(u)->capacity;
}
}
@ -368,7 +379,8 @@ static int canwalk(unit * u)
effsk = effskill(u, SK_RIDING, 0);
maxwagen = effsk * u->number * 2;
if (u_race(u) == get_race(RC_TROLL)) {
maxwagen = MAX(maxwagen, u->number / 4);
int trolls = u->number / 4;
if (maxwagen > trolls) maxwagen = trolls;
}
maxpferde = effsk * u->number * 4 + u->number;
@ -510,8 +522,9 @@ static double overload(const region * r, ship * sh)
getshipweight(sh, &n, &p);
ovl = n / (double)sh->type->cargo;
if (mcabins)
ovl = MAX(ovl, p / (double)mcabins);
if (mcabins) {
ovl = fmax(ovl, p / (double)mcabins);
}
return ovl;
}
}
@ -752,7 +765,7 @@ double damage_overload(double overload)
badness = overload - overload_worse();
if (badness >= 0) {
assert(overload_worst() > overload_worse() || !"overload.worst must be > overload.worse");
damage += MIN(badness, overload_worst() - overload_worse()) *
damage += fmin(badness, overload_worst() - overload_worse()) *
(overload_max_damage() - damage) /
(overload_worst() - overload_worse());
}
@ -952,7 +965,7 @@ static unit *bewegung_blockiert_von(unit * reisender, region * r)
double prob_u = (sk - stealth) * skill_prob;
guard_count += u->number;
/* amulet counts at most once */
prob_u += MIN(1, MIN(u->number, i_get(u->items, ramulet->itype))) * amulet_prob;
prob_u += fmin(1, fmin(u->number, i_get(u->items, ramulet->itype))) * amulet_prob;
if (u->building && (u->building->type == castle_bt) && u == building_owner(u->building))
prob_u += castle_prob*buildingeffsize(u->building, 0);
if (prob_u >= prob) {
@ -1967,8 +1980,8 @@ static void sail(unit * u, order * ord, region_list ** routep, bool drifting)
const luxury_type *ltype = resource2luxury(itm->type->rtype);
if (ltype != NULL && itm->number > 0) {
int st = itm->number * effskill(harbourmaster, SK_TRADE, 0) / 50;
st = MIN(itm->number, st);
if (st > itm->number) st = itm->number;
if (st > 0) {
i_change(&u2->items, itm->type, -st);
i_change(&harbourmaster->items, itm->type, st);

View file

@ -50,7 +50,7 @@ extern "C" {
#define MV_SWIM (1<<8) /* kann schwimmen */
#define MV_WALK (1<<9) /* kann über Land gehen */
#define HORSESNEEDED 2
#define HORSES_PER_CART 2 /* number of horses for a cart */
#define STRENGTHMULTIPLIER 50 /* multiplier for trollbelt */
/* ein mensch wiegt 10, traegt also 5, ein pferd wiegt 50, traegt also 20. ein

View file

@ -32,8 +32,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* util includes */
#include <util/base36.h>
#include <util/bsdstring.h>
#include <util/language.h>
#include <util/functions.h>
#include <util/language.h>
#include <util/macros.h>
#include <util/rng.h>
#include <util/unicode.h>

View file

@ -1,3 +1,4 @@
#include <platform.h>
#include "piracy.h"
#include "direction.h"

View file

@ -5,16 +5,13 @@
#endif
#ifdef _MSC_VER
#ifndef __STDC__
#define __STDC__ 1 // equivalent to /Za
#endif
#define NO_MKDIR
#if _MSC_VER >= 1900
#pragma warning(disable: 4710 4820)
#pragma warning(disable: 4710 4820 4001)
#pragma warning(disable: 4100) // unreferenced formal parameter
#pragma warning(disable: 4456) // declaration hides previous
#pragma warning(disable: 4457) // declaration hides function parameter
#pragma warning(disable: 4459) // declaration hides global
#pragma warning(disable: 4224) // formal parameter was previously defined as a type
#endif
#else /* assume gcc */
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
@ -29,18 +26,7 @@
# define MAX_PATH 4096
#endif
#define UNUSED_ARG(a) (void)(a)
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define TOLUA_CAST (char*)
#ifdef NO_MKDIR
int mkdir(const char *pathname, int mode);
#endif
/* do not use M_PI, use one of these instead: */
#define PI_F 3.1415926535897932384626433832795F
#define PI_D 3.1415926535897932384626433832795
#define PI_L 3.1415926535897932384626433832795L

View file

@ -1,3 +1,7 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "prefix.h"
#include <tests.h>

View file

@ -675,10 +675,11 @@ static void godcurse(void)
double dmg = config_get_flt("rules.ship.damage.godcurse", 0.1);
damage_ship(sh, dmg);
if (sh->damage >= sh->size * DAMAGE_SCALE) {
unit *u = ship_owner(sh);
if (u)
ADDMSG(&u->faction->msgs,
msg_message("godcurse_destroy_ship", "ship", sh));
unit *uo = ship_owner(sh);
if (uo) {
ADDMSG(&uo->faction->msgs,
msg_message("godcurse_destroy_ship", "ship", sh));
}
remove_ship(&sh->region->ships, sh);
}
sh = shn;

View file

@ -16,9 +16,9 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#define ECHECK_VERSION "4.01"
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <kernel/config.h>
#include "report.h"
@ -104,9 +104,7 @@ 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
#define ECHECK_VERSION "4.01"
extern int *storms;
extern int weeks_per_month;
@ -922,7 +920,7 @@ void report_region(struct stream *out, const region * r, faction * f)
if (!r2)
continue;
for (b = get_borders(r, r2); b;) {
struct edge *e = edges;
struct edge *edg = edges;
bool transparent = b->type->transparent(b, f);
const char *name = border_name(b, r, f, GF_DETAILED | GF_ARTICLE);
@ -933,18 +931,18 @@ void report_region(struct stream *out, const region * r, faction * f)
b = b->next;
continue;
}
while (e && (e->transparent != transparent || strcmp(name, e->name)!=0)) {
e = e->next;
while (edg && (edg->transparent != transparent || strcmp(name, edg->name)!=0)) {
edg = edg->next;
}
if (!e) {
e = calloc(sizeof(struct edge), 1);
e->name = str_strdup(name);
e->transparent = transparent;
e->next = edges;
edges = e;
if (!edg) {
edg = calloc(sizeof(struct edge), 1);
edg->name = str_strdup(name);
edg->transparent = transparent;
edg->next = edges;
edges = edg;
}
e->lastd = d;
e->exist[d] = true;
edg->lastd = d;
edg->exist[d] = true;
b = b->next;
}
}
@ -1009,7 +1007,7 @@ void report_region(struct stream *out, const region * r, faction * f)
/* iron & stone */
if (r->seen.mode >= seen_unit) {
resource_report result[MAX_RAWMATERIALS];
int n, numresults = report_resources(r, result, MAX_RAWMATERIALS, f, true);
int numresults = report_resources(r, result, MAX_RAWMATERIALS, f, true);
for (n = 0; n < numresults; ++n) {
if (result[n].number >= 0 && result[n].level >= 0) {
@ -1024,8 +1022,8 @@ void report_region(struct stream *out, const region * r, faction * f)
/* peasants & silver */
if (rpeasants(r)) {
int n = rpeasants(r);
bytes = snprintf(bufp, size, ", %d", n);
int p = rpeasants(r);
bytes = snprintf(bufp, size, ", %d", p);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
@ -1040,7 +1038,7 @@ void report_region(struct stream *out, const region * r, faction * f)
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
bytes =
(int)strlcpy(bufp, LOC(f->locale, n == 1 ? "peasant" : "peasant_p"),
(int)strlcpy(bufp, LOC(f->locale, p == 1 ? "peasant" : "peasant_p"),
size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
@ -1172,17 +1170,17 @@ void report_region(struct stream *out, const region * r, faction * f)
/* Spezielle Richtungen */
for (a = a_find(r->attribs, &at_direction); a && a->type == &at_direction;
a = a->next) {
spec_direction *d = (spec_direction *)(a->data.v);
spec_direction *spd = (spec_direction *)(a->data.v);
bytes = (int)strlcpy(bufp, " ", size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
bytes = (int)strlcpy(bufp, LOC(f->locale, d->desc), size);
bytes = (int)strlcpy(bufp, LOC(f->locale, spd->desc), size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
bytes = (int)strlcpy(bufp, " (\"", size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
bytes = (int)strlcpy(bufp, LOC(f->locale, d->keyword), size);
bytes = (int)strlcpy(bufp, LOC(f->locale, spd->keyword), size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
bytes = (int)strlcpy(bufp, "\")", size);
@ -2226,14 +2224,14 @@ report_plaintext(const char *filename, report_context * ctx,
WARN_STATIC_BUFFER();
if (ptype->itype->construction) {
requirement *m = ptype->itype->construction->materials;
while (m->number) {
requirement *rm = ptype->itype->construction->materials;
while (rm->number) {
bytes =
(int)strlcpy(bufp, LOC(f->locale, resourcename(m->rtype, 0)), size);
(int)strlcpy(bufp, LOC(f->locale, resourcename(rm->rtype, 0)), size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
++m;
if (m->number)
if (rm->number)
bytes = (int)strlcpy(bufp, ", ", size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
@ -2275,7 +2273,8 @@ report_plaintext(const char *filename, report_context * ctx,
if (markets_module() && r->land) {
const item_type *lux = r_luxury(r);
const item_type *herb = r->land->herbtype;
message *m = 0;
m = NULL;
if (herb && lux) {
m = msg_message("nr_market_info_p", "p1 p2",
lux->rtype, herb->rtype);
@ -2288,7 +2287,6 @@ report_plaintext(const char *filename, report_context * ctx,
newline(out);
nr_paragraph(out, m, f);
}
/* */
}
else {
if (!fval(r->terrain, SEA_REGION) && rpeasants(r) / TRADE_FRACTION > 0) {

View file

@ -67,6 +67,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/language.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/strings.h>
#include <util/translation.h>
#include <stream.h>
@ -537,10 +538,9 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
if (u->attribs && alliedunit(u, f, HELP_FSTEALTH)) {
faction *otherf = get_otherfaction(u);
if (otherf) {
int result =
snprintf(bufp, size, ", %s (%s)", factionname(otherf),
factionname(u->faction));
if (wrptr(&bufp, &size, result) != 0)
int n = snprintf(bufp, size, ", %s (%s)",
factionname(otherf), factionname(u->faction));
if (wrptr(&bufp, &size, n) != 0)
WARN_STATIC_BUFFER();
}
else {
@ -675,23 +675,22 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
if (book) {
selist *ql = book->spells;
int qi, header, maxlevel = effskill(u, SK_MAGIC, 0);
int result = snprintf(bufp, size, ". Aura %d/%d", get_spellpoints(u), max_spellpoints(u->region, u));
if (wrptr(&bufp, &size, result) != 0) {
int n = snprintf(bufp, size, ". Aura %d/%d", get_spellpoints(u), max_spellpoints(u->region, u));
if (wrptr(&bufp, &size, n) != 0) {
WARN_STATIC_BUFFER();
}
for (header = 0, qi = 0; ql; selist_advance(&ql, &qi, 1)) {
spellbook_entry * sbe = (spellbook_entry *)selist_get(ql, qi);
if (sbe->level <= maxlevel) {
int result = 0;
if (!header) {
result = snprintf(bufp, size, ", %s: ", LOC(lang, "nr_spells"));
n = snprintf(bufp, size, ", %s: ", LOC(lang, "nr_spells"));
header = 1;
}
else {
result = (int)strlcpy(bufp, ", ", size);
n = (int)strlcpy(bufp, ", ", size);
}
if (wrptr(&bufp, &size, result) != 0) {
if (wrptr(&bufp, &size, n) != 0) {
WARN_STATIC_BUFFER();
}
/* TODO: no need to deref the spellref here (spref->name is good) */
@ -704,9 +703,8 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
break;
}
if (i != MAXCOMBATSPELLS) {
int result =
snprintf(bufp, size, ", %s: ", LOC(lang, "nr_combatspells"));
if (wrptr(&bufp, &size, result) != 0)
n = snprintf(bufp, size, ", %s: ", LOC(lang, "nr_combatspells"));
if (wrptr(&bufp, &size, n) != 0)
WARN_STATIC_BUFFER();
dh = 0;
@ -723,8 +721,8 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
int sl = get_combatspelllevel(u, i);
bufp = STRLCPY(bufp, spell_name(sp, lang), size);
if (sl > 0) {
result = snprintf(bufp, size, " (%d)", sl);
if (wrptr(&bufp, &size, result) != 0)
n = snprintf(bufp, size, " (%d)", sl);
if (wrptr(&bufp, &size, n) != 0)
WARN_STATIC_BUFFER();
}
}
@ -741,8 +739,8 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
keyword_t kwd = getkeyword(ord);
if (is_repeated(kwd)) {
if (printed < ORDERS_IN_NR) {
int result = (int)buforder(bufp, size, ord, u->faction->locale, printed++);
if (wrptr(&bufp, &size, result) != 0)
int n = (int)buforder(bufp, size, ord, u->faction->locale, printed++);
if (wrptr(&bufp, &size, n) != 0)
WARN_STATIC_BUFFER();
}
else
@ -754,12 +752,13 @@ bufunit(const faction * f, const unit * u, unsigned int indent, seen_mode mode,
keyword_t kwd = getkeyword(ord);
if (is_repeated(kwd)) {
if (printed < ORDERS_IN_NR) {
int result = (int)buforder(bufp, size, ord, lang, printed++);
if (wrptr(&bufp, &size, result) != 0)
int n = (int)buforder(bufp, size, ord, lang, printed++);
if (wrptr(&bufp, &size, n) != 0)
WARN_STATIC_BUFFER();
}
else
else {
break;
}
}
}
}
@ -1339,8 +1338,8 @@ void reorder_units(region * r)
while (*unext && sh) {
unit **ufirst = unext; /* where the first unit in the building should go */
unit **umove = unext; /* a unit we consider moving */
unit *owner = ship_owner(sh);
umove = unext;
while (owner && *umove) {
unit *u = *umove;
if (u->number && u->ship == sh) {
@ -1478,8 +1477,8 @@ void prepare_report(report_context *ctx, faction *f)
for (b = rbuildings(r); b; b = b->next) {
if (b && b->type == bt_lighthouse) {
/* region owners get maximm range */
int br = lighthouse_range(b, NULL, NULL);
if (br > range) range = br;
int lhr = lighthouse_range(b, NULL, NULL);
if (lhr > range) range = lhr;
}
}
}

View file

@ -11,7 +11,6 @@
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#include <platform.h>
#include <kernel/config.h>
@ -64,6 +63,7 @@
#include <util/event.h>
#include <util/gamedata.h>
#include <util/language.h>
#include <util/macros.h>
#include <util/message.h>
#include <util/parser.h>
#include <util/umlaut.h>

View file

@ -1,5 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "borders.h"
#include "vortex.h"
@ -15,6 +16,7 @@
#include <util/attrib.h>
#include <util/gamedata.h>
#include <util/language.h>
#include <util/macros.h>
#include <util/rand.h>
#include <util/rng.h>
#include <util/resolve.h>
@ -119,7 +121,7 @@ struct region *from, struct region *to, bool routing)
wall_data *fd = (wall_data *)b->data.v;
if (!routing && fd->active) {
int hp = dice(3, fd->force) * u->number;
hp = MIN(u->hp, hp);
if (u->hp < hp) hp = u->hp;
u->hp -= hp;
if (u->hp) {
ADDMSG(&u->faction->msgs, msg_message("firewall_damage",

View file

@ -26,6 +26,7 @@
#include <util/base36.h>
#include <util/functions.h>
#include <util/language.h>
#include <util/macros.h>
/* libc includes */
#include <string.h>

View file

@ -37,6 +37,7 @@
#include <util/attrib.h>
#include <util/base36.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/rand.h>
#include <util/rng.h>

View file

@ -25,6 +25,7 @@
/* util includes */
#include <util/log.h>
#include <util/macros.h>
#include <util/nrmessage.h>
#include <util/message.h>
#include <util/functions.h>

View file

@ -26,6 +26,7 @@
#include <util/functions.h>
#include <util/language.h>
#include <util/log.h>
#include <util/macros.h>
#include <storage.h>

View file

@ -26,6 +26,7 @@
#include <util/gamedata.h>
#include <util/language.h>
#include <util/nrmessage.h>
#include <util/macros.h>
#include <util/message.h>
#include <util/base36.h>
#include <util/functions.h>

View file

@ -425,9 +425,8 @@ static void sink_ship(region * r, ship * sh, unit * saboteur)
}
}
for (ui = &r->units; *ui;) {
unit *u = *ui;
/* inform this faction about the sinking ship: */
u = *ui;
if (!(u->faction->flags & FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
if (sink_msg == NULL) {

View file

@ -1,4 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <kernel/config.h>
#include <kernel/faction.h>
#include <kernel/race.h>

View file

@ -768,7 +768,7 @@ int study_cmd(unit * u, order * ord)
if (skill > maxalchemy) {
for (ptype = potiontypes; ptype; ptype = ptype->next) {
if (skill == ptype->level * 2) {
attrib *a = a_find(f->attribs, &at_showitem);
a = a_find(f->attribs, &at_showitem);
while (a && a->type == &at_showitem && a->data.v != ptype)
a = a->next;
if (a == NULL || a->type != &at_showitem) {

View file

@ -4,6 +4,7 @@
#include <kernel/unit.h>
#include <kernel/faction.h>
#include <util/attrib.h>
#include <util/macros.h>
#include "travelthru.h"
#include "reports.h"

View file

@ -25,11 +25,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/event.h>
#include <util/gamedata.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/resolve.h>
#include <util/base36.h>
#include <storage.h>

View file

@ -25,11 +25,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/event.h>
#include <util/gamedata.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/resolve.h>
#include <util/base36.h>
#include <storage.h>

View file

@ -27,11 +27,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/event.h>
#include <util/gamedata.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/resolve.h>
#include <util/base36.h>
#include <storage.h>

View file

@ -25,11 +25,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/event.h>
#include <util/gamedata.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/resolve.h>
#include <util/base36.h>
#include <storage.h>

View file

@ -31,6 +31,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/event.h>
#include <util/gamedata.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/resolve.h>
#include <storage.h>

View file

@ -22,6 +22,7 @@
#include <util/event.h>
#include <util/gamedata.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/resolve.h>
#include <storage.h>

View file

@ -29,6 +29,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/event.h>
#include <util/gamedata.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/resolve.h>
#include <storage.h>

View file

@ -28,6 +28,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/event.h>
#include <util/gamedata.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/resolve.h>
#include <storage.h>

View file

@ -34,6 +34,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/event.h>
#include <util/gamedata.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/resolve.h>
#include <util/rng.h>

View file

@ -24,6 +24,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/event.h>
#include <util/gamedata.h>
#include <util/log.h>
#include <util/macros.h>
#include <storage.h>

View file

@ -1,3 +1,7 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <CuTest.h>
#include "base36.h"
#include <stdlib.h>

View file

@ -1,4 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <string.h>
#include <errno.h>
#include <assert.h>

View file

@ -1,3 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <CuTest.h>
#include "bsdstring.h"
#include <errno.h>

View file

@ -14,6 +14,7 @@
#include <platform.h>
#include "crmessage.h"
#include "macros.h"
#include "message.h"
#include "strings.h"
#include "log.h"

View file

@ -1,3 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <CuTest.h>
#include <stdio.h>
#include <string.h>

View file

@ -16,6 +16,10 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "language.h"
#include "log.h"

View file

@ -16,8 +16,11 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#include "lists.h"
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "lists.h"
#include "strings.h"
#include <stdlib.h>

View file

@ -1,7 +1,10 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include <CuTest.h>
#include "log.h"
#include "macros.h"
#include <stdarg.h>
#include <string.h>

View file

@ -1,3 +1,3 @@
#define UNUSED_ARG(x) (void)x
#define UNUSED_ARG(x) (void)(x)
#define TOLUA_CAST (char*)

Some files were not shown because too many files have changed in this diff Show more