Skip to content

MSG_DO_WEAPON_AT_LOCATION sends unused ObjectID argument. #3410

Open

Description

@Ui-shigure-z

Here's all 3 location it sends extra argument:

// create the message and append arguments
msg = TheMessageStream->appendMessage( GameMessage::MSG_DO_WEAPON_AT_LOCATION );
msg->appendIntegerArgument( command->getWeaponSlot() );
msg->appendLocationArgument( world );
msg->appendIntegerArgument( command->getMaxShotsToFire() );
//Also append the object ID (incase weapon doesn't like obstacles on land).
Object *target = validUnderCursor( mouse, command, PICK_TYPE_SELECTABLE );
ObjectID targetID = target ? target->getID() : INVALID_ID;
msg->appendObjectIDArgument( targetID );

//Actually, you know what.... we want to attack the object's location instead.
msgType = GameMessage::MSG_DO_WEAPON_AT_LOCATION;
if( commandType == DO_COMMAND )
{
GameMessage *msg;
msg = TheMessageStream->appendMessage( msgType );
msg->appendIntegerArgument( command->getWeaponSlot() );
msg->appendLocationArgument( *pos );
msg->appendIntegerArgument( command->getMaxShotsToFire() );
//Object in way.... some location weapons care, others don't
ObjectID targetID = (target && target->getObject()) ? target->getObject()->getID() : INVALID_ID;
msg->appendObjectIDArgument( targetID );
}

//LOCATION BASED FIRE WEAPON
msgType = GameMessage::MSG_DO_WEAPON_AT_LOCATION;
if( commandType == DO_COMMAND )
{
GameMessage *msg;
msg = TheMessageStream->appendMessage( msgType );
msg->appendIntegerArgument( command->getWeaponSlot() );
msg->appendLocationArgument( *pos );
msg->appendIntegerArgument( command->getMaxShotsToFire() );
//Object in way.... some location weapons care, others don't
ObjectID targetID = (target && target->getObject()) ? target->getObject()->getID() : INVALID_ID;
msg->appendObjectIDArgument( targetID );
}

Where the message is processed:

bool GameLogic::onDoWeaponAtLocation(MAYBE_UNUSED GameMessage *msg, AIGroupPtr &currentlySelectedGroup)
{
WeaponSlotType weaponSlot = (WeaponSlotType)msg->getArgument( 0 )->integer;
Coord3D targetLoc = msg->getArgument( 1 )->location;
Int maxShotsToFire = msg->getArgument( 2 )->integer;
// issue command for either single object or for selected group
if( currentlySelectedGroup )
{
// lock it just till the weapon is empty or the attack is "done"
if (currentlySelectedGroup->setWeaponLockForGroup( weaponSlot, LOCKED_TEMPORARILY ))
currentlySelectedGroup->groupAttackPosition( &targetLoc, maxShotsToFire, CMD_FROM_PLAYER );
}
return true;
}

Looks harmless.

Activity

  1. added theissue type on Oct 3, 2026
  2. Caball009 commented on Oct 3, 2026

    @Caball009

    Similar to #2762.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions