Replace 0 with NULL (consistency is good).

This commit is contained in:
Enno Rehling 2018-01-14 09:58:45 +01:00
parent 75f41a7169
commit f776450f9b
9 changed files with 26 additions and 26 deletions

View File

@ -37,7 +37,7 @@ static void test_give_control_building(CuTest * tc)
test_setup();
f = test_create_faction(NULL);
r = test_create_region(0, 0, NULL);
b = test_create_building(r, 0);
b = test_create_building(r, NULL);
u1 = test_create_unit(f, r);
u_set_building(u1, b);
u2 = test_create_unit(f, r);
@ -58,7 +58,7 @@ static void test_give_control_ship(CuTest * tc)
test_setup();
f = test_create_faction(NULL);
r = test_create_region(0, 0, NULL);
sh = test_create_ship(r, 0);
sh = test_create_ship(r, NULL);
u1 = test_create_unit(f, r);
u_set_ship(u1, sh);
u2 = test_create_unit(f, r);
@ -586,7 +586,7 @@ static void test_modify_production(CuTest *tc) {
rt_silver = get_resourcetype(R_SILVER);
itype = test_create_itemtype("stone");
rtype = itype->rtype;
u = test_create_unit(test_create_faction(NULL), test_create_region(0,0,0));
u = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
make_item(u, itype, 1);
CuAssertPtrNotNull(tc, test_find_messagetype(u->faction->msgs, "error_cannotmake"));
CuAssertIntEquals(tc, 0, get_item(u, itype));

View File

@ -164,7 +164,7 @@ static void test_readwrite_building(CuTest * tc)
test_setup();
r = test_create_region(0, 0, NULL);
b = test_create_building(r, 0);
b = test_create_building(r, NULL);
free(b->name);
b->name = str_strdup(" Hodor ");
CuAssertStrEquals(tc, " Hodor ", b->name);
@ -197,7 +197,7 @@ static void test_readwrite_ship(CuTest * tc)
test_setup();
r = test_create_region(0, 0, NULL);
sh = test_create_ship(r, 0);
sh = test_create_ship(r, NULL);
free(sh->name);
sh->name = str_strdup(" Hodor ");
CuAssertStrEquals(tc, " Hodor ", sh->name);

View File

@ -410,7 +410,7 @@ static ship *setup_ship(void) {
ship_type *stype;
config_set("movement.shipspeed.skillbonus", "0");
r = test_create_region(0, 0, test_create_terrain("ocean", 0));
r = test_create_ocean(0, 0);
stype = test_create_shiptype("longboat");
stype->cptskill = 1;
stype->sumskill = 10;

View File

@ -304,7 +304,7 @@ static void test_inside_building(CuTest *tc) {
test_setup();
u = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
b = test_create_building(u->region, 0);
b = test_create_building(u->region, NULL);
b->size = 1;
scale_number(u, 1);
@ -395,7 +395,7 @@ static void test_unit_description(CuTest *tc) {
test_setup();
lang = test_create_locale();
rc = test_create_race("hodor");
u = test_create_unit(test_create_faction(rc), test_create_region(0,0,0));
u = test_create_unit(test_create_faction(rc), test_create_region(0, 0, NULL));
CuAssertPtrEquals(tc, 0, u->display);
CuAssertStrEquals(tc, 0, u_description(u, lang));

View File

@ -955,7 +955,7 @@ static void test_name_building(CuTest *tc) {
faction *f;
u = setup_name_cmd();
u->building = test_create_building(u->region, 0);
u->building = test_create_building(u->region, NULL);
f = u->faction;
uo = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
u_set_building(uo, u->building);
@ -999,7 +999,7 @@ static void test_name_ship(CuTest *tc) {
faction *f;
u = setup_name_cmd();
u->ship = test_create_ship(u->region, 0);
u->ship = test_create_ship(u->region, NULL);
f = u->faction;
uo = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
u_set_ship(uo, u->ship);
@ -1206,13 +1206,13 @@ static void test_name_cmd(CuTest *tc) {
free_order(ord);
ord = create_order(K_NAME, f->locale, "%s ' Ho\tdor '", LOC(f->locale, parameters[P_SHIP]));
u->ship = test_create_ship(u->region, 0);
u->ship = test_create_ship(u->region, NULL);
name_cmd(u, ord);
CuAssertStrEquals(tc, "Hodor", u->ship->name);
free_order(ord);
ord = create_order(K_NAME, f->locale, "%s ' Ho\tdor '", LOC(f->locale, parameters[P_BUILDING]));
u_set_building(u, test_create_building(u->region, 0));
u_set_building(u, test_create_building(u->region, NULL));
name_cmd(u, ord);
CuAssertStrEquals(tc, "Hodor", u->building->name);
free_order(ord);

View File

@ -75,7 +75,7 @@ static void setup_harbor(move_fixture *mf) {
ttype = test_create_terrain("glacier", LAND_REGION | ARCTIC_REGION | WALK_INTO);
btype = test_create_buildingtype("harbour");
sh = test_create_ship(0, 0);
sh = test_create_ship(0, NULL);
r = test_create_region(0, 0, ttype);
b = test_create_building(r, btype);
@ -219,8 +219,8 @@ static void test_ship_trails(CuTest *tc) {
r1 = test_create_region(0, 0, otype);
r2 = test_create_region(1, 0, otype);
r3 = test_create_region(2, 0, otype);
sh = test_create_ship(r1, 0);
move_ship(sh, r1, r3, 0);
sh = test_create_ship(r1, NULL);
move_ship(sh, r1, r3, NULL);
CuAssertPtrEquals(tc, r3, sh->region);
CuAssertPtrEquals(tc, sh, r3->ships);
CuAssertPtrEquals(tc, 0, r1->ships);
@ -246,8 +246,8 @@ static void test_age_trails(CuTest *tc) {
test_setup();
r1 = test_create_region(0, 0, NULL);
r2 = test_create_region(1, 0, 0);
sh = test_create_ship(r1, 0);
r2 = test_create_region(1, 0, NULL);
sh = test_create_ship(r1, NULL);
add_regionlist(&route, r1);
add_regionlist(&route, r2);
move_ship(sh, r1, r2, route);

View File

@ -58,7 +58,7 @@ static void test_renumber_building(CuTest *tc) {
test_setup_ex(tc);
u = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
u->building = test_create_building(u->region, 0);
u->building = test_create_building(u->region, NULL);
no = u->building->no;
uno = (no > 1) ? no - 1 : no + 1;
lang = u->faction->locale;
@ -76,9 +76,9 @@ static void test_renumber_building_duplicate(CuTest *tc) {
test_setup_ex(tc);
u = test_create_unit(f = test_create_faction(NULL), test_create_region(0, 0, NULL));
u->building = test_create_building(u->region, 0);
u->building = test_create_building(u->region, NULL);
uno = u->building->no;
u->building = test_create_building(u->region, 0);
u->building = test_create_building(u->region, NULL);
no = u->building->no;
lang = f->locale;
u->thisorder = create_order(K_NUMBER, lang, "%s %s", LOC(lang, parameters[P_BUILDING]), itoa36(uno));
@ -95,7 +95,7 @@ static void test_renumber_ship(CuTest *tc) {
test_setup_ex(tc);
u = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
u->ship = test_create_ship(u->region, 0);
u->ship = test_create_ship(u->region, NULL);
no = u->ship->no;
uno = (no > 1) ? no - 1 : no + 1;
lang = u->faction->locale;
@ -112,7 +112,7 @@ static void test_renumber_ship_twice(CuTest *tc) {
test_setup_ex(tc);
u = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
u->ship = test_create_ship(u->region, 0);
u->ship = test_create_ship(u->region, NULL);
no = u->ship->no;
uno = (no > 1) ? no - 1 : no + 1;
lang = u->faction->locale;
@ -134,9 +134,9 @@ static void test_renumber_ship_duplicate(CuTest *tc) {
test_setup_ex(tc);
u = test_create_unit(f = test_create_faction(NULL), test_create_region(0, 0, NULL));
u->ship = test_create_ship(u->region, 0);
u->ship = test_create_ship(u->region, NULL);
uno = u->ship->no;
u->ship = test_create_ship(u->region, 0);
u->ship = test_create_ship(u->region, NULL);
no = u->ship->no;
lang = f->locale;
u->thisorder = create_order(K_NUMBER, lang, "%s %s", LOC(lang, parameters[P_SHIP]), itoa36(uno));

View File

@ -159,7 +159,7 @@ static void test_report_travelthru(CuTest *tc) {
r->flags |= RF_TRAVELUNIT;
f = test_create_faction(NULL);
f->locale = lang;
u = test_create_unit(f, test_create_region(0, 1, 0));
u = test_create_unit(f, test_create_region(0, 1, NULL));
unit_setname(u, "Hodor");
unit_setid(u, 1);

View File

@ -35,7 +35,7 @@ static void setup_travelthru(travel_fixture *fix, int nunits) {
}
f = test_create_faction(NULL);
while (nunits--) {
unit *u = test_create_unit(f, test_create_region(1, 0, 0));
unit *u = test_create_unit(f, test_create_region(1, 0, NULL));
travelthru_add(r, u);
}
fix->r = r;