forked from github/server
cannot assert that free_unit has no faction (complicated reasons)
This commit is contained in:
parent
728f7ed389
commit
3e0bc4f26d
|
@ -917,6 +917,7 @@ void free_region(region * r)
|
||||||
while (r->units) {
|
while (r->units) {
|
||||||
unit *u = r->units;
|
unit *u = r->units;
|
||||||
r->units = u->next;
|
r->units = u->next;
|
||||||
|
u->region = NULL;
|
||||||
uunhash(u);
|
uunhash(u);
|
||||||
free_unit(u);
|
free_unit(u);
|
||||||
free(u);
|
free(u);
|
||||||
|
|
|
@ -1400,12 +1400,11 @@ int invisible(const unit * target, const unit * viewer)
|
||||||
/** remove the unit from memory.
|
/** remove the unit from memory.
|
||||||
* this frees all memory that's only accessible through the unit,
|
* this frees all memory that's only accessible through the unit,
|
||||||
* and you should already have called uunhash and removed the unit from the
|
* and you should already have called uunhash and removed the unit from the
|
||||||
* region and faction.
|
* region.
|
||||||
*/
|
*/
|
||||||
void free_unit(unit * u)
|
void free_unit(unit * u)
|
||||||
{
|
{
|
||||||
assert(!u->region);
|
assert(!u->region);
|
||||||
assert(!u->faction);
|
|
||||||
free(u->_name);
|
free(u->_name);
|
||||||
free(u->display);
|
free(u->display);
|
||||||
free_order(u->thisorder);
|
free_order(u->thisorder);
|
||||||
|
|
Loading…
Reference in New Issue