-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the new syntax #46
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for starting this! You should try to compile stuff before you open a pull request. Try to compile the testscript with #pragma newdecls required
. A lot of the errors would have shown up, I've noticed too late you didn't try to compile, so I still went through all your changes.
Some general comments:
- Use methodmaps where available!
- Convar_* functions now require the
ConVar
tag instead of a genericHandle
. That breaks backwards compat, but seems ok. @noreturn
documentation can be removed due to the explicitvoid
return type.- Can remove the
#if SOURCEMOD_V_MAJOR >= 1 && SOURCEMOD_V_MINOR >= 7
workarounds since we're requiring 1.7 now. - Replace all
INVALID_HANDLE
withnull
and replaceCloseHandle
calls withdelete
I only reviewed your changes, didn't look at the unchanged spots yet. I'm sure there will be lots more errors once you try to compile.
@@ -131,13 +131,13 @@ stock Array_FindHighestValue(any:array[], size, start=0) | |||
* @param start Optional: Offset where to start (0 - (size-1)). | |||
* @noreturn | |||
*/ | |||
stock Array_Fill(any:array[], size, any:value, start=0) | |||
stock int Array_Fill(any[] array, int size, any value, int start = 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void return!
@@ -150,9 +150,9 @@ stock Array_Fill(any:array[], size, any:value, start=0) | |||
* @param size Size of the array (or number of cells to copy) | |||
* @noreturn | |||
*/ | |||
stock Array_Copy(const any:array[], any:newArray[], size) | |||
stock int Array_Copy(const any[] array, any[] newArray, int size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void return
{ | ||
return Obs_Mode:GetEntProp(client, Prop_Send, "m_iObserverMode"); | ||
return Obs_Mode GetEntProp(client, Prop_Send, "m_iObserverMode"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
view_as
@@ -256,7 +256,7 @@ stock bool:Client_SetObserverMode(client, Obs_Mode:mode, bool:updateMoveType=tru | |||
// check mp_forcecamera settings for dead players | |||
if (mode > OBS_MODE_FIXED && GetClientTeam(client) > TEAM_SPECTATOR) | |||
{ | |||
new Handle:mp_forcecamera = FindConVar("mp_forcecamera"); | |||
Handle mp_forcecamera = FindConVar("mp_forcecamera"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the ConVar
methodmap
@@ -245,9 +245,9 @@ stock Obs_Mode:Client_GetObserverMode(client) | |||
* @param client Client Index. | |||
* @param mode New Observer mode value (Obs_Mode). | |||
* @param updateMoveType Set to true (default) to allow this function updating the movetype, false otherwise. | |||
* @noreturn | |||
* @return True or False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might add better documentation when it returns true or false ;)
{ | ||
return bool:GetEntProp(weapon, Prop_Data, "m_bInReload"); | ||
return bool GetEntProp(weapon, Prop_Data, "m_bInReload"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
== 1
{ | ||
return bool:GetEntProp(weapon, Prop_Data, "m_bFiresUnderwater"); | ||
return bool GetEntProp(weapon, Prop_Data, "m_bFiresUnderwater"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
== 1
@@ -168,7 +168,7 @@ stock bool:Weapon_FiresUnderWater(weapon) | |||
* @param can True or False. | |||
* @noreturn | |||
*/ | |||
stock Weapon_SetFiresUnderWater(weapon, bool:can=true) | |||
stock void Weapon_SetFiresUnderWater(int weapon, bool can = true) | |||
{ | |||
SetEntProp(weapon, Prop_Data, "m_bFiresUnderwater", _:can); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
view_as<int>
{ | ||
return bool:GetEntProp(weapon, Prop_Data, "m_bAltFiresUnderwater"); | ||
return bool GetEntProp(weapon, Prop_Data, "m_bAltFiresUnderwater"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
== 1
@@ -191,7 +191,7 @@ stock bool:Weapon_FiresUnderWaterAlt(weapon) | |||
* @param can True or False. | |||
* @noreturn | |||
*/ | |||
stock Weapon_SetFiresUnderWaterAlt(weapon, bool:can=true) | |||
stock void Weapon_SetFiresUnderWaterAlt(int weapon, bool can = true) | |||
{ | |||
SetEntProp(weapon, Prop_Data, "m_bAltFiresUnderwater", _:can); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
view_as<int>
Thanks for your review. I forget about ConVar, DataPack.. and started to fix that yesterday. But I haven't yet pushed. |
I fixed a lot of errors today but I have one that I have not managed to fix for the moment. The compile.exe tells me this (and only this) : But the line didn't seems wrong : |
Hello, How can I download a new syntax smlib? |
This was done in the transitional_syntax branch. If you did more changes other than switching the syntax, please reapply them against that branch. |
For issue #30
I think we need to create a new branch for this, or to save master in a new branch before mergin this.