1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-18 15:04:25 +03:00

Ensure that all non-specified values are higher than specified ones

This commit is contained in:
Dannii Willis 2024-05-04 13:20:38 +10:00
parent efcbd8d43a
commit 550b9b49e0

View file

@ -352,6 +352,16 @@ void Instances::make_instances_from_Neptune(void) {
kind_constructor_instance *kci; kind_constructor_instance *kci;
inter_ti current_val = 0; inter_ti current_val = 0;
inter_ti highest_val = 0; inter_ti highest_val = 0;
// First loop to determine the highest specified value
LOOP_OVER_LINKED_LIST(kci, kind_constructor_instance, L) {
if (kci->value_specified) {
current_val = (inter_ti) kci->value;
if (current_val > highest_val) {
highest_val = current_val;
}
}
}
// Then loop to add the values and work out the non-specified ones
LOOP_OVER_LINKED_LIST(kci, kind_constructor_instance, L) { LOOP_OVER_LINKED_LIST(kci, kind_constructor_instance, L) {
wording W = Feeds::feed_text(kci->natural_language_name); wording W = Feeds::feed_text(kci->natural_language_name);
kind *K = Kinds::base_construction(kc); kind *K = Kinds::base_construction(kc);
@ -360,9 +370,6 @@ void Instances::make_instances_from_Neptune(void) {
instance *I = Instances::latest(); instance *I = Instances::latest();
if (kci->value_specified) { if (kci->value_specified) {
current_val = (inter_ti) kci->value; current_val = (inter_ti) kci->value;
if (current_val > highest_val) {
highest_val = current_val;
}
} }
else { else {
highest_val++; highest_val++;