equal
deleted
inserted
replaced
329 WP(w, newgrf_add_d).list = list; |
329 WP(w, newgrf_add_d).list = list; |
330 break; |
330 break; |
331 } |
331 } |
332 |
332 |
333 case 4: { /* Remove GRF */ |
333 case 4: { /* Remove GRF */ |
334 GRFConfig **pc, *c; |
334 GRFConfig **pc, *c, *newsel; |
|
335 |
|
336 /* Choose the next GRF file to be the selected file */ |
|
337 newsel = WP(w, newgrf_d).sel->next; |
|
338 |
335 for (pc = WP(w, newgrf_d).list; (c = *pc) != NULL; pc = &c->next) { |
339 for (pc = WP(w, newgrf_d).list; (c = *pc) != NULL; pc = &c->next) { |
|
340 /* If the new selection is empty (i.e. we're deleting the last item |
|
341 * in the list, pick the file just before the selected file */ |
|
342 if (newsel == NULL && c->next == WP(w, newgrf_d).sel) newsel = c; |
|
343 |
336 if (c == WP(w, newgrf_d).sel) { |
344 if (c == WP(w, newgrf_d).sel) { |
337 *pc = c->next; |
345 *pc = c->next; |
338 free(c); |
346 free(c); |
339 break; |
347 break; |
340 } |
348 } |
341 } |
349 } |
342 WP(w, newgrf_d).sel = NULL; |
350 |
|
351 WP(w, newgrf_d).sel = newsel; |
343 SetupNewGRFWindow(w); |
352 SetupNewGRFWindow(w); |
344 SetWindowDirty(w); |
353 SetWindowDirty(w); |
345 break; |
354 break; |
346 } |
355 } |
347 |
356 |