 |
ivanforum Forum for Iter Vehemens ad Necem
|
| View previous topic :: View next topic |
| Author |
Message |
TheFallenOne222 gibberling
Joined: 03 Apr 2005 Posts: 166
|
Posted: Tue Apr 05, 2005 11:49 pm Post subject: Bug in the Code |
|
|
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 |
|
 |
Skavian large spider
Joined: 16 Feb 2005 Posts: 33 Location: Keene, NH
|
Posted: Wed Apr 06, 2005 12:58 am Post subject: |
|
|
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 |
|
 |
TheFallenOne222 gibberling
Joined: 03 Apr 2005 Posts: 166
|
Posted: Wed Apr 06, 2005 1:08 am Post subject: |
|
|
| 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 |
|
 |
Atomic archangel

Joined: 12 Jan 2005 Posts: 1442 Location: In the fire
|
Posted: Wed Apr 06, 2005 2:14 am Post subject: |
|
|
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 |
|
 |
TheFallenOne222 gibberling
Joined: 03 Apr 2005 Posts: 166
|
Posted: Wed Apr 06, 2005 2:18 am Post subject: |
|
|
| Atomic wrote: |
| Is IVAN done in C or C++? |
Hmm, looks like C++... |
|
| Back to top |
|
 |
hexi Party Vice Chairman

Joined: 04 Jan 2005 Posts: 74
|
Posted: Wed Apr 06, 2005 8:17 am Post subject: |
|
|
Kind of funny how well the blink dogs behave even with our buggy code
Thanks for the report! |
|
| Back to top |
|
 |
|
|
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
|