Fix crash if Num_walls=0
[btb/d2x.git] / main / player.c
1 /* $Id: player.c,v 1.3 2003-10-10 09:36:35 btb Exp $ */
2
3 /*
4  *
5  * Player Stuff
6  *
7  */
8
9 #ifdef HAVE_CONFIG_H
10 #include <conf.h>
11 #endif
12
13 #include "player.h"
14 #include "cfile.h"
15
16 #ifdef RCS
17 static char rcsid[] = "$Id: player.c,v 1.3 2003-10-10 09:36:35 btb Exp $";
18 #endif
19
20 /*
21  * reads a player_ship structure from a CFILE
22  */
23 void player_ship_read(player_ship *ps, CFILE *fp)
24 {
25         int i;
26
27         ps->model_num = cfile_read_int(fp);
28         ps->expl_vclip_num = cfile_read_int(fp);
29         ps->mass = cfile_read_fix(fp);
30         ps->drag = cfile_read_fix(fp);
31         ps->max_thrust = cfile_read_fix(fp);
32         ps->reverse_thrust = cfile_read_fix(fp);
33         ps->brakes = cfile_read_fix(fp);
34         ps->wiggle = cfile_read_fix(fp);
35         ps->max_rotthrust = cfile_read_fix(fp);
36         for (i = 0; i < N_PLAYER_GUNS; i++)
37                 cfile_read_vector(&(ps->gun_points[i]), fp);
38 }