Announcement

Collapse
No announcement yet.

Curius thing.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Curius thing.

    Because I could not continue with successfully any tutorial, I stated investigating UT scripts. When I reached function Killed, I saw this:

    Code:
    if ( bEnemyKill )
    			{
    				V = UTVehicle(KilledPawn); // <--- redundant line???
    
    				if ( !bFirstBlood )
    				{
    					bFirstBlood = True;
    					BroadcastLocalizedMessage( class'UTFirstBloodMessage', 0, KillerPRI );
    					KillerPRI.IncrementEventStat('EVENT_FIRSTBLOOD');
    				}
    			}
    I commented V = UTVehic... with redundant line because I think it does nothing. Am I wrong?
    Shouldn't it be removed in next release?
    You can find that line at 641 at UTGame.uc.

    #2
    The answer is in the original UT3 source code:
    Code:
    if ( bEnemyKill )
    {
    	V = UTVehicle(KilledPawn);
    	if ( KilledPRI.IsHero() )
    	{
    		KillerPRI.IncrementHeroMeter(6.0, UTDamageType);
    	}
    	if ( (V != None) && (V.HeroBonus > 0) )
    	{
    		KillerPRI.IncrementHeroMeter(V.HeroBonus, UTDamageType);
    	}
    
    	if ( !bFirstBlood )
    	{
    		bFirstBlood = True;
    		KillerPRI.IncrementHeroMeter(1.0, UTDamageType);
    		BroadcastLocalizedMessage( class'UTFirstBloodMessage', 0, KillerPRI );
    		KillerPRI.IncrementEventStat('EVENT_FIRSTBLOOD');
    	}
    }
    They must have stripped out some of the old code, but forgotten that one line. Normally an unused variable like that would result in a compiler warning, but "V" is reused later in the function. I wouldn't be surprised if there are lots of little things like this all over the UDK source, which hopefully will be cleaned up over time.

    Comment


      #3
      People should be dangerus with the copy paste haha. Well, just was my curiosity. Thank you for reply.

      Comment


        #4
        Another at 922 from UTGame.uc. The better of this is that compiler should give some warning about botToRemove parameter unreferenced, shouldn't it?

        Code:
        /**
         * Look at the current game rules and determine if there are too many bots.  In a single player
         * game, this function will always return false since the teams are preset and changes are not allowed.
         *
         * @Param BotToRemove		The Bot to remove
         */
        
        function bool TooManyBots(Controller botToRemove)
        {
        	// We only auto-manage bots if we are not in single player mode.
        	if ( SinglePlayerMissionID == INDEX_NONE )
        	{
        		if ( (WorldInfo.NetMode != NM_Standalone) && bPlayersVsBots )
        			return ( NumBots > Min(16,BotRatio*NumPlayers) );
        		if ( bPlayerBecameActive )
        		{
        			bPlayerBecameActive = false;
        			return true;
        		}
        		return ( NumBots + NumPlayers > DesiredPlayerCount );
        	}
        	return false;
        }

        Comment


          #5
          i don't know, that doesn't seem like it should be an error - what if i want to override that function in a later class, and not do anything with the function at all, or not do anything with the parameter?

          If it threw a warning or error for every function I've ever stubbed out, i'd be really annoyed.

          Comment


            #6
            Originally posted by Blade[UG] View Post
            what if i want to override that function in a later class, and not do anything with the function at all, or not do anything with the parameter?
            Didn't thought about that. Thank you for your reply.

            Comment

            Working...
            X