forked from github/server
fix linux build
This commit is contained in:
parent
a9ecd1f55e
commit
fc308940b5
|
@ -1242,7 +1242,7 @@ typedef struct travel_data {
|
||||||
int n;
|
int n;
|
||||||
} travel_data;
|
} travel_data;
|
||||||
|
|
||||||
static void cb_cr_travelthru_ship(const region *r, unit *u, void *cbdata) {
|
static void cb_cr_travelthru_ship(region *r, unit *u, void *cbdata) {
|
||||||
travel_data *data = (travel_data *)cbdata;
|
travel_data *data = (travel_data *)cbdata;
|
||||||
const faction *f = data->f;
|
const faction *f = data->f;
|
||||||
FILE *F = data->file;
|
FILE *F = data->file;
|
||||||
|
@ -1255,7 +1255,7 @@ static void cb_cr_travelthru_ship(const region *r, unit *u, void *cbdata) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cb_cr_travelthru_unit(const region *r, unit *u, void *cbdata) {
|
static void cb_cr_travelthru_unit(region *r, unit *u, void *cbdata) {
|
||||||
travel_data *data = (travel_data *)cbdata;
|
travel_data *data = (travel_data *)cbdata;
|
||||||
const faction *f = data->f;
|
const faction *f = data->f;
|
||||||
FILE *F = data->file;
|
FILE *F = data->file;
|
||||||
|
|
|
@ -988,7 +988,7 @@ typedef struct address_data {
|
||||||
int stealthmod;
|
int stealthmod;
|
||||||
} address_data;
|
} address_data;
|
||||||
|
|
||||||
static void cb_add_address(const region *r, unit *ut, void *cbdata) {
|
static void cb_add_address(region *r, unit *ut, void *cbdata) {
|
||||||
address_data *data = (address_data *)cbdata;
|
address_data *data = (address_data *)cbdata;
|
||||||
faction *f = data->f;
|
faction *f = data->f;
|
||||||
|
|
||||||
|
@ -2396,7 +2396,7 @@ typedef struct count_data {
|
||||||
const struct faction *f;
|
const struct faction *f;
|
||||||
} count_data;
|
} count_data;
|
||||||
|
|
||||||
static void count_cb(const region *r, unit *u, void *cbdata) {
|
static void count_cb(region *r, unit *u, void *cbdata) {
|
||||||
count_data *data = (count_data *)cbdata;
|
count_data *data = (count_data *)cbdata;
|
||||||
const struct faction *f = data->f;
|
const struct faction *f = data->f;
|
||||||
if (r != u->region && (!u->ship || ship_owner(u->ship) == u)) {
|
if (r != u->region && (!u->ship || ship_owner(u->ship) == u)) {
|
||||||
|
|
|
@ -182,11 +182,6 @@ static void test_cr_unit(CuTest *tc) {
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reset_stream(stream *out) {
|
|
||||||
out->api->rewind(out->handle);
|
|
||||||
out->api->write(out->handle, "", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_write_travelthru(CuTest *tc) {
|
static void test_write_travelthru(CuTest *tc) {
|
||||||
stream out = { 0 };
|
stream out = { 0 };
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
@ -212,21 +207,23 @@ static void test_write_travelthru(CuTest *tc) {
|
||||||
out.api->rewind(out.handle);
|
out.api->rewind(out.handle);
|
||||||
len = out.api->read(out.handle, buf, sizeof(buf));
|
len = out.api->read(out.handle, buf, sizeof(buf));
|
||||||
CuAssertIntEquals_Msg(tc, "no travelers, no report", 0, (int)len);
|
CuAssertIntEquals_Msg(tc, "no travelers, no report", 0, (int)len);
|
||||||
|
mstream_done(&out);
|
||||||
reset_stream(&out);
|
|
||||||
|
mstream_init(&out);
|
||||||
travelthru_add(r, u);
|
travelthru_add(r, u);
|
||||||
write_travelthru(&out, r, f);
|
write_travelthru(&out, r, f);
|
||||||
out.api->rewind(out.handle);
|
out.api->rewind(out.handle);
|
||||||
len = out.api->read(out.handle, buf, sizeof(buf));
|
len = out.api->read(out.handle, buf, sizeof(buf));
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
CuAssertStrEquals_Msg(tc, "list one unit", "Durchreise: Hodor (1).\n", buf);
|
CuAssertStrEquals_Msg(tc, "list one unit", "Durchreise: Hodor (1).\n", buf);
|
||||||
|
mstream_done(&out);
|
||||||
|
|
||||||
reset_stream(&out);
|
mstream_init(&out);
|
||||||
move_unit(u, r, 0);
|
move_unit(u, r, 0);
|
||||||
write_travelthru(&out, r, f);
|
write_travelthru(&out, r, f);
|
||||||
out.api->rewind(out.handle);
|
out.api->rewind(out.handle);
|
||||||
len = out.api->read(out.handle, buf, sizeof(buf));
|
len = out.api->read(out.handle, buf, sizeof(buf));
|
||||||
CuAssertIntEquals_Msg(tc, "do not list units that stopped in the region", 0, len);
|
CuAssertIntEquals_Msg(tc, "do not list units that stopped in the region", 0, (int)len);
|
||||||
|
|
||||||
mstream_done(&out);
|
mstream_done(&out);
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
struct attrib;
|
struct attrib;
|
||||||
|
|
||||||
static void count_travelers(const region *r, unit *u, void *cbdata) {
|
static void count_travelers(region *r, unit *u, void *cbdata) {
|
||||||
int *n = (int *)cbdata;
|
int *n = (int *)cbdata;
|
||||||
unused_arg(r);
|
unused_arg(r);
|
||||||
*n += u->number;
|
*n += u->number;
|
||||||
|
|
Loading…
Reference in New Issue