If the only problem is with writing the code for it, given the formulaic nature of the system, couldn't you just write a program to write the long, repeatable part of the script for you? (Write a program to write you program : P )
Lets say you give each resource its own number so a province modifier looks like export_p_1_333 (exporting primary resource 1, grain, to province 333, Rome), couldn't you do something like
for 50 primary resources (this ignores other types of resources, but if you change the value of P to the number of refined resources and change export_p_ to export_r_ etc. you use it again and copy the next load in for refined goods etc.
edit: Obviously if having that many province flags exist at all is a problem this won't solve it, but it should help with the grunt work?
For just one resource type at a time, you could remove the first for loop (and corresponding bracket) and the variables p and P, and change the penultimate fprintf statemant to fprintf(output, " set_province_flag = export_p_grain_%d \n", i); , manually changing the resources one at a time.
Lets say you give each resource its own number so a province modifier looks like export_p_1_333 (exporting primary resource 1, grain, to province 333, Rome), couldn't you do something like
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void) {
int P, p, i, prov_num;
prov_num = 1463;
P = 50;
FILE *output;
output = fopen("output.txt","w");
for(p = 1; p <= P; p++) {
for(i = 1; i <= prov_num; i++) {
fprintf(output, "if = { \n");
fprintf(output, " limit = { \n");
fprintf(output, " ROOT = { \n");
fprintf(output, " province_id = %d \n", i);
fprintf(output, " } \n");
fprintf(output, " } \n");
fprintf(output, " set_province_flag = export_p_%d_%d \n", p, i);
fprintf(output, "} \n");
}
}
fclose(output);
return EXIT_SUCCESS;
}
for 50 primary resources (this ignores other types of resources, but if you change the value of P to the number of refined resources and change export_p_ to export_r_ etc. you use it again and copy the next load in for refined goods etc.
edit: Obviously if having that many province flags exist at all is a problem this won't solve it, but it should help with the grunt work?
For just one resource type at a time, you could remove the first for loop (and corresponding bracket) and the variables p and P, and change the penultimate fprintf statemant to fprintf(output, " set_province_flag = export_p_grain_%d \n", i); , manually changing the resources one at a time.
Last edited: