Skip to content
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

cant edit bots in lobby with latest #5413

Closed
kuronekochomusuke opened this issue Apr 24, 2024 · 8 comments · Fixed by #5414
Closed

cant edit bots in lobby with latest #5413

kuronekochomusuke opened this issue Apr 24, 2024 · 8 comments · Fixed by #5414
Labels
Blocker Bug Nightly Issue spotted in the nightly build Princess/AI

Comments

@kuronekochomusuke
Copy link
Collaborator

kuronekochomusuke commented Apr 24, 2024

megamek.MegaMek.initializeLogging(MegaMek.java:118) - Starting MegaMek v0.49.20-SNAPSHOT
Build Date: N/A
Today: 2024-04-24
Origin Project: MegaMek
Java Vendor: Eclipse Adoptium
Java Version: 17.0.6
Platform: Windows 11 10.0 (amd64)
System Locale: en_US
Total memory available to MegaMek: 8 GB

in lobby bots are not editable when starting a new game.
double click on bot and menu is grayed out.

image

megamek.log

@Sleet01
Copy link
Collaborator

Sleet01 commented Apr 24, 2024

@kuronekochomusuke Do you happen to have a log for this run?

@kuronekochomusuke
Copy link
Collaborator Author

attached it, but not seeing anything useful in it.

@Sleet01
Copy link
Collaborator

Sleet01 commented Apr 24, 2024

I think this is new / suboptimal, but I'd need to check against an older build:

19:05:39,809 ERROR [megamek.client.AbstractClient] {AWT-EventQueue-0}
megamek.client.AbstractClient.handlePacket(AbstractClient.java:383) - Failed to parse Packet command SERVER_GREETING
java.lang.NullPointerException
	at java.base/java.util.TreeMap.compare(TreeMap.java:1570)
	at java.base/java.util.TreeMap.addEntryToEmptyMap(TreeMap.java:776)
	at java.base/java.util.TreeMap.put(TreeMap.java:785)
	at java.base/java.util.TreeMap.put(TreeMap.java:534)
	at megamek.client.bot.BotClient.correctName(BotClient.java:1162)
	at megamek.client.AbstractClient.handleGameIndependentPacket(AbstractClient.java:413)
	at megamek.client.AbstractClient.handlePacket(AbstractClient.java:376)
	at megamek.client.bot.princess.Princess.handlePacket(Princess.java:1915)
	at megamek.client.AbstractClient$1.lambda$packetReceived$0(AbstractClient.java:530)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

19:05:39,810 ERROR [megamek.client.bot.princess.Precognition] {AWT-EventQueue-0}
megamek.client.bot.princess.Precognition.handlePacket(Precognition.java:273) - Attempted to parse unknown PacketCommand of SERVER_GREETING

19:05:39,813 ERROR [megamek.client.bot.BotClient] {AWT-EventQueue-0}
megamek.client.bot.BotClient.correctName(BotClient.java:1158) - Name correction arrived at incorrect BotClient!

@kuronekochomusuke
Copy link
Collaborator Author

that could be from when it tried to add the bot

@Sleet01
Copy link
Collaborator

Sleet01 commented Apr 24, 2024

I'm seeing this in the latest code; I'll try bisecting to narrow down the offending change.

@Sleet01
Copy link
Collaborator

Sleet01 commented Apr 24, 2024

Bisect tracked down this check-in: eef2a3c

PR: #5384

Commit: eef2a3c

@Sleet01
Copy link
Collaborator

Sleet01 commented Apr 24, 2024

I believe this doesn't break for saved games because the bot already has a name by the time it gets to this call, but for new bots, they don't yet have a name so the new code thinks the wrong bot has been renamed (when in fact this is the way a new bot gets a name).

I was incorrect; it looks like instead Princess is misinterpreting the server greeting packet as a name change request.

@Sleet01
Copy link
Collaborator

Sleet01 commented Apr 24, 2024

@SJuliez I think the issue is the lack of a break; after line 411 in AbstractClient.java; that's new code from the offending commit and it looks like we're erroneously falling through from case SERVER_GREETING to case SERVER_CORRECT_NAME.

Sleet01 added a commit that referenced this issue Apr 25, 2024
…s_game_and_gets_name_change_packet

Fix #5413: Fix improper drop-through in packet handling switch/case
@kuronekochomusuke kuronekochomusuke added the Nightly Issue spotted in the nightly build label Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocker Bug Nightly Issue spotted in the nightly build Princess/AI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants