Skip to content

Commit fe17e1f

Browse files
committed
Update naming for ScriptIterator functions
1 parent 60a812b commit fe17e1f

3 files changed

Lines changed: 49 additions & 49 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,13 @@ void PrintTable(ScriptHandle table)
209209
switch (iter.ValueType)
210210
{
211211
case ScriptField_Int:
212-
PrintToServer("%s = %d", key, iter.GetInt());
212+
PrintToServer("%s = %d", key, iter.GetValueInt());
213213
case ScriptField_Float:
214-
PrintToServer("%s = %f", key, iter.GetFloat());
214+
PrintToServer("%s = %f", key, iter.GetValueFloat());
215215
case ScriptField_String:
216216
{
217217
char val[256];
218-
iter.GetString(val, sizeof(val));
218+
iter.GetValueString(val, sizeof(val));
219219
PrintToServer("%s = %s", key, val);
220220
}
221221
}
@@ -233,7 +233,7 @@ void SumArray(ScriptHandle arr)
233233
ScriptIterator iter = arr.Iterate();
234234
while (iter.Next())
235235
{
236-
sum += iter.GetInt();
236+
sum += iter.GetValueInt();
237237
}
238238
delete iter;
239239

include/vscript.inc

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,23 @@ methodmap ScriptIterator < Handle
104104
* @return The integer value.
105105
* @error Next() was not called or returned false.
106106
*/
107-
public native int GetInt();
107+
public native int GetValueInt();
108108

109109
/**
110110
* Gets a boolean value at the current position.
111111
*
112112
* @return The boolean value.
113113
* @error Next() was not called or returned false.
114114
*/
115-
public native bool GetBool();
115+
public native bool GetValueBool();
116116

117117
/**
118118
* Gets a float value at the current position.
119119
*
120120
* @return The float value.
121121
* @error Next() was not called or returned false.
122122
*/
123-
public native float GetFloat();
123+
public native float GetValueFloat();
124124

125125
/**
126126
* Gets a string value at the current position.
@@ -130,47 +130,47 @@ methodmap ScriptIterator < Handle
130130
* @return Number of bytes written.
131131
* @error Next() was not called or returned false.
132132
*/
133-
public native int GetString(char[] buffer, int maxlen);
133+
public native int GetValueString(char[] buffer, int maxlen);
134134

135135
/**
136136
* Gets a vector value at the current position.
137137
*
138138
* @param vec Array to store the vector.
139139
* @error Next() was not called or returned false.
140140
*/
141-
public native void GetVector(float vec[3]);
141+
public native void GetValueVector(float vec[3]);
142142

143143
/**
144144
* Gets a Vector2D value at the current position.
145145
*
146146
* @param vec Array to store the Vector2D.
147147
* @error Next() was not called or returned false.
148148
*/
149-
public native void GetVector2D(float vec[2]);
149+
public native void GetValueVector2D(float vec[2]);
150150

151151
/**
152152
* Gets a Quaternion value at the current position.
153153
*
154154
* @param quat Array to store the Quaternion.
155155
* @error Next() was not called or returned false.
156156
*/
157-
public native void GetQuaternion(float quat[4]);
157+
public native void GetValueQuaternion(float quat[4]);
158158

159159
/**
160160
* Gets an HSCRIPT value at the current position.
161161
*
162162
* @return A ScriptHandle, or null if not found. Must be closed with delete when done.
163163
* @error Next() was not called or returned false.
164164
*/
165-
public native ScriptHandle GetHScript();
165+
public native ScriptHandle GetValueHScript();
166166

167167
/**
168168
* Gets an entity index from an HSCRIPT instance or EHANDLE value at the current position.
169169
*
170170
* @return Entity index, or -1 if invalid or not an entity.
171171
* @error Next() was not called or returned false.
172172
*/
173-
public native int GetEntity();
173+
public native int GetValueEntity();
174174
};
175175

176176
/**
@@ -1057,15 +1057,15 @@ public void __ext_vscript_SetNTVOptional()
10571057
MarkNativeAsOptional("ScriptIterator.GetKeyInt");
10581058
MarkNativeAsOptional("ScriptIterator.KeyType.get");
10591059
MarkNativeAsOptional("ScriptIterator.ValueType.get");
1060-
MarkNativeAsOptional("ScriptIterator.GetInt");
1061-
MarkNativeAsOptional("ScriptIterator.GetBool");
1062-
MarkNativeAsOptional("ScriptIterator.GetFloat");
1063-
MarkNativeAsOptional("ScriptIterator.GetString");
1064-
MarkNativeAsOptional("ScriptIterator.GetVector");
1065-
MarkNativeAsOptional("ScriptIterator.GetVector2D");
1066-
MarkNativeAsOptional("ScriptIterator.GetQuaternion");
1067-
MarkNativeAsOptional("ScriptIterator.GetHScript");
1068-
MarkNativeAsOptional("ScriptIterator.GetEntity");
1060+
MarkNativeAsOptional("ScriptIterator.GetValueInt");
1061+
MarkNativeAsOptional("ScriptIterator.GetValueBool");
1062+
MarkNativeAsOptional("ScriptIterator.GetValueFloat");
1063+
MarkNativeAsOptional("ScriptIterator.GetValueString");
1064+
MarkNativeAsOptional("ScriptIterator.GetValueVector");
1065+
MarkNativeAsOptional("ScriptIterator.GetValueVector2D");
1066+
MarkNativeAsOptional("ScriptIterator.GetValueQuaternion");
1067+
MarkNativeAsOptional("ScriptIterator.GetValueHScript");
1068+
MarkNativeAsOptional("ScriptIterator.GetValueEntity");
10691069

10701070
// ScriptCall methodmap
10711071
MarkNativeAsOptional("ScriptCall.ScriptCall");

src/natives.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ static cell_t Native_IterValueType(IPluginContext *pContext, const cell_t *param
467467
return (cell_t)VariantMarshal::EngineToSPField(pIter->value.GetType());
468468
}
469469

470-
// native int ScriptIterator.GetInt();
471-
static cell_t Native_IterGetInt(IPluginContext *pContext, const cell_t *params)
470+
// native int ScriptIterator.GetValueInt();
471+
static cell_t Native_IterGetValueInt(IPluginContext *pContext, const cell_t *params)
472472
{
473473
ScriptIteratorState *pIter = ReadScriptIterator(pContext, (Handle_t)params[1]);
474474
if (!pIter) return 0;
@@ -482,8 +482,8 @@ static cell_t Native_IterGetInt(IPluginContext *pContext, const cell_t *params)
482482
return VariantMarshal::ReadVariantInt(pIter->value);
483483
}
484484

485-
// native bool ScriptIterator.GetBool();
486-
static cell_t Native_IterGetBool(IPluginContext *pContext, const cell_t *params)
485+
// native bool ScriptIterator.GetValueBool();
486+
static cell_t Native_IterGetValueBool(IPluginContext *pContext, const cell_t *params)
487487
{
488488
ScriptIteratorState *pIter = ReadScriptIterator(pContext, (Handle_t)params[1]);
489489
if (!pIter) return 0;
@@ -497,8 +497,8 @@ static cell_t Native_IterGetBool(IPluginContext *pContext, const cell_t *params)
497497
return VariantMarshal::ReadVariantBool(pIter->value);
498498
}
499499

500-
// native float ScriptIterator.GetFloat();
501-
static cell_t Native_IterGetFloat(IPluginContext *pContext, const cell_t *params)
500+
// native float ScriptIterator.GetValueFloat();
501+
static cell_t Native_IterGetValueFloat(IPluginContext *pContext, const cell_t *params)
502502
{
503503
ScriptIteratorState *pIter = ReadScriptIterator(pContext, (Handle_t)params[1]);
504504
if (!pIter) return 0;
@@ -512,8 +512,8 @@ static cell_t Native_IterGetFloat(IPluginContext *pContext, const cell_t *params
512512
return sp_ftoc(VariantMarshal::ReadVariantFloat(pIter->value));
513513
}
514514

515-
// native int ScriptIterator.GetString(char[] buffer, int maxlen);
516-
static cell_t Native_IterGetString(IPluginContext *pContext, const cell_t *params)
515+
// native int ScriptIterator.GetValueString(char[] buffer, int maxlen);
516+
static cell_t Native_IterGetValueString(IPluginContext *pContext, const cell_t *params)
517517
{
518518
ScriptIteratorState *pIter = ReadScriptIterator(pContext, (Handle_t)params[1]);
519519
if (!pIter) return 0;
@@ -531,8 +531,8 @@ static cell_t Native_IterGetString(IPluginContext *pContext, const cell_t *param
531531
return VariantMarshal::ReadVariantString(pIter->value, buffer, maxlen);
532532
}
533533

534-
// native ScriptHandle ScriptIterator.GetHScript();
535-
static cell_t Native_IterGetHScript(IPluginContext *pContext, const cell_t *params)
534+
// native ScriptHandle ScriptIterator.GetValueHScript();
535+
static cell_t Native_IterGetValueHScript(IPluginContext *pContext, const cell_t *params)
536536
{
537537
ScriptIteratorState *pIter = ReadScriptIterator(pContext, (Handle_t)params[1]);
538538
if (!pIter) return BAD_HANDLE;
@@ -552,8 +552,8 @@ static cell_t Native_IterGetHScript(IPluginContext *pContext, const cell_t *para
552552
return (cell_t)CreateHScriptHandle(pContext, h, HScriptType::Table, HScriptOwnership::Owned);
553553
}
554554

555-
// native int ScriptIterator.GetEntity();
556-
static cell_t Native_IterGetEntity(IPluginContext *pContext, const cell_t *params)
555+
// native int ScriptIterator.GetValueEntity();
556+
static cell_t Native_IterGetValueEntity(IPluginContext *pContext, const cell_t *params)
557557
{
558558
IScriptVM *pVM = GetVMOrThrow(pContext);
559559
if (!pVM) return -1;
@@ -571,7 +571,7 @@ static cell_t Native_IterGetEntity(IPluginContext *pContext, const cell_t *param
571571
}
572572

573573
template <int N, void (*ReadFn)(const ScriptVariant_t &, float *)>
574-
static cell_t Native_IterGetFloatArray(IPluginContext *pContext, const cell_t *params)
574+
static cell_t Native_IterGetValueFloatArray(IPluginContext *pContext, const cell_t *params)
575575
{
576576
ScriptIteratorState *pIter = ReadScriptIterator(pContext, (Handle_t)params[1]);
577577
if (!pIter) return 0;
@@ -1855,20 +1855,20 @@ const sp_nativeinfo_t g_VScriptNatives[] =
18551855
{ "ScriptHandle.LookupFunction", Native_LookupFunction },
18561856

18571857
// ScriptIterator methodmap
1858-
{ "ScriptIterator.Next", Native_IterNext },
1859-
{ "ScriptIterator.GetKeyString", Native_IterGetKeyString },
1860-
{ "ScriptIterator.GetKeyInt", Native_IterGetKeyInt },
1861-
{ "ScriptIterator.KeyType.get", Native_IterKeyType },
1862-
{ "ScriptIterator.ValueType.get", Native_IterValueType },
1863-
{ "ScriptIterator.GetInt", Native_IterGetInt },
1864-
{ "ScriptIterator.GetBool", Native_IterGetBool },
1865-
{ "ScriptIterator.GetFloat", Native_IterGetFloat },
1866-
{ "ScriptIterator.GetString", Native_IterGetString },
1867-
{ "ScriptIterator.GetVector", Native_IterGetFloatArray<3, VariantMarshal::ReadVariantVector> },
1868-
{ "ScriptIterator.GetVector2D", Native_IterGetFloatArray<2, VariantMarshal::ReadVariantVector2D> },
1869-
{ "ScriptIterator.GetQuaternion", Native_IterGetFloatArray<4, VariantMarshal::ReadVariantQuaternion> },
1870-
{ "ScriptIterator.GetHScript", Native_IterGetHScript },
1871-
{ "ScriptIterator.GetEntity", Native_IterGetEntity },
1858+
{ "ScriptIterator.Next", Native_IterNext },
1859+
{ "ScriptIterator.GetKeyString", Native_IterGetKeyString },
1860+
{ "ScriptIterator.GetKeyInt", Native_IterGetKeyInt },
1861+
{ "ScriptIterator.KeyType.get", Native_IterKeyType },
1862+
{ "ScriptIterator.ValueType.get", Native_IterValueType },
1863+
{ "ScriptIterator.GetValueInt", Native_IterGetValueInt },
1864+
{ "ScriptIterator.GetValueBool", Native_IterGetValueBool },
1865+
{ "ScriptIterator.GetValueFloat", Native_IterGetValueFloat },
1866+
{ "ScriptIterator.GetValueString", Native_IterGetValueString },
1867+
{ "ScriptIterator.GetValueVector", Native_IterGetValueFloatArray<3, VariantMarshal::ReadVariantVector> },
1868+
{ "ScriptIterator.GetValueVector2D", Native_IterGetValueFloatArray<2, VariantMarshal::ReadVariantVector2D> },
1869+
{ "ScriptIterator.GetValueQuaternion", Native_IterGetValueFloatArray<4, VariantMarshal::ReadVariantQuaternion> },
1870+
{ "ScriptIterator.GetValueHScript", Native_IterGetValueHScript },
1871+
{ "ScriptIterator.GetValueEntity", Native_IterGetValueEntity },
18721872

18731873
// ScriptCall methodmap
18741874
{ "ScriptCall.ScriptCall", Native_ScriptCall_Ctor },

0 commit comments

Comments
 (0)