Skip to content

Commit

Permalink
Hull points calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
gmoromisato committed Nov 13, 2018
1 parent eb6be85 commit 7ef2f96
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
3 changes: 3 additions & 0 deletions TransData/Help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ void ShowHelp (CXMLElement *pCmdLine)
printf(" [/fireRateAdj] AI fire rate adjustment (%% of normal).\n");
printf(" [/genericName] generic name.\n");
printf(" [/hullMass] mass of hull only (in tons).\n");
printf(" [/hullPoints] total points used to calculate hull value.\n");
printf(" [/hullPointsStats] points used to calculate hull value.\n");
printf(" [/hullValue] value of hull only (credits).\n");
printf(" [/launcher] launcher.\n");
printf(" [/maneuver] time for a complete rotation.\n");
printf(" [/manufacturer] ship manufacturer.\n");
Expand Down
6 changes: 3 additions & 3 deletions TransData/ShipImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void GenerateShipImage (CUniverse &Universe, CXMLElement *pCmdLine)
// Create a rotation structure (to track ship thrusters)

CIntegralRotation Rotation;
Rotation.Init(pClass->GetRotationDesc());
Rotation.Init(pClass->GetIntegralRotationDesc());

// Paint

Expand All @@ -106,13 +106,13 @@ void GenerateShipImage (CUniverse &Universe, CXMLElement *pCmdLine)

// Set the ship rotation

Rotation.SetRotationAngle(pClass->GetRotationDesc(), pClass->GetRotationDesc().GetRotationAngle(i));
Rotation.SetRotationAngle(pClass->GetIntegralRotationDesc(), pClass->GetIntegralRotationDesc().GetRotationAngle(i));

// Set the paint context (we need to do this after the rotation setting)

Ctx.iTick = 0;
Ctx.iVariant = Rotation.GetFrameIndex();
Ctx.iRotation = Rotation.GetRotationAngle(pClass->GetRotationDesc());
Ctx.iRotation = Rotation.GetRotationAngle(pClass->GetIntegralRotationDesc());
Ctx.iDestiny = 0;
Ctx.iMaxLength = -1;

Expand Down
26 changes: 25 additions & 1 deletion TransData/ShipTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#define MAX_LEVEL 25

#define FIELD_BALANCE CONSTLIT("balance")
#define FIELD_HULL_POINTS_STATS CONSTLIT("hullPointsStats")
#define FIELD_LEVEL CONSTLIT("level")
#define FIELD_MANEUVER CONSTLIT("maneuver")
#define FIELD_NAME CONSTLIT("name")
Expand Down Expand Up @@ -74,7 +75,18 @@ void GenerateShipTable (CUniverse &Universe, CXMLElement *pCmdLine)
if (j != 0)
printf("\t");

printf(Cols[j].GetASCIIZPointer());
if (strEquals(Cols[j], FIELD_HULL_POINTS_STATS))
{
for (int k = 0; k < CHullPointsCalculator::fieldCount; k++)
{
if (k != 0)
printf("\t");

printf((LPSTR)CHullPointsCalculator::GetFieldName(k));
}
}
else
printf(Cols[j].GetASCIIZPointer());
}

printf("\n");
Expand Down Expand Up @@ -130,6 +142,18 @@ void GenerateShipTable (CUniverse &Universe, CXMLElement *pCmdLine)
printf("%.1f", pResult->GetIntegerValue() / 1000.0);
else if (strEquals(sField, FIELD_SCORE_CALC))
printf("%d", pClass->CalcScore());
else if (strEquals(sField, FIELD_HULL_POINTS_STATS))
{
CHullPointsCalculator Calc(*pClass);

for (int k = 0; k < Calc.GetFieldCount(); k++)
{
if (k != 0)
printf("\t");

printf("%.1f", Calc.GetField(k) * 10.0);
}
}
else
{
CString sValue = pResult->Print(&g_pUniverse->GetCC(), PRFLAG_NO_QUOTES | PRFLAG_ENCODE_FOR_DISPLAY);
Expand Down

0 comments on commit 7ef2f96

Please sign in to comment.