Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kaldrum
SRB2
Commits
b7bf0f22
Commit
b7bf0f22
authored
Nov 25, 2023
by
Lactozilla
Browse files
Options
Downloads
Patches
Plain Diff
Manual cherry-pick of
626aee96
parent
ebf9e001
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lua_infolib.c
+10
-13
10 additions, 13 deletions
src/lua_infolib.c
with
10 additions
and
13 deletions
src/lua_infolib.c
+
10
−
13
View file @
b7bf0f22
...
...
@@ -2465,23 +2465,23 @@ static int teamscores_len(lua_State *L)
static
int
playerstarts_get
(
lua_State
*
L
)
{
playerstarts_t
*
starts
=
*
((
playerstarts_t
**
)
luaL_checkudata
(
L
,
1
,
META_PLAYERSTARTS
));
int
i
=
luaL_checkinteger
(
L
,
2
);
if
(
i
<
0
||
i
>=
(
signed
)
starts
->
count
)
return
luaL_error
(
L
,
"player start index %d out of range (0 - %d)"
,
i
,
max
(
0
,
(
int
)
starts
->
count
-
1
));
LUA_PushUserdata
(
L
,
starts
->
list
[
i
],
META_MAPTHING
);
int
i
ndex
=
luaL_checkinteger
(
L
,
2
);
if
(
i
ndex
<
0
||
i
ndex
>=
(
signed
)
starts
->
count
)
return
luaL_error
(
L
,
"player start index %d out of range (0 - %d)"
,
i
ndex
,
max
(
0
,
(
int
)
starts
->
count
-
1
));
LUA_PushUserdata
(
L
,
starts
->
list
[
i
ndex
],
META_MAPTHING
);
return
1
;
}
static
int
playerstarts_set
(
lua_State
*
L
)
{
playerstarts_t
*
starts
=
*
((
playerstarts_t
**
)
luaL_checkudata
(
L
,
1
,
META_PLAYERSTARTS
));
int
i
=
luaL_checkinteger
(
L
,
2
);
int
i
ndex
=
luaL_checkinteger
(
L
,
2
);
mapthing_t
*
mthing
=
*
((
mapthing_t
**
)
luaL_checkudata
(
L
,
3
,
META_MAPTHING
));
if
(
i
<
0
||
i
>=
(
signed
)
starts
->
count
)
return
luaL_error
(
L
,
"player start index %d out of range (0 - %d)"
,
i
,
max
(
0
,
(
int
)
starts
->
count
-
1
));
if
(
i
ndex
<
0
||
i
ndex
>=
(
signed
)
starts
->
count
)
return
luaL_error
(
L
,
"player start index %d out of range (0 - %d)"
,
i
ndex
,
max
(
0
,
(
int
)
starts
->
count
-
1
));
if
(
!
mthing
)
return
LUA_ErrInvalid
(
L
,
"mapthing_t"
);
starts
->
list
[
i
]
=
mthing
;
starts
->
list
[
i
ndex
]
=
mthing
;
return
0
;
}
...
...
@@ -2494,22 +2494,19 @@ static int playerstarts_len(lua_State *L)
static
int
lib_getTeamstarts
(
lua_State
*
L
)
{
int
i
;
lua_remove
(
L
,
1
);
i
=
luaL_checkinteger
(
L
,
1
);
int
i
=
luaL_checkinteger
(
L
,
1
);
if
(
i
<=
0
||
i
>=
numteams
)
return
luaL_error
(
L
,
"team index %d out of range (1 - %d)"
,
i
,
numteams
-
1
);
LUA_PushUserdata
(
L
,
&
teamstarts
[
i
],
META_PLAYERSTARTS
);
return
1
;
}
// #teamstarts -> MAXTEAMS
static
int
lib_teamstartslen
(
lua_State
*
L
)
{
lua_pushinteger
(
L
,
MAXTEAMS
);
lua_pushinteger
(
L
,
max
(
0
,
numteams
-
1
)
);
return
1
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment