Skip to content
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

Closed
wants to merge 15 commits into from
Closed

Use the new syntax #46

wants to merge 15 commits into from

Conversation

Nobody-x
Copy link

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.

Copy link
Member

@peace-maker peace-maker left a 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 generic Handle. That breaks backwards compat, but seems ok.
  • @noreturn documentation can be removed due to the explicit void 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 with null and replace CloseHandle calls with delete

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)
Copy link
Member

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)
Copy link
Member

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");
Copy link
Member

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");
Copy link
Member

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
Copy link
Member

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");
Copy link
Member

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");
Copy link
Member

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);
Copy link
Member

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");
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

view_as<int>

@Nobody-x
Copy link
Author

Nobody-x commented Nov 30, 2016

Thanks for your review. I forget about ConVar, DataPack.. and started to fix that yesterday. But I haven't yet pushed.

@Nobody-x
Copy link
Author

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) : F:\___Servers\_compile\1.8.0_5961\include\smlib/crypt.inc(57) : warning 213: tag mismatch

But the line didn't seems wrong : static const char base64_cFillChar = '=';
I base myself on this : https://wiki.alliedmods.net/Introduction_to_SourcePawn_1.7#Characters

@emsit
Copy link

emsit commented May 26, 2017

Hello, How can I download a new syntax smlib?

@peace-maker
Copy link
Member

This was done in the transitional_syntax branch. If you did more changes other than switching the syntax, please reapply them against that branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants