summaryrefslogtreecommitdiffstats
path: root/kpat/freecell-solver/pqueue.c
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
commit838baf3f99ec5ab81b063eb5449a3381d860f377 (patch)
treedd31abcfde08ca92e4623b8f50b3d762a87c997a /kpat/freecell-solver/pqueue.c
parent2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff)
downloadtdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.tar.gz
tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.zip
TQt4 port kdegames
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1236074 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpat/freecell-solver/pqueue.c')
-rw-r--r--kpat/freecell-solver/pqueue.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/kpat/freecell-solver/pqueue.c b/kpat/freecell-solver/pqueue.c
index 086cce96..7cacf8ff 100644
--- a/kpat/freecell-solver/pqueue.c
+++ b/kpat/freecell-solver/pqueue.c
@@ -33,7 +33,7 @@
the list is sorted ascending or descending... */
void freecell_solver_PQueueInitialise(
- PQUEUE *pq,
+ PTQUEUE *pq,
int32 MaxElements
)
{
@@ -53,7 +53,7 @@ void freecell_solver_PQueueInitialise(
returns TRUE if successful, FALSE if fails. (You fail by filling the pqueue.)
PGetRating is a function which returns the rating of the item you're adding for sorting purposes */
-int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r)
+int freecell_solver_PQueuePush( PTQUEUE *pq, void *item, pq_rating_t r)
{
uint32 i;
pq_element_t * Elements = pq->Elements;
@@ -73,7 +73,7 @@ int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r)
i = (++CurrentSize);
- /* while the parent of the space we're putting the new node into is worse than
+ /* while the tqparent of the space we're putting the new node into is worse than
our new node, swap the space with the worse node. We keep doing that until we
get to a worse node or until we get to the top
@@ -82,17 +82,17 @@ int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r)
{
- while( ( i==PQ_FIRST_ENTRY ?
- (PQUEUE_MaxRating) /* return biggest possible rating if first element */
+ while( ( i==PTQ_FIRST_ENTRY ?
+ (PTQUEUE_MaxRating) /* return biggest possible rating if first element */
:
- (PGetRating(Elements[ PQ_PARENT_INDEX(i) ]) )
+ (PGetRating(Elements[ PTQ_PARENT_INDEX(i) ]) )
)
< r
)
{
- Elements[ i ] = Elements[ PQ_PARENT_INDEX(i) ];
+ Elements[ i ] = Elements[ PTQ_PARENT_INDEX(i) ];
- i = PQ_PARENT_INDEX(i);
+ i = PTQ_PARENT_INDEX(i);
}
}
@@ -110,14 +110,14 @@ int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r)
#define PQueueIsEmpty(pq) ((pq)->CurrentSize == 0)
/* free up memory for pqueue */
-void freecell_solver_PQueueFree( PQUEUE *pq )
+void freecell_solver_PQueueFree( PTQUEUE *pq )
{
free( pq->Elements );
}
/* remove the first node from the pqueue and provide a pointer to it */
-void *freecell_solver_PQueuePop( PQUEUE *pq)
+void *freecell_solver_PQueuePop( PTQUEUE *pq)
{
int32 i;
int32 child;
@@ -132,7 +132,7 @@ void *freecell_solver_PQueuePop( PQUEUE *pq)
return NULL;
}
- pMaxElement = Elements[PQ_FIRST_ENTRY];
+ pMaxElement = Elements[PTQ_FIRST_ENTRY];
/* get pointer to last element in tree */
pLastElement = Elements[ CurrentSize-- ];
@@ -143,9 +143,9 @@ void *freecell_solver_PQueuePop( PQUEUE *pq)
/* UNTESTED */
- for( i=PQ_FIRST_ENTRY; (child = PQ_LEFT_CHILD_INDEX(i)) <= CurrentSize; i=child )
+ for( i=PTQ_FIRST_ENTRY; (child = PTQ_LEFT_CHILD_INDEX(i)) <= CurrentSize; i=child )
{
- /* set child to the smaller of the two children... */
+ /* set child to the smaller of the two tqchildren... */
if( (child != CurrentSize) &&
(PGetRating(Elements[child + 1]) > PGetRating(Elements[child])) )