Optimize this code
#3

For a start, do not call GetVehicleEngineType function 4 times.
if/else if can be replaced with a switch.
format is useless when can set string directly.

pawn Код:
switch (GetVehicleEngineType(modelid))
{
    case 'H': typestr = "Human Powered";
    case 'D': typestr = "Diesel";
    case 'P': typestr = "Petrol";
    case 'E': typestr = "Electric";
}
Reply


Messages In This Thread
Optimize this code - by Dice_ - 04.07.2018, 10:34
Re: Optimize this code - by Dice_ - 04.07.2018, 10:43
Re: Optimize this code - by Calisthenics - 04.07.2018, 14:33

Forum Jump:


Users browsing this thread: 1 Guest(s)