opentibiabr / canary

Canary Server 13.x for OpenTibia community.
https://docs.opentibiabr.com/
GNU General Public License v2.0
384 stars 637 forks source link

fix: crash concurrent modification/casting in tile management #3107

Closed dudantas closed 2 weeks ago

dudantas commented 2 weeks ago

Description

This PR adds the implementation for dynamically determining the type of tile (HouseTile, StaticTile, DynamicTile) when creating a new tile object. The motivation is to correctly identify and assign specific tile types, which enhances code readability and maintainability. The change also ensures that houses have associated HouseTile objects for better data integrity. No additional dependencies are required for this change.

Fixes this crash: crash house.txt

Behaviour

Actual

Tiles are being created without properly distinguishing between house, static, and dynamic types.

Expected

House tiles should be identified and instantiated as HouseTile objects, and other tiles should be correctly instantiated as StaticTile or DynamicTile based on the cached tile data.

Type of change

How Has This Been Tested

The changes have been tested by:

Checklist

sonarcloud[bot] commented 2 weeks ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud