TomenetGame / tomenet

TomeNET is an online multiplayer roguelike role-playing game
https://www.tomenet.eu/
Other
69 stars 11 forks source link

Fix server crashing when mapping a big number to character #28

Closed jezek closed 2 years ago

jezek commented 2 years ago

It's not fully tested yet, but you told, that my old code is live, so I made this PR to fix the possible server crashes. I experienced these crashes, when tested the dynamic byte transfer for character and set the MAX_FONT to high number (>255*200). I was because the [fr]_char_mod variable used for unmapping for map mind linking, used to be an array of 256 chars. Now the char can be a 32 number, so I had to change the array to a dictionary(linked list).

Edit:I also took liberty to change the 5.0.0 in comments to 4.8.1. Edit: I just tested if it works for MAX_FONT with high values, so we had to transfer 3 or 4 bytes per character and it works. Hope I didn't introduced more errors.

jezek commented 2 years ago

I'm trying to test the map mind linking unmapping, but I can't figure out how it works. Can somebody test, or point me into some info? Thanks

Edit: I made a test, where I added code for unmapping to ordinary character transfer, to see if it unmaps correctly, and it seems to be working as expected. But real field test would be good too.

CBlueGH commented 2 years ago

Hm, mindlink still causes packet error here, I just tried it on a local server, with client+server cleanly compiled from latest source, and source+target clients both using latest source, tested client mindlink linux->linux and windows->windows.

jezek commented 2 years ago

@CBlueGH Oh crap. I apologize. My mistake was, that I forgot to change the PR #27 to draft again after @mhirki 's answers to my questions and than it was merged before I could test it fully. I'm sorry, I'll see that it never happens again.

I'll debug and fix the mindlink packet error this along with #29 .

CBlueGH commented 2 years ago

Well nothing terrible so far ^^ it can happen sometimes. I wonder how often I already broke everything.