[crossfire] Default hp/sp for exits

Preston Crow pc-crossfire06 at crowcastle.net
Fri Feb 18 20:54:39 CST 2022


On 2022-02-18 14:32, Kevin Zheng wrote:
> On 2/18/22 10:54 AM, Nicolas Weeger wrote:
>>> I expect there are maps where the exit target is zero in one of the two
>>> coordinates.  Since doing a mix of default and specified coordinates is
>>> probably a bad idea, I would have the server convert a single -1 to a
>>> 0.  I would then only need to search through the maps for any exits 
>>> with
>>> a slaying field but not hp or sp, just in case there are any 0,0 exits
>>> on purpose.
>>
>> That can easily be checked automatically if needed.
>>
>> Note that this is the current behaviour - if one coordinate is -1, 
>> then it'll
>> be replaced by the default map enter x/y one (again, see enter_map()).
>
> I believe Preston was pointing out that existing maps, that have one 
> of hp/sp set to zero, will not have a hp/sp field (because 
> object_diff() will remove them), but will change to -1 after the change.
>
> I suspect there are few exits where one of the coordinates to go zero, 
> but it would be good to do a search and fix them up in case.
>
Yes, I pushed a change to enter_map() in server/server.c to change the 
input x or y to zero if one and only one is negative. This handles most 
cases of intentional use of 0 as an exit coordinate, such as in 
buildings in cities on tiled map boundaries.  There was only one 
legitimate exit to 0,0, which is beginners2 in Scorn.  I pushed a change 
to the map to specify the 0,0 exit, as the world map has a enter_x/y of 
1,1.  These changes should have no impact to anyone.

The big change is to the arches.

I was surprised to see the arches for magic_portal and perm_magic_portal 
having default hp/sp of 15,19 and slaying of /city/city.  The hp/sp 
defaults are used in some of the guild portals, possibly by accident, 
but I'm not touching those.

There are a ton of type 66 (exit) archetypes.  I've set them all to have 
hp/sp of -1,-1 in my code with an awk script, but it's 297 files (and 
skips the aforementioned portals).

I did some testing, and I pushed the change 
(961eba31eb8d2df5ec6811d971a4194357aced0e).

So unless I missed something, nobody should notice any difference, and 
going forward, you can leave hp/sp off when defining exits for the main 
map entrance if enter_x,enter_y are correct.  This should make it 
simpler to modify maps without also having to change the maps that link 
to them.

I was thinking about decoupling the links in both directions, but that 
gets a lot more complicated.



More information about the crossfire mailing list