29.12.2011, 09:22
@KoczkaHUN: I assume you're not familiar with the [ pawn ] tags?
Also, are you aware the the DecreasePVar is slower now? Because it now must replace 3 strings instead of 1. As you (may) know, macro's literally replaces texts (only while compiling - not visual in the pwn like CTRL+H). It's now gonna do this:
2- 'DecreasePVar' is a defined macro, so change 'DecreasePVar' for 'IncreasePVar(*, *, -(*))'
3- Change 'IncreasePVar' for 'SetPVarInt(*, *, GetPVarInt(*, *) + *);' (cuz it was also a defined macro)
4- Compile the output (which is now: 'SetPVarInt(playerid, varname[], GetPVarInt(playerid, varname[]) +- value);'
While it would do this when you have this code: #define DecreasePVar(%0,%1,%2) SetPVarInt(%0, %1, GetPVarInt(%0) - %2);
1- Change 'DecreasePVar' for 'SetPVarInt(*, *, GetPVarInt(*) - *);'
2- Compile the output (which is now: See above)
It's not a big deal, but it is slower. I'd rather use the second one. But, for something like this, I wouldn't use them both. I'd go for the literally functions, since I never use PVars: Those are slower (I ever saw a trustable source who'd benchmarked this). The only handy things is that it can hold bigger strings (I read it in the same topic).
More information about what I've told about (the Pre-Processor): https://sampforum.blast.hk/showthread.php?tid=166680
- Kevin
p.s.
Please say it if I'm wrong: As far as I understood and read about in different topics (especially ******' one), it works like this :P
pawn Код:
#define IncreasePVar(%0,%1,%2) SetPVarInt(%0, %1, GetPVarInt(%0, %1) + %2)
#define DecreasePVar(%0,%1,%2) IncreasePVar(%0, %1, -(%2))
2- 'DecreasePVar' is a defined macro, so change 'DecreasePVar' for 'IncreasePVar(*, *, -(*))'
3- Change 'IncreasePVar' for 'SetPVarInt(*, *, GetPVarInt(*, *) + *);' (cuz it was also a defined macro)
4- Compile the output (which is now: 'SetPVarInt(playerid, varname[], GetPVarInt(playerid, varname[]) +- value);'
While it would do this when you have this code: #define DecreasePVar(%0,%1,%2) SetPVarInt(%0, %1, GetPVarInt(%0) - %2);
1- Change 'DecreasePVar' for 'SetPVarInt(*, *, GetPVarInt(*) - *);'
2- Compile the output (which is now: See above)
It's not a big deal, but it is slower. I'd rather use the second one. But, for something like this, I wouldn't use them both. I'd go for the literally functions, since I never use PVars: Those are slower (I ever saw a trustable source who'd benchmarked this). The only handy things is that it can hold bigger strings (I read it in the same topic).
More information about what I've told about (the Pre-Processor): https://sampforum.blast.hk/showthread.php?tid=166680
- Kevin
p.s.
Please say it if I'm wrong: As far as I understood and read about in different topics (especially ******' one), it works like this :P