1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2025-01-11 03:19:46 +01:00

De-duplicate say/reply line adding code

I found it patently ridiculous that `i++; add(customscript[i]);` was
copy-pasted four separate times. Well, at least it's only copy-pasted
twice now.
This commit is contained in:
Misa 2020-05-27 00:03:02 -07:00 committed by Ethan Lee
parent 79d55baf6d
commit ff6cc1a777

View file

@ -3792,11 +3792,8 @@ void scriptclass::loadcustom(std::string t)
break; break;
} }
int ti=atoi(words[1].c_str()); int ti=atoi(words[1].c_str());
if(ti>=0 && ti<=50){ int nti = ti>=0 && ti<=50 ? ti : 1;
for(int ti2=0; ti2<ti; ti2++){ for(int ti2=0; ti2<nti; ti2++){
i++; add(customscript[i]);
}
}else{
i++; add(customscript[i]); i++; add(customscript[i]);
} }
@ -3817,11 +3814,8 @@ void scriptclass::loadcustom(std::string t)
add("text(cyan,0,0,"+words[1]+")"); add("text(cyan,0,0,"+words[1]+")");
int ti=atoi(words[1].c_str()); int ti=atoi(words[1].c_str());
if(ti>=0 && ti<=50){ int nti = ti>=0 && ti<=50 ? ti : 1;
for(int ti2=0; ti2<ti; ti2++){ for(int ti2=0; ti2<nti; ti2++){
i++; add(customscript[i]);
}
}else{
i++; add(customscript[i]); i++; add(customscript[i]);
} }
add("position(player,above)"); add("position(player,above)");