Clean up the array copying for the new high scores list. It was way
[attac-man.git] / include / linked-lists.h
blobdd78defe7f55ea2867259f884fc64dc9e40edfbb
1 /*
2 Pacman Arena
3 Copyright (C) 2003 Nuno Subtil
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 /* $Id: linked-lists.h,v 1.1 2003/11/22 16:22:08 nsubtil Exp $ */
22 #ifndef _LINKED_LISTS_H
23 #define _LINKED_LISTS_H
26 * Macros for handling linked lists
29 /* adds element to head of list */
30 #define LLIST_ADD(TYPE, root, new) \
31 if(root == NULL) {\
32 root = new; \
33 new->next = NULL; \
34 } else {\
35 new->next = root; \
36 root = new; \
39 /* removes element from list */
40 #define LLIST_REMOVE(TYPE, root, remove) \
41 if(root == remove) {\
42 root = remove->next; \
43 } else {\
44 TYPE *_llist_cur, *_llist_prev; \
45 _llist_prev = root; \
46 _llist_cur = _llist_prev->next; \
47 while(_llist_cur) {\
48 if(_llist_cur == remove) {\
49 _llist_prev->next = _llist_cur->next; \
50 break; \
52 _llist_prev = _llist_cur; \
53 _llist_cur = _llist_cur->next; \
55 printf("LLIST_REMOVE: %p not found at %p", remove, root);\
56 SDL_Quit();\
57 exit(1);\
60 #endif /* ifndef _LINKED_LISTS_H */