Incorrect message displayed when attempting to ride a vehicle that has full passenger slots

Issue #76 resolved
Colin Basnett created an issue

Correct message should be "Vehicle is full" or something along those lines.

Comments (4)

  1. Matt Hands

    Bug is in DH_ROTreadCraft's TryToDrive function, corrected below. DH_VehicleMessage returns the "all rider positions full" message as the default fallback if no valid number is entered. I have specified message no.8, which will give that result, but it would be better if DH_VehicleMessage were also modified so VehicleFull is message no.8 and the default return is a null string (also shown below).

    class DH_ROTreadCraft extends ROTreadCraft;
    
    // Matt: corrected vehicle message if all rider positions are full
    function bool TryToDrive(Pawn P)
    {
        local int x;
    
        if (DH_Pawn(P).bOnFire)
        {
            return false;
        }
    
        // Don't allow vehicle to be stolen when somebody is in a turret
        if (!bTeamLocked && P.GetTeamNum() != VehicleTeam)
        {
            for (x = 0; x < WeaponPawns.length; x++)
            {
                if (WeaponPawns[x].Driver != none)
                {
                    DenyEntry(P, 2);
                    return false;
                }
            }
        }
    
        if (P.bIsCrouched || bNonHumanControl || P.Controller == none || Driver != none || P.DrivenVehicle != none || !P.Controller.bIsPlayer || P.IsA('Vehicle') || Health <= 0)
        {
            return false;
        }
    
        if (!Level.Game.CanEnterVehicle(self, P))
            return false;
    
        // Check vehicle Locking ....
        if (bTeamLocked && P.GetTeamNum() != VehicleTeam)
        {
            DenyEntry(P, 1);
            return false;
        }
        else if (bMustBeTankCommander && !ROPlayerReplicationInfo(P.Controller.PlayerReplicationInfo).RoleInfo.bCanBeTankCrew && P.IsHumanControlled())
        {
            // They mut be a non-tanker role so let's go through the available rider positions and find a place for them to sit
            // Check first to ensure riders are allowed
            if (!bAllowRiders)
            {
                DenyEntry(P, 3);
                return false;
            }
    
            // Cycle through the available passenger positions - check the class type to see if it is ROPassengerPawn
            for (x = 1; x < WeaponPawns.length; x++) //skip over the turret
            {
                // If riders are allowed, the WeaponPawn is free and it is a passenger pawn class then climb aboard
                if (WeaponPawns[x].Driver == none && WeaponPawns[x].IsA('ROPassengerPawn'))
                {
                    WeaponPawns[x].KDriverEnter(P);
                    return true;
                }
            }
    
            DenyEntry(P, 8); // Matt: corrected this from message no.0, which gave an "not qualified to operate vehicle" message
            return false;
        }
        else
        {
            if (bEnterringUnlocks && bTeamLocked)
            {
                bTeamLocked = false;
            }
    
            KDriverEnter( P );
            return true;
        }
    }
    
    // Matt: modified to make VehicleFull message no.8 instead of being the default fallback return
    class DH_VehicleMessage extends ROVehicleMessage;
    
    static function string GetString(
        optional int Switch,
        optional PlayerReplicationInfo RelatedPRI_1,
        optional PlayerReplicationInfo RelatedPRI_2,
        optional Object OptionalObject
        )
    {
        switch (Switch)
        {
            case 0:
                return default.NotQualified;
            case 1:
                return default.VehicleIsEnemy;
            case 2:
                return default.CannotEnter;
            case 3:
                return default.CannotRide;
            case 4:
                return default.CannotExit;
            case 5:
                return default.AssaultGunExit;
            case 6:
                return default.Sabotaged;
            case 7:
                return default.OverSpeed;
            case 8:
                return default.VehicleFull;
            default:
                return "";
        }
    }
    
  2. Log in to comment