--- deliantra/server/include/player.h 2008/09/25 22:58:13 1.84 +++ deliantra/server/include/player.h 2008/12/27 08:01:07 1.89 @@ -166,9 +166,29 @@ /* Special DM fields */ tag_t *stack_items; /* Item stack for patch/dump/... commands */ int ACC (RW, stack_position); /* Current stack position, 0 for no item */ - sint8 blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]; /* array showing what spaces */ - /* the player can see. For maps smaller than */ - /* MAP_CLIENT_.., the upper left is used */ + sint8 los[MAP_CLIENT_X][MAP_CLIENT_Y]; /* array showing what spaces */ + /* the player can see. For maps smaller than */ + /* MAP_CLIENT_.., the center is used */ + + // return the los value for the given coordinate + MTH sint8 blocked_los (int dx, int dy) const + { + dx += LOS_X0; + dy += LOS_Y0; + + return 0 <= dx && dx < MAP_CLIENT_X + && 0 <= dy && dy < MAP_CLIENT_Y + ? los[dx][dy] : LOS_BLOCKED; + } + + // unchecked variant + sint8 blocked_los_uc (int dx, int dy) const + { + return los[dx + LOS_X0][dy + LOS_Y0]; + } + + MTH void clear_los (sint8 value = LOS_BLOCKED); + MTH void update_los (); shstr ACC (RW, invis_race); /* What race invisible to? */ @@ -201,8 +221,8 @@ } // wether the player can "see" this mapspace or not, decided by los - // 0 - nothing see, 100 - fully visible - MTH sint8 visibility_at (maptile *map, int x, int y) const; + // 0 - bright, 3 dark, 4 too dark, 100 blocked or out of range + MTH sint8 darkness_at (maptile *map, int x, int y) const; MTH void connect (client *ns); MTH void disconnect (); @@ -249,6 +269,10 @@ for (unsigned _i = 0; _i < ::players.size (); ++_i) \ statementvar (player *, var, ::players [_i]) +#define for_all_players_on_map(var,mapp) \ + for_all_players(var) \ + if ((var)->ob->map == (mapp)) + inline void object::statusmsg (const char *msg, int color) {