--- deliantra/server/socket/request.C 2007/05/01 05:48:21 1.93 +++ deliantra/server/socket/request.C 2007/05/22 10:50:01 1.99 @@ -1,5 +1,5 @@ /* - * CrossFire, A Multiplayer game for X-windows + * CrossFire, A Multiplayer game * * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team * Copyright (C) 2001 Mark Wedel @@ -732,28 +732,26 @@ * Get player's current range attack in obuf. */ static void -rangetostring (object *ob, char *obuf) +rangetostring (player *pl, char *obuf) { dynbuf_text buf; - player *pl = ob->contr; - if (pl->ranged_ob) - buf << " Range: " << pl->ranged_ob->name; + buf << " Range" << (pl->ob->current_weapon == pl->ranged_ob ? "*" : "") << ": " << pl->ranged_ob->name; if (pl->combat_ob) - buf << " Combat: " << pl->combat_ob->name; + buf << " Combat" << (pl->ob->current_weapon == pl->combat_ob ? "*" : "") << ": " << pl->combat_ob->name; + + //TODO: remove this when slot system is working, this is only for debugging + if (pl->ob->chosen_skill) + buf << " Skill*: " << pl->ob->chosen_skill->name; + //TODO: maybe golem should become the current_weapon, quite simply? if (pl->golem) - buf << " Golem: " << pl->golem->name; + buf << " Golem*: " << pl->golem->name; - if (buf.empty ()) - *obuf = 0; - else - { - memcpy (obuf, buf.linearise () + 1, buf.size () - 1); - obuf [buf.size ()] = 0; - } + buf.linearise (obuf); + obuf [buf.size ()] = 0; } #define AddIfInt64(Old,New,Type) if (Old != New) {\ @@ -771,9 +769,9 @@ sl << uint8 (Type) << uint16 (New); \ } -#define AddIfFloat(Old,New,Type) if (Old != New) {\ +#define AddIfFloat(Old,New,Type,mult) if (Old != New) {\ Old = New; \ - sl << uint8 (Type) << uint32 (New*FLOAT_MULTI); \ + sl << uint8 (Type) << uint32 (New*FLOAT_MULTI*mult); \ } #define AddIfString(Old,New,Type) if (Old == NULL || strcmp(Old,New)) {\ @@ -836,9 +834,9 @@ AddIfShort (ns->last_stats.wc, ob->stats.wc, CS_STAT_WC); AddIfShort (ns->last_stats.ac, ob->stats.ac, CS_STAT_AC); AddIfShort (ns->last_stats.dam, ob->stats.dam, CS_STAT_DAM); - AddIfFloat (ns->last_speed, ob->speed, CS_STAT_SPEED); + AddIfFloat (ns->last_speed, ob->speed, CS_STAT_SPEED, 1.f/TICK); AddIfShort (ns->last_stats.food, ob->stats.food, CS_STAT_FOOD); - AddIfFloat (ns->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP); + AddIfFloat (ns->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP, 1.f/TICK); AddIfInt (ns->last_weight_limit, weight_limit[ob->stats.Str], CS_STAT_WEIGHT_LIM); flags = 0; @@ -870,7 +868,7 @@ AddIfInt (ns->last_path_denied, ob->path_denied, CS_STAT_SPELL_DENY); } - rangetostring (ob, buf); /* we want use the new fire & run system in new client */ + rangetostring (pl, buf); /* we want use the new fire & run system in new client */ AddIfString (ns->stats.range, buf, CS_STAT_RANGE); set_title (ob, buf); AddIfString (ns->stats.title, buf, CS_STAT_TITLE);