annotate carNode.c @ 0:0fae5658fb0b

Initial revision
author gongo
date Thu, 02 Nov 2006 08:55:19 +0000
parents
children a1908b83f8fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
1 /*
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
2 * $Id$
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
3 */
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
4 #include <stdio.h>
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
5 #include <stdlib.h>
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
6 #include "libps2.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
7 #include "ps2util.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
8 #include "car.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
9 #include "game.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
10
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
11 extern Game game;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
12
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
13 /* --- car.c --- */
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
14 extern void car_destroy(CarPtr car);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
15
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
16 static CarPtr car_list;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
17
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
18 void
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
19 carNode_append(CarPtr new)
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
20 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
21 CarPtr p = car_list;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
22
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
23 if (!p) {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
24 car_list = new;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
25 } else {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
26 while (p->next) p = p->next;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
27 p->next = new;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
28 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
29 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
30
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
31 void
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
32 carNode_draw()
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
33 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
34 CarPtr p = car_list;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
35
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
36 while (p) {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
37 ps2util_obj_Draw(p->body);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
38 p = p->next;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
39 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
40 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
41
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
42 void
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
43 carNode_destroy()
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
44 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
45 CarPtr p = car_list;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
46
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
47 while (p) {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
48 car_destroy(p);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
49 p = p->next;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
50 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
51 car_list = NULL;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
52 }