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

Prevent the game from thinking horizontal warp lines are cyan crewmates (#87)

* Add entity type attribute checks to getcrewman()

This means that the game is no longer able to target other non-crewmate
entities when it looks for a crewmate.

This has actually happened in practice. A command like
position(cyan,above) could position the text box above a horizontal warp
line instead of the intended crewmate.

This is because getcrewman() previously only checked the rule attributes
of entities, and if their rule happened to be 6 or 7. Usually this
corresponds with crewmates being unflipped or flipped, respectively.

But warp lines' rules overlap with rules 6 and 7. If a warp line is
vertical, its rule is 5, and if it is horizontal, its rule is 7.

Now, usually, this wouldn't be an issue, but getcrewman() does a color
check as well. And for cyan, that is color 0. However, if an entity
doesn't use a color, it just defaults to color 0. So, getcrewman() found
an entity with a rule of 7 and a color of 0. This must mean it's a cyan
crewmate! But, well, it's actually just a horizontal warp line.

This commit prevents the above from happening.
This commit is contained in:
Info Teddy 2020-01-15 20:55:53 -08:00 committed by Ethan Lee
parent 37a1482bb3
commit 4e952450d5

View file

@ -4381,7 +4381,8 @@ int entityclass::getcrewman( int t )
for (int i = 0; i < nentity; i++)
{
if (entities[i].rule == 6 || entities[i].rule == 7)
if ((entities[i].type == 12 || entities[i].type == 14)
&& (entities[i].rule == 6 || entities[i].rule == 7))
{
if(entities[i].colour==t)
{