--- deliantra/server/socket/info.C 2007/04/25 18:47:51 1.38 +++ deliantra/server/socket/info.C 2007/04/29 21:44:35 1.39 @@ -310,23 +310,14 @@ { switch (pl->contr->shoottype) { - case range_none: - strcpy (obuf, "Range: nothing"); - break; - case range_bow: - { - object *op; - - for (op = pl->inv; op; op = op->below) - if (op->type == BOW && QUERY_FLAG (op, FLAG_APPLIED)) - break; + for (object *op = pl->inv; op; op = op->below) + if (op->type == BOW && QUERY_FLAG (op, FLAG_APPLIED)) + { + sprintf (obuf, "Range: %s (%s)", query_base_name (op, 0), op->race ? &op->race : "nothing"); + return; + } - if (op == NULL) - break; - - sprintf (obuf, "Range: %s (%s)", query_base_name (op, 0), op->race ? (const char *) op->race : "nothing"); - } break; case range_magic: @@ -335,19 +326,25 @@ if (pl->casting_time > -1) { if (pl->casting_time == 0) - sprintf (obuf, "Range: Holding spell (%s)", &pl->spell->name); + sprintf (obuf, "Holding spell: %s", &pl->spell->name); else - sprintf (obuf, "Range: Casting spell (%s)", &pl->spell->name); + sprintf (obuf, "Casting spell: %s", &pl->spell->name); } else - sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name); + sprintf (obuf, "Spell: %s", &pl->contr->ranges[range_magic]->name); } else - sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name); - break; + sprintf (obuf, "Spell: %s", &pl->contr->ranges[range_magic]->name); + + return; case range_misc: - sprintf (obuf, "Range: %s", pl->contr->ranges[range_misc] ? query_base_name (pl->contr->ranges[range_misc], 0) : "none"); + if (object *op = pl->contr->ranges[range_misc]) + { + sprintf (obuf, "Item: %s", query_base_name (op, 0)); + return; + } + break; /* range_scroll is only used for controlling golems. If the @@ -355,25 +352,29 @@ */ case range_golem: if (object *golem = pl->contr->ranges[range_golem]) - sprintf (obuf, "Range: golem (%s)", &golem->name); - else { - pl->contr->shoottype = range_none; - strcpy (obuf, "Range: nothing"); + sprintf (obuf, "Golem: %s", &golem->name); + return; } + break; case range_skill: - sprintf (obuf, "Skill: %s", pl->chosen_skill != NULL ? (const char *) pl->chosen_skill->name : "none"); + if (object *op = pl->chosen_skill) + { + sprintf (obuf, "Skill: %s", &op->name); + return; + } + break; case range_builder: sprintf (obuf, "Builder: %s", query_base_name (pl->contr->ranges[range_builder], 0)); - break; - - default: - strcpy (obuf, "Range: illegal"); + return; } + + pl->contr->shoottype = range_none; + strcpy (obuf, "Range: nothing"); } /**