MAX_VEHICLES
#1

he would like to transfer MAX_VEHICLES
in GetVehiclePoolSizebut who loop best-optimized

Код:
for(new i = 0; i <= GetVehiclePoolSize(); i++)

for(new i = 0, j = GetVehiclePoolSize(); i <= j; i++)

for(new i = GetVehiclePoolSize(); i > 0; i--)
Reply
#2

Last, one variable 'i' and one usage GetVehiclePoolSize
Reply
#3

Код:
for(new i = GetVehiclePoolSize(); i > 0; i--)
why this code?
Reply
#4

Because GetVehiclePoolSize function is called only once, its returned value is saved into pawn's VM memory. That should be faster than always calling a function that will be passing a value from some other place in memory. Basically there is less code abstraction (probably not best way to explain it but my mind is empty atm.)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)