Author Topic: a little inconsistency with combat messages  (Read 753 times)

Ginga

  • Traveller
  • *
  • Posts: 17
    • View Profile
a little inconsistency with combat messages
« on: December 03, 2004, 02:51:45 am »
hi,

I\'ve found a little inconsistency with the locations of hits in combats. in src/common/net/messages.h:

--------------------------------------------------------------
/**
 * Messages sent from server to client containing each detailed
 * combat event.
 */
class psCombatEventMessage : public psMessageCracker
{
public:
    int        event_type;
    uint32_t   attacker_id;
    uint32_t   target_id;
   uint32_t   target_location; // Where on the target the attack hit/miss
--------------------------------------------------------------

the target location (note: unsigned int) seems related to src/common/util/slots.h:

--------------------------------------------------------------
/** Holds a list of the possible socket identifiers that items can be attached to.
 */
enum EQUIPMENT_SLOTS
{
   PSCHARACTER_SLOT_NONE = -1,
    PSCHARACTER_SLOT_RIGHTHAND = 0,
    PSCHARACTER_SLOT_LEFTHAND = 1,
    ...
    PSCHARACTER_SLOT_COUNT = 16
};
--------------------------------------------------------------

then in src/server/combatmanager.cpp:

--------------------------------------------------------------
void psCombatManager::HandleDeathEvent(MsgEntry *me)
{
    CPrintf(CON_DEBUG, \"Combat Manager handling Death Event\\n\");
    psDeathEvent death(me);

    // Send out the notification of death, which plays the anim, etc.
    psCombatEventMessage die(death.deadActor->GetClientID(),
                                psCombatEventMessage::COMBAT_DEATH,
                                (death.killer)?death.killer->GetEntity()->GetID():0,
                                death.deadActor->GetEntity()->GetID(),
                                -1, // no target location
                                0,  // no dmg on a death
                                -1,  // TODO: \"killing blow\" matrix of mob-types vs. weapon types
                                death.deadActor->FindAnimIndex(\"death\") ); // Death anim on client side is handled by the death mode message

    die.Multicast(death.deadActor->GetMulticastClients(),0,0);
}
--------------------------------------------------------------

the compiler gives a warning because this function pass -1 to an int, and so the value really stored it\'s MAX-UNSIGNED-INTEGER for each particular architecture.

so I guess that in this particular message it\'s not a problem because the server will report that the player is dead and no special information about where the player got hit; but anyway I think that the right thing to do is to use int instead of unsigned integer (in the first chunk of code that I pasted).

acraig

  • Administrator
  • Veteran
  • *
  • Posts: 1562
    • View Profile
(No subject)
« Reply #1 on: December 03, 2004, 03:33:42 am »
Fixed in CVS
----------
Andrew
"For all I know, she's lying, everyone's lying; welcome to the Internet"