forked from github/server
fix qsort in wormhole code. pointers are hard.
This commit is contained in:
parent
3e829e2880
commit
cbf9bb8985
1 changed files with 123 additions and 122 deletions
|
@ -46,11 +46,11 @@ static bool good_region(const region * r)
|
||||||
|
|
||||||
static int cmp_age(const void *v1, const void *v2)
|
static int cmp_age(const void *v1, const void *v2)
|
||||||
{
|
{
|
||||||
const region *r1 = (const region *)v1;
|
const region **r1 = (const region **)v1;
|
||||||
const region *r2 = (const region *)v2;
|
const region **r2 = (const region **)v2;
|
||||||
if (r1->age < r2->age)
|
if ((*r1)->age < (*r2)->age)
|
||||||
return -1;
|
return -1;
|
||||||
if (r1->age > r2->age)
|
if ((*r1)->age > (*r2)->age)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,8 @@ static int wormhole_age(struct attrib *a)
|
||||||
message *m = NULL;
|
message *m = NULL;
|
||||||
if (u->number > maxtransport || has_limited_skills(u)) {
|
if (u->number > maxtransport || has_limited_skills(u)) {
|
||||||
m = msg_message("wormhole_requirements", "unit region", u, u->region);
|
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);
|
move_unit(u, data->exit, NULL);
|
||||||
maxtransport -= u->number;
|
maxtransport -= u->number;
|
||||||
m = msg_message("wormhole_exit", "unit region", u, data->exit);
|
m = msg_message("wormhole_exit", "unit region", u, data->exit);
|
||||||
|
|
Loading…
Reference in a new issue