From 168818b9b039df64de014fd036a9b8e959f27d36 Mon Sep 17 00:00:00 2001 From: suhrke Date: Mon, 17 Jul 2017 13:16:59 -0700 Subject: [PATCH] Error messages made more clear --- ReflexToQ3/includes/EntityConverter.cpp | 44 ++++++++++++------------- docs/reflex-mapping.txt | 31 ----------------- 2 files changed, 22 insertions(+), 53 deletions(-) delete mode 100644 docs/reflex-mapping.txt diff --git a/ReflexToQ3/includes/EntityConverter.cpp b/ReflexToQ3/includes/EntityConverter.cpp index 73e3b16..4b07a6e 100644 --- a/ReflexToQ3/includes/EntityConverter.cpp +++ b/ReflexToQ3/includes/EntityConverter.cpp @@ -249,7 +249,7 @@ EntityConverter::convertPickup(const std::vector &lines) const if ( lines.size() < 2 ) { throw std::runtime_error( - makeErrorMessage( "error: Pickup entity requires at least type and ID", lines )); + makeErrorMessage( "error: Pickup entity requires minimum of two lines (type and ID)", lines )); } for (int i = 1; i < lines.size(); i++) { @@ -260,7 +260,7 @@ EntityConverter::convertPickup(const std::vector &lines) const if ( ! (iss >> trash >> trash >> coords[0] >> coords[1] >> coords[2])) { throw std::runtime_error( - makeErrorMessage( "error: Pickup entity requires coordinates", lines )); + makeErrorMessage( "error: Invalid Pickup position", lines )); } } else if ( type == "pickupType" ) { @@ -268,7 +268,7 @@ EntityConverter::convertPickup(const std::vector &lines) const // UInt8 pickupType ID if ( ! (iss >> trash >> trash >> pickupID) ) { throw std::runtime_error( - makeErrorMessage( "error: Pickup entity requires Pickup ID", lines )); + makeErrorMessage( "error: Format of Pickup ID line is invalid", lines )); } havePickupID = true; } @@ -278,12 +278,12 @@ EntityConverter::convertPickup(const std::vector &lines) const auto pickupIter = pickupMap_.find(pickupID); if ( pickupIter == pickupMap_.end() ) { throw std::runtime_error( - makeErrorMessage( "error: Pickup ID must be valid", lines )); + makeErrorMessage( "error: Pickup ID is invalid", lines )); } std::stringstream pickupStream; pickupStream << "\"classname\" \"" << pickupIter->second << "\"" << std::endl; convertedLines.push_back ( pickupStream.str() ); - // coordinates reordered to x, z, y + // coordinates reordered to x, z, yentity std::stringstream positionStream; positionStream << "\"origin\" \"" << coords[0] << " " << coords[2] << " " << offset(coords[1], OFFSET_PICKUP) << "\"" << std::endl; @@ -292,7 +292,7 @@ EntityConverter::convertPickup(const std::vector &lines) const } else { throw std::runtime_error( - makeErrorMessage( "error: Pickup requires position and pickup ID, missing 1 or both", lines )); + makeErrorMessage( "error: Pickup ID was not in the entity", lines )); } } @@ -335,7 +335,7 @@ EntityConverter::convertPlayerSpawn(const std::vector &lines) const if ( ! (iss >> trash >> trash >> coords[0] >> coords[1] >> coords[2])) { throw std::runtime_error( - makeErrorMessage( "error: PlayerSpawn entity must have valid position coordinates if specified", lines )); + makeErrorMessage( "error: Invalid PlayerSpawn position", lines )); } } else if ( type == "angles" ) { @@ -343,7 +343,7 @@ EntityConverter::convertPlayerSpawn(const std::vector &lines) const // UInt8 pickupType ID if ( ! (iss >> trash >> trash >> angle )) { throw std::runtime_error( - makeErrorMessage( "error: Pickup entity requires Pickup ID", lines )); + makeErrorMessage( "error: Invalid PlayerSpawn angle", lines )); } } // Bool8 modeX 0 indicates this spawn is not for game mode X @@ -414,13 +414,13 @@ EntityConverter::convertJumpPad(const std::vector &lines) const if ( lines.size() < 2 ) { throw std::runtime_error( - makeErrorMessage( "error: JumpPad entity requires at least type and target name", lines )); + makeErrorMessage( "error: JumpPad entity requires minimum of two lines (type and target)", lines )); } std::istringstream iss(lines[1]); // String32 target targetName if ( ! (iss >> trash >> trash >> targetName) ) { throw std::runtime_error( - makeErrorMessage( "error: JumpPad entity requires target name", lines )); + makeErrorMessage( "error: Invalid JumpPad target", lines )); } convertedLines.push_back ( "\"classname\" \"trigger_push\"\n" ); @@ -441,13 +441,13 @@ EntityConverter::convertTeleporter(const std::vector &lines) const if ( lines.size() < 2 ) { throw std::runtime_error( - makeErrorMessage( "error: Teleport entity requires at least type and target name", lines )); + makeErrorMessage( "error: Teleport entity requires minimum of two lines (type and target)", lines )); } std::istringstream iss(lines[1]); // String32 target targetName if ( ! (iss >> trash >> trash >> targetName) ) { throw std::runtime_error( - makeErrorMessage( "error: Teleport entity requires target name", lines )); + makeErrorMessage( "error: Invalid Teleport target", lines )); } convertedLines.push_back ( "\"classname\" \"trigger_teleport\"\n" ); @@ -473,7 +473,7 @@ EntityConverter::convertTarget(const std::vector &lines) const if ( lines.size() < 3 ) { throw std::runtime_error( - makeErrorMessage( "error: Target entity requires at least type and name", lines )); + makeErrorMessage( "error: Target entity requires minimum of two lines (type and name)", lines )); } for (int i = 1; i < lines.size(); i++) { @@ -484,7 +484,7 @@ EntityConverter::convertTarget(const std::vector &lines) const if ( ! (iss >> trash >> trash >> coords[0] >> coords[1] >> coords[2])) { throw std::runtime_error( - makeErrorMessage( "error: Target entity requires coordinates", lines )); + makeErrorMessage( "error: Invalid Target position", lines )); } } else if ( type == "name" ) { @@ -492,7 +492,7 @@ EntityConverter::convertTarget(const std::vector &lines) const // UInt8 name uniqueName if ( ! (iss >> trash >> trash >> targetName) ) { throw std::runtime_error( - makeErrorMessage( "error: Target entity requires target name", lines )); + makeErrorMessage( "error: Invalid Target \"target\"", lines )); } haveName = true; } @@ -501,7 +501,7 @@ EntityConverter::convertTarget(const std::vector &lines) const // Vector3 angles angle notapplicable notapplicable if ( ! (iss >> trash >> trash >> angle) ) { throw std::runtime_error( - makeErrorMessage( "error: Target entity requires target angle if specified", lines )); + makeErrorMessage( "error: Invalid Target angle", lines )); } } @@ -510,7 +510,7 @@ EntityConverter::convertTarget(const std::vector &lines) const if ( haveName) { auto targetIter = targetMap_.find(targetName); if ( targetIter == targetMap_.end() ) { - std::cerr << makeErrorMessage("EntityConverter doesn't know what the source of a Target entity with the following attributes. This entity will not be converted. It is probably an unsupported entity type or feature. (e.g. game over camera)", lines); + std::cerr << makeErrorMessage("End-game camera Target is not a supported feature in id Tech games. This entity will not be converted", lines); std::vector empty; return empty; @@ -544,7 +544,7 @@ EntityConverter::convertTarget(const std::vector &lines) const } else { throw std::runtime_error( - makeErrorMessage( "error: Target entity requires position coordinates and targetname", lines )); + makeErrorMessage( "error: \"target\" was not found in this Target entity", lines )); } } @@ -592,7 +592,7 @@ EntityConverter::convertPointLight(const std::vector &lines) const if ( lines.size() < 2 ) { throw std::runtime_error( - makeErrorMessage( "error: PointLight entity requires at least type", lines )); + makeErrorMessage( "error: PointLight entity requires at least one line (type)", lines )); } for (int i = 1; i < lines.size(); i++) { @@ -603,7 +603,7 @@ EntityConverter::convertPointLight(const std::vector &lines) const if ( ! (iss >> trash >> trash >> coords[0] >> coords[1] >> coords[2])) { throw std::runtime_error( - makeErrorMessage( "error: PointLight entity requires valid position coordinates", lines )); + makeErrorMessage( "error: Invalid PointLight position", lines )); } } else if ( type == "intensity" ) { @@ -611,7 +611,7 @@ EntityConverter::convertPointLight(const std::vector &lines) const // Float intensity validFloat if ( ! (iss >> trash >> trash >> intensity) ) { throw std::runtime_error( - makeErrorMessage( "error: PointLight intensity keyword must be followed by a value", lines )); + makeErrorMessage( "error: Invalid PointLight intensity", lines )); } } else if ( type == "color" ) { @@ -619,7 +619,7 @@ EntityConverter::convertPointLight(const std::vector &lines) const // ColourXRGB32 color eightDigitHexValue if ( ! (iss >> trash >> trash >> color) ) { throw std::runtime_error( - makeErrorMessage( "error: PointLight color keyword must be followed by a value", lines )); + makeErrorMessage( "error: Invalid PointLight color", lines )); } haveColor = true; } diff --git a/docs/reflex-mapping.txt b/docs/reflex-mapping.txt deleted file mode 100644 index 2a76ad3..0000000 --- a/docs/reflex-mapping.txt +++ /dev/null @@ -1,31 +0,0 @@ -======================= -=The Reflex Map Format= -======================= - -Worldspawn contains all brushes and entities. The maps I've seen contain only a single Worldspawn. - -"Pickup" denoted by ID number. We stored the Reflex to Xonotic conversion in r2x.pck - - - - -"PlayerSpawn" consists of coordinate (Vector3), - angle (first element of Vector3), - team indicator (on individual lines), - game type indicator (on individual lines) - --"JumpPad" stored as a brush and a Target - --"Teleporter" stored as a brush and a Target - --"Target" stored as a position (Vector3) and - a "name" (String32) - ***Target can be destination of teleports OR jump pads - --"RaceStart" stored as a brush - --"RaceFinish" stored as a brush - -That's all we have converted so far but we intend to convert Effect, -PointLight, Prefab, CameraPath, and possibly liquids. -