ivanforum ivanforum
Forum for Iter Vehemens ad Necem
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   fchat fChat   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bug in the Code

 
Post new topic   Reply to topic    ivanforum Forum Index -> Trouble Shooting and Bugs
View previous topic :: View next topic  
Author Message
TheFallenOne222
gibberling


Joined: 03 Apr 2005
Posts: 166

PostPosted: Tue Apr 05, 2005 11:49 pm    Post subject: Bug in the Code Reply with quote

This has probably already been caught for next version, but I figured I'd post it anyways.

This code:

Code:
int blinkdog::TakeHit(character* Enemy, item* Weapon, bodypart* EnemyBodyPart, v2 HitPos, double Damage, double ToHitValue, int Success, int Type, int Direction, truth Critical, truth ForceHit)
{
  int Return = nonhumanoid::TakeHit(Enemy, Weapon, EnemyBodyPart, HitPos, Damage, ToHitValue, Success, Type, Direction, Critical, ForceHit);

  if(Return != HAS_DIED)
  {
    if(!(RAND() & 15) && SummonFriend())
      return Return;

    if((RAND() & 1 && StateIsActivated(PANIC))
       || (!(RAND() & 3) && IsInBadCondition())
       || !(RAND() & 15));
    MonsterTeleport("terrified yelp");
  }

  return Return;
}


has an empty control statement in the middle of it, which doesn't look like the intent.

Here's the problem:

Code:
    if((RAND() & 1 && StateIsActivated(PANIC))
       || (!(RAND() & 3) && IsInBadCondition())
       || !(RAND() & 15));
    MonsterTeleport("terrified yelp");


It should be:

Code:
    if((RAND() & 1 && StateIsActivated(PANIC))
       || (!(RAND() & 3) && IsInBadCondition())
       || !(RAND() & 15))
    MonsterTeleport("terrified yelp");
Back to top
View user's profile Send private message
Skavian
large spider


Joined: 16 Feb 2005
Posts: 33
Location: Keene, NH

PostPosted: Wed Apr 06, 2005 12:58 am    Post subject: Reply with quote

Crazy coders. I looked at your problem very hard, and tried to come up with a reason why it might cause something or another to explode in the game. All I can think of is that it might punctuate and connect two independent clauses, but that might just be the English student speaking in me.
_________________
Elvis vomited himself to death while unconscious in underwater tunnel level 2.
Back to top
View user's profile Send private message AIM Address
TheFallenOne222
gibberling


Joined: 03 Apr 2005
Posts: 166

PostPosted: Wed Apr 06, 2005 1:08 am    Post subject: Reply with quote

Skavian wrote:
Crazy coders. I looked at your problem very hard, and tried to come up with a reason why it might cause something or another to explode in the game. All I can think of is that it might punctuate and connect two independent clauses, but that might just be the English student speaking in me.


lol, well, the only difference in what is actually there and what should be there is the additional ; in the original code. In C++, that's essentially an "end of statement" character, so what it's doing is it's saying in the original code:

If <stuff> then do nothing.
MonsterTeleport('terrified yelp");

When it should be saying this:

If <stuff> then MonsterTeleport("terrified yelp");

So essentially it's not even checking to see if the monster should be teleporting, it is just teleporting it whenever it gets hit.
Back to top
View user's profile Send private message
Atomic
archangel


Joined: 12 Jan 2005
Posts: 1442
Location: In the fire

PostPosted: Wed Apr 06, 2005 2:14 am    Post subject: Reply with quote

Is IVAN done in C or C++?
_________________
"Also, I'm the only person I know capable of a pelvic pary and riposte." -- Squashmonster

I moderate in red.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
TheFallenOne222
gibberling


Joined: 03 Apr 2005
Posts: 166

PostPosted: Wed Apr 06, 2005 2:18 am    Post subject: Reply with quote

Atomic wrote:
Is IVAN done in C or C++?


Hmm, looks like C++...
Back to top
View user's profile Send private message
hexi
Party Vice Chairman


Joined: 04 Jan 2005
Posts: 74

PostPosted: Wed Apr 06, 2005 8:17 am    Post subject: Reply with quote

Kind of funny how well the blink dogs behave even with our buggy code Smile

Thanks for the report!
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    ivanforum Forum Index -> Trouble Shooting and Bugs All times are GMT


Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group