1 | /* |
1 | /* |
2 | * CrossFire, A Multiplayer game |
2 | * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game. |
3 | * |
3 | * |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
5 | * Copyright (C) 2001 Mark Wedel |
5 | * Copyright (©) 2001,2007 Mark Wedel |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * Crossfire TRT is free software; you can redistribute it and/or modify it |
9 | * it under the terms of the GNU General Public License as published by |
9 | * under the terms of the GNU General Public License as published by the Free |
10 | * the Free Software Foundation; either version 2 of the License, or |
10 | * Software Foundation; either version 2 of the License, or (at your option) |
11 | * (at your option) any later version. |
11 | * any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, but |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
16 | * GNU General Public License for more details. |
16 | * for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License along |
19 | * along with this program; if not, write to the Free Software |
19 | * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
21 | * |
21 | * |
22 | * The author can be reached via e-mail to <crossfire@schmorp.de> |
22 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
23 | */ |
23 | */ |
24 | |
24 | |
25 | /** |
25 | /** |
26 | * \file |
26 | * \file |
27 | * Client handling. |
27 | * Client handling. |
… | |
… | |
740 | buf << " Range" << (pl->ob->current_weapon == pl->ranged_ob ? "*" : "") << ": " << pl->ranged_ob->name; |
740 | buf << " Range" << (pl->ob->current_weapon == pl->ranged_ob ? "*" : "") << ": " << pl->ranged_ob->name; |
741 | |
741 | |
742 | if (pl->combat_ob) |
742 | if (pl->combat_ob) |
743 | buf << " Combat" << (pl->ob->current_weapon == pl->combat_ob ? "*" : "") << ": " << pl->combat_ob->name; |
743 | buf << " Combat" << (pl->ob->current_weapon == pl->combat_ob ? "*" : "") << ": " << pl->combat_ob->name; |
744 | |
744 | |
|
|
745 | //TODO: remove this when slot system is working, this is only for debugging |
|
|
746 | if (pl->ob->chosen_skill) |
|
|
747 | buf << " Skill*: " << pl->ob->chosen_skill->name; |
|
|
748 | |
745 | //TODO: maybe golem should become the current_weapon, quite simply? |
749 | //TODO: maybe golem should become the current_weapon, quite simply? |
746 | if (pl->golem) |
750 | if (pl->golem) |
747 | buf << " Golem*: " << pl->golem->name; |
751 | buf << " Golem*: " << pl->golem->name; |
748 | |
752 | |
749 | buf.linearise (obuf); |
753 | buf.linearise (obuf); |
… | |
… | |
763 | #define AddIfShort(Old,New,Type) if (Old != New) {\ |
767 | #define AddIfShort(Old,New,Type) if (Old != New) {\ |
764 | Old = New; \ |
768 | Old = New; \ |
765 | sl << uint8 (Type) << uint16 (New); \ |
769 | sl << uint8 (Type) << uint16 (New); \ |
766 | } |
770 | } |
767 | |
771 | |
768 | #define AddIfFloat(Old,New,Type) if (Old != New) {\ |
772 | #define AddIfFloat(Old,New,Type,mult) if (Old != New) {\ |
769 | Old = New; \ |
773 | Old = New; \ |
770 | sl << uint8 (Type) << uint32 (New*FLOAT_MULTI); \ |
774 | sl << uint8 (Type) << uint32 (New*FLOAT_MULTI*mult); \ |
771 | } |
775 | } |
772 | |
776 | |
773 | #define AddIfString(Old,New,Type) if (Old == NULL || strcmp(Old,New)) {\ |
777 | #define AddIfString(Old,New,Type) if (Old == NULL || strcmp(Old,New)) {\ |
774 | free(Old); Old = strdup (New);\ |
778 | free(Old); Old = strdup (New);\ |
775 | sl << uint8 (Type) << data8 (New); \ |
779 | sl << uint8 (Type) << data8 (New); \ |
… | |
… | |
828 | AddIfInt64 (ns->last_stats.exp, ob->stats.exp, CS_STAT_EXP64); |
832 | AddIfInt64 (ns->last_stats.exp, ob->stats.exp, CS_STAT_EXP64); |
829 | AddIfShort (ns->last_level, ob->level, CS_STAT_LEVEL); |
833 | AddIfShort (ns->last_level, ob->level, CS_STAT_LEVEL); |
830 | AddIfShort (ns->last_stats.wc, ob->stats.wc, CS_STAT_WC); |
834 | AddIfShort (ns->last_stats.wc, ob->stats.wc, CS_STAT_WC); |
831 | AddIfShort (ns->last_stats.ac, ob->stats.ac, CS_STAT_AC); |
835 | AddIfShort (ns->last_stats.ac, ob->stats.ac, CS_STAT_AC); |
832 | AddIfShort (ns->last_stats.dam, ob->stats.dam, CS_STAT_DAM); |
836 | AddIfShort (ns->last_stats.dam, ob->stats.dam, CS_STAT_DAM); |
833 | AddIfFloat (ns->last_speed, ob->speed, CS_STAT_SPEED); |
837 | AddIfFloat (ns->last_speed, ob->speed, CS_STAT_SPEED, 1.f/TICK); |
834 | AddIfShort (ns->last_stats.food, ob->stats.food, CS_STAT_FOOD); |
838 | AddIfShort (ns->last_stats.food, ob->stats.food, CS_STAT_FOOD); |
835 | AddIfFloat (ns->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP); |
839 | AddIfFloat (ns->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP, 1.f/TICK); |
836 | AddIfInt (ns->last_weight_limit, weight_limit[ob->stats.Str], CS_STAT_WEIGHT_LIM); |
840 | AddIfInt (ns->last_weight_limit, weight_limit[ob->stats.Str], CS_STAT_WEIGHT_LIM); |
837 | |
841 | |
838 | flags = 0; |
842 | flags = 0; |
839 | |
843 | |
840 | if (pl->fire_on) |
844 | if (pl->fire_on) |