IconCutter

by Lummox JR
Utility: Create a set of autojoiner icons from source icons you supply.
ID:1052600
 
With the way F_A's Autojoin library is written icons made with this demo do not work.

I assume the icon state selection code is different. A good solution would be a patch for F_A's library for comparability with icons made with this demo
Frankly, that autojoin library isn't very good. A few reasons:

1) My code is based on a much earlier autojoining standard set down by Pmikell. This has been the standard on BYOND for quite some time, used by many games and articles, and I'm surprised FA saw fit to change it because it was so well established. (The only other standard of similar age is the limited 13-state join style created by Foomer.) In this setup, NORTH is 1 and it goes clockwise to NORTHWEST at 128. FA's library inexplicably uses NORTHWEST as 1. Both standards are equally logical, but failing to defer to the established one when it's easy to work with makes no sense. To use his library with IconCutter's icons, you'd have to rotate the bit flags by using d = ((d<<7) | (d>>1)) & 255.

2) The library uses a truly terrible method of grabbing turfs via locate() instead of get_step(); the latter I would expect to be much faster as the offset math can be done directly in hard code.

3) As far as I can tell, his 47-state joining is straight-up broken. The math he's using says that a corner is filled in if A) any adjacent side matches, or B) there's a match in the corner only. This is incorrect. In 47-state joining, a corner should be filled only if the corner and both adjacent sides match. The correct way to do this is to calculate a 256-state join, and then do some simple bitwise math.
I see, I like having my walls autojoin, so I use your library to setup the icon, I'm not really fond of how Foomer's library initiates the autojoin