[Change] pilot_free uses memmove.

This commit is contained in:
Allanis 2013-07-06 16:42:28 +01:00
parent 30b6dfed77
commit ab277eabb4

View File

@ -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! */