-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sprite (including camo) swap in the phase report/log #5661
Comments
My initial guess is that we're no longer properly clearing the sprite cache at the end of the game, which would be supported by the last two 'mechs using the correct graphics: those unit ids weren't in the first game, so there were no cached graphics for them. |
Those are my thoughts as well. I tried smashing out some breakpoints last night, but they all either showed the correct sprite loading, or weren't triggered at all. |
A similar thing used to happen with pilot portraits before it was fixed. |
After smashing some breakpoints in |
Look at the icon cache, iirc in the game server? |
Progress! Sort of...
Sorry, I'm not sure where/which/what you are referring to. EDIT: I've found a working sprite under EntitySprite. |
See also: #5769 |
Further testing - In a new game I added two Blue Riflemen (ID 1 and 2). I then deleted them from the lobby, and added two Red Piranhas (ID 3 and 4). The Piranhas displayed correctly. After finishing the game with the Red Piranhas, I added two Green Highlanders (ID 1 and 2). The Highlanders became Blue Riflemen in the round reports, and never got "Loading image on the fly"ed. The Blue Riflemen 'stuck' in ID slots 1 and 2, even though they were deleted while in the lobby, and therefor were never displayed in a round report. |
This matches some of the similar experiences I've had, where reinforced units would sometimes take on the sprites of units that were added and then removed from the lobby, as opposed to wreck sprites. |
It should be noted that the image cache is a separate store from the list of units in the Lobby, and the image cache is not cleared (nor are cached images delete) when a given unit is deleted. We need to, at the very least, clear the mechImages cache after every game. We should probably also remove the cached images of every unit that is removed from the Lobby list. |
If instead of returning to the lobby, the player exits out further to the start screen (the one with Start New Game, Load Saved Game, Start Scenario, etc.) the issue does not occur. mechImages.clear() and mechImageList.clear() are currently being run via line number 1137 of megamek/client/ui/swing/ClientGUI.java . Unfortunately they don't quite seem to be working as intended at this location, possibly due to some phase switching shenanigans. From my limited understanding, if the cache is cleared too early (while the mechs still need to be displayed) it will just repopulate itself. |
So I inserted |
Environment
Master (latest PR #5784)
Java 17
Linux
Description
I started and finished a game in MM with 4 blue Annihilators vs. 4 red Atlases. The game ran without incident. Then I started another game with 5 Ghost Bear Kodiak II's vs 5 Jade Falcon Turkina's. The mech's and camo are those from the first game. The facing is however correct, and is not carried over from the first game.
Interesting to note: The 5th Kodiak II uses the camo/sprite from the 1st Atlas, and the 4th and 5th Turkina's use the correct camo.
The text was updated successfully, but these errors were encountered: