Loading system failing
#5

Quote:
Originally Posted by Antenastyle
Посмотреть сообщение
The enum:
Код:
enum CarInfo
{
    pVehicle1,
// ...
	pVehicle2,
// ...
	pVehicle3,
// ...
}
new PlayerCars[MAX_PLAYERS][CarInfo];
Ok, now imagine that you need to support 20 vehicles. Or 100 vehicles. Are you going to add 1200 new specifiers? Are you going to copy all your INI_Writes 100 times? Is that maintainable? Think ahead before diving in head first.

Create a 3D array instead. You will only have to change one number and you can use loops.

PHP код:
enum CarInfo 
{
    
pVehicle,
    
pVehicleModel,
    
Float:pVehicleX,
    
Float:pVehicleY,
    
Float:pVehicleZ,
    
Float:pVehicleC,
    
pVehicleColor1,
    
pVehicleColor2,
    
pVehicleValue,
    
pVehiclePlate,
    
pVehicleLock
}
new 
PlayerCars[MAX_PLAYERS][3][CarInfo]; 
Sorry for the rant. I'm allergic to non-DRY code.
Reply


Messages In This Thread
Loading system failing - by Antenastyle - 19.05.2017, 17:33
Re: Loading system failing - by Aly - 19.05.2017, 17:39
Re: Loading system failing - by Antenastyle - 19.05.2017, 17:50
Re: Loading system failing - by Aly - 19.05.2017, 18:33
Re: Loading system failing - by Vince - 19.05.2017, 18:56
Re: Loading system failing - by Antenastyle - 19.05.2017, 21:37
Re: Loading system failing - by Aly - 19.05.2017, 22:52
Re: Loading system failing - by Antenastyle - 20.05.2017, 11:16
Re: Loading system failing - by Aly - 20.05.2017, 11:24
Re: Loading system failing - by Antenastyle - 20.05.2017, 11:45

Forum Jump:


Users browsing this thread: 4 Guest(s)