Index: trunk/src/obj_arc.h =================================================================== --- trunk/src/obj_arc.h (revision 7775) +++ trunk/src/obj_arc.h (revision 7776) @@ -96,7 +96,7 @@ #define PCB_ARC_ALL_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l =0; l < pcb_max_layer; l++, layer++) \ + for (l =0; l < (top)->LayerN; l++, layer++) \ { \ PCB_ARC_LOOP(layer) @@ -103,7 +103,7 @@ #define PCB_ARC_COPPER_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l =0; l < pcb_max_layer; l++, layer++) \ + for (l =0; l < (top)->LayerN; l++, layer++) \ { \ if (!(pcb_layer_flags(l) & PCB_LYT_COPPER)) continue; \ PCB_ARC_LOOP(layer) @@ -111,7 +111,7 @@ #define PCB_ARC_SILK_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ if (!(pcb_layer_flags(l) & PCB_LYT_SILK)) continue; \ PCB_ARC_LOOP(layer) @@ -119,7 +119,7 @@ #define PCB_ARC_VISIBLE_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ if (layer->On) \ PCB_ARC_LOOP(layer) Index: trunk/src/obj_line.h =================================================================== --- trunk/src/obj_line.h (revision 7775) +++ trunk/src/obj_line.h (revision 7776) @@ -99,7 +99,7 @@ #define PCB_LINE_ALL_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ PCB_LINE_LOOP(layer) @@ -106,7 +106,7 @@ #define PCB_LINE_COPPER_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ if (!(pcb_layer_flags(l) & PCB_LYT_COPPER)) continue; \ PCB_LINE_LOOP(layer) @@ -114,7 +114,7 @@ #define PCB_LINE_SILK_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ if (!(pcb_layer_flags(l) & PCB_LYT_SILK)) continue; \ PCB_LINE_LOOP(layer) @@ -122,7 +122,7 @@ #define PCB_LINE_VISIBLE_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ if (layer->On) \ PCB_LINE_LOOP(layer) Index: trunk/src/obj_poly.h =================================================================== --- trunk/src/obj_poly.h (revision 7775) +++ trunk/src/obj_poly.h (revision 7776) @@ -89,7 +89,7 @@ #define PCB_POLY_ALL_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ PCB_POLY_LOOP(layer) @@ -96,7 +96,7 @@ #define PCB_POLY_COPPER_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ if (!(pcb_layer_flags(l) & PCB_LYT_COPPER)) continue; \ PCB_POLY_LOOP(layer) @@ -104,7 +104,7 @@ #define PCB_POLY_SILK_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ if (!(pcb_layer_flags(l) & PCB_LYT_SILK)) continue; \ PCB_POLY_LOOP(layer) @@ -112,7 +112,7 @@ #define PCB_POLY_VISIBLE_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ if (layer->On) \ PCB_POLY_LOOP(layer) Index: trunk/src/obj_text.h =================================================================== --- trunk/src/obj_text.h (revision 7775) +++ trunk/src/obj_text.h (revision 7776) @@ -82,7 +82,7 @@ #define PCB_TEXT_ALL_LOOP(top) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (top)->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (top)->LayerN; l++, layer++) \ { \ PCB_TEXT_LOOP(layer) @@ -89,7 +89,7 @@ #define PCB_TEXT_VISIBLE_LOOP(board) do { \ pcb_cardinal_t l; \ pcb_layer_t *layer = (board)->Data->Layer; \ - for (l = 0; l < pcb_max_layer; l++, layer++) \ + for (l = 0; l < (board)->Data->LayerN; l++, layer++) \ { \ PCB_TEXT_LOOP(layer); \ if (pcb_text_is_visible((board), layer, text))