comparison src/getship.c @ 4:aa38447a4b21

First entry of Paradise Server 2.9 patch 10 Beta
author darius
date Sat, 06 Dec 1997 04:37:03 +0000
parents
children
comparison
equal deleted inserted replaced
3:cafa94d86546 4:aa38447a4b21
1 /*--------------------------------------------------------------------------
2 NETREK II -- Paradise
3
4 Permission to use, copy, modify, and distribute this software and its
5 documentation, or any derivative works thereof, for any NON-COMMERCIAL
6 purpose and without fee is hereby granted, provided that this copyright
7 notice appear in all copies. No representations are made about the
8 suitability of this software for any purpose. This software is provided
9 "as is" without express or implied warranty.
10
11 Xtrek Copyright 1986 Chris Guthrie
12 Netrek (Xtrek II) Copyright 1989 Kevin P. Smith
13 Scott Silvey
14 Paradise II (Netrek II) Copyright 1993 Larry Denys
15 Kurt Olsen
16 Brandon Gillespie
17 --------------------------------------------------------------------------*/
18
19
20 #include "config.h"
21 #include <stdio.h>
22 #include <sys/types.h>
23 #include <sys/ipc.h>
24 #include <sys/shm.h>
25 #include <string.h>
26
27 #include "defs.h"
28 #include "struct.h"
29 #include "data.h"
30 #include "shmem.h"
31
32
33
34
35 /*-------------------------------INTERNAL FUNCTONS------------------------*/
36
37 /*----------------------------------GETSHIP--------------------------------*/
38 /*
39 * This function gets the particular ship type the player wants. It takes
40 * the ship values from the shipvals array.
41 */
42
43 void
44 getship(shipp, s_type)
45 struct ship *shipp; /* the ship structure to load */
46 int s_type; /* the type of ship to get */
47 {
48 memcpy((char *) shipp, (char *) &(shipvals[s_type]), sizeof(struct ship));
49 }
50
51
52
53 /*------------------------------------------------------------------------*/
54
55
56
57
58
59 void
60 get_ship_for_player(me, s_type)
61 struct player *me;
62 int s_type;
63 {
64 getship(&me->p_ship, s_type);
65
66 me->p_shield = me->p_ship.s_maxshield; /* shields are at max */
67 me->p_damage = 0; /* no damage to ship */
68 me->p_subdamage = 0; /* no fractional damage either */
69 me->p_subshield = 0; /* no fractional damage to shield */
70
71 me->p_fuel = me->p_ship.s_maxfuel; /* fuel is at max */
72 me->p_etemp = 0; /* engines are ice cold */
73 me->p_etime = 0; /* not counting down for E-temp */
74 me->p_warptime = 0; /* we are not preparing for warp */
75 me->p_wtemp = 0; /* weapons cool too */
76 me->p_wtime = 0; /* not counting down for W-temp */
77
78 if (allows_docking(me->p_ship))
79 { /* if ship can be docked to */
80 int i;
81 me->p_docked = 0; /* then set all ports as */
82 for (i = 0; i < MAXPORTS; i++) /* vacant */
83 me->p_port[i] = VACANT;
84 }
85 if (weaponsallowed[WP_MISSILE] &&
86 (me->p_ship.s_missilestored > 0) &&
87 (me->p_kills >= configvals->mskills))
88 {
89 me->p_ship.s_nflags |= SFNHASMISSILE; /* arm ship with missile
90 * launcher */
91 }
92 if (!(me->p_ship.s_nflags & SFNHASMISSILE))
93 {
94 me->p_ship.s_missilestored = 0; /* no missiles if no launcher */
95 }
96 if (weaponsallowed[WP_PLASMA] &&
97 (me->p_ship.s_plasma.cost > 0) &&
98 (me->p_kills >= configvals->plkills))
99 {
100 me->p_ship.s_nflags |= SFNPLASMAARMED; /* arm ship with plasma
101 * launcher */
102 }
103 me->p_specweap = 0;
104
105 /*
106 * fix this now since we can't do it right in a conf.sysdef/default/pl_gen
107 * ordering... sigh.
108 */
109 if (!configvals->warpdrive)
110 me->p_ship.s_nflags &= ~SFNCANWARP;
111 }
112
113
114 /*----------END OF FILE-----*/