Package megamek.common

Examples of megamek.common.InfernoTracker


                subnodes = child.elements();
                while (subnodes.hasMoreElements()) {
                    subnode = (ParsedXML) subnodes.nextElement();
                    if (subnode.getName().equals("inferno")) {
                        coords = null;
                        InfernoTracker tracker = new InfernoTracker();

                        // Try to find the inferno detail nodes.
                        Enumeration<?> details = subnode.elements();
                        while (details.hasMoreElements()) {
                            ParsedXML detail = (ParsedXML) details
                                    .nextElement();

                            // Have we found the coords detail?
                            if (detail.getName().equals("coords")) {
                                coords = CoordsEncoder.decode(detail, game);
                            }

                            // Have we found the Arrow IV inferno detail?
                            else if (detail.getName().equals("arrowiv")) {

                                // Get the burn turns attribute.
                                attrStr = detail.getAttribute("turns");
                                if (null == attrStr) {
                                    throw new IllegalStateException(
                                            "Couldn't decode the burn turns for an Arrow IV inferno round.");
                                }

                                // Try to pull the value from the string
                                try {
                                    attrVal = Integer.parseInt(attrStr);
                                } catch (NumberFormatException exp) {
                                    throw new IllegalStateException(
                                            "Couldn't get an integer from "
                                                    + attrStr);
                                }

                                // Add the number of Arrow IV burn turns.
                                tracker.add(InfernoTracker.INFERNO_IV_TURN,
                                        attrVal);

                            } // End found-arrowiv-detail

                            // Have we found the standard inferno entry?
                            else if (detail.getName().equals("standard")) {

                                // Get the burn turns attribute.
                                attrStr = detail.getAttribute("turns");
                                if (null == attrStr) {
                                    throw new IllegalStateException(
                                            "Couldn't decode the burn turns for a standard inferno round.");
                                }

                                // Try to pull the value from the string
                                try {
                                    attrVal = Integer.parseInt(attrStr);
                                } catch (NumberFormatException exp) {
                                    throw new IllegalStateException(
                                            "Couldn't get an integer from "
                                                    + attrStr);
                                }

                                // Add the number of standard burn turns.
                                tracker.add(InfernoTracker.STANDARD_TURN,
                                        attrVal);

                            } // End found-standard-detail

                        } // Handle the next detail node.
View Full Code Here

TOP

Related Classes of megamek.common.InfernoTracker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.