mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
[swift] killed approximately 150 compiler warnings
This commit is contained in:
6
png.h
6
png.h
@@ -2308,19 +2308,19 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
|
||||
#define png_debug(l,m) \
|
||||
{ \
|
||||
int num_tabs=l; \
|
||||
fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
|
||||
fprintf(PNG_DEBUG_FILE,"%s" m,(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
|
||||
}
|
||||
#define png_debug1(l,m,p1) \
|
||||
{ \
|
||||
int num_tabs=l; \
|
||||
fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
|
||||
fprintf(PNG_DEBUG_FILE,"%s" m,(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
|
||||
}
|
||||
#define png_debug2(l,m,p1,p2) \
|
||||
{ \
|
||||
int num_tabs=l; \
|
||||
fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
|
||||
fprintf(PNG_DEBUG_FILE,"%s" m,(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
|
||||
}
|
||||
#endif /* (PNG_DEBUG > 1) */
|
||||
|
||||
@@ -510,7 +510,7 @@ int ConvertBitmapToAlpha(
|
||||
struct ImageInfo * ioImage)
|
||||
{
|
||||
unsigned char * oldData, * newData, * srcPixel, * dstPixel;
|
||||
int count;
|
||||
//int count;
|
||||
int x,y;
|
||||
|
||||
if (ioImage->channels == 4)
|
||||
@@ -525,7 +525,7 @@ int ConvertBitmapToAlpha(
|
||||
|
||||
srcPixel = oldData;
|
||||
dstPixel = newData;
|
||||
count = ioImage->width * ioImage->height;
|
||||
//count = ioImage->width * ioImage->height;
|
||||
for (y = 0; y < ioImage->height; ++y)
|
||||
for (x = 0; x < ioImage->width; ++x)
|
||||
{
|
||||
@@ -567,7 +567,7 @@ int ConvertAlphaToBitmap(
|
||||
struct ImageInfo * ioImage)
|
||||
{
|
||||
unsigned char * oldData, * newData, * srcPixel, * dstPixel;
|
||||
int count;
|
||||
//int count;
|
||||
int x,y;
|
||||
|
||||
if (ioImage->channels == 3)
|
||||
@@ -590,7 +590,7 @@ int ConvertAlphaToBitmap(
|
||||
|
||||
srcPixel = oldData;
|
||||
dstPixel = newData;
|
||||
count = ioImage->width * ioImage->height;
|
||||
//count = ioImage->width * ioImage->height;
|
||||
|
||||
for (y = 0; y < ioImage->height; ++y)
|
||||
for (x = 0; x < ioImage->width; ++x)
|
||||
@@ -633,7 +633,7 @@ int ConvertAlphaToBitmap(
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
//#pragma mark -
|
||||
|
||||
#if BITMAP_USE_JPEG
|
||||
|
||||
@@ -842,8 +842,8 @@ int CreateBitmapFromJPEGData(void * inBytes, int inLength, struct ImageInfo * o
|
||||
|
||||
#endif /* BITMAP_USE_JPEG */
|
||||
|
||||
void my_error (png_structp,png_const_charp err){}
|
||||
void my_warning(png_structp,png_const_charp err){}
|
||||
void my_error (png_structp,png_const_charp /*err*/){}
|
||||
void my_warning(png_structp,png_const_charp /*err*/){}
|
||||
|
||||
unsigned char * png_start_pos = NULL;
|
||||
unsigned char * png_end_pos = NULL;
|
||||
@@ -867,7 +867,7 @@ int CreateBitmapFromPNG(const char * inFilePath, struct ImageInfo * outImageInf
|
||||
png_infop infoPtr = NULL;
|
||||
unsigned char * buffer = NULL;
|
||||
FILE * file = NULL;
|
||||
int fileLength = 0;
|
||||
size_t fileLength = 0;
|
||||
outImageInfo->data = NULL;
|
||||
char** rows = NULL;
|
||||
double lcl_gamma; // This will be the gamma of the file if it has one.
|
||||
@@ -947,7 +947,7 @@ int CreateBitmapFromPNG(const char * inFilePath, struct ImageInfo * outImageInf
|
||||
rows=(char**)malloc(height*sizeof(char*));
|
||||
if (!rows) goto bail;
|
||||
|
||||
for(int i=0;i<height;i++)
|
||||
for(png_uint_32 i=0;i<height;i++)
|
||||
{
|
||||
rows[i]=(char*)outImageInfo->data +((outImageInfo->height-1-i)*(outImageInfo->width)*(outImageInfo->channels));
|
||||
}
|
||||
|
||||
@@ -140,9 +140,9 @@ bool XObjRead(const char * inFile, XObj& outObj)
|
||||
cmd.cmdType = type_PtLine;
|
||||
count = obj2_op;
|
||||
if (tokens.size() < 4) return false;
|
||||
scanned_st_rgb[0][0]=scanned_st_rgb[1][0]=atof(tokens[1].c_str())*0.1; // r
|
||||
scanned_st_rgb[0][1]=scanned_st_rgb[1][1]=atof(tokens[2].c_str())*0.1; // g
|
||||
scanned_st_rgb[0][2]=scanned_st_rgb[1][2]=atof(tokens[3].c_str())*0.1; // b
|
||||
scanned_st_rgb[0][0]=scanned_st_rgb[1][0]=static_cast<float>(atof(tokens[1].c_str()))*0.1f; // r
|
||||
scanned_st_rgb[0][1]=scanned_st_rgb[1][1]=static_cast<float>(atof(tokens[2].c_str()))*0.1f; // g
|
||||
scanned_st_rgb[0][2]=scanned_st_rgb[1][2]=static_cast<float>(atof(tokens[3].c_str()))*0.1f; // b
|
||||
|
||||
// Sets of x,y,z follows.
|
||||
for (int t = 0; t < count; ++t)
|
||||
@@ -151,9 +151,9 @@ bool XObjRead(const char * inFile, XObj& outObj)
|
||||
f.next();
|
||||
BreakString(line, tokens);
|
||||
if (tokens.size() < 3) return false;
|
||||
vrgb.v[0] = atof(tokens[0].c_str());
|
||||
vrgb.v[1] = atof(tokens[1].c_str());
|
||||
vrgb.v[2] = atof(tokens[2].c_str());
|
||||
vrgb.v[0] = static_cast<float>(atof(tokens[0].c_str()));
|
||||
vrgb.v[1] = static_cast<float>(atof(tokens[1].c_str()));
|
||||
vrgb.v[2] = static_cast<float>(atof(tokens[2].c_str()));
|
||||
vrgb.rgb[0] = scanned_st_rgb[t][0];
|
||||
vrgb.rgb[1] = scanned_st_rgb[t][1];
|
||||
vrgb.rgb[2] = scanned_st_rgb[t][2];
|
||||
@@ -176,10 +176,10 @@ bool XObjRead(const char * inFile, XObj& outObj)
|
||||
// because
|
||||
if (version == 2)
|
||||
{
|
||||
scanned_st_rgb[2][0]=scanned_st_rgb[3][0]=atof(tokens[1].c_str()); // s1
|
||||
scanned_st_rgb[0][0]=scanned_st_rgb[1][0]=atof(tokens[2].c_str()); // s2
|
||||
scanned_st_rgb[1][1]=scanned_st_rgb[2][1]=atof(tokens[3].c_str()); // t1
|
||||
scanned_st_rgb[0][1]=scanned_st_rgb[3][1]=atof(tokens[4].c_str()); // t2
|
||||
scanned_st_rgb[2][0]=scanned_st_rgb[3][0]=static_cast<float>(atof(tokens[1].c_str())); // s1
|
||||
scanned_st_rgb[0][0]=scanned_st_rgb[1][0]=static_cast<float>(atof(tokens[2].c_str())); // s2
|
||||
scanned_st_rgb[1][1]=scanned_st_rgb[2][1]=static_cast<float>(atof(tokens[3].c_str())); // t1
|
||||
scanned_st_rgb[0][1]=scanned_st_rgb[3][1]=static_cast<float>(atof(tokens[4].c_str())); // t2
|
||||
} else {
|
||||
scanned_st_rgb[2][0]=scanned_st_rgb[3][0]=0.0;
|
||||
scanned_st_rgb[0][0]=scanned_st_rgb[1][0]=0.0;
|
||||
@@ -194,9 +194,9 @@ bool XObjRead(const char * inFile, XObj& outObj)
|
||||
BreakString(line, tokens);
|
||||
if (tokens.size() < 3) return false;
|
||||
|
||||
vst.v[0] = atof(tokens[0].c_str());
|
||||
vst.v[1] = atof(tokens[1].c_str());
|
||||
vst.v[2] = atof(tokens[2].c_str());
|
||||
vst.v[0] = static_cast<float>(atof(tokens[0].c_str()));
|
||||
vst.v[1] = static_cast<float>(atof(tokens[1].c_str()));
|
||||
vst.v[2] = static_cast<float>(atof(tokens[2].c_str()));
|
||||
vst.st[0] = scanned_st_rgb[t][0];
|
||||
vst.st[1] = scanned_st_rgb[t][1];
|
||||
cmd.st.push_back(vst);
|
||||
@@ -224,17 +224,17 @@ bool XObjRead(const char * inFile, XObj& outObj)
|
||||
f.next();
|
||||
BreakString(line, tokens);
|
||||
if (tokens.size() < 10) return false;
|
||||
vst.v[0] = atof(tokens[0].c_str());
|
||||
vst.v[1] = atof(tokens[1].c_str());
|
||||
vst.v[2] = atof(tokens[2].c_str());
|
||||
vst.st[0] = atof(tokens[6].c_str());
|
||||
vst.st[1] = atof(tokens[8].c_str());
|
||||
vst.v[0] = static_cast<float>(atof(tokens[0].c_str()));
|
||||
vst.v[1] = static_cast<float>(atof(tokens[1].c_str()));
|
||||
vst.v[2] = static_cast<float>(atof(tokens[2].c_str()));
|
||||
vst.st[0] = static_cast<float>(atof(tokens[6].c_str()));
|
||||
vst.st[1] = static_cast<float>(atof(tokens[8].c_str()));
|
||||
cmd.st.push_back(vst);
|
||||
vst.v[0] = atof(tokens[3].c_str());
|
||||
vst.v[1] = atof(tokens[4].c_str());
|
||||
vst.v[2] = atof(tokens[5].c_str());
|
||||
vst.st[0] = atof(tokens[7].c_str());
|
||||
vst.st[1] = atof(tokens[9].c_str());
|
||||
vst.v[0] = static_cast<float>(atof(tokens[3].c_str()));
|
||||
vst.v[1] = static_cast<float>(atof(tokens[4].c_str()));
|
||||
vst.v[2] = static_cast<float>(atof(tokens[5].c_str()));
|
||||
vst.st[0] = static_cast<float>(atof(tokens[7].c_str()));
|
||||
vst.st[1] = static_cast<float>(atof(tokens[9].c_str()));
|
||||
cmd.st.push_back(vst);
|
||||
}
|
||||
outObj.cmds.push_back(cmd);
|
||||
@@ -270,12 +270,12 @@ bool XObjRead(const char * inFile, XObj& outObj)
|
||||
BreakString(line, tokens);
|
||||
if (tokens.size() > 5)
|
||||
{
|
||||
vrgb.v[0] = atof(tokens[0].c_str());
|
||||
vrgb.v[1] = atof(tokens[1].c_str());
|
||||
vrgb.v[2] = atof(tokens[2].c_str());
|
||||
vrgb.rgb[0] = atof(tokens[3].c_str());
|
||||
vrgb.rgb[1] = atof(tokens[4].c_str());
|
||||
vrgb.rgb[2] = atof(tokens[5].c_str());
|
||||
vrgb.v[0] = static_cast<float>(atof(tokens[0].c_str()));
|
||||
vrgb.v[1] = static_cast<float>(atof(tokens[1].c_str()));
|
||||
vrgb.v[2] = static_cast<float>(atof(tokens[2].c_str()));
|
||||
vrgb.rgb[0] = static_cast<float>(atof(tokens[3].c_str()));
|
||||
vrgb.rgb[1] = static_cast<float>(atof(tokens[4].c_str()));
|
||||
vrgb.rgb[2] = static_cast<float>(atof(tokens[5].c_str()));
|
||||
|
||||
cmd.rgb.push_back(vrgb);
|
||||
} else
|
||||
@@ -295,22 +295,22 @@ bool XObjRead(const char * inFile, XObj& outObj)
|
||||
BreakString(line, tokens);
|
||||
if (tokens.size() > 4)
|
||||
{
|
||||
vst.v[0] = atof(tokens[0].c_str());
|
||||
vst.v[1] = atof(tokens[1].c_str());
|
||||
vst.v[2] = atof(tokens[2].c_str());
|
||||
vst.st[0] = atof(tokens[3].c_str());
|
||||
vst.st[1] = atof(tokens[4].c_str());
|
||||
vst.v[0] = static_cast<float>(atof(tokens[0].c_str()));
|
||||
vst.v[1] = static_cast<float>(atof(tokens[1].c_str()));
|
||||
vst.v[2] = static_cast<float>(atof(tokens[2].c_str()));
|
||||
vst.st[0] = static_cast<float>(atof(tokens[3].c_str()));
|
||||
vst.st[1] = static_cast<float>(atof(tokens[4].c_str()));
|
||||
|
||||
cmd.st.push_back(vst);
|
||||
|
||||
if (tokens.size() > 9)
|
||||
{
|
||||
--count;
|
||||
vst.v[0] = atof(tokens[5].c_str());
|
||||
vst.v[1] = atof(tokens[6].c_str());
|
||||
vst.v[2] = atof(tokens[7].c_str());
|
||||
vst.st[0] = atof(tokens[8].c_str());
|
||||
vst.st[1] = atof(tokens[9].c_str());
|
||||
vst.v[0] = static_cast<float>(atof(tokens[5].c_str()));
|
||||
vst.v[1] = static_cast<float>(atof(tokens[6].c_str()));
|
||||
vst.v[2] = static_cast<float>(atof(tokens[7].c_str()));
|
||||
vst.st[0] = static_cast<float>(atof(tokens[8].c_str()));
|
||||
vst.st[1] = static_cast<float>(atof(tokens[9].c_str()));
|
||||
|
||||
cmd.st.push_back(vst);
|
||||
}
|
||||
@@ -322,10 +322,10 @@ bool XObjRead(const char * inFile, XObj& outObj)
|
||||
break;
|
||||
case type_Attr:
|
||||
|
||||
if (tokens.size() > count)
|
||||
if (tokens.size() > static_cast<size_t>(count))
|
||||
{
|
||||
for (int n = 0; n < count; ++n)
|
||||
cmd.attributes.push_back(atof(tokens[n+1].c_str()));
|
||||
cmd.attributes.push_back(static_cast<float>(atof(tokens[n+1].c_str())));
|
||||
} else
|
||||
return false;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ XPCAircraft::~XPCAircraft()
|
||||
}
|
||||
|
||||
XPMPPlaneCallbackResult XPCAircraft::AircraftCB(
|
||||
XPMPPlaneID inPlane,
|
||||
XPMPPlaneID /*inPlane*/,
|
||||
XPMPPlaneDataType inDataType,
|
||||
void * ioData,
|
||||
void * inRefcon)
|
||||
|
||||
@@ -114,11 +114,11 @@ const char * XPMPMultiplayerInit(
|
||||
gDefaultPlane = inDefaultPlane;
|
||||
gIntPrefsFunc = inIntPrefsFunc;
|
||||
gFloatPrefsFunc = inFloatPrefsFunc;
|
||||
char myPath[1024];
|
||||
char airPath[1024];
|
||||
char line[256];
|
||||
char sysPath[1024];
|
||||
FILE * fi;
|
||||
//char myPath[1024];
|
||||
//char airPath[1024];
|
||||
//char line[256];
|
||||
//char sysPath[1024];
|
||||
//FILE * fi;
|
||||
|
||||
bool problem = false;
|
||||
|
||||
@@ -162,13 +162,13 @@ const char * XPMPMultiplayerEnable(void)
|
||||
std::vector<char *> ptrs;
|
||||
gPlanePaths.push_back("");
|
||||
|
||||
for (int p = 0; p < gPackages.size(); ++p)
|
||||
for (size_t p = 0; p < gPackages.size(); ++p)
|
||||
{
|
||||
for (int pp = 0; pp < gPackages[p].planes.size(); ++pp)
|
||||
for (size_t pp = 0; pp < gPackages[p].planes.size(); ++pp)
|
||||
{
|
||||
if (gPackages[p].planes[pp].plane_type == plane_Austin)
|
||||
{
|
||||
gPackages[p].planes[pp].austin_idx = gPlanePaths.size();
|
||||
gPackages[p].planes[pp].austin_idx = static_cast<int>(gPlanePaths.size());
|
||||
char buf[1024];
|
||||
strcpy(buf,gPackages[p].planes[pp].file_path.c_str());
|
||||
#if APL
|
||||
@@ -180,11 +180,11 @@ const char * XPMPMultiplayerEnable(void)
|
||||
}
|
||||
|
||||
// Copy the list into something that's not permanent, but is needed by the XPLM.
|
||||
for (int n = 0; n < gPlanePaths.size(); ++n)
|
||||
for (size_t n = 0; n < gPlanePaths.size(); ++n)
|
||||
{
|
||||
#if DEBUG_MANUAL_LOADING
|
||||
char strbuf[1024];
|
||||
sprintf(strbuf, "Plane %d = '%s'\n", n, gPlanePaths[n].c_str());
|
||||
sprintf(strbuf, "Plane %d = '%s'\n", static_cast<int>(n), gPlanePaths[n].c_str());
|
||||
XPLMDebugString(strbuf);
|
||||
#endif
|
||||
ptrs.push_back((char *) gPlanePaths[n].c_str());
|
||||
@@ -220,8 +220,8 @@ void XPMPLoadPlanesIfNecessary(void)
|
||||
if (owner != XPLMGetMyID())
|
||||
return;
|
||||
|
||||
if (models > gPlanePaths.size())
|
||||
models = gPlanePaths.size();
|
||||
if (models > static_cast<int>(gPlanePaths.size()))
|
||||
models = static_cast<int>(gPlanePaths.size());
|
||||
for (int n = 1; n < models; ++n)
|
||||
{
|
||||
if (!gPlanePaths[n].empty())
|
||||
@@ -327,13 +327,13 @@ void XPMPSetDefaultPlaneICAO(
|
||||
|
||||
long XPMPCountPlanes(void)
|
||||
{
|
||||
return gPlanes.size();
|
||||
return static_cast<long>(gPlanes.size());
|
||||
}
|
||||
|
||||
XPMPPlaneID XPMPGetNthPlane(
|
||||
long index)
|
||||
{
|
||||
if ((index < 0) || (index >= gPlanes.size()))
|
||||
if ((index < 0) || (index >= static_cast<long>(gPlanes.size())))
|
||||
return NULL;
|
||||
|
||||
return gPlanes[index];
|
||||
@@ -457,8 +457,8 @@ void XPMPSetPlaneRenderer(
|
||||
// This callback ping-pongs the multiplayer count up and back depending
|
||||
// on whether we're drawing the TCAS gauges or not.
|
||||
int XPMPControlPlaneCount(
|
||||
XPLMDrawingPhase inPhase,
|
||||
int inIsBefore,
|
||||
XPLMDrawingPhase /*inPhase*/,
|
||||
int /*inIsBefore*/,
|
||||
void * inRefcon)
|
||||
{
|
||||
if (inRefcon == NULL)
|
||||
@@ -473,9 +473,9 @@ int XPMPControlPlaneCount(
|
||||
|
||||
// This routine draws the actual planes.
|
||||
int XPMPRenderMultiplayerPlanes(
|
||||
XPLMDrawingPhase inPhase,
|
||||
int inIsBefore,
|
||||
void * inRefcon)
|
||||
XPLMDrawingPhase /*inPhase*/,
|
||||
int /*inIsBefore*/,
|
||||
void * /*inRefcon*/)
|
||||
{
|
||||
static int is_blend = 0;
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ int HFS2PosixPath(const char *path, char *result, int resultLen)
|
||||
static void MakePartialPathNativeObj(string& io_str)
|
||||
{
|
||||
// char sep = *XPLMGetDirectorySeparator();
|
||||
for(int i = 0; i < io_str.size(); ++i)
|
||||
for(size_t i = 0; i < io_str.size(); ++i)
|
||||
if(io_str[i] == '/' || io_str[i] == ':' || io_str[i] == '\\')
|
||||
io_str[i] = '/';
|
||||
}
|
||||
@@ -140,6 +140,12 @@ struct XPLMDump {
|
||||
XPLMDebugString(buf);
|
||||
return *this;
|
||||
}
|
||||
XPLMDump& operator<<(size_t n) {
|
||||
char buf[255];
|
||||
sprintf(buf, "%u", static_cast<unsigned>(n));
|
||||
XPLMDebugString(buf);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -182,6 +188,7 @@ char * fgets_multiplatform(char * s, int n, FILE * file)
|
||||
|
||||
// EOF: this could mean I/O error or end of file.
|
||||
if (c == EOF)
|
||||
{
|
||||
if (feof(file) && p != s) // We read something and now the file's done, ok.
|
||||
break;
|
||||
else
|
||||
@@ -189,6 +196,7 @@ char * fgets_multiplatform(char * s, int n, FILE * file)
|
||||
// Haven't read yet? I/O error? Return NULL!
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
*p++ = c;
|
||||
}
|
||||
@@ -230,7 +238,7 @@ void BreakStringPvt(const char * inString, std::vector<std::string>& outStrings,
|
||||
++iter;
|
||||
if (iter < endPos)
|
||||
{
|
||||
if (maxBreak && (maxBreak == (outStrings.size()+1)))
|
||||
if (maxBreak && (maxBreak == static_cast<int>(outStrings.size()+1)))
|
||||
{
|
||||
outStrings.push_back(std::string(iter, endPos));
|
||||
return;
|
||||
@@ -556,7 +564,7 @@ bool LoadOnePackage(const string& inPath, int pass)
|
||||
HFS2PosixPath(xsystem, xsystem, 1024);
|
||||
#endif
|
||||
|
||||
int sys_len = strlen(xsystem);
|
||||
size_t sys_len = strlen(xsystem);
|
||||
if(fullPath.size() > sys_len)
|
||||
fullPath.erase(fullPath.begin(),fullPath.begin() + sys_len);
|
||||
else
|
||||
@@ -613,10 +621,10 @@ bool LoadOnePackage(const string& inPath, int pass)
|
||||
icao = tokens[1];
|
||||
group = gGroupings[icao];
|
||||
if (pckg->matches[match_icao].count(icao) == 0)
|
||||
pckg->matches[match_icao] [icao] = pckg->planes.size() - 1;
|
||||
pckg->matches[match_icao] [icao] = static_cast<int>(pckg->planes.size()) - 1;
|
||||
if (!group.empty())
|
||||
if (pckg->matches[match_group].count(group) == 0)
|
||||
pckg->matches[match_group] [group] = pckg->planes.size() - 1;
|
||||
pckg->matches[match_group] [group] = static_cast<int>(pckg->planes.size()) - 1;
|
||||
} else {
|
||||
parse_err = true;
|
||||
XPLMDump(path, lineNum, line) << "XSB WARNING: ICAO command takes 1 argument.\n";
|
||||
@@ -636,7 +644,7 @@ bool LoadOnePackage(const string& inPath, int pass)
|
||||
airline = tokens[2];
|
||||
group = gGroupings[icao];
|
||||
if (pckg->matches[match_icao_airline].count(icao + " " + airline) == 0)
|
||||
pckg->matches[match_icao_airline] [icao + " " + airline] = pckg->planes.size() - 1;
|
||||
pckg->matches[match_icao_airline] [icao + " " + airline] = static_cast<int>(pckg->planes.size()) - 1;
|
||||
#if USE_DEFAULTING
|
||||
if (pckg->matches[match_icao ].count(icao ) == 0)
|
||||
pckg->matches[match_icao ] [icao ] = pckg->planes.size() - 1;
|
||||
@@ -648,7 +656,7 @@ bool LoadOnePackage(const string& inPath, int pass)
|
||||
pckg->matches[match_group ] [group ] = pckg->planes.size() - 1;
|
||||
#endif
|
||||
if (pckg->matches[match_group_airline].count(group + " " + airline) == 0)
|
||||
pckg->matches[match_group_airline] [group + " " + airline] = pckg->planes.size() - 1;
|
||||
pckg->matches[match_group_airline] [group + " " + airline] = static_cast<int>(pckg->planes.size()) - 1;
|
||||
}
|
||||
} else {
|
||||
parse_err = true;
|
||||
@@ -677,7 +685,7 @@ bool LoadOnePackage(const string& inPath, int pass)
|
||||
pckg->matches[match_icao_airline ] [icao + " " + airline ] = pckg->planes.size() - 1;
|
||||
#endif
|
||||
if (pckg->matches[match_icao_airline_livery ].count(icao + " " + airline + " " + livery) == 0)
|
||||
pckg->matches[match_icao_airline_livery ] [icao + " " + airline + " " + livery] = pckg->planes.size() - 1;
|
||||
pckg->matches[match_icao_airline_livery ] [icao + " " + airline + " " + livery] = static_cast<int>(pckg->planes.size()) - 1;
|
||||
if (!group.empty())
|
||||
{
|
||||
#if USE_DEFAULTING
|
||||
@@ -687,7 +695,7 @@ bool LoadOnePackage(const string& inPath, int pass)
|
||||
pckg->matches[match_group_airline ] [group + " " + airline ] = pckg->planes.size() - 1;
|
||||
#endif
|
||||
if (pckg->matches[match_group_airline_livery ].count(group + " " + airline + " " + livery) == 0)
|
||||
pckg->matches[match_group_airline_livery ] [group + " " + airline + " " + livery] = pckg->planes.size() - 1;
|
||||
pckg->matches[match_group_airline_livery ] [group + " " + airline + " " + livery] = static_cast<int>(pckg->planes.size()) - 1;
|
||||
}
|
||||
} else {
|
||||
parse_err = true;
|
||||
@@ -777,12 +785,12 @@ bool CSL_LoadCSL(const char * inFolderPath, const char * inRelatedFile, const ch
|
||||
vector<string> tokens;
|
||||
BreakStringPvt(buf, tokens, 0, " \t\r\n");
|
||||
string group;
|
||||
for (int n = 0; n < tokens.size(); ++n)
|
||||
for (size_t n = 0; n < tokens.size(); ++n)
|
||||
{
|
||||
if (n != 0) group += " ";
|
||||
group += tokens[n];
|
||||
}
|
||||
for (int n = 0; n < tokens.size(); ++n)
|
||||
for (size_t n = 0; n < tokens.size(); ++n)
|
||||
{
|
||||
gGroupings[tokens[n]] = group;
|
||||
}
|
||||
@@ -827,7 +835,7 @@ bool CSL_LoadCSL(const char * inFolderPath, const char * inRelatedFile, const ch
|
||||
free(index_buf);
|
||||
|
||||
for (int pass = 0; pass < pass_Count; ++pass)
|
||||
for (int n = 0; n < pckgs.size(); ++n)
|
||||
for (size_t n = 0; n < pckgs.size(); ++n)
|
||||
{
|
||||
if (LoadOnePackage(pckgs[n], pass))
|
||||
ok = false;
|
||||
@@ -909,7 +917,7 @@ CSLPlane_t * CSL_MatchPlane(const char * inICAO, const char * inAirline, const c
|
||||
}
|
||||
|
||||
// Now go through each group and see if we match.
|
||||
for (int p = 0; p < gPackages.size(); ++p)
|
||||
for (size_t p = 0; p < gPackages.size(); ++p)
|
||||
{
|
||||
map<string,int>::iterator iter = gPackages[p].matches[n].find(key);
|
||||
if (iter != gPackages[p].matches[n].end())
|
||||
@@ -976,7 +984,7 @@ CSLPlane_t * CSL_MatchPlane(const char * inICAO, const char * inAirline, const c
|
||||
}
|
||||
}
|
||||
|
||||
for (int p = 0; p < gPackages.size(); ++p)
|
||||
for (size_t p = 0; p < gPackages.size(); ++p)
|
||||
{
|
||||
std::map<string, int>::const_iterator it = gPackages[p].matches[4].begin();
|
||||
while(it != gPackages[p].matches[4].end()) {
|
||||
@@ -1039,10 +1047,10 @@ CSLPlane_t * CSL_MatchPlane(const char * inICAO, const char * inAirline, const c
|
||||
void CSL_Dump(void)
|
||||
{
|
||||
// DIAGNOSTICS - print out everything we know.
|
||||
for (int n = 0; n < gPackages.size(); ++n)
|
||||
for (size_t n = 0; n < gPackages.size(); ++n)
|
||||
{
|
||||
XPLMDump() << "XSB CSL: Package " << n << " path = " << gPackages[n].name << "\n";
|
||||
for (int p = 0; p < gPackages[n].planes.size(); ++p)
|
||||
for (size_t p = 0; p < gPackages[n].planes.size(); ++p)
|
||||
{
|
||||
XPLMDump() << "XSB CSL: Plane " << p << " = " << gPackages[n].planes[p].file_path << "\n";
|
||||
}
|
||||
@@ -1096,10 +1104,10 @@ void CSL_DrawObject(
|
||||
{
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glTranslatef(x, y, z);
|
||||
glRotatef(heading, 0.0, -1.0, 0.0);
|
||||
glRotatef(pitch, 01.0, 0.0, 0.0);
|
||||
glRotatef(roll, 0.0, 0.0, -1.0);
|
||||
glTranslatef(static_cast<GLfloat>(x), static_cast<GLfloat>(y), static_cast<GLfloat>(z));
|
||||
glRotatef(static_cast<GLfloat>(heading), 0.0, -1.0, 0.0);
|
||||
glRotatef(static_cast<GLfloat>(pitch), 01.0, 0.0, 0.0);
|
||||
glRotatef(static_cast<GLfloat>(roll), 0.0, 0.0, -1.0);
|
||||
}
|
||||
|
||||
switch (type)
|
||||
@@ -1111,7 +1119,8 @@ void CSL_DrawObject(
|
||||
XPLMCountAircraft(&total, &active, &who);
|
||||
if (model->austin_idx > 0 && model->austin_idx < active)
|
||||
XPLMDrawAircraft(model->austin_idx,
|
||||
x, y ,z, pitch, roll, heading,
|
||||
static_cast<GLfloat>(x), static_cast<GLfloat>(y), static_cast<GLfloat>(z),
|
||||
static_cast<GLfloat>(pitch), static_cast<GLfloat>(roll), static_cast<GLfloat>(heading),
|
||||
full, state);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -50,17 +50,17 @@ const double kMetersToNM = 0.000539956803;
|
||||
//const float kNavLightGreen[] = {0.0, 1.0, 0.3, 0.6};
|
||||
//const float kLandingLight[] = {1.0, 1.0, 0.7, 0.6};
|
||||
//const float kStrobeLight[] = {1.0, 1.0, 1.0, 0.4};
|
||||
const float kNavLightRed[] = {1.0, 0.0, 0.2, 0.5};
|
||||
const float kNavLightGreen[] = {0.0, 1.0, 0.3, 0.5};
|
||||
const float kLandingLight[] = {1.0, 1.0, 0.7, 0.6};
|
||||
const float kStrobeLight[] = {1.0, 1.0, 1.0, 0.7};
|
||||
const float kNavLightRed[] = {1.0f, 0.0f, 0.2f, 0.5f};
|
||||
const float kNavLightGreen[] = {0.0f, 1.0f, 0.3f, 0.5f};
|
||||
const float kLandingLight[] = {1.0f, 1.0f, 0.7f, 0.6f};
|
||||
const float kStrobeLight[] = {1.0f, 1.0f, 1.0f, 0.7f};
|
||||
|
||||
static int sLightTexture = -1;
|
||||
|
||||
static void MakePartialPathNativeObj(string& io_str)
|
||||
{
|
||||
// char sep = *XPLMGetDirectorySeparator();
|
||||
for(int i = 0; i < io_str.size(); ++i)
|
||||
for(size_t i = 0; i < io_str.size(); ++i)
|
||||
if(io_str[i] == '/' || io_str[i] == ':' || io_str[i] == '\\')
|
||||
io_str[i] = '/';
|
||||
}
|
||||
@@ -73,7 +73,7 @@ bool NormalizeVec(float vec[3])
|
||||
float len=sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]);
|
||||
if (len>0.0)
|
||||
{
|
||||
len = 1.0 / len;
|
||||
len = 1.0f / len;
|
||||
vec[0] *= len;
|
||||
vec[1] *= len;
|
||||
vec[2] *= len;
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
void NormalizeNormals(void);
|
||||
void DebugDrawNormals();
|
||||
void Purge() { mPointPool.clear(); }
|
||||
int Size() { return mPointPool.size(); }
|
||||
int Size() { return static_cast<int>(mPointPool.size()); }
|
||||
private:
|
||||
vector<float> mPointPool;
|
||||
};
|
||||
@@ -119,14 +119,14 @@ int OBJ_PointPool::AddPoint(float xyz[3], float st[2])
|
||||
{
|
||||
#if !DISABLE_SHARING
|
||||
// Use x as the key...see if we can find it
|
||||
for(int n = 0; n < mPointPool.size(); n += 8)
|
||||
for(size_t n = 0; n < mPointPool.size(); n += 8)
|
||||
{
|
||||
if((xyz[0] == mPointPool[n]) &&
|
||||
(xyz[1] == mPointPool[n+1]) &&
|
||||
(xyz[2] == mPointPool[n+2]) &&
|
||||
(st[0] == mPointPool[n+3]) &&
|
||||
(st[1] == mPointPool[n+4]))
|
||||
return n/8; // Clients care about point # not array index
|
||||
return static_cast<int>(n/8); // Clients care about point # not array index
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -137,7 +137,7 @@ int OBJ_PointPool::AddPoint(float xyz[3], float st[2])
|
||||
mPointPool.push_back(st[0]); mPointPool.push_back(st[1]);
|
||||
// Allocate some space for the normal later
|
||||
mPointPool.push_back(0.0); mPointPool.push_back(0.0); mPointPool.push_back(0.0);
|
||||
return (mPointPool.size()/8)-1;
|
||||
return (static_cast<int>(mPointPool.size())/8)-1;
|
||||
}
|
||||
|
||||
// This function sets up OpenGL for our point pool
|
||||
@@ -213,9 +213,9 @@ void OBJ_PointPool::NormalizeNormals(void)
|
||||
// be the same but the S&T coords won't. If we have slightly different normals and the sun is making
|
||||
// shiney specular hilites, the discontinuity is real noticiable.
|
||||
#if BLEND_NORMALS
|
||||
for (int n = 0; n < mPointPool.size(); n += 8)
|
||||
for (size_t n = 0; n < mPointPool.size(); n += 8)
|
||||
{
|
||||
for (int m = 0; m < mPointPool.size(); m += 8)
|
||||
for (size_t m = 0; m < mPointPool.size(); m += 8)
|
||||
if (mPointPool[n ]==mPointPool[m ] &&
|
||||
mPointPool[n+1]==mPointPool[m+1] &&
|
||||
mPointPool[n+2]==mPointPool[m+2] &&
|
||||
@@ -227,7 +227,7 @@ void OBJ_PointPool::NormalizeNormals(void)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (int n = 5; n < mPointPool.size(); n += 8)
|
||||
for (size_t n = 5; n < mPointPool.size(); n += 8)
|
||||
{
|
||||
NormalizeVec(&mPointPool[n]);
|
||||
}
|
||||
@@ -239,7 +239,7 @@ void OBJ_PointPool::DebugDrawNormals()
|
||||
XPLMSetGraphicsState(0, 0, 0, 0, 0, 1, 0);
|
||||
glColor3f(1.0, 0.0, 1.0);
|
||||
glBegin(GL_LINES);
|
||||
for(int n = 0; n < mPointPool.size(); n+=8)
|
||||
for(size_t n = 0; n < mPointPool.size(); n+=8)
|
||||
{
|
||||
glVertex3f(mPointPool[n], mPointPool[n+1], mPointPool[n+2]);
|
||||
glVertex3f(mPointPool[n] + mPointPool[n+5], mPointPool[n+1] + mPointPool[n+1+5],
|
||||
@@ -322,10 +322,10 @@ int OBJ_LoadModel(const char * inFilePath)
|
||||
{
|
||||
string path(inFilePath);
|
||||
|
||||
for (int n = 0; n < sObjects.size(); ++n)
|
||||
for (size_t n = 0; n < sObjects.size(); ++n)
|
||||
{
|
||||
if (path == sObjects[n].path)
|
||||
return n;
|
||||
return static_cast<int>(n);
|
||||
}
|
||||
|
||||
sObjects.push_back(ObjInfo_t());
|
||||
@@ -394,15 +394,15 @@ int OBJ_LoadModel(const char * inFilePath)
|
||||
{
|
||||
// For each light we've found, copy the data into our
|
||||
// own light vector
|
||||
for(int n = 0; n < cmd->rgb.size(); n++)
|
||||
for(size_t n = 0; n < cmd->rgb.size(); n++)
|
||||
{
|
||||
sObjects.back().lods.back().lights.push_back(LightInfo_t());
|
||||
sObjects.back().lods.back().lights.back().xyz[0] = cmd->rgb[n].v[0];
|
||||
sObjects.back().lods.back().lights.back().xyz[1] = cmd->rgb[n].v[1];
|
||||
sObjects.back().lods.back().lights.back().xyz[2] = cmd->rgb[n].v[2];
|
||||
sObjects.back().lods.back().lights.back().rgb[0] = cmd->rgb[n].rgb[0];
|
||||
sObjects.back().lods.back().lights.back().rgb[1] = cmd->rgb[n].rgb[1];
|
||||
sObjects.back().lods.back().lights.back().rgb[2] = cmd->rgb[n].rgb[2];
|
||||
sObjects.back().lods.back().lights.back().rgb[0] = static_cast<int>(cmd->rgb[n].rgb[0]);
|
||||
sObjects.back().lods.back().lights.back().rgb[1] = static_cast<int>(cmd->rgb[n].rgb[1]);
|
||||
sObjects.back().lods.back().lights.back().rgb[2] = static_cast<int>(cmd->rgb[n].rgb[2]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -410,7 +410,7 @@ int OBJ_LoadModel(const char * inFilePath)
|
||||
{
|
||||
vector<int> indexes;
|
||||
// First get our point pool setup with all verticies
|
||||
for(int n = 0; n < cmd->st.size(); n++)
|
||||
for(size_t n = 0; n < cmd->st.size(); n++)
|
||||
{
|
||||
float xyz[3], st[2];
|
||||
int index;
|
||||
@@ -426,13 +426,13 @@ int OBJ_LoadModel(const char * inFilePath)
|
||||
|
||||
switch(cmd->cmdID) {
|
||||
case obj_Tri:
|
||||
for(int n = 0; n < indexes.size(); ++n)
|
||||
for(size_t n = 0; n < indexes.size(); ++n)
|
||||
{
|
||||
sObjects.back().lods.back().triangleList.push_back(indexes[n]);
|
||||
}
|
||||
break;
|
||||
case obj_Tri_Fan:
|
||||
for(int n = 2; n < indexes.size(); n++)
|
||||
for(size_t n = 2; n < indexes.size(); n++)
|
||||
{
|
||||
sObjects.back().lods.back().triangleList.push_back(indexes[0 ]);
|
||||
sObjects.back().lods.back().triangleList.push_back(indexes[n-1]);
|
||||
@@ -441,7 +441,7 @@ int OBJ_LoadModel(const char * inFilePath)
|
||||
break;
|
||||
case obj_Tri_Strip:
|
||||
case obj_Quad_Strip:
|
||||
for(int n = 2; n < indexes.size(); n++)
|
||||
for(size_t n = 2; n < indexes.size(); n++)
|
||||
{
|
||||
if((n % 2) == 1)
|
||||
{
|
||||
@@ -458,7 +458,7 @@ int OBJ_LoadModel(const char * inFilePath)
|
||||
}
|
||||
break;
|
||||
case obj_Quad:
|
||||
for(int n = 3; n < indexes.size(); n += 4)
|
||||
for(size_t n = 3; n < indexes.size(); n += 4)
|
||||
{
|
||||
sObjects.back().lods.back().triangleList.push_back(indexes[n-3]);
|
||||
sObjects.back().lods.back().triangleList.push_back(indexes[n-2]);
|
||||
@@ -475,9 +475,9 @@ int OBJ_LoadModel(const char * inFilePath)
|
||||
}
|
||||
|
||||
// Calculate our normals for all LOD's
|
||||
for (int i = 0; i < sObjects.back().lods.size(); i++)
|
||||
for (size_t i = 0; i < sObjects.back().lods.size(); i++)
|
||||
{
|
||||
for (int n = 0; n < sObjects.back().lods[i].triangleList.size(); n += 3)
|
||||
for (size_t n = 0; n < sObjects.back().lods[i].triangleList.size(); n += 3)
|
||||
{
|
||||
sObjects.back().lods[i].pointPool.CalcTriNormal(
|
||||
sObjects.back().lods[i].triangleList[n],
|
||||
@@ -488,7 +488,7 @@ int OBJ_LoadModel(const char * inFilePath)
|
||||
sObjects.back().lods[i].dl = 0;
|
||||
}
|
||||
sObjects.back().obj.cmds.clear();
|
||||
return sObjects.size()-1;
|
||||
return static_cast<int>(sObjects.size())-1;
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
@@ -497,18 +497,18 @@ int OBJ_LoadModel(const char * inFilePath)
|
||||
// Note that texID and litTexID are OPTIONAL! They will only be filled
|
||||
// in if the user wants to override the default texture specified by the
|
||||
// obj file
|
||||
void OBJ_PlotModel(int model, int texID, int litTexID, float inDistance, double inX,
|
||||
double inY, double inZ, double inPitch, double inRoll, double inHeading)
|
||||
void OBJ_PlotModel(int model, int texID, int litTexID, float inDistance, double /*inX*/,
|
||||
double /*inY*/, double /*inZ*/, double /*inPitch*/, double /*inRoll*/, double /*inHeading*/)
|
||||
{
|
||||
int tex, lit;
|
||||
// Find out what LOD we need to draw
|
||||
int lodIdx = -1;
|
||||
for(int n = 0; n < sObjects[model].lods.size(); n++)
|
||||
for(size_t n = 0; n < sObjects[model].lods.size(); n++)
|
||||
{
|
||||
if((inDistance >= sObjects[model].lods[n].nearDist) &&
|
||||
(inDistance <= sObjects[model].lods[n].farDist))
|
||||
{
|
||||
lodIdx = n;
|
||||
lodIdx = static_cast<int>(n);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -574,7 +574,7 @@ void OBJ_PlotModel(int model, int texID, int litTexID, float inDistance, double
|
||||
|
||||
glNewList(sObjects[model].lods[lodIdx].dl, GL_COMPILE);
|
||||
// Kick OpenGL and draw baby!
|
||||
glDrawElements(GL_TRIANGLES, sObjects[model].lods[lodIdx].triangleList.size(),
|
||||
glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(sObjects[model].lods[lodIdx].triangleList.size()),
|
||||
GL_UNSIGNED_INT, &(*sObjects[model].lods[lodIdx].triangleList.begin()));
|
||||
|
||||
#if DEBUG_NORMALS
|
||||
@@ -682,12 +682,12 @@ void OBJ_DrawLights(int model, float inDistance, double inX, double inY,
|
||||
|
||||
// Find out what LOD we need to draw
|
||||
int lodIdx = -1;
|
||||
for(int n = 0; n < sObjects[model].lods.size(); n++)
|
||||
for(size_t n = 0; n < sObjects[model].lods.size(); n++)
|
||||
{
|
||||
if((inDistance >= sObjects[model].lods[n].nearDist) &&
|
||||
(inDistance <= sObjects[model].lods[n].farDist))
|
||||
{
|
||||
lodIdx = n;
|
||||
lodIdx = static_cast<int>(n);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -695,13 +695,14 @@ void OBJ_DrawLights(int model, float inDistance, double inX, double inY,
|
||||
if(lodIdx == -1)
|
||||
return;
|
||||
|
||||
double size, distance;
|
||||
GLfloat size;
|
||||
double distance;
|
||||
// Where are we looking?
|
||||
XPLMCameraPosition_t cameraPos;
|
||||
XPLMReadCameraPosition(&cameraPos);
|
||||
|
||||
// We can have 1 or more lights on each aircraft
|
||||
for(int n = 0; n < sObjects[model].lods[lodIdx].lights.size(); n++)
|
||||
for(size_t n = 0; n < sObjects[model].lods[lodIdx].lights.size(); n++)
|
||||
{
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
@@ -726,9 +727,9 @@ void OBJ_DrawLights(int model, float inDistance, double inX, double inY,
|
||||
glRotated(cameraPos.roll, 0.0, 0.0, -1.0);
|
||||
|
||||
// Find our distance from the camera
|
||||
float dx = cameraPos.x - inX;
|
||||
float dy = cameraPos.y - inY;
|
||||
float dz = cameraPos.z - inZ;
|
||||
float dx = cameraPos.x - static_cast<float>(inX);
|
||||
float dy = cameraPos.y - static_cast<float>(inY);
|
||||
float dz = cameraPos.z - static_cast<float>(inZ);
|
||||
distance = sqrt((dx * dx) + (dy * dy) + (dz * dz));
|
||||
|
||||
// Convert to NM
|
||||
@@ -744,9 +745,9 @@ void OBJ_DrawLights(int model, float inDistance, double inX, double inY,
|
||||
// that light size changed more rapidly when closer than 3nm so
|
||||
// I have a separate equation for that.
|
||||
if(distance <= 3.6)
|
||||
size = (10 * distance) + 1;
|
||||
size = (10.0f * static_cast<GLfloat>(distance)) + 1.0f;
|
||||
else
|
||||
size = (6.7 * distance) + 12;
|
||||
size = (6.7f * static_cast<GLfloat>(distance)) + 12.0f;
|
||||
|
||||
// Finally we can draw our lights
|
||||
// Red Nav
|
||||
@@ -757,10 +758,10 @@ void OBJ_DrawLights(int model, float inDistance, double inX, double inY,
|
||||
{
|
||||
if(navLights) {
|
||||
glColor4fv(kNavLightRed);
|
||||
glTexCoord2f(0, 0.5); glVertex2f(-(size/2.0), -(size/2.0));
|
||||
glTexCoord2f(0, 1.0); glVertex2f(-(size/2.0), (size/2.0));
|
||||
glTexCoord2f(0.25, 1.0); glVertex2f((size/2.0), (size/2.0));
|
||||
glTexCoord2f(0.25, 0.5); glVertex2f((size/2.0), -(size/2.0));
|
||||
glTexCoord2f(0.0f, 0.5f); glVertex2f(-(size/2.0f), -(size/2.0f));
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex2f(-(size/2.0f), (size/2.0f));
|
||||
glTexCoord2f(0.25f, 1.0f); glVertex2f((size/2.0f), (size/2.0f));
|
||||
glTexCoord2f(0.25f, 0.5f); glVertex2f((size/2.0f), -(size/2.0f));
|
||||
}
|
||||
}
|
||||
// Green Nav
|
||||
@@ -770,10 +771,10 @@ void OBJ_DrawLights(int model, float inDistance, double inX, double inY,
|
||||
{
|
||||
if(navLights) {
|
||||
glColor4fv(kNavLightGreen);
|
||||
glTexCoord2f(0, 0.5); glVertex2f(-(size/2.0), -(size/2.0));
|
||||
glTexCoord2f(0, 1.0); glVertex2f(-(size/2.0), (size/2.0));
|
||||
glTexCoord2f(0.25, 1.0); glVertex2f((size/2.0), (size/2.0));
|
||||
glTexCoord2f(0.25, 0.5); glVertex2f((size/2.0), -(size/2.0));
|
||||
glTexCoord2f(0.0f, 0.5f); glVertex2f(-(size/2.0f), -(size/2.0f));
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex2f(-(size/2.0f), (size/2.0f));
|
||||
glTexCoord2f(0.25f, 1.0f); glVertex2f((size/2.0f), (size/2.0f));
|
||||
glTexCoord2f(0.25f, 0.5f); glVertex2f((size/2.0f), -(size/2.0f));
|
||||
}
|
||||
}
|
||||
// Beacon
|
||||
@@ -784,10 +785,10 @@ void OBJ_DrawLights(int model, float inDistance, double inX, double inY,
|
||||
if(bcnLights)
|
||||
{
|
||||
glColor4fv(kNavLightRed);
|
||||
glTexCoord2f(0, 0.5); glVertex2f(-(size/2.0), -(size/2.0));
|
||||
glTexCoord2f(0, 1.0); glVertex2f(-(size/2.0), (size/2.0));
|
||||
glTexCoord2f(0.25, 1.0); glVertex2f((size/2.0), (size/2.0));
|
||||
glTexCoord2f(0.25, 0.5); glVertex2f((size/2.0), -(size/2.0));
|
||||
glTexCoord2f(0.0f, 0.5f); glVertex2f(-(size/2.0f), -(size/2.0f));
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex2f(-(size/2.0f), (size/2.0f));
|
||||
glTexCoord2f(0.25f, 1.0f); glVertex2f((size/2.0f), (size/2.0f));
|
||||
glTexCoord2f(0.25f, 0.5f); glVertex2f((size/2.0f), -(size/2.0f));
|
||||
}
|
||||
}
|
||||
// Strobes
|
||||
@@ -798,10 +799,10 @@ void OBJ_DrawLights(int model, float inDistance, double inX, double inY,
|
||||
if(strbLights)
|
||||
{
|
||||
glColor4fv(kStrobeLight);
|
||||
glTexCoord2f(0.25, 0.0); glVertex2f(-(size/1.5), -(size/1.5));
|
||||
glTexCoord2f(0.25, 0.5); glVertex2f(-(size/1.5), (size/1.5));
|
||||
glTexCoord2f(0.50, 0.5); glVertex2f((size/1.5), (size/1.5));
|
||||
glTexCoord2f(0.50, 0.0); glVertex2f((size/1.5), -(size/1.5));
|
||||
glTexCoord2f(0.25f, 0.0f); glVertex2f(-(size/1.5f), -(size/1.5f));
|
||||
glTexCoord2f(0.25f, 0.5f); glVertex2f(-(size/1.5f), (size/1.5f));
|
||||
glTexCoord2f(0.50f, 0.5f); glVertex2f((size/1.5f), (size/1.5f));
|
||||
glTexCoord2f(0.50f, 0.0f); glVertex2f((size/1.5f), -(size/1.5f));
|
||||
}
|
||||
}
|
||||
// Landing Lights
|
||||
@@ -820,24 +821,24 @@ void OBJ_DrawLights(int model, float inDistance, double inX, double inY,
|
||||
if(color[0] < 0.0) color[0] = 0.0;
|
||||
color[2] = kLandingLight[2];
|
||||
if(color[0] < 0.0) color[0] = 0.0;
|
||||
color[3] = kLandingLight[3] * ((distance * -0.05882) + 1.1764);
|
||||
color[3] = kLandingLight[3] * ((static_cast<float>(distance) * -0.05882f) + 1.1764f);
|
||||
glColor4fv(color);
|
||||
glTexCoord2f(0.25, 0.0); glVertex2f(-(size/2.0), -(size/2.0));
|
||||
glTexCoord2f(0.25, 0.5); glVertex2f(-(size/2.0), (size/2.0));
|
||||
glTexCoord2f(0.50, 0.5); glVertex2f((size/2.0), (size/2.0));
|
||||
glTexCoord2f(0.50, 0.0); glVertex2f((size/2.0), -(size/2.0));
|
||||
glTexCoord2f(0.25f, 0.0f); glVertex2f(-(size/2.0f), -(size/2.0f));
|
||||
glTexCoord2f(0.25f, 0.5f); glVertex2f(-(size/2.0f), (size/2.0f));
|
||||
glTexCoord2f(0.50f, 0.5f); glVertex2f((size/2.0f), (size/2.0f));
|
||||
glTexCoord2f(0.50f, 0.0f); glVertex2f((size/2.0f), -(size/2.0f));
|
||||
}
|
||||
} else {
|
||||
// rear nav light and others? I guess...
|
||||
if(navLights) {
|
||||
glColor3f(
|
||||
sObjects[model].lods[lodIdx].lights[n].rgb[0] * 0.1,
|
||||
sObjects[model].lods[lodIdx].lights[n].rgb[1] * 0.1,
|
||||
sObjects[model].lods[lodIdx].lights[n].rgb[2] * 0.1);
|
||||
glTexCoord2f(0, 0.5); glVertex2f(-(size/2.0), -(size/2.0));
|
||||
glTexCoord2f(0, 1.0); glVertex2f(-(size/2.0), (size/2.0));
|
||||
glTexCoord2f(0.25, 1.0); glVertex2f((size/2.0), (size/2.0));
|
||||
glTexCoord2f(0.25, 0.5); glVertex2f((size/2.0), -(size/2.0));
|
||||
sObjects[model].lods[lodIdx].lights[n].rgb[0] * 0.1f,
|
||||
sObjects[model].lods[lodIdx].lights[n].rgb[1] * 0.1f,
|
||||
sObjects[model].lods[lodIdx].lights[n].rgb[2] * 0.1f);
|
||||
glTexCoord2f(0.0f, 0.5f); glVertex2f(-(size/2.0f), -(size/2.0f));
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex2f(-(size/2.0f), (size/2.0f));
|
||||
glTexCoord2f(0.25f, 1.0f); glVertex2f((size/2.0f), (size/2.0f));
|
||||
glTexCoord2f(0.25f, 0.5f); glVertex2f((size/2.0f), -(size/2.0f));
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
|
||||
@@ -97,7 +97,7 @@ static float obj_get_float(void * inRefcon)
|
||||
{
|
||||
if(s_cur_plane == NULL) return 0.0f;
|
||||
|
||||
int v = reinterpret_cast<intptr_t>(inRefcon);
|
||||
intptr_t v = reinterpret_cast<intptr_t>(inRefcon);
|
||||
switch(v)
|
||||
{
|
||||
case gear_rat: return s_cur_plane->state->gearPosition; break;
|
||||
@@ -111,10 +111,10 @@ static float obj_get_float(void * inRefcon)
|
||||
case head_rat: return s_cur_plane->state->yokeHeading; break;
|
||||
case roll_rat: return s_cur_plane->state->yokeRoll; break;
|
||||
|
||||
case lan_lite_on: return s_cur_plane->lights.landLights; break;
|
||||
case bcn_lite_on: return s_cur_plane->lights.bcnLights; break;
|
||||
case str_lite_on: return s_cur_plane->lights.strbLights; break;
|
||||
case nav_lite_on: return s_cur_plane->lights.navLights; break;
|
||||
case lan_lite_on: return static_cast<float>(s_cur_plane->lights.landLights); break;
|
||||
case bcn_lite_on: return static_cast<float>(s_cur_plane->lights.bcnLights); break;
|
||||
case str_lite_on: return static_cast<float>(s_cur_plane->lights.strbLights); break;
|
||||
case nav_lite_on: return static_cast<float>(s_cur_plane->lights.navLights); break;
|
||||
|
||||
default:
|
||||
return 0.0f;
|
||||
@@ -124,7 +124,7 @@ static float obj_get_float(void * inRefcon)
|
||||
int obj_get_float_array(
|
||||
void * inRefcon,
|
||||
float * inValues,
|
||||
int inOffset,
|
||||
int /*inOffset*/,
|
||||
int inCount)
|
||||
{
|
||||
if(inValues == NULL)
|
||||
@@ -212,7 +212,7 @@ void obj_schedule_one_aircraft(
|
||||
double pitch,
|
||||
double roll,
|
||||
double heading,
|
||||
int full, //
|
||||
int /*full*/, //
|
||||
xpmp_LightStatus lights,
|
||||
XPLMPlaneDrawState_t * state)
|
||||
{
|
||||
@@ -255,12 +255,12 @@ void obj_schedule_one_aircraft(
|
||||
i->lights = lights;
|
||||
i->state = state;
|
||||
i->location.structSize = sizeof(i->location);
|
||||
i->location.x = x;
|
||||
i->location.y = y;
|
||||
i->location.z = z;
|
||||
i->location.pitch = pitch;
|
||||
i->location.roll = roll;
|
||||
i->location.heading = heading;
|
||||
i->location.x = static_cast<float>(x);
|
||||
i->location.y = static_cast<float>(y);
|
||||
i->location.z = static_cast<float>(z);
|
||||
i->location.pitch = static_cast<float>(pitch);
|
||||
i->location.roll = static_cast<float>(roll);
|
||||
i->location.heading = static_cast<float>(heading);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,7 +332,10 @@ void XPMPDefaultPlaneRenderer(int is_blend)
|
||||
double x,y,z;
|
||||
XPLMWorldToLocal(pos.lat, pos.lon, pos.elevation * kFtToMeters, &x, &y, &z);
|
||||
|
||||
float distMeters = sqrt(sphere_distance_sqr(&gl_camera,x,y,z));
|
||||
float distMeters = sqrt(sphere_distance_sqr(&gl_camera,
|
||||
static_cast<float>(x),
|
||||
static_cast<float>(y),
|
||||
static_cast<float>(z)));
|
||||
|
||||
// If the plane is farther than our TCAS range, it's just not visible. Drop it!
|
||||
if (distMeters > kMaxDistTCAS)
|
||||
@@ -358,8 +361,12 @@ void XPMPDefaultPlaneRenderer(int is_blend)
|
||||
// Calculate the angles between the camera angles and the real angles.
|
||||
// Cull if we exceed half the FOV.
|
||||
|
||||
if(!cull && !sphere_is_visible(&gl_camera, x, y, z, 50.0))
|
||||
if(!cull && !sphere_is_visible(&gl_camera, static_cast<float>(x),
|
||||
static_cast<float>(y),
|
||||
static_cast<float>(z), 50.0))
|
||||
{
|
||||
cull = true;
|
||||
}
|
||||
|
||||
// Full plane or lites based on distance.
|
||||
bool drawFullPlane = (distMeters < fullPlaneDist);
|
||||
@@ -379,9 +386,9 @@ void XPMPDefaultPlaneRenderer(int is_blend)
|
||||
// Stash one render record with the plane's position, etc.
|
||||
{
|
||||
PlaneToRender_t renderRecord;
|
||||
renderRecord.x = x;
|
||||
renderRecord.y = y;
|
||||
renderRecord.z = z;
|
||||
renderRecord.x = static_cast<float>(x);
|
||||
renderRecord.y = static_cast<float>(y);
|
||||
renderRecord.z = static_cast<float>(z);
|
||||
renderRecord.pitch = pos.pitch;
|
||||
renderRecord.heading = pos.heading;
|
||||
renderRecord.roll = pos.roll;
|
||||
@@ -409,13 +416,13 @@ void XPMPDefaultPlaneRenderer(int is_blend)
|
||||
|
||||
} else {
|
||||
renderRecord.state.structSize = sizeof(renderRecord.state);
|
||||
renderRecord.state.gearPosition = (pos.elevation < 70) ? 1.0 : 0.0;
|
||||
renderRecord.state.flapRatio = (pos.elevation < 70) ? 1.0 : 0.0;
|
||||
renderRecord.state.gearPosition = (pos.elevation < 70) ? 1.0f : 0.0f;
|
||||
renderRecord.state.flapRatio = (pos.elevation < 70) ? 1.0f : 0.0f;
|
||||
renderRecord.state.spoilerRatio = renderRecord.state.speedBrakeRatio = renderRecord.state.slatRatio = renderRecord.state.wingSweep = 0.0;
|
||||
renderRecord.state.thrust = (pos.pitch > 30) ? 1.0 : 0.6;
|
||||
renderRecord.state.yokePitch = pos.pitch / 90.0;
|
||||
renderRecord.state.yokeHeading = pos.heading / 180.0;
|
||||
renderRecord.state.yokeRoll = pos.roll / 90.0;
|
||||
renderRecord.state.thrust = (pos.pitch > 30) ? 1.0f : 0.6f;
|
||||
renderRecord.state.yokePitch = pos.pitch / 90.0f;
|
||||
renderRecord.state.yokeHeading = pos.heading / 180.0f;
|
||||
renderRecord.state.yokeRoll = pos.roll / 90.0f;
|
||||
|
||||
// use some smart defaults
|
||||
renderRecord.lights.bcnLights = 1;
|
||||
@@ -449,7 +456,7 @@ void XPMPDefaultPlaneRenderer(int is_blend)
|
||||
// We do this in two stages: building up what to do, then doing it in the optimal
|
||||
// OGL order.
|
||||
|
||||
int renderedCounter = 0;
|
||||
size_t renderedCounter = 0;
|
||||
|
||||
vector<PlaneToRender_t *> planes_obj_lites;
|
||||
multimap<int, PlaneToRender_t *> planes_austin;
|
||||
@@ -655,11 +662,11 @@ void XPMPDefaultPlaneRenderer(int is_blend)
|
||||
float x, y;
|
||||
convert_to_2d(&gl_camera, vp, iter->second.x, iter->second.y, iter->second.z, 1.0, &x, &y);
|
||||
|
||||
float rat = 1.0 - (iter->first / labelDist);
|
||||
c[0] = c[1] = 0.5 + 0.5 * rat;
|
||||
c[2] = 0.5 - 0.5 * rat; // gray -> yellow - no alpha in the SDK - foo!
|
||||
float rat = 1.0f - (iter->first / static_cast<float>(labelDist));
|
||||
c[0] = c[1] = 0.5f + 0.5f * rat;
|
||||
c[2] = 0.5f - 0.5f * rat; // gray -> yellow - no alpha in the SDK - foo!
|
||||
|
||||
XPLMDrawString(c, x, y+10, (char *) iter->second.label.c_str(), NULL, xplmFont_Basic);
|
||||
XPLMDrawString(c, static_cast<int>(x), static_cast<int>(y)+10, (char *) iter->second.label.c_str(), NULL, xplmFont_Basic);
|
||||
}
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
@@ -671,8 +678,8 @@ void XPMPDefaultPlaneRenderer(int is_blend)
|
||||
|
||||
|
||||
// Final hack - leave a note to ourselves for how many of Austin's planes we relocated to do TCAS.
|
||||
if (tcas > renderedCounter)
|
||||
tcas = renderedCounter;
|
||||
if (tcas > static_cast<int>(renderedCounter))
|
||||
tcas = static_cast<int>(renderedCounter);
|
||||
gEnableCount = (tcas+1);
|
||||
|
||||
gDumpOneRenderCycle = 0;
|
||||
|
||||
@@ -53,12 +53,14 @@ static char * my_fgets(char * s, int n, FILE * file)
|
||||
c = fgetc(file);
|
||||
|
||||
if (c == EOF)
|
||||
{
|
||||
if (/*feof(file) &&*/ p != s)
|
||||
break;
|
||||
else
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
*p++ = c;
|
||||
}
|
||||
@@ -109,7 +111,7 @@ void StTextFileScanner::read_next(void)
|
||||
|
||||
while (mFile && /*!feof(mFile) &&*/ my_fgets(buf, sizeof(buf), mFile))
|
||||
{
|
||||
int len = strlen(buf);
|
||||
int len = static_cast<int>(strlen(buf));
|
||||
while ((len > 0) && (buf[len-1] == '\r' || buf[len-1] == '\n'))
|
||||
{
|
||||
buf[len-1] = 0;
|
||||
@@ -223,13 +225,13 @@ int PickRandom(vector<double>& chances)
|
||||
{
|
||||
double v = (double) (rand() % RAND_MAX) / (double) RAND_MAX;
|
||||
|
||||
for (int n = 0; n < chances.size(); ++n)
|
||||
for (size_t n = 0; n < chances.size(); ++n)
|
||||
{
|
||||
if (v < chances[n])
|
||||
return n;
|
||||
return static_cast<int>(n);
|
||||
v -= chances[n];
|
||||
}
|
||||
return chances.size();
|
||||
return static_cast<int>(chances.size());
|
||||
}
|
||||
|
||||
bool RollDice(double inProb)
|
||||
@@ -351,8 +353,8 @@ void ExtractFixedRecordString(
|
||||
{
|
||||
int sp = inBegin-1;
|
||||
int ep = inEnd;
|
||||
if (ep > inLine.length()) ep = inLine.length();
|
||||
if (sp > inLine.length()) sp = inLine.length();
|
||||
if (ep > static_cast<int>(inLine.length())) ep = static_cast<int>(inLine.length());
|
||||
if (sp > static_cast<int>(inLine.length())) sp = static_cast<int>(inLine.length());
|
||||
|
||||
while ((sp < ep) && (inLine[sp] == ' '))
|
||||
++sp;
|
||||
@@ -389,7 +391,7 @@ bool ExtractFixedRecordUnsignedLong(
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
//#pragma mark -
|
||||
|
||||
struct XPointPool::XPointPoolImp {
|
||||
|
||||
@@ -408,7 +410,7 @@ struct XPointPool::XPointPoolImp {
|
||||
|
||||
int count(void)
|
||||
{
|
||||
return pts.size();
|
||||
return static_cast<int>(pts.size());
|
||||
}
|
||||
|
||||
int accumulate(const float xyz[3], const float st[2])
|
||||
@@ -427,9 +429,9 @@ struct XPointPool::XPointPoolImp {
|
||||
memcpy(p.xyz, xyz, sizeof(p.xyz));
|
||||
memcpy(p.st, st, sizeof(p.st));
|
||||
pts.push_back(p);
|
||||
index.insert(map<string,int>::value_type(key, pts.size()));
|
||||
index.insert(map<string,int>::value_type(key, static_cast<int>(pts.size())));
|
||||
pts.push_back(p);
|
||||
return pts.size()-1;
|
||||
return static_cast<int>(pts.size())-1;
|
||||
}
|
||||
|
||||
void get(int i, float xyz[3], float st[2])
|
||||
@@ -501,12 +503,12 @@ void DecomposeObjCmd(const XObjCmd& inCmd, vector<XObjCmd>& outCmds, int maxVale
|
||||
case obj_Polygon:
|
||||
// Polygons might be ok. But if we have to break them down,
|
||||
// we generate N-2 triangles in a fan configuration.
|
||||
if (maxValence < inCmd.st.size())
|
||||
if (maxValence < static_cast<int>(inCmd.st.size()))
|
||||
{
|
||||
c.st.push_back(inCmd.st[0]);
|
||||
c.st.push_back(inCmd.st[1]);
|
||||
c.st.push_back(inCmd.st[2]);
|
||||
for (int n = 2; n < inCmd.st.size(); ++n)
|
||||
for (size_t n = 2; n < inCmd.st.size(); ++n)
|
||||
{
|
||||
c.st[1] = inCmd.st[n-1];
|
||||
c.st[2] = inCmd.st[n ];
|
||||
@@ -521,7 +523,7 @@ void DecomposeObjCmd(const XObjCmd& inCmd, vector<XObjCmd>& outCmds, int maxVale
|
||||
c.st.push_back(inCmd.st[0]);
|
||||
c.st.push_back(inCmd.st[1]);
|
||||
c.st.push_back(inCmd.st[2]);
|
||||
for (int n = 2; n < inCmd.st.size(); ++n)
|
||||
for (size_t n = 2; n < inCmd.st.size(); ++n)
|
||||
{
|
||||
if (n%2)
|
||||
{
|
||||
@@ -542,7 +544,7 @@ void DecomposeObjCmd(const XObjCmd& inCmd, vector<XObjCmd>& outCmds, int maxVale
|
||||
c.st.push_back(inCmd.st[0]);
|
||||
c.st.push_back(inCmd.st[1]);
|
||||
c.st.push_back(inCmd.st[2]);
|
||||
for (int n = 2; n < inCmd.st.size(); ++n)
|
||||
for (size_t n = 2; n < inCmd.st.size(); ++n)
|
||||
{
|
||||
c.st[1] = inCmd.st[n-1];
|
||||
c.st[2] = inCmd.st[n ];
|
||||
@@ -558,7 +560,7 @@ void DecomposeObjCmd(const XObjCmd& inCmd, vector<XObjCmd>& outCmds, int maxVale
|
||||
c.st.push_back(inCmd.st[1]);
|
||||
c.st.push_back(inCmd.st[2]);
|
||||
c.st.push_back(inCmd.st[3]);
|
||||
for (int n = 2; n < inCmd.st.size(); n += 2)
|
||||
for (size_t n = 2; n < inCmd.st.size(); n += 2)
|
||||
{
|
||||
c.st[0] = inCmd.st[n-2];
|
||||
c.st[1] = inCmd.st[n-1];
|
||||
@@ -570,7 +572,7 @@ void DecomposeObjCmd(const XObjCmd& inCmd, vector<XObjCmd>& outCmds, int maxVale
|
||||
c.st.push_back(inCmd.st[0]);
|
||||
c.st.push_back(inCmd.st[1]);
|
||||
c.st.push_back(inCmd.st[2]);
|
||||
for (int n = 2; n < inCmd.st.size(); ++n)
|
||||
for (size_t n = 2; n < inCmd.st.size(); ++n)
|
||||
{
|
||||
if (n%2)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user