git » fp-git.git » commit 0612e4e

tested for high priority

author ecalot
2006-06-13 23:11:06 UTC
committer ecalot
2006-06-13 23:11:06 UTC
parent 2b4780af6bb8cab4c3c2aa92fcee9067d36fee08

tested for high priority

PR/src/lib/layers/pallist.c +8 -5

diff --git a/PR/src/lib/layers/pallist.c b/PR/src/lib/layers/pallist.c
index 48c3f09..c3f344c 100644
--- a/PR/src/lib/layers/pallist.c
+++ b/PR/src/lib/layers/pallist.c
@@ -130,10 +130,13 @@ int pl_add(tPL* pl, tObject* o, tResourceId resid, tPriority p) {
 tObject* pl_get(tPL* pl, int* priorityRight, int colors) {
 	tPL_Node* node;
 				
+	*priorityRight=1;
 	if (pl->priority_field.object) {
-		*priorityRight=(colors<=paletteGetColors(*pl->priority_field.object));
-		 /* true iif the object palette has more colors than the given variable */
-		return pl->priority_field.object;
+		if (colors<=paletteGetColors(*pl->priority_field.object)) {
+			return pl->priority_field.object;
+		} else {
+			*priorityRight=0;
+		}
 	}
 
 	node=pl->list_first;
@@ -141,7 +144,6 @@ tObject* pl_get(tPL* pl, int* priorityRight, int colors) {
 	while (node && colors>paletteGetColors(*node->object))
 		node=node->next;
 	
-	*priorityRight=1;
 	return node?node->object:NULL;
 }
 
@@ -163,7 +165,8 @@ int main(int a,char** b) {
 	pl_add(&pl, tests, ress[0], lowPriority);
 	pl_add(&pl, tests+1, ress[1], lowPriority);
 	pl_add(&pl, tests, ress[0], lowPriority);
-	pl_add(&pl, tests+2, ress[1], lowPriority);
+	pl_add(&pl, tests, ress[1], highPriority);
+	pl_add(&pl, tests+2, ress[0], highPriority);
 
 	{
 		tPL_Node* nodo=pl.list_first;