mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Fix bug with destroy(moving)
/destroy(disappear)
This commit fixes an obscure bug with `destroy(moving)` and `destroy(disappear)` where, when looping through entities, the code doesn't actually check what the entity is before trying to destroy the block underneath it. To fix this, we just put the block-destroying code *inside* of the check, instead of being outside of it. I also fixed the code style because it was horrible.
This commit is contained in:
parent
5b2fbeb6b4
commit
bcc302bcc2
1 changed files with 38 additions and 15 deletions
|
@ -268,25 +268,48 @@ void scriptclass::run(void)
|
|||
}
|
||||
if (words[0] == "destroy")
|
||||
{
|
||||
if(words[1]=="gravitylines"){
|
||||
for(size_t edi=0; edi<obj.entities.size(); edi++){
|
||||
if(obj.entities[edi].type==9) obj.disableentity(edi);
|
||||
if(obj.entities[edi].type==10) obj.disableentity(edi);
|
||||
if (words[1] == "gravitylines")
|
||||
{
|
||||
for (size_t edi = 0; edi < obj.entities.size(); edi++)
|
||||
{
|
||||
if (obj.entities[edi].type == 9 || obj.entities[edi].type == 10)
|
||||
{
|
||||
obj.disableentity(edi);
|
||||
}
|
||||
}else if(words[1]=="warptokens"){
|
||||
for(size_t edi=0; edi<obj.entities.size(); edi++){
|
||||
if(obj.entities[edi].type==11) obj.disableentity(edi);
|
||||
}
|
||||
}else if(words[1]=="platforms"||words[1]=="moving"){
|
||||
bool fixed=words[1]=="moving";
|
||||
for(size_t edi=0; edi<obj.entities.size(); edi++){
|
||||
if(fixed) obj.disableblockat(obj.entities[edi].xp, obj.entities[edi].yp);
|
||||
if(obj.entities[edi].rule==2 && obj.entities[edi].animate==100) obj.disableentity(edi);
|
||||
}
|
||||
}else if(words[1]=="disappear"){
|
||||
for(size_t edi=0; edi<obj.entities.size(); edi++){
|
||||
else if (words[1] == "warptokens")
|
||||
{
|
||||
for (size_t edi = 0; edi < obj.entities.size(); edi++) {
|
||||
if (obj.entities[edi].type == 11)
|
||||
{
|
||||
obj.disableentity(edi);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (words[1] == "platforms" || words[1] == "moving")
|
||||
{
|
||||
for (size_t edi = 0; edi < obj.entities.size(); edi++)
|
||||
{
|
||||
if (obj.entities[edi].rule == 2 && obj.entities[edi].animate == 100)
|
||||
{
|
||||
if (words[1] == "moving")
|
||||
{
|
||||
obj.disableblockat(obj.entities[edi].xp, obj.entities[edi].yp);
|
||||
if(obj.entities[edi].type==2 && obj.entities[edi].rule==3) obj.disableentity(edi);
|
||||
}
|
||||
obj.disableentity(edi);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (words[1] == "disappear")
|
||||
{
|
||||
for (size_t edi = 0; edi < obj.entities.size(); edi++)
|
||||
{
|
||||
obj.disableblockat(obj.entities[edi].xp, obj.entities[edi].yp);
|
||||
if (obj.entities[edi].type == 2 && obj.entities[edi].rule == 3)
|
||||
{
|
||||
obj.disableentity(edi);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue