Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 6, 2018, 6:07:53 PM (7 years ago)
Author:
landauf
Message:

[HUD_HS16] fixed issue that the hud shows pickups of ALL players/bots instead of just the own spaceship. fixed this by comparing objectIDs
note: network calls currently support only 5 arguments, so I removed representationObjectId which doesn't seem to be used (neither in C++ nor in Lua)

Location:
code/trunk/src/modules/pickup
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/pickup/PickupManager.cc

    r11704 r11708  
    301301        if(GameMode::isStandalone() || Host::getPlayerID() == clientId)
    302302        {
    303             // If there is no PickupRepresentation registered the default representation is used.
    304             if(this->representations_.find(pickup->getRepresentationName()) == this->representations_.end())
    305                 PickupManager::pickupChangedPickedUpNetwork(index, pickup->isUsable(), this->defaultRepresentation_->getObjectID(), pickup->getRepresentationName(), pickedUp);
    306             else
    307                 PickupManager::pickupChangedPickedUpNetwork(index, pickup->isUsable(), this->representations_[pickup->getRepresentationName()]->getObjectID(), pickup->getRepresentationName(), pickedUp);
     303            PickupManager::pickupChangedPickedUpNetwork(index, pickup->isUsable(), pickup->getRepresentationName(), pickedUp, pawn->getObjectID());
    308304        }
    309305        // If the concerned host is somewhere in the network, we call pickupChangedPickedUpNetwork() on its PickupManager.
    310306        else
    311307        {
    312             // If there is no PickupRepresentation registered the default representation is used.
    313             if(this->representations_.find(pickup->getRepresentationName()) == this->representations_.end())
    314             {
    315                 callStaticNetworkFunction(&PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->defaultRepresentation_->getObjectID(), pickedUp);
    316             }
    317             else
    318             {
    319                 callStaticNetworkFunction(&PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->representations_[pickup->getRepresentationName()]->getObjectID(), pickedUp);
    320             }
     308            callStaticNetworkFunction(&PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), pickedUp, pawn->getObjectID());
    321309        }
    322310
     
    332320    @param usable
    333321        Whether the Pickupable's used status can be changed to used in the PickupInventory.
    334     @param representationObjectId
    335         The objectId identifying (over the network) the PickupRepresentation that represents this Pickupable.
    336322    @param representationName
    337323        The name of the associated PickupRepresentation
    338324    @param pickedUp
    339325        The pickedUp status the Pickupable changed to.
    340     */
    341     /*static*/ void PickupManager::pickupChangedPickedUpNetwork(uint32_t pickup, bool usable, uint32_t representationObjectId, const std::string& representationName, bool pickedUp)
     326    @param carrierPawnId
     327        The objectId identifier (over the network) the Pawn that carries this Pickupable
     328    */
     329    /*static*/ void PickupManager::pickupChangedPickedUpNetwork(uint32_t pickup, bool usable, const std::string& representationName, bool pickedUp, uint32_t carrierPawnId)
    342330    {
    343331        PickupManager& manager = PickupManager::getInstance(); // Get the PickupManager singleton on this host.
     
    352340            container->usable = usable;
    353341            container->unusable = false;
    354             container->representationObjectId = representationObjectId;
    355342            container->representationName = representationName;
     343            container->carrierPawnId = carrierPawnId;
    356344            // Insert the container into the pickupInventoryContainers_ list.
    357345            manager.pickupInventoryContainers_.insert(std::pair<uint32_t, PickupInventoryContainer*>(pickup, container));
  • code/trunk/src/modules/pickup/PickupManager.h

    r11704 r11708  
    6464        bool usable; //!< Whether the @ref orxonox::Pickupable "Pickupable" is usable.
    6565        bool unusable; //!< Whether the @ref orxonox::Pickupable "Pickupable" is droppable.
    66         uint32_t representationObjectId; //!< The objectId of the @ref orxonox::PickupRepresentation "PickupRepresentation" that represents the @ref orxonox::Pickupable "Pickupable".
    6766        std::string representationName; //!< The name of the associated PickupRepresentation
     67        uint32_t carrierPawnId; //!< The objectId of the @ref orxonox::Pawn "Pawn" that carries the @ref orxonox::Pickupable "Pickupable".
    6868    };
    6969    // tolua_end
     
    120120            static void pickupChangedUsedNetwork(uint32_t pickup, bool inUse, bool usable, bool unusable); //!< Helper method to react to the change in the used status of a Pickupable.
    121121            virtual void pickupChangedPickedUp(Pickupable* pickup, bool pickedUp) override; //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input pickedUp state.
    122             static void pickupChangedPickedUpNetwork(uint32_t pickup, bool usable, uint32_t representationObjectId, const std::string& representationName, bool pickedUp); //!< Helper method to react to the change in the pickedUp status of a Pickupable.
     122            static void pickupChangedPickedUpNetwork(uint32_t pickup, bool usable, const std::string& representationName, bool pickedUp, uint32_t carrierPawnId); //!< Helper method to react to the change in the pickedUp status of a Pickupable.
    123123
    124124        // Methods to be used by the PickupInventory.
  • code/trunk/src/modules/pickup/PickupPrereqs.h

    r11052 r11708  
    7272    class Pickup;
    7373    class PickupCollection;
     74    class PickupInventoryContainer;
    7475    class PickupManager;
    7576    class PickupRepresentation;
Note: See TracChangeset for help on using the changeset viewer.