Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
解决GameObject的排序问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed Jul 15, 2013
1 parent 77d3634 commit 2ff7c2b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/game_object.c
Expand Up @@ -162,11 +162,12 @@ LCUI_API void GameObject_AtLanding( LCUI_Widget *widget,
GameObject_Connect( widget, AT_LANDING, func );
}

/** 对流中的GameObject按照剩余时间从小到大的顺序排序 */
static void GameObjectStream_Sort(void)
{
int i, j, total;
LCUI_Widget *widget;
GameObject *tmp, *p1, *p2;
GameObject *p1, *p2;

Queue_Lock( &gameobject_stream );
total = Queue_GetTotal( &gameobject_stream );
Expand All @@ -182,10 +183,8 @@ static void GameObjectStream_Sort(void)
if( !p2 ) {
continue;
}
if( p1->remain_time < p2->remain_time ) {
tmp = p1;
if( p1->remain_time > p2->remain_time ) {
p1 = p2;
p2 = tmp;
Queue_Swap( &gameobject_stream, j, i );
}
}
Expand Down

0 comments on commit 2ff7c2b

Please sign in to comment.