udp_send:: Invalid argument, error fixed. net_delplayer_send had a problem with the local second player

origin
stpohle 21 years ago
parent b009022799
commit 04b94954cb

@ -1,4 +1,4 @@
$Id: ChangeLog,v 1.80 2004/09/13 22:18:28 stpohle Exp $
$Id: ChangeLog,v 1.81 2004/09/23 13:19:57 stpohle Exp $
* NEED TO FIX: Server starts the game soo fast that the
client's ignore the gamestat for a running game.
@ -6,6 +6,16 @@ $Id: ChangeLog,v 1.80 2004/09/13 22:18:28 stpohle Exp $
* FINISH TEAM MODE.
2004-09-23
- changed: Playermenu (F2 in the Playerselection screen).
You will see some details about the other players and
you can go to the teammenu from here.
- fixed: udp_send:: Invalid argument Error Message
net_game_send_delplayer had a problem with the second
local player.
2004-09-13
- changed: Chat Mode will always keep active if there is

@ -1,4 +1,4 @@
/* $Id: single.h,v 1.3 2004/06/08 22:35:24 stpohle Exp $
/* $Id: single.h,v 1.4 2004/09/23 13:21:44 stpohle Exp $
* single player */
// single.c
@ -14,6 +14,6 @@ extern inline int ai_checkpos (_player * pl, _point * pos);
extern int ai_findnearbombs (_point pos);
extern int ai_findbestbombdir (_point pos, int dir, int range);
extern int ai_bombpoints (_point pos, int range);
extern _airunaway ai_runawayfrom (_point p, int nearbomb, signed char norecursive);
extern _airunaway ai_runawayfrom (_point p, int nearbomb, int range, signed char norecursive);
extern int ai_checkfield (int x, int y);
extern int ai_easyrunaway (_point p);
extern int ai_easyrunaway (_point p, int range);

@ -1,4 +1,4 @@
/* $Id: single.c,v 1.69 2004/09/12 21:35:32 stpohle Exp $ */
/* $Id: single.c,v 1.70 2004/09/23 13:21:44 stpohle Exp $ */
/* single player */
#include "basic.h"
@ -51,9 +51,10 @@ ai_checkfield (int x, int y)
* this function is even needed for the start of
* the game to place the players on a good position */
int
ai_easyrunaway (_point p)
ai_easyrunaway (_point p, int range)
{
int i,
dist = 0,
done = 0,
dir = 0;
_point pos[4],
@ -86,7 +87,7 @@ ai_easyrunaway (_point p)
/* test the possible ways */
while (!done) {
done = 1;
dist++;
for (i = 0; i < 4; i++) {
/* check if we are still in the game field */
if (pos[i].x <= 0 || pos[i].y <= 0 || pos[i].x >= map.size.x - 1
@ -112,6 +113,7 @@ ai_easyrunaway (_point p)
}
pos[i].x += m[i].x;
pos[i].y += m[i].y;
if (dist > range) dir |= (1 << i);
}
}
}
@ -124,7 +126,7 @@ ai_easyrunaway (_point p)
/* give the run away direction
the return value: */
_airunaway
ai_runawayfrom (_point p, int nearbomb, signed char norecursive)
ai_runawayfrom (_point p, int nearbomb, int range, signed char norecursive)
{
int i,
done = 0,
@ -133,7 +135,8 @@ ai_runawayfrom (_point p, int nearbomb, signed char norecursive)
_i,
bdirpoints = 10,
j,
c;
c,
dist = 0;
_airunaway res;
_point pos[4],
m[4],
@ -178,7 +181,7 @@ ai_runawayfrom (_point p, int nearbomb, signed char norecursive)
/* test the possible ways */
while (!done) {
done = 1;
dist++;
for (i = 0; i < 4; i++) {
/* check if we are still in the game field */
if (pos[i].x <= 0 || pos[i].y <= 0 || pos[i].x >= map.size.x - 1
@ -200,7 +203,7 @@ ai_runawayfrom (_point p, int nearbomb, signed char norecursive)
nbomb = ai_findnearbombs (tpos);
c = s_countbits (nbomb, 5);
if (!norecursive) {
tdir = ai_runawayfrom (tpos, nbomb, 1).dir;
tdir = ai_runawayfrom (tpos, nbomb, range, 1).dir;
_i = ai_invertdir (i);
if (tdir != (1 << _i)) { // usefull direction
res.dir |= (1 << i); // add this one
@ -226,6 +229,10 @@ ai_runawayfrom (_point p, int nearbomb, signed char norecursive)
}
pos[i].x += m[i].x;
pos[i].y += m[i].y;
if (dist > range && res.bestdir == -1) {
res.dir |= (1 << i);
res.bestdir = i;
}
}
}
}
@ -287,7 +294,7 @@ ai_bombpoints (_point pos, int range)
}
}
if (ai_easyrunaway (pos) == 0 || ai_findnearbombs (pos) != 0)
if (ai_easyrunaway (pos, range) == 0 || ai_findnearbombs (pos) != 0)
points = 0;
return points;
@ -682,7 +689,7 @@ single_loop ()
if (nearbomb == 0) { // no bombs found
bestbdir = ai_findbestbombdir (plpos, pl->d, pl->range);
if (bestbdir & DIRM_under) {
if (ai_easyrunaway (plpos) != 0)
if (ai_easyrunaway (plpos, pl->range) != 0)
player_drop_bomb (p);
}
else if (bestbdir == 0) {
@ -698,7 +705,7 @@ single_loop ()
}
else {
// bombs in the near found
rawdir = ai_runawayfrom (plpos, nearbomb, 0);
rawdir = ai_runawayfrom (plpos, nearbomb, pl->range, 0);
if (rawdir.dir != 0 && rawdir.bestdir == -1) {
pl->d = ai_choosedir (rawdir.dir, nearbomb, pl->d); // we have to make a choice.. do it
pl->m = 1;
@ -706,7 +713,11 @@ single_loop ()
else if (rawdir.bestdir != -1) {
pl->d = rawdir.bestdir;
pl->m = 1;
}
}
else if (rawdir.bestdir == -1 && rawdir.dir == 0) {
/* no good ways found, just run in the opposite direction of the bomb */
// ERRORRRRRRRRR;
}
}
if (pl->m == 0 && map.field[(int) pl->pos.x][(int) pl->pos.y].type == FT_tunnel)

Loading…
Cancel
Save