--- deliantra/server/socket/request.C 2006/12/21 23:37:06 1.50 +++ deliantra/server/socket/request.C 2006/12/30 10:16:11 1.55 @@ -178,7 +178,7 @@ flags |= 8; snprintf (buf, MAX_BUF, "mapinfo - spatial %d %d %d %d %d %s", - flags, socket.mapx / 2 - ob->x, socket.mapy / 2 - ob->y, ob->map->width, ob->map->height, ob->map->path); + flags, socket.mapx / 2 - ob->x, socket.mapy / 2 - ob->y, ob->map->width, ob->map->height, &ob->map->path); } else snprintf (buf, MAX_BUF, "mapinfo current"); @@ -336,7 +336,7 @@ if (map->tile_path[3]) flags |= 8; - snprintf (bigbuf, MAX_BUF, "mapinfo %s spatial %d %d %d %d %d %s", token, flags, mapx, mapy, map->width, map->height, map->path); + snprintf (bigbuf, MAX_BUF, "mapinfo %s spatial %d %d %d %d %d %s", token, flags, mapx, mapy, map->width, map->height, &map->path); } else snprintf (bigbuf, MAX_BUF, "mapinfo %s nomap", token); @@ -401,10 +401,7 @@ safe_strcat (cmdback, param, &slen, HUGE_BUF); } else if (!strcmp (cmd, "exp64")) - { - ns->exp64 = atoi (param); - safe_strcat (cmdback, param, &slen, HUGE_BUF); - } + safe_strcat (cmdback, param, &slen, HUGE_BUF); else if (!strcmp (cmd, "spellmon")) { ns->monitor_spells = atoi (param); @@ -571,13 +568,7 @@ void AddMeCmd (char *buf, int len, client * ns) { - if (INVOKE_CLIENT (ADDME, ns)) - return; - - if (ns->pl || add_player (ns)) - ns->send_packet ("addme_failed"); - else - ns->send_packet ("addme_success"); + INVOKE_CLIENT (ADDME, ns, ARG_DATA (buf, len)); } /** Reply to ExtendedInfos command */ @@ -852,17 +843,6 @@ LOG (llevError, "Got reply message with ST_PLAYING input state\n"); break; - case ST_PLAY_AGAIN: - /* We can check this for return value (2==quit). Maybe we - * should, and do something appropriate? - */ - receive_play_again (pl->ob, buf[0]); - break; - - case ST_ROLL_STAT: - key_roll_stat (pl->ob, buf[0]); - break; - case ST_CHANGE_CLASS: key_change_class (pl->ob, buf[0]); break; @@ -871,20 +851,6 @@ key_confirm_quit (pl->ob, buf[0]); break; - case ST_CONFIGURE: - LOG (llevError, "In client input handling, but into configure state\n"); - ns->state = ST_PLAYING; - break; - - case ST_GET_NAME: - receive_player_name (pl->ob, 13); - break; - - case ST_GET_PASSWORD: - case ST_CONFIRM_PASSWORD: - receive_player_password (pl->ob, 13); - break; - case ST_GET_PARTY_PASSWORD: /* Get password for party */ receive_party_password (pl->ob, 13); break; @@ -1047,6 +1013,9 @@ char buf[MAX_BUF]; uint16 flags; + if (!pl->ns) + return; + packet sl ("stats"); if (pl->ob) @@ -1058,33 +1027,28 @@ AddIfShort (pl->last_stats.grace, pl->ob->stats.grace, CS_STAT_GRACE); AddIfShort (pl->last_stats.maxgrace, pl->ob->stats.maxgrace, CS_STAT_MAXGRACE); AddIfShort (pl->last_stats.Str, pl->ob->stats.Str, CS_STAT_STR); - AddIfShort (pl->last_stats.Int, pl->ob->stats.Int, CS_STAT_INT); - AddIfShort (pl->last_stats.Pow, pl->ob->stats.Pow, CS_STAT_POW); - AddIfShort (pl->last_stats.Wis, pl->ob->stats.Wis, CS_STAT_WIS); AddIfShort (pl->last_stats.Dex, pl->ob->stats.Dex, CS_STAT_DEX); AddIfShort (pl->last_stats.Con, pl->ob->stats.Con, CS_STAT_CON); + AddIfShort (pl->last_stats.Int, pl->ob->stats.Int, CS_STAT_INT); + AddIfShort (pl->last_stats.Wis, pl->ob->stats.Wis, CS_STAT_WIS); + AddIfShort (pl->last_stats.Pow, pl->ob->stats.Pow, CS_STAT_POW); AddIfShort (pl->last_stats.Cha, pl->ob->stats.Cha, CS_STAT_CHA); } - if (pl->ns->exp64) - for (int s = 0; s < NUM_SKILLS; s++) - if (pl->last_skill_ob[s] && pl->last_skill_exp[s] != pl->last_skill_ob[s]->stats.exp) - { - /* Always send along the level if exp changes. This is only - * 1 extra byte, but keeps processing simpler. - */ - sl << uint8 (s + CS_STAT_SKILLINFO) - << uint8 (pl->last_skill_ob[s]->level) - << uint64 (pl->last_skill_ob[s]->stats.exp); - - pl->last_skill_exp[s] = pl->last_skill_ob[s]->stats.exp; - } + for (int s = 0; s < NUM_SKILLS; s++) + if (pl->last_skill_ob[s] && pl->last_skill_exp[s] != pl->last_skill_ob[s]->stats.exp) + { + /* Always send along the level if exp changes. This is only + * 1 extra byte, but keeps processing simpler. + */ + sl << uint8 (s + CS_STAT_SKILLINFO) + << uint8 (pl->last_skill_ob[s]->level) + << uint64 (pl->last_skill_ob[s]->stats.exp); - if (pl->ns->exp64) - { AddIfInt64 (pl->last_stats.exp, pl->ob->stats.exp, CS_STAT_EXP64) } - else - { AddIfInt (pl->last_stats.exp, (int) pl->ob->stats.exp, CS_STAT_EXP) } + pl->last_skill_exp[s] = pl->last_skill_ob[s]->stats.exp; + } + AddIfInt64 (pl->last_stats.exp, pl->ob->stats.exp, CS_STAT_EXP64); AddIfShort (pl->last_level, (char) pl->ob->level, CS_STAT_LEVEL); AddIfShort (pl->last_stats.wc, pl->ob->stats.wc, CS_STAT_WC); AddIfShort (pl->last_stats.ac, pl->ob->stats.ac, CS_STAT_AC); @@ -1544,7 +1508,7 @@ /* If there is no object for this space, or if the face for the object * is the blank face, set the smoothlevel to zero. */ - if (!ob || ob->face == blank_face || MAP_NOSMOOTH (mp)) + if (!ob || ob->face == blank_face) smoothlevel = 0; else { @@ -2122,6 +2086,9 @@ void esrv_update_spells (player *pl) { + if (!pl->ns) + return; + if (!pl->ns->monitor_spells) return;