Updated code for revision to Star class. Places in the code which used to use getStellarClass() to get a spectral type string now use getSpectralType method.

ver1_5_1
Chris Laurel 2004-09-20 03:29:34 +00:00
parent 12d827d29e
commit 1ae63147ce
3 changed files with 31 additions and 22 deletions

View File

@ -1464,6 +1464,25 @@ void CelestiaCore::charEntered(const char *c_p, int modifiers)
}
break;
case '%':
{
const ColorTemperatureTable* current =
renderer->getStarColorTable();
if (current == GetStarColorTable(ColorTable_Enhanced))
{
renderer->setStarColorTable(GetStarColorTable(ColorTable_Blackbody_D65));
}
else if (current == GetStarColorTable(ColorTable_Blackbody_D65))
{
renderer->setStarColorTable(GetStarColorTable(ColorTable_Enhanced));
}
else
{
// Unknown color table
}
}
break;
case '&':
renderer->setLabelMode(renderer->getLabelMode() ^ Renderer::LocationLabels);
notifyWatchers(LabelFlagsChanged);
@ -2679,7 +2698,7 @@ static void displayStarInfo(Overlay& overlay,
star.getAbsoluteMagnitude(),
astro::absToAppMag(star.getAbsoluteMagnitude(), (float) distance));
overlay << "Luminosity: " << SigDigitNum(star.getLuminosity(), 3) << "x Sun\n";
overlay << "Class: " << star.getStellarClass() << '\n';
overlay << "Class: " << star.getSpectralType() << '\n';
displayApparentDiameter(overlay, star.getRadius(),
astro::lightYearsToKilometers(distance));

View File

@ -862,7 +862,8 @@ void LuaState::requestIO()
string policy = appCore->getConfig()->scriptSystemAccessPolicy;
if (policy == "allow")
{
lua_iolibopen(costate);
//lua_iolibopen(costate);
luaopen_io(costate);
ioMode = IOAllowed;
}
else if (policy == "deny")
@ -2145,18 +2146,9 @@ static int object_spectraltype(lua_State* l)
if (sel->star() != NULL)
{
char buf[16];
StellarClass sc = sel->star()->getStellarClass();
if (sc.str(buf, sizeof(buf)))
{
lua_pushstring(l, buf);
}
else
{
// This should only happen if the spectral type has > 15 chars
// (i.e. never, unless there's a bug)
assert(0);
doError(l, "Bad spectral type (this is a bug!)");
}
strncpy(buf, sel->star()->getSpectralType(), sizeof buf);
buf[sizeof(buf) - 1] = '\0'; // make sure it's zero terminate
lua_pushstring(l, buf);
}
else
{
@ -2180,7 +2172,7 @@ static int object_getinfo(lua_State* l)
setTable(l, "name", getAppCore(l, AllErrors)->getSimulation()->getUniverse()
->getStarCatalog()->getStarName(*(sel->star())).c_str());
setTable(l, "catalogNumber", star->getCatalogNumber());
setTable(l, "stellarClass", star->getStellarClass().str().c_str());
setTable(l, "stellarClass", star->getSpectralType());
setTable(l, "absoluteMagnitude", (lua_Number)star->getAbsoluteMagnitude());
setTable(l, "luminosity", (lua_Number)star->getLuminosity());
setTable(l, "radius", (lua_Number)star->getRadius());

View File

@ -14,6 +14,7 @@
#include <set>
#include <windows.h>
#include <commctrl.h>
#include <cstring>
#include "winstarbrowser.h"
#include "res/resource.h"
@ -308,12 +309,7 @@ int CALLBACK StarBrowserCompareFunc(LPARAM lParam0, LPARAM lParam1,
return (int) sign(star0->getAbsoluteMagnitude() - star1->getAbsoluteMagnitude());
case 4:
if (star0->getStellarClass() < star1->getStellarClass())
return -1;
else if (star1->getStellarClass() < star0->getStellarClass())
return 1;
else
return 0;
return strcmp(star0->getSpectralType(), star1->getSpectralType());
default:
return 0;
@ -362,7 +358,9 @@ void StarBrowserDisplayItem(LPNMLVDISPINFOA nm, StarBrowser* browser)
break;
case 4:
star->getStellarClass().str(callbackScratch, sizeof(callbackScratch));
strncpy(callbackScratch, star->getSpectralType(),
sizeof(callbackScratch));
callbackScratch[sizeof(callbackScratch) - 1] = '\0';
nm->item.pszText = callbackScratch;
break;
}