Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Practical jokers. Dwarves keep creating slabs for living colleagues.  (Read 1261 times)

Saiko Kila

  • Bay Watcher
  • Dwarven alchemist
    • View Profile

Maybe this is a know bug (though I couldn't find it), but even if so it is funny. I find that memorial engraving is finicky in comparison to some older versions of DF, because it has much less targets, and some obvious targets don't show up on the list.

But recently I got reversal of the situation. My stonecrafters started to engrave slabs for their new colleagues, guys who came with the king. Even a liaison got her memorial slab. I intend to install it in her room, as a memento mori. For some reason only three legendary soldiers and the liaison got the slabs, but it's better than nothing.

The liaison's slab reads "Outpost Liaison of Salves of Chancing 250 to -1". It may be worth noticing that the current year is 255. So it seems value 255 is treated as signed char, hence -1. But I prefer to believe that my dwarves are practical jokers, and just want to make some cheap laughs at the expense of newcomers.
Logged

BoredVirulence

  • Bay Watcher
    • View Profile
Re: Practical jokers. Dwarves keep creating slabs for living colleagues.
« Reply #1 on: March 28, 2015, 05:35:59 pm »

That's one young liaison...

I'm not particularly familiar with the difference between unsigned and signed char, but I can't see why 0xFF would represent -1 rather than, say, -127, when it would represent 255 when unsigned. I would rather see -1 as a potential error thrown. Totally right, 0xFF in a signed char is -1, I'll have to review the actual encoding. Returning special values as an error code is common in C and C++, and throwing exceptions fairly uncommon.


Although I'm assuming -1 indicates an error that wasn't properly caught, I do find it difficult to consider the year 255 as coincidence. Maybe it has to do with it.
Edit: It could still be an error code, but I doubt it. It would be a funny coincidence if a value of 255 is supposed to return -1 as an error code when it could also be a signed char to int conversion.

This probably belongs on the bug tracker somewhere. I'm assuming year shouldn't be cast into a signed char, and its definitely a bug.
« Last Edit: March 28, 2015, 06:00:57 pm by BoredVirulence »
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Practical jokers. Dwarves keep creating slabs for living colleagues.
« Reply #2 on: March 28, 2015, 09:47:08 pm »

Years in DF are stored as 32-bit integers, not 8-bit, and the number -1 is explicitly used to denote a lack of meaningful value - an event which happens in the year -1 happened "before time began", and a death year of -1 just means it hasn't died yet.

The fact that you saw -1 at the year 255 was a complete and total coincidence and has nothing to do with 8-bit integer size.
« Last Edit: March 28, 2015, 09:55:20 pm by Quietust »
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Saiko Kila

  • Bay Watcher
  • Dwarven alchemist
    • View Profile
Re: Practical jokers. Dwarves keep creating slabs for living colleagues.
« Reply #3 on: March 29, 2015, 04:00:04 am »

Yes, I know years are stored in 32-bit integers, and I had slabs with much higher years than 255 (in older versions), but I thought it not impossible to be a bug, like wrong casting somewhere. Since the slab engraving code is different to what it was, there was possibility to introduce some new bugs. I also thought it possible it may be a mere coincidence, sure. I had a child which was born in future in the same fort, I named it "NegaChild" because of that, but it had nothing to do with year 255.
Logged