Skip to content
This repository was archived by the owner on Sep 24, 2023. It is now read-only.

Commit f795fa1

Browse files
committed
Fix behavior of Push and add docs
1 parent 17df8b8 commit f795fa1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

scripting/include/level_keyvalues.inc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ methodmap LevelEntityList {
6464
* The key / values are internally copied to a new handle, so any changes to the specified
6565
* LevelEntityKeyValues handle will not be propagated to the internal copy.
6666
*/
67-
public static native void Push(LevelEntityKeyValues entity);
67+
public static native int Push(LevelEntityKeyValues entity);
6868

6969
/**
7070
* Returns the number of LevelEntityKeyValues handles in the list.
@@ -82,8 +82,9 @@ forward Action LevelEntity_OnEntityKeysParsed(LevelEntityKeyValues entity);
8282

8383
/**
8484
* Called when the entity string in `OnLevelInit` has been fully parsed out.
85-
* Any modifications to the LevelEntityList or its member LevelEntityKeyValues will be written
86-
* out to the entity string.
85+
*
86+
* During this forward, modifications to the LevelEntityList or its member LevelEntityKeyValues
87+
* are guaranteed to be written out to the entity string.
8788
*/
8889
forward void LevelEntity_OnAllEntitiesParsed();
8990

scripting/level_keyvalues.sp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ public int Native_InsertEntity(Handle plugin, int argc) {
125125
ThrowNativeError(1, "Can't push new entity into list during non-mutable state.");
126126
}
127127
StringMultiMap entity = GetNativeCell(1);
128-
g_MapEntities.Push(CloneStringMultiMap(entity));
129-
return;
128+
return g_MapEntities.Push(CloneStringMultiMap(entity));
130129
}
131130

132131
public int Native_LevelListGetLength(Handle plugin, int argc) {

0 commit comments

Comments
 (0)