1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-03 03:23:33 +02:00

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:39:51 -08:00
parent 6f8d2dc90b
commit 08c1e43f8a

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)
{