# \[0xB\] Stable crash

**URL:** https://discourse.cataclysmdda.org/t/0xb-stable-crash/8176
**Category:** The Garage
**Created:** [December 3, 2014, 6:05pm UTC](https://discourse.cataclysmdda.org/t/0xb-stable-crash/8176 "2014-12-03T18:05:59Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![EditorRUS](https://avatars.discourse-cdn.com/v4/letter/e/9fc29f/32.png) [@EditorRUS](https://discourse.cataclysmdda.org/u/EditorRUS)
#### Post date: [December 3, 2014, 6:05pm UTC](https://discourse.cataclysmdda.org/t/0xb-stable-crash/8176/1 "2014-12-03T18:05:59Z")

</div>

For some totally weird reasons, when you try to craft an antenna without memorizing the recipe (say, by using AAA guide), the game crashes.  
Stumbled upon in this save: [http://rghost.net/59406313](http://rghost.net/59406313) (most upper-left locker)  
Reproduced in free play. Reasons are unknown by me, I am debugging this stuff now:  
UPD:  
Probably I found this error (crafting.cpp, 1496 line)

if (x\_in\_y(making-\>time, (1000 \* 8 \* (difficulty ^ 4)) /  
(get\_skill\_level(making-\>skill\_used) \* get\_int())))  
You seems to be dividing by NULL (returned by get\_skill\_level as antenna doesn’t use any skill)

---

<div class="post-metadata">

### Author: ![Zireael](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zireael/32/956_2.png) [@Zireael](https://discourse.cataclysmdda.org/u/Zireael)
#### Post date: [December 3, 2014, 6:45pm UTC](https://discourse.cataclysmdda.org/t/0xb-stable-crash/8176/2 "2014-12-03T18:45:34Z")

</div>

Been fixed in experimental.

---

<div class="post-metadata">

### Author: ![EditorRUS](https://avatars.discourse-cdn.com/v4/letter/e/9fc29f/32.png) [@EditorRUS](https://discourse.cataclysmdda.org/u/EditorRUS)
#### Post date: [December 3, 2014, 9:31pm UTC](https://discourse.cataclysmdda.org/t/0xb-stable-crash/8176/3 "2014-12-03T21:31:13Z")

</div>

Where was the error then? I’ve downloaded latest source code and found that the line is not fixed (or it’s not needed to fix).

---

<div class="post-metadata">

### Author: ![KA101](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@KA101](https://discourse.cataclysmdda.org/u/KA101)
#### Post date: [December 3, 2014, 10:55pm UTC](https://discourse.cataclysmdda.org/t/0xb-stable-crash/8176/4 "2014-12-03T22:55:47Z")

</div>

Antenna didn’t have a skill assigned, so presumably the skill check was dividing by 0 or something.

---

<div class="post-metadata">

### Author: ![Coolthulhu](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/coolthulhu/32/2446_2.png) [@Coolthulhu](https://discourse.cataclysmdda.org/u/Coolthulhu)
#### Post date: [December 3, 2014, 11:02pm UTC](https://discourse.cataclysmdda.org/t/0xb-stable-crash/8176/5 "2014-12-03T23:02:05Z")

</div>

> [@EditorRUS](#):
>
> Where was the error then? I’ve downloaded latest source code and found that the line is not fixed (or it’s not needed to fix).

Antenna now uses a skill.

Anyway, I wonder what is the difficulty ^ 4 thing supposed to do.  
Bitwise XOR with 4 will add 4 when difficulty is 0, 1, 2, 3, 8, 9 and 10, but subtract 4 when difficulty is 4, 5, 6 or 7.  
So, 11 first values of difficulty ^ 4 are: 4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15

The comment above it says “worst case is lvl 10 which will take 10^4/10 (1000 minutes)”, which seems to imply the author thought ‘^’ operator means “power” rather than bitwise XOR.

If x\_in\_y wasn’t done on floats, it would probably crash the game when an unknown recipe with difficulty 4 is used. Thanks to floats, x\_in\_y(positive, 0) always returns true.

---

<div class="post-metadata">

### Author: ![EditorRUS](https://avatars.discourse-cdn.com/v4/letter/e/9fc29f/32.png) [@EditorRUS](https://discourse.cataclysmdda.org/u/EditorRUS)
#### Post date: [December 4, 2014, 3:20am UTC](https://discourse.cataclysmdda.org/t/0xb-stable-crash/8176/6 "2014-12-04T03:20:09Z")

</div>

Oh, well.

> Antenna didn't have a skill assigned, so presumably the skill check was dividing by 0 or something.

=\>

> You seems to be dividing by NULL (returned by get\_skill\_level as antenna doesn't use any skill)

> Anyway, I wonder what is the difficulty ^ 4 thing supposed to do.

Didn't except this thing. For me it was POWER operator as well, because that is common meaning of this symbol in programming languages.
