| 1040 | } |
| 1041 | |
| 1042 | playerent *newclient(int cn) // ensure valid entity |
| 1043 | { |
| 1044 | if(cn<0 || cn>=MAXCLIENTS) |
| 1045 | { |
| 1046 | neterr("clientnum"); |
| 1047 | return NULL; |
| 1048 | } |
| 1049 | while(cn>=players.length()) players.add(NULL); |
| 1050 | playerent *d = players[cn]; |
| 1051 | if(d) return d; |
| 1052 | d = newplayerent(); |
| 1053 | players[cn] = d; |
| 1054 | d->clientnum = cn; |
| 1055 | return d; |
| 1056 | } |
| 1057 | |
| 1058 | playerent *getclient(int cn) // ensure valid entity |
| 1059 | { |
no test coverage detected