Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
68dda540
Commit
68dda540
authored
Apr 11, 2018
by
Crazy-P
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes incorrect adding to last in self_list
Fixes
https://github.com/godotengine/godot/issues/18052
parent
d87307d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
15 deletions
+26
-15
self_list.h
core/self_list.h
+26
-15
No files found.
core/self_list.h
View file @
68dda540
...
...
@@ -39,6 +39,7 @@ public:
class
List
{
SelfList
<
T
>
*
_first
;
SelfList
<
T
>
*
_last
;
public
:
void
add
(
SelfList
<
T
>
*
p_elem
)
{
...
...
@@ -48,47 +49,54 @@ public:
p_elem
->
_root
=
this
;
p_elem
->
_next
=
_first
;
p_elem
->
_prev
=
NULL
;
if
(
_first
)
if
(
_first
)
{
_first
->
_prev
=
p_elem
;
}
else
{
_last
=
p_elem
;
}
_first
=
p_elem
;
}
void
add_last
(
SelfList
<
T
>
*
p_elem
)
{
ERR_FAIL_COND
(
p_elem
->
_root
);
if
(
!
_first
)
{
add
(
p_elem
);
return
;
}
p_elem
->
_root
=
this
;
p_elem
->
_next
=
NULL
;
p_elem
->
_prev
=
_last
;
SelfList
<
T
>
*
e
=
_first
;
if
(
_last
)
{
_last
->
_next
=
p_elem
;
while
(
e
->
next
())
{
e
=
e
->
next
()
;
}
else
{
_first
=
p_elem
;
}
e
->
_next
=
p_elem
;
p_elem
->
_prev
=
e
->
_next
;
p_elem
->
_root
=
this
;
_last
=
p_elem
;
}
void
remove
(
SelfList
<
T
>
*
p_elem
)
{
ERR_FAIL_COND
(
p_elem
->
_root
!=
this
);
if
(
p_elem
->
_next
)
{
p_elem
->
_next
->
_prev
=
p_elem
->
_prev
;
}
if
(
p_elem
->
_prev
)
{
if
(
p_elem
->
_prev
)
{
p_elem
->
_prev
->
_next
=
p_elem
->
_next
;
}
if
(
_first
==
p_elem
)
{
_first
=
p_elem
->
_next
;
}
if
(
_last
==
p_elem
)
{
_last
=
p_elem
->
_prev
;
}
p_elem
->
_next
=
NULL
;
p_elem
->
_prev
=
NULL
;
p_elem
->
_root
=
NULL
;
...
...
@@ -96,7 +104,10 @@ public:
_FORCE_INLINE_
SelfList
<
T
>
*
first
()
{
return
_first
;
}
_FORCE_INLINE_
const
SelfList
<
T
>
*
first
()
const
{
return
_first
;
}
_FORCE_INLINE_
List
()
{
_first
=
NULL
;
}
_FORCE_INLINE_
List
()
{
_first
=
NULL
;
_last
=
NULL
;
}
_FORCE_INLINE_
~
List
()
{
ERR_FAIL_COND
(
_first
!=
NULL
);
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment