Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 25, 2015, 5:37:15 PM (10 years ago)
Author:
landauf
Message:

callStaticNetworkFunction() and callMemberNetworkFunction() are now template functions instead of macros.
simplified function call interface: always pass five MultiType-references. Check if MultiType.null() evaluates to true to see if the argument was defined.
moved references to NetworkFunctionManager to NetworkFunctionIncludes.cc.
this also fixed a linker error in MSVC by including NetworkFunctionIncludes.h in a build-unit inside the network library.

Location:
code/branches/core7/src/orxonox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/orxonox/Test.cc

    r10465 r10478  
    105105  void Test::call(unsigned int clientID)
    106106    {
    107         callStaticNetworkFunction( &Test::printV1, clientID );
    108         callStaticNetworkFunction( &Test::printV1, clientID );
     107        callStaticNetworkFunction(&Test::printV1, clientID );
     108        callStaticNetworkFunction(&Test::printV1, clientID );
    109109    }
    110110
    111111    void Test::call2(unsigned int clientID, std::string s1, std::string s2, std::string s3, std::string s4)
    112112    {
    113         callMemberNetworkFunction( Test, printBlaBla, this->getObjectID(), clientID, s1, s2, s3, s4, s4 );
     113        callMemberNetworkFunction( &Test::printBlaBla, this->getObjectID(), clientID, s1, s2, s3, s4, s4 );
    114114    }
    115115
     
    130130    //     if(!Core::isMaster())
    131131    //       call2(0, "bal", "a", "n", "ce");
    132     //       callMemberNetworkFunction( Test, checkU1, this->getObjectID(), 0 );
     132    //       callMemberNetworkFunction( &Test::checkU1, this->getObjectID(), 0 );
    133133    }
    134134
  • code/branches/core7/src/orxonox/infos/GametypeInfo.cc

    r10465 r10478  
    369369                this->changedReadyToSpawn(ready);
    370370            else
    371                 callMemberNetworkFunction(GametypeInfo, changedReadyToSpawn, this->getObjectID(), player->getClientID(), ready);
     371                callMemberNetworkFunction(&GametypeInfo::changedReadyToSpawn, this->getObjectID(), player->getClientID(), ready);
    372372        }
    373373    }
     
    388388                    this->changedSpawned(spawned);
    389389            else
    390                 callMemberNetworkFunction(GametypeInfo, changedSpawned, this->getObjectID(), player->getClientID(), spawned);
     390                callMemberNetworkFunction(&GametypeInfo::changedSpawned, this->getObjectID(), player->getClientID(), spawned);
    391391        }
    392392    }
     
    399399        if (GameMode::isMaster())
    400400        {
    401             callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), NETWORK_PEER_ID_BROADCAST, message);
     401            callMemberNetworkFunction(&GametypeInfo::dispatchAnnounceMessage, this->getObjectID(), NETWORK_PEER_ID_BROADCAST, message);
    402402            this->dispatchAnnounceMessage(message);
    403403        }
     
    411411                this->dispatchAnnounceMessage(message);
    412412            else
    413                 callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), clientID, message);
     413                callMemberNetworkFunction(&GametypeInfo::dispatchAnnounceMessage, this->getObjectID(), clientID, message);
    414414        }
    415415    }
     
    422422                this->dispatchKillMessage(message);
    423423            else
    424                 callMemberNetworkFunction(GametypeInfo, dispatchKillMessage, this->getObjectID(), clientID, message);
     424                callMemberNetworkFunction(&GametypeInfo::dispatchKillMessage, this->getObjectID(), clientID, message);
    425425        }
    426426    }
     
    433433                this->dispatchDeathMessage(message);
    434434            else
    435                 callMemberNetworkFunction(GametypeInfo, dispatchDeathMessage, this->getObjectID(), clientID, message);
     435                callMemberNetworkFunction(&GametypeInfo::dispatchDeathMessage, this->getObjectID(), clientID, message);
    436436        }
    437437    }
     
    444444                this->dispatchStaticMessage(message, colour);
    445445            else
    446                 callMemberNetworkFunction(GametypeInfo, dispatchStaticMessage, this->getObjectID(), clientID, message, colour);
     446                callMemberNetworkFunction(&GametypeInfo::dispatchStaticMessage, this->getObjectID(), clientID, message, colour);
    447447        }
    448448    }
     
    455455                this->dispatchFadingMessage(message);
    456456            else
    457                 callMemberNetworkFunction(GametypeInfo, dispatchFadingMessage, this->getObjectID(), clientID, message);
     457                callMemberNetworkFunction(&GametypeInfo::dispatchFadingMessage, this->getObjectID(), clientID, message);
    458458        }
    459459    }
  • code/branches/core7/src/orxonox/interfaces/NotificationListener.cc

    r10465 r10478  
    8484        else if(GameMode::isServer() && sendMode == notificationSendMode::network && Host::getPlayerID() != clientId)
    8585        {
    86             callStaticNetworkFunction(NotificationListener::sendHelper, clientId, message, sender, isCommand, (unsigned int)messageType);
     86            callStaticNetworkFunction(&NotificationListener::sendHelper, clientId, message, sender, isCommand, (unsigned int)messageType);
    8787        }
    8888        else if(GameMode::isServer() && sendMode == notificationSendMode::broadcast)
    8989        {
    9090            // TODO: Works as intended?
    91             callStaticNetworkFunction(NotificationListener::sendHelper, NETWORK_PEER_ID_BROADCAST, message, sender, isCommand, (unsigned int)messageType);
     91            callStaticNetworkFunction(&NotificationListener::sendHelper, NETWORK_PEER_ID_BROADCAST, message, sender, isCommand, (unsigned int)messageType);
    9292        }
    9393    }
  • code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc

    r10465 r10478  
    307307        else
    308308        {
    309             callMemberNetworkFunction(ControllableEntity, fire, this->getObjectID(), 0, firemode);
     309            callMemberNetworkFunction(&ControllableEntity::fire, this->getObjectID(), 0, firemode);
    310310        }
    311311    }
     
    323323            if ( target != 0 )
    324324            {
    325                 callMemberNetworkFunction(ControllableEntity, setTargetInternal, this->getObjectID(), 0, target->getObjectID() );
     325                callMemberNetworkFunction(&ControllableEntity::setTargetInternal, this->getObjectID(), 0, target->getObjectID() );
    326326            }
    327327           else
    328328           {
    329                 callMemberNetworkFunction(ControllableEntity, setTargetInternal, this->getObjectID(), 0, OBJECTID_UNKNOWN );
     329                callMemberNetworkFunction(&ControllableEntity::setTargetInternal, this->getObjectID(), 0, OBJECTID_UNKNOWN );
    330330           }
    331331        }
Note: See TracChangeset for help on using the changeset viewer.