fix qsort in wormhole code. pointers are hard.

This commit is contained in:
Enno Rehling 2014-09-29 20:38:01 +02:00
parent 3e829e2880
commit cbf9bb8985
1 changed files with 123 additions and 122 deletions

View File

@ -46,11 +46,11 @@ static bool good_region(const region * r)
static int cmp_age(const void *v1, const void *v2)
{
const region *r1 = (const region *)v1;
const region *r2 = (const region *)v2;
if (r1->age < r2->age)
const region **r1 = (const region **)v1;
const region **r2 = (const region **)v2;
if ((*r1)->age < (*r2)->age)
return -1;
if (r1->age > r2->age)
if ((*r1)->age > (*r2)->age)
return 1;
return 0;
}
@ -82,7 +82,8 @@ static int wormhole_age(struct attrib *a)
message *m = NULL;
if (u->number > maxtransport || has_limited_skills(u)) {
m = msg_message("wormhole_requirements", "unit region", u, u->region);
} else if (data->exit != NULL) {
}
else if (data->exit != NULL) {
move_unit(u, data->exit, NULL);
maxtransport -= u->number;
m = msg_message("wormhole_exit", "unit region", u, data->exit);