Revert "Added loop counter per while instead of global. fixes #135"

This reverts commit 59cf6a1fb2.
This commit is contained in:
welcor 2024-09-28 20:05:40 +02:00
parent 59cf6a1fb2
commit e76c603110
2 changed files with 4 additions and 5 deletions

View file

@ -2486,6 +2486,7 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode)
char cmd[MAX_INPUT_LENGTH], *p;
struct script_data *sc = 0;
struct cmdlist_element *temp;
unsigned long loops = 0;
void *go = NULL;
void obj_command_interpreter(obj_data *obj, char *argument);
@ -2577,8 +2578,8 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode)
if (process_if(p + 6, go, sc, trig, type)) {
temp->original = cl;
} else {
cl->loops = 0;
cl = temp;
loops = 0;
}
} else if (!strn_cmp("switch ", p, 7)) {
cl = find_case(trig, cl, go, sc, type, p + 7);
@ -2598,10 +2599,9 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode)
if (cl->original && process_if(orig_cmd + 6, go, sc, trig,
type)) {
cl = cl->original;
cl->loops++;
loops++;
GET_TRIG_LOOPS(trig)++;
if (cl->loops == 30) {
cl->loops = 0;
if (loops == 30) {
process_wait(go, trig, type, "wait 1", cl);
depth--;
return ret_val;

View file

@ -135,7 +135,6 @@ struct cmdlist_element {
char *cmd; /* one line of a trigger */
struct cmdlist_element *original;
struct cmdlist_element *next;
int loops; /* for counting number of runs in a while loop */
};
struct trig_var_data {