Skip to content

Commit

Permalink
fix bug in initial updates for clients
Browse files Browse the repository at this point in the history
Some objects rarely or never update (e.g. nebula).  There is an optimization
that far-away objects sometimes skip updates.  When a client first connects, if
he misses the initial update for a nebula or other such object due to this
optimization, he will never get an update for that object and will not know it
even exists.  Do not do this far-away-update-skip optimization for clients that
just joined.
  • Loading branch information
smcameron committed Jul 2, 2013
1 parent 2a32dd2 commit b17da8d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions snis_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -3003,6 +3003,10 @@ static int too_far_away_to_care(struct game_client *c, struct snis_entity *o)
double dx, dy, dist;
const double threshold = (XKNOWN_DIM / 2) * (XKNOWN_DIM / 2);

/* do not optimize updates for brand new clients, they need everything. */
if (c->timestamp == 0)
return 0;

dx = (ship->x - o->x);
dy = (ship->y - o->y);
dist = (dx * dx) + (dy * dy);
Expand Down

0 comments on commit b17da8d

Please sign in to comment.