Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MegaMek- and MekWars-Related Error
#1
If anyone has spare time, I'd appreciate a look at the logs here. Only #1 has anything to do directly with MegaMek. But both errors should be in the logs.

(1) An Aerospace unit's firing was not resolved and not reported in the firing report.
(2) Games are not resolving on our server. When the MegaMek game concludes, it typically removes those units from a hangar, distributes a game reward, eliminates dead pilots, and so on. Games are not reporting at random.

https://www.dropbox.com/s/ysxdo7wkzmbnaxu/Logs.zip?dl=0
Reply
#2
Looks like this ...

Code:
    /**
     * this returns the external ID. 1/16/2012 - Taharqa: I am changing
     * externalId to a string so I can use UUIDs in MHQ. It should only require
     * a simple parseInt to be added to it to return an integer for other
     * programs (i.e. MekWars)
     *
     * @return the ID settable by external sources (such as mm.net)
     * @see megamek.common.Entity#externalId
     */
    public int getExternalId() {
        return Integer.parseInt(externalId);
    }

... doesn't work if the external ID comes from something which sets an UUID there.

(Nor do I see how it ever could.)
Reply
#3
Because the 2 types of programs aren't meant to be used together. This was included for backwards compatibility with programs that use the old style, but mix at your own peril, eh? Wink

Just have to choose 1: UUID or Integer.
Reply
#4
Well, it doesn't hurt to be clear in the documentation. So now it reads as follows:

Code:
    /**
     * This returns the external ID.
     * <p>
     * Taharqa: I am changing
     * externalId to a string so I can use UUIDs in MHQ. It should only require
     * a simple parseInt to be added to it to return an integer for other
     * programs (i.e. MekWars).
     *
     * @return the ID settable by external sources (such as mm.net)
     * @throws NumberFormatException if the stored ID is not an integer
     * @see megamek.common.Entity#externalId
     */

Problem solved. People who use this method know that they need to expect and catch the NumberFormatException and do some application-specific code (generate and set a new one, display an error, ignore the entity, whatever fits best) when encountering one.
Reply
#5
You assume people read the comments Wink

But yeah, I agree. We need better JavaDocs comments throughout.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Sort-of related TigerShark 20 2,499 03-12-2016, 02:48 AM
Last Post: Akjosch

Forum Jump:


Users browsing this thread: 1 Guest(s)