1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

De-duplicate 'ed.numcrewmates() - game.crewmates()'

Any decent compiler will optimize this so that it's still only two
function calls (or it gets inlined). However, it's still not very
readable, so I've assigned the result to a variable and used that
instead.
This commit is contained in:
Misa 2020-06-20 19:29:50 -07:00 committed by Ethan Lee
parent 8a110ead34
commit b66d303540

View file

@ -1970,10 +1970,12 @@ void maprender()
graphics.Print( -1, FLIP(110), meta.Desc2, 196, 196, 255 - help.glow, true);
graphics.Print( -1, FLIP(120), meta.Desc3, 196, 196, 255 - help.glow, true);
if(ed.numcrewmates()-game.crewmates()==1){
graphics.Print(1,FLIP(165), help.number(ed.numcrewmates()-game.crewmates())+ " crewmate remains", 196, 196, 255 - help.glow, true);
}else if(ed.numcrewmates()-game.crewmates()>0){
graphics.Print(1,FLIP(165), help.number(ed.numcrewmates()-game.crewmates())+ " crewmates remain", 196, 196, 255 - help.glow, true);
int remaining = ed.numcrewmates() - game.crewmates();
if(remaining==1){
graphics.Print(1,FLIP(165), help.number(remaining)+ " crewmate remains", 196, 196, 255 - help.glow, true);
}else if(remaining>0){
graphics.Print(1,FLIP(165), help.number(remaining)+ " crewmates remain", 196, 196, 255 - help.glow, true);
}
}
#endif