[Change] pilot_free uses memmove.
This commit is contained in:
parent
30b6dfed77
commit
ab277eabb4
11
src/pilot.c
11
src/pilot.c
@ -1032,17 +1032,18 @@ void pilot_free(Pilot* p) {
|
||||
/* Destroy pilot from stack. */
|
||||
void pilot_destroy(Pilot* p) {
|
||||
int i;
|
||||
|
||||
/* Find the pilot. */
|
||||
for(i = 0; i < pilot_nstack; i++)
|
||||
if(pilot_stack[i] == p)
|
||||
break;
|
||||
|
||||
/* Pilot is eliminated. */
|
||||
pilot_free(p);
|
||||
pilot_nstack--;
|
||||
|
||||
while(i < pilot_nstack) {
|
||||
pilot_stack[i] = pilot_stack[i+1];
|
||||
i++;
|
||||
}
|
||||
pilot_free(p);
|
||||
/* Copy other pilots down. */
|
||||
memmove(&pilot_stack[i], &pilot_stack[i+1], (pilot_nstack-i)*sizeof(Pilot*));
|
||||
}
|
||||
|
||||
/* Free the prisoned pilot! */
|
||||
|
Loading…
Reference in New Issue
Block a user