1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 14:38:30 +02: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;
}
int ti=atoi(words[1].c_str());
if(ti>=0 && ti<=50){
for(int ti2=0; ti2<ti; ti2++){
i++; add(customscript[i]);
}
}else{
int nti = ti>=0 && ti<=50 ? ti : 1;
for(int ti2=0; ti2<nti; ti2++){
i++; add(customscript[i]);
}
@ -3817,11 +3814,8 @@ void scriptclass::loadcustom(std::string t)
add("text(cyan,0,0,"+words[1]+")");
int ti=atoi(words[1].c_str());
if(ti>=0 && ti<=50){
for(int ti2=0; ti2<ti; ti2++){
i++; add(customscript[i]);
}
}else{
int nti = ti>=0 && ti<=50 ? ti : 1;
for(int ti2=0; ti2<nti; ti2++){
i++; add(customscript[i]);
}
add("position(player,above)");