protected void drawObject(int position, TrekObject thisObj, String hudValue) {
        if (thisObj == null) {
            if (hudobjects.containsKey(hudValue) && !getHudValueString(hudValue).equals("")) {
                player.sendText(TrekAnsi.locate(position + 3, 23, player) + format("", "", 36));
                setHudValue(hudValue, "");
            }

            return;
        }

        String buffer = "", endBuffer = "";
        String distance = new Integer(new Double(Math.round(TrekMath.getDistance(player.ship, thisObj))).intValue()).toString();

        // Check for scan and lock...
        if (TrekUtilities.isObjectShip(thisObj)) {
            TrekShip testScan = (TrekShip) thisObj;

            if (testScan.lockTarget == player.ship) {
                if (testScan.scanTarget != null && testScan.scanTarget == player.ship) {
                    buffer = "#";
                } else {
                    buffer = " ";
                }
            } else if (testScan.scanTarget == player.ship) {
                buffer = "*";
            } else {
                buffer = " ";
            }

            if (TrekServer.isTeamPlayEnabled()) {
                buffer += thisObj.scanLetter + " " + format(thisObj.name, new Integer(testScan.parent.teamNumber).toString(), 18);
            } else {
                buffer += thisObj.scanLetter + " " + thisObj.name;
            }
        }

        if (TrekUtilities.isObjectWormhole(thisObj)) {
            TrekWormhole hole = (TrekWormhole) thisObj;
            if (hole.active) {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name;
            } else {
                buffer = " " + thisObj.scanLetter + ")";
            }
        }

        if (TrekUtilities.isObjectPulsar(thisObj)) {
            TrekZone pulsar = (TrekZone) thisObj;
            if (pulsar.active) {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name;
            } else {
                buffer = " " + thisObj.scanLetter + ")";
            }
        }

        if (TrekUtilities.isObjectDrone(thisObj)) {
            TrekDrone drone = (TrekDrone) thisObj;
            if (drone.owner == player.ship) {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name + "*";
            } else {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name;
            }
        }

        if (TrekUtilities.isObjectBuoy(thisObj)) {
            TrekBuoy buoy = (TrekBuoy) thisObj;
            if (buoy.owner == player.ship) {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name + "*";
            } else {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name;
            }
        }

        if (TrekUtilities.isObjectMine(thisObj)) {
            TrekMine mine = (TrekMine) thisObj;
            if (mine.owner == player.ship) {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name + "*";
            } else {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name;
            }
        }

        if (TrekUtilities.isObjectTorpedo(thisObj)) {
            TrekTorpedo torp = (TrekTorpedo) thisObj;
            if (torp.torpType != TrekShip.TORPEDO_WARHEAD) {
                if (torp.owner == player.ship) {
                    buffer = " " + thisObj.scanLetter + ") " + thisObj.name + "*";
                } else {
                    buffer = " " + thisObj.scanLetter + ") " + thisObj.name;
                }
            } else {
                if (torp.interceptTarget == player.ship) {
                    buffer = " " + thisObj.scanLetter + ") " + thisObj.name + "*";
                } else {
                    buffer = " " + thisObj.scanLetter + ") " + thisObj.name;
                }
            }
        }

        if (TrekUtilities.isObjectObserverDevice(thisObj)) {
            TrekObserverDevice observer = (TrekObserverDevice) thisObj;

            if (observer.scanTarget == player.ship) {
                buffer = "*" + thisObj.scanLetter + ") " + thisObj.name;
            } else {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name;
            }
        }

        if (TrekUtilities.isObjectCorbomite(thisObj)) {
            TrekCorbomite corbomite = (TrekCorbomite) thisObj;

            if (corbomite.owner == player.ship) {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name + "*";
            } else {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name;
            }
        }

        if (TrekUtilities.isObjectIridium(thisObj)) {
            TrekIridium iridium = (TrekIridium) thisObj;

            if (iridium.owner == player.ship) {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name + "*";
            } else {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name;
            }
        }

        if (TrekUtilities.isObjectMagnabuoy(thisObj)) {
            TrekMagnabuoy magnabuoy = (TrekMagnabuoy) thisObj;

            if (magnabuoy.owner == player.ship) {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name + "*";
            } else {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name;
            }
        }

        if (TrekUtilities.isObjectNeutron(thisObj)) {
            TrekNeutron neutron = (TrekNeutron) thisObj;

            if (neutron.owner == player.ship) {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name + "*";
            } else {
                buffer = " " + thisObj.scanLetter + ") " + thisObj.name;
            }
        }

        if (buffer.equals("")) {
            buffer = " " + thisObj.scanLetter + ") " + thisObj.name;
        }

        if (player.playerOptions.getOption(TrekPlayerOptions.OPTION_BEARINGUPDATE) == 0) {
            try {
                setHudValue("TacticalObjectBearing" + position, player.ship.getBearingToObj(thisObj));
            } catch (NullPointerException npe) {
                System.out.println("TEST");
            }
        } else if (player.playerOptions.getOption(TrekPlayerOptions.OPTION_BEARINGUPDATE) == -1) {
            setHudValue("TacticalObjectBearing" + position, "");
        } else {
            // by making it check for mod == 1 (instead of 0), we get a display when the user first loads the ship
            if ((tick % player.playerOptions.getOption(TrekPlayerOptions.OPTION_BEARINGUPDATE) == 1)) {
                setHudValue("TacticalObjectBearing" + position, player.ship.getBearingToObj(thisObj));
            }
        }

        if (player.playerOptions.getOption(TrekPlayerOptions.OPTION_RANGEUPDATE) == 0) {
            setHudValue("TacticalObjectRange" + position, distance);
        } else {
            if ((tick % player.playerOptions.getOption(TrekPlayerOptions.OPTION_RANGEUPDATE) == 0)) {
                setHudValue("TacticalObjectRange" + position, distance);
            }
        }

        endBuffer = format(getHudValueString("TacticalObjectBearing" + position), getHudValueString("TacticalObjectRange" + position), 13);

        buffer = format(buffer, endBuffer, 35);

        String currentHudValue = getHudValueString(hudValue);

        byte[] current = currentHudValue.getBytes();
        byte[] buf = buffer.getBytes();

        if (!currentHudValue.equals(buffer)) {
            // Figure out what character starts the change.

            if (currentHudValue.equals("")) {
                player.sendText(TrekAnsi.locate(position + 3, 23, player) + buffer);
            } else {
                for (int x = 0; x < current.length; x++) {
                    if (current[x] != buf[x]) {
                        player.sendText(TrekAnsi.locate(position + 3, x + 23, player) + buffer.substring(x, buffer.length()));
                        break;
                    }
                }
            }

            setHudValue(hudValue, buffer);
        }
    }