4,10d3
< #include "list.h"
< #include "defs.h"
< #include "func.h"
< #include "regen.h"
< #include "report.h"
< #include "road.h"
< #include "report.h"
12,13c5,16
< void
< derive_percentage_target(int period) {
---
> #include "harvest.h"
> 
> #include "hash.h"
> 
> //#include "list.h"
> //#include "defs.h"
> //#include "func.h"
> //#include "regen.h"
> //#include "report.h"
> //#include "road.h"
> 
> void derive_percentage_target(int period) {
16c19
< 	CLASS	*class;
---
> 	TIMBER_CLASS	*timber_class;
33,37c36,40
< 				class = (CLASS *)list_next(au->classlist);
< 				while (class!=NULL) {
< 					if (class->class_type==OPERABLE) {
< 						vph=func_vph(class->parent_au->table, class->age);
< 						TotalGS += class->area*vph;
---
> 				timber_class = (TIMBER_CLASS *)list_next(au->classlist);
> 				while (timber_class!=NULL) {
> 					if (timber_class->class_type==OPERABLE) {
> 						vph=func_vph(timber_class->parent_au->table, timber_class->age);
> 						TotalGS += timber_class->area*vph;
39c42
< 					class = (CLASS *)list_next(au->classlist);
---
> 					timber_class = (TIMBER_CLASS *)list_next(au->classlist);
55,56c58
< void
< harvest_update_activity(CLASS *class, double harea, double vph, int period) {
---
> void harvest_update_activity(TIMBER_CLASS *timber_class, double harea, double vph, int period) {
61c63
< 	if (class->class_type==INACTIVE) return;
---
> 	if (timber_class->class_type==INACTIVE) return;
72,73c74,75
< 	class->parent_zone->achieved->volume += hvol;
< 	class->parent_zone->achieved->area += harea;
---
> 	timber_class->parent_zone->achieved->volume += hvol;
> 	timber_class->parent_zone->achieved->area += harea;
75,76c77,78
< 	class->floatgrouplist = (LIST_PTR *)list_reset(class->floatgrouplist);
< 	group = (GROUP *)list_next(class->floatgrouplist);
---
> 	timber_class->floatgrouplist = (LIST_PTR *)list_reset(timber_class->floatgrouplist);
> 	group = (GROUP *)list_next(timber_class->floatgrouplist);
84c86
< 			ad = (AGEDIST *)list_find(group->achieved->AgeDist, class->age);
---
> 			ad = (AGEDIST *)list_find(group->achieved->AgeDist, timber_class->age);
91,92c93,94
< 				ad->age = class->age;
< 				ad->width = class->width;
---
> 				ad->age = timber_class->age;
> 				ad->width = timber_class->width;
97c99
< 			if ( ad->width != class->width ) {
---
> 			if ( ad->width != timber_class->width ) {
103,104c105,106
< 				ad->age = class->age;
< 				ad->width = class->width;
---
> 				ad->age = timber_class->age;
> 				ad->width = timber_class->width;
112c114
< 		group = (GROUP *)list_next(class->floatgrouplist);
---
> 		group = (GROUP *)list_next(timber_class->floatgrouplist);
115,116c117,118
< 	class->staticgrouplist = (LIST_PTR *)list_reset(class->staticgrouplist);
< 	group = (GROUP *)list_next(class->staticgrouplist);
---
> 	timber_class->staticgrouplist = (LIST_PTR *)list_reset(timber_class->staticgrouplist);
> 	group = (GROUP *)list_next(timber_class->staticgrouplist);
124c126
< 			ad = (AGEDIST *)list_find(group->achieved->AgeDist, class->age);
---
> 			ad = (AGEDIST *)list_find(group->achieved->AgeDist, timber_class->age);
131,132c133,134
< 				ad->age = class->age;
< 				ad->width = class->width;
---
> 				ad->age = timber_class->age;
> 				ad->width = timber_class->width;
137c139
< 			if ( ad->width != class->width ) {
---
> 			if ( ad->width != timber_class->width ) {
143,144c145,146
< 				ad->age = class->age;
< 				ad->width = class->width;
---
> 				ad->age = timber_class->age;
> 				ad->width = timber_class->width;
152c154
< 		group = (GROUP *)list_next(class->staticgrouplist);
---
> 		group = (GROUP *)list_next(timber_class->staticgrouplist);
156,159c158,162
< static double
< harvest_adjacency(CLASS *class, int period) {
< 	if (class->parent_block->AdjacencyDelay > period_length[period]) return(0.0);
< 	return(class->MerchArea);
---
> // extern inline
> static double harvest_adjacency(TIMBER_CLASS *timber_class, int period)
> {
> 	if (timber_class->parent_block->AdjacencyDelay > period_length[period]) return(0.0);
> 	return(timber_class->MerchArea);
162,163c165,166
< static double
< harvest_volume_shortfall(CLASS *class, double vph, int period) {
---
> 
> static double harvest_volume_shortfall(TIMBER_CLASS *timber_class, double vph, int period) {
167c170
< 	if (class->class_type==INACTIVE) {
---
> 	if (timber_class->class_type==INACTIVE) {
184,185c187,188
< 	if ( (class->parent_zone->target!=NULL) &&
< 	     (func_compare_float(class->parent_zone->target->max_volume[period],DUMMYINPUT)==TRUE) ) {
---
> 	if ( (timber_class->parent_zone->target!=NULL) &&
> 	     (func_compare_float(timber_class->parent_zone->target->max_volume[period],DUMMYINPUT)==TRUE) ) {
188,190c191,193
< 	} else if ( (class->parent_zone->target!=NULL) &&
< 		    (func_compare_float(class->parent_zone->target->max_volume[period],DUMMYINPUT)!=TRUE) ) {
< 		tmp = (double)class->parent_zone->target->max_volume[period] - class->parent_zone->achieved->volume;
---
> 	} else if ( (timber_class->parent_zone->target!=NULL) &&
> 		    (func_compare_float(timber_class->parent_zone->target->max_volume[period],DUMMYINPUT)!=TRUE) ) {
> 		tmp = (double)timber_class->parent_zone->target->max_volume[period] - timber_class->parent_zone->achieved->volume;
198,199c201,202
< 	class->floatgrouplist = (LIST_PTR *)list_reset(class->floatgrouplist);
< 	group = (GROUP *)list_next(class->floatgrouplist);
---
> 	timber_class->floatgrouplist = (LIST_PTR *)list_reset(timber_class->floatgrouplist);
> 	group = (GROUP *)list_next(timber_class->floatgrouplist);
213c216
< 		group = (GROUP *)list_next(class->floatgrouplist);
---
> 		group = (GROUP *)list_next(timber_class->floatgrouplist);
215,216c218,219
< 	class->staticgrouplist = (LIST_PTR *)list_reset(class->staticgrouplist);
< 	group = (GROUP *)list_next(class->staticgrouplist);
---
> 	timber_class->staticgrouplist = (LIST_PTR *)list_reset(timber_class->staticgrouplist);
> 	group = (GROUP *)list_next(timber_class->staticgrouplist);
229c232
< 		group = (GROUP *)list_next(class->staticgrouplist);
---
> 		group = (GROUP *)list_next(timber_class->staticgrouplist);
233,234c236,237
< 	if (result > class->MerchArea) {
< 		result = class->MerchArea;
---
> 	if (result > timber_class->MerchArea) {
> 		result = timber_class->MerchArea;
239,240c242
< static double
< harvest_area_shortfall(CLASS *class, int period) {
---
> static double harvest_area_shortfall(TIMBER_CLASS *timber_class, int period) {
244c246
< 	if (class->class_type==INACTIVE) return(0.0);
---
> 	if (timber_class->class_type==INACTIVE) return(0.0);
258,259c260,261
< 	if ( (class->parent_zone->target!=NULL) &&
< 	     (func_compare_float(class->parent_zone->target->max_area[period],DUMMYINPUT)==TRUE) ) {
---
> 	if ( (timber_class->parent_zone->target!=NULL) &&
> 	     (func_compare_float(timber_class->parent_zone->target->max_area[period],DUMMYINPUT)==TRUE) ) {
262,264c264,266
< 	} else if ( (class->parent_zone->target!=NULL) &&
< 		    (func_compare_float(class->parent_zone->target->max_area[period],DUMMYINPUT)!=TRUE) ) {
< 		tmp = (double)class->parent_zone->target->max_area[period] - class->parent_zone->achieved->area;
---
> 	} else if ( (timber_class->parent_zone->target!=NULL) &&
> 		    (func_compare_float(timber_class->parent_zone->target->max_area[period],DUMMYINPUT)!=TRUE) ) {
> 		tmp = (double)timber_class->parent_zone->target->max_area[period] - timber_class->parent_zone->achieved->area;
272,273c274,275
< 	class->floatgrouplist = (LIST_PTR *)list_reset(class->floatgrouplist);
< 	group = (GROUP *)list_next(class->floatgrouplist);
---
> 	timber_class->floatgrouplist = (LIST_PTR *)list_reset(timber_class->floatgrouplist);
> 	group = (GROUP *)list_next(timber_class->floatgrouplist);
288c290
< 		group = (GROUP *)list_next(class->floatgrouplist);
---
> 		group = (GROUP *)list_next(timber_class->floatgrouplist);
290,291c292,293
< 	class->staticgrouplist = (LIST_PTR *)list_reset(class->staticgrouplist);
< 	group = (GROUP *)list_next(class->staticgrouplist);
---
> 	timber_class->staticgrouplist = (LIST_PTR *)list_reset(timber_class->staticgrouplist);
> 	group = (GROUP *)list_next(timber_class->staticgrouplist);
306c308
< 		group = (GROUP *)list_next(class->staticgrouplist);
---
> 		group = (GROUP *)list_next(timber_class->staticgrouplist);
308c310
< 	if (shortfall>class->MerchArea) shortfall=class->MerchArea;
---
> 	if (shortfall>timber_class->MerchArea) shortfall=timber_class->MerchArea;
311a314
> // extern inlined
313c316
< calculate_green_up(AXSDEF *axs, CLASS *class, int period) {
---
> calculate_green_up(AXSDEF *axs, TIMBER_CLASS *timber_class, int period) {
317c320
< 		tmp = class->MerchArea;
---
> 		tmp = timber_class->MerchArea;
320,323d322
<         /*printf("\nBaseArea (calculate_green_up): %f", axs->BaseArea);
<         printf("\nPercent: %f", axs->Percent);
<         printf("\nAgeArea: %x", axs->AgeArea);
<         printf("\nAge: %d", axs->Age);*/
328,329c327
< static void
< debug_display_agearea(AXSDEF *axs, char *where) {
---
> static void debug_display_agearea(AXSDEF *axs, char *where) {
341c339
< calculate_old_growth(AXSDEF *axs, CLASS *class, int period) {
---
> calculate_old_growth(AXSDEF *axs, TIMBER_CLASS *timber_class, int period) {
346c344
< 	areaabove = func_area_ge(axs->AgeArea, axs->NumAgeAreaElements, class->age-class->width+1, period);
---
> 	areaabove = func_area_ge(axs->AgeArea, axs->NumAgeAreaElements, timber_class->age-timber_class->width+1, period);
357c355
< harvest_constraints(CLASS *class, int period) {
---
> harvest_constraints(TIMBER_CLASS *timber_class, int period) {
362c360
< 	if (class->class_type==INACTIVE) {
---
> 	if (timber_class->class_type==INACTIVE) {
366c364
< 	result = class->MerchArea;
---
> 	result = timber_class->MerchArea;
368,370c366,368
< 	if (class->parent_zone->axslist != NULL) {
< 		class->parent_zone->axslist = (LIST_PTR *)list_reset(class->parent_zone->axslist);
< 		axs = (AXSDEF *)list_next(class->parent_zone->axslist);
---
> 	if (timber_class->parent_zone->axslist != NULL) {
> 		timber_class->parent_zone->axslist = (LIST_PTR *)list_reset(timber_class->parent_zone->axslist);
> 		axs = (AXSDEF *)list_next(timber_class->parent_zone->axslist);
375c373
< 						tmp = calculate_green_up(axs, class, period);
---
> 						tmp = calculate_green_up(axs, timber_class, period);
390c388
< 						tmp = calculate_old_growth(axs, class, period);
---
> 						tmp = calculate_old_growth(axs, timber_class, period);
408c406
< 			axs = (AXSDEF *)list_next(class->parent_zone->axslist);
---
> 			axs = (AXSDEF *)list_next(timber_class->parent_zone->axslist);
411,412c409,410
< 	class->floatgrouplist = (LIST_PTR *)list_reset(class->floatgrouplist);
< 	group = (GROUP *)list_next(class->floatgrouplist);
---
> 	timber_class->floatgrouplist = (LIST_PTR *)list_reset(timber_class->floatgrouplist);
> 	group = (GROUP *)list_next(timber_class->floatgrouplist);
417,418c415,416
<             /*printf("\nparent_zone->id (harvest_constraints): %d", class->parent_zone->id);
<             printf("\nparent_au->id (harvest_constraints): %d", class->parent_au->id);
---
>             /*printf("\nparent_zone->id (harvest_constraints): %d", timber_class->parent_zone->id);
>             printf("\nparent_au->id (harvest_constraints): %d", timber_class->parent_au->id);
431c429
< 							tmp = calculate_green_up(axs, class, period);
---
> 							tmp = calculate_green_up(axs, timber_class, period);
444c442
< 							tmp = calculate_old_growth(axs, class, period);
---
> 							tmp = calculate_old_growth(axs, timber_class, period);
462c460
< 		group = (GROUP *)list_next(class->floatgrouplist);
---
> 		group = (GROUP *)list_next(timber_class->floatgrouplist);
464,465c462,463
< 	class->staticgrouplist = (LIST_PTR *)list_reset(class->staticgrouplist);
< 	group = (GROUP *)list_next(class->staticgrouplist);
---
> 	timber_class->staticgrouplist = (LIST_PTR *)list_reset(timber_class->staticgrouplist);
> 	group = (GROUP *)list_next(timber_class->staticgrouplist);
474c472
< 							tmp = calculate_green_up(axs, class, period);
---
> 							tmp = calculate_green_up(axs, timber_class, period);
486c484
< 							tmp = calculate_old_growth(axs, class, period);
---
> 							tmp = calculate_old_growth(axs, timber_class, period);
504c502
< 		group = (GROUP *)list_next(class->staticgrouplist);
---
> 		group = (GROUP *)list_next(timber_class->staticgrouplist);
510,511c508
< void
< harvest(int period) {
---
> void harvest(int period) {
513c510
< 	CLASS		*class;
---
> 	TIMBER_CLASS		*timber_class;
534,535c531,532
< 		class = (CLASS *)list_next(hashrec->candidates);
< 		while (class != NULL)
---
> 		timber_class = (TIMBER_CLASS *)list_next(hashrec->candidates);
> 		while (timber_class != NULL)
537c534
< 			if (class->class_type != INACTIVE)
---
> 			if (timber_class->class_type != INACTIVE)
541,542c538,539
< 				hadj=class->MerchArea;hvol=hadj;harea=hadj;haxs=hadj;
< 				vph = func_vph_recovered(class);
---
> 				hadj=timber_class->MerchArea;hvol=hadj;harea=hadj;haxs=hadj;
> 				vph = func_vph_recovered(timber_class);
547c544
< 					hadj = harvest_adjacency(class, period);
---
> 					hadj = harvest_adjacency(timber_class, period);
553c550
< 						hvol = harvest_volume_shortfall(class, vph, period);
---
> 						hvol = harvest_volume_shortfall(timber_class, vph, period);
568c565
< 						harea = harvest_area_shortfall(class, period);
---
> 						harea = harvest_area_shortfall(timber_class, period);
580c577
< 						haxs = harvest_constraints(class, period);
---
> 						haxs = harvest_constraints(timber_class, period);
597,602c594,599
< 							class->parent_zone->label,
< 							class->parent_au->label,
< 							class->parent_block->label,
< 							class->age,
< 							class->area,
< 							class->MerchArea,
---
> 							timber_class->parent_zone->label,
> 							timber_class->parent_au->label,
> 							timber_class->parent_block->label,
> 							timber_class->age,
> 							timber_class->area,
> 							timber_class->MerchArea,
608c605
< 							(class->MerchArea-harvest));
---
> 							(timber_class->MerchArea-harvest));
613c610
< 						/* class splitting ENABLED; do not create or leave class area < MinSplitThreshold */
---
> 						/* timber_class splitting ENABLED; do not create or leave timber_class area < MinSplitThreshold */
615c612
< 						   ((class->area-harvest>=MinSplitThreshold)||(class->area-harvest<=ROUND_ERROR)))
---
> 						   ((timber_class->area-harvest>=MinSplitThreshold)||(timber_class->area-harvest<=ROUND_ERROR)))
617,618c614,615
< 							harvest_update_activity(class, harvest, vph, period);
< 							harvest = road_class(class, harvest, period);
---
> 							harvest_update_activity(timber_class, harvest, vph, period);
> 							harvest = road_class(timber_class, harvest, period);
620c617
< 							regen_class(class, harvest, period);
---
> 							regen_class(timber_class, harvest, period);
629,630c626,627
< 						/* class splitting DISABLED */
< 						if (harvest+ROUND_ERROR>=class->area)
---
> 						/* timber_class splitting DISABLED */
> 						if (harvest+ROUND_ERROR>=timber_class->area)
633c630
< 							harvest_update_activity(class, harvest, vph, period);
---
> 							harvest_update_activity(timber_class, harvest, vph, period);
635c632
< 							harvest = road_class(class, harvest, period);
---
> 							harvest = road_class(timber_class, harvest, period);
637c634
< 							regen_class(class, harvest, period);
---
> 							regen_class(timber_class, harvest, period);
641c638
< 							/* class splitting disabled; no harvest */
---
> 							/* timber_class splitting disabled; no harvest */
646c643
< 			class = (CLASS *)list_next(hashrec->candidates);
---
> 			timber_class = (TIMBER_CLASS *)list_next(hashrec->candidates);
