diff --git a/OVP/D3D9Client/VVessel.cpp b/OVP/D3D9Client/VVessel.cpp index a663caf4e..ad61dba0e 100644 --- a/OVP/D3D9Client/VVessel.cpp +++ b/OVP/D3D9Client/VVessel.cpp @@ -2032,7 +2032,7 @@ static inline const int clip(int v, int vMin, int vMax) inline const char *value_string (char *buf, size_t buf_size, double val) { - static const char unit_prefixes[] = { 'µ', 'm', '\0', 'k' , 'M' , 'G' , 'T' , 'P' }; + static const char unit_prefixes[] = { (char)230/*'µ'*/, 'm', '\0', 'k' , 'M' , 'G' , 'T' , 'P'}; int index = (int) (log10(val)) / 3; val /= pow(10.0, index*3); diff --git a/Sound/XRSound/XRSound/src/XRSoundDLL/VesselXRSoundEngine.cpp b/Sound/XRSound/XRSound/src/XRSoundDLL/VesselXRSoundEngine.cpp index b501023e5..22ccd6e4c 100644 --- a/Sound/XRSound/XRSound/src/XRSoundDLL/VesselXRSoundEngine.cpp +++ b/Sound/XRSound/XRSound/src/XRSoundDLL/VesselXRSoundEngine.cpp @@ -766,7 +766,7 @@ double VesselXRSoundEngine::GetPlasmaLevel() const double extTemp = GetExternalTemperature(); const double noseconeTemp = extTemp + degreesK; - const double noseconeTempLimit = 2840 + 273; // convert to kelvin + const double noseconeTempLimit = (double)2840 + (double)273; // convert to kelvin const double minVisibilityTemp = noseconeTempLimit * 0.387; // tweaked to coincide with Orbiter visual plasma; org in XR code was 0.387 const double maxVisibilityTemp = noseconeTempLimit * 0.80; // was 0.80 in XR code; also tweaked to coincide with Orbiter visual plasma diff --git a/Src/Orbiter/Pane.cpp b/Src/Orbiter/Pane.cpp index cd8c5d129..d4c316292 100644 --- a/Src/Orbiter/Pane.cpp +++ b/Src/Orbiter/Pane.cpp @@ -679,7 +679,8 @@ void Pane::TriggerPanelRedrawArea (int pid, int aid) if (panel) { if (panel->GetId() == pid) { int idx = panel->AreaIndex (aid); - panel->RedrawArea (idx, PANEL_REDRAW_USER); + if (idx >= 0) + panel->RedrawArea (idx, PANEL_REDRAW_USER); } } else if (panel2d) { if (panel2d->GetId() == pid) { @@ -714,11 +715,14 @@ bool Pane::BltPanelAreaBackground (int aid, SURFHANDLE surf) { if (panel) { int idx = panel->AreaIndex (aid); - return panel->BltAreaBackground (idx, surf); + if (idx >= 0) + return panel->BltAreaBackground (idx, surf); } else if (vcockpit) { int idx = vcockpit->AreaIndex (aid); - return vcockpit->BltAreaBackground (idx, surf); - } else return false; + if (idx >= 0) + return vcockpit->BltAreaBackground (idx, surf); + } + return false; } void Pane::TriggerVCRedrawArea (int vcid, int aid) diff --git a/Src/Orbiter/State.cpp b/Src/Orbiter/State.cpp index c5ac0d74b..6d573aada 100644 --- a/Src/Orbiter/State.cpp +++ b/Src/Orbiter/State.cpp @@ -61,8 +61,12 @@ bool State::Read (const char *fname) mjd0 = MJD (time (NULL)); // default to current system time mjd0 += UTC_CT_diff*day; // map from UTC to CT (or TDB) time scales mjd = mjd0; - memset (scnhelp, 0, 128); // no scenario help by default - memset (script, 0, 128); // no scenario script by default + memset (solsys, 0, 64); // no scenario solsys by default + memset (context, 0, 64); // no scenario context by default + memset (script, 0, 128); // no scenario script by default + memset (scnhelp, 0, 128); // no scenario help by default + memset (playback, 0, 128); // no scenario playback by default + memset (focus, 0, 64); // no scenario focus by default if (FindLine (ifs, "BEGIN_ENVIRONMENT")) { for (;;) { diff --git a/Src/Orbiter/ddeserver.cpp b/Src/Orbiter/ddeserver.cpp index 12f9b765e..39af2464c 100644 --- a/Src/Orbiter/ddeserver.cpp +++ b/Src/Orbiter/ddeserver.cpp @@ -114,7 +114,7 @@ bool DDEServer::DDERequest (HWND hServer, HWND hClient, WORD fmt, ATOM item) return true; } - DDEACK ddeack = {-1, 0, 0, 0}; + DDEACK ddeack = {0, 0, 0, 0}; // bAppReturnCode = 0x0000 -> Normal SendMessage (hClient, WM_DDE_ACK, (WPARAM)hServer, PackDDElParam(WM_DDE_ACK, *(UINT*)&ddeack, item)); return false; } @@ -191,7 +191,7 @@ void DDEServer::get_vesselid (HWND hClient, ATOM item, DWORD idx) } DDEDATA *ddedata = AllocDatablock (32); char *cbuf = (char*)ddedata->Value; - sprintf (cbuf, "%d", id); + sprintf (cbuf, "%p", id); PostMessage (hClient, WM_DDE_DATA, (WPARAM)hServer, PackDDElParam(WM_DDE_DATA,(UINT_PTR)ddedata,item)); } @@ -217,7 +217,7 @@ bool DDEServer::get_objid (HWND hClient, ATOM item, char *fmtstr) if (id) { DDEDATA *ddedata = AllocDatablock(32); char *cbuf = (char*)ddedata->Value; - sprintf (cbuf, "%d", id); + sprintf (cbuf, "%p", id); PostMessage (hClient, WM_DDE_DATA, (WPARAM)hServer, PackDDElParam(WM_DDE_DATA,(UINT_PTR)ddedata,item)); return true; } else { @@ -259,7 +259,7 @@ bool DDEServer::get_state (HWND hClient, ATOM item, char *fmtstr) bool mapequ = false; char *c; c = strtok (fmtstr,","); - n = sscanf(c, "%d", &id); + n = sscanf(c, "%lld", &id); if (!n) return false; // Currently, this function is only defined for vessels diff --git a/Src/Orbiter/elevmgr.h b/Src/Orbiter/elevmgr.h index e3f42d714..c54142743 100644 --- a/Src/Orbiter/elevmgr.h +++ b/Src/Orbiter/elevmgr.h @@ -16,14 +16,14 @@ struct ElevationTile { ~ElevationTile() { if (data) delete []data; } void Clear() { if (data) { delete[]data; data = 0; } last_access = 0.0; } INT16 *data; - int lvl, tgtlvl; - double latmin, latmax; - double lngmin, lngmax; - double emin, emax; - double last_access; - int lat0, lng0; - bool celldiag; - int nmlidx; + int lvl = 0, tgtlvl = 0; + double latmin = 0, latmax = 0; + double lngmin = 0, lngmax = 0; + double emin = 0, emax = 0; + double last_access = 0; + int lat0 = 0, lng0 = 0; + bool celldiag = false; + int nmlidx = 0; Vector normal; }; diff --git a/Src/Plugin/TransX/TransXFunction.cpp b/Src/Plugin/TransX/TransXFunction.cpp index be351340b..95b259ba1 100644 --- a/Src/Plugin/TransX/TransXFunction.cpp +++ b/Src/Plugin/TransX/TransXFunction.cpp @@ -113,14 +113,14 @@ void TransXFunction::findfinish(FILEHANDLE scn) void TransXFunction::savedouble(FILEHANDLE scn, double savenumber) { - char buffer[80]; + char buffer[80]=""; sprintf(buffer," %.12g",savenumber); oapiWriteScenario_string(scn,"Double",buffer); } void TransXFunction::savevector(FILEHANDLE scn, VECTOR3 &vector) { - char buffer[100]; + char buffer[100]=""; sprintf(buffer," %.12g %.12g %.12g",vector.x,vector.y,vector.z); oapiWriteScenario_string(scn,"Vector",buffer); } diff --git a/Src/Plugin/TransX/basefunction.cpp b/Src/Plugin/TransX/basefunction.cpp index f7cb4da59..b4f74decf 100644 --- a/Src/Plugin/TransX/basefunction.cpp +++ b/Src/Plugin/TransX/basefunction.cpp @@ -943,7 +943,7 @@ void basefunction::doupdate(Sketchpad *sketchpad,int tw, int th,int viewmode) TextShow(sketchpad,"Focus ApD:", wpos,hpos, craft.getapodistance()); } hpos+=linespacing; - char buffer[20]; + char buffer[20]=""; int length=snprintf(buffer, sizeof(buffer) - 1, "Pe MJD: %.4f",(craft.getpedeltatime()+craft.gettimestamp())/SECONDS_PER_DAY+simstartMJD); sketchpad->Text(wpos,hpos,buffer, length); hpos+=linespacing; diff --git a/Src/Plugin/TransX/globals.cpp b/Src/Plugin/TransX/globals.cpp index 659b7a91f..64c41d7f4 100644 --- a/Src/Plugin/TransX/globals.cpp +++ b/Src/Plugin/TransX/globals.cpp @@ -153,7 +153,7 @@ bool SelectVariableBody(void *id, char *str, void *usrdata) void TextShow(Sketchpad *sketchpad,const char *label,int wpos,int hpos,OBJHANDLE handle) { - char buffer[30],buffer2[20]; + char buffer[30]="", buffer2[20]=""; oapiGetObjectName(handle,buffer2,20); strcpy(buffer,label); strcat(buffer,buffer2); @@ -184,7 +184,7 @@ void TextForm(char *buffer,const char *label,double value) index[0]='T'; } strcpy(buffer,label); - char buffer2[20]; + char buffer2[20]=""; sprintf(buffer2,"%.4g",value); strcat(buffer2,index); strcat(buffer,buffer2); @@ -193,7 +193,7 @@ void TextForm(char *buffer,const char *label,double value) void TextShow(Sketchpad *sketchpad,const char *label, int wpos, int hpos, double value) { - char buffer[30]; + char buffer[30]=""; TextForm(buffer,label,value); int length=strlen(buffer); diff --git a/Src/Plugin/TransX/mfdvarhandler.cpp b/Src/Plugin/TransX/mfdvarhandler.cpp index c52e012fe..ec3e9c07a 100644 --- a/Src/Plugin/TransX/mfdvarhandler.cpp +++ b/Src/Plugin/TransX/mfdvarhandler.cpp @@ -35,7 +35,7 @@ void MFDvarhandler::addtolist(MFDvariable *item) void MFDvarhandler::saveallvariables(FILEHANDLE scn) { - char buffer[80]; + char buffer[80]=""; class dblliter *iterator=listhead.getiterator(); class MFDvariable *pointer=static_cast(iterator->front()); while (pointer!=NULL) diff --git a/Src/Plugin/TransX/mfdvariable.cpp b/Src/Plugin/TransX/mfdvariable.cpp index b6ea7b294..d6fa11629 100644 --- a/Src/Plugin/TransX/mfdvariable.cpp +++ b/Src/Plugin/TransX/mfdvariable.cpp @@ -81,7 +81,7 @@ void MFDvariable::setcmdnugget(cmdnugget *nugget) bool MFDvariable::showgeneric(Sketchpad *sketchpad,int width,int line, char *inbuff) { // This is a helper function that formats output to the MFD screen - char buffer[MAX_NAME_LENGTH]; + char buffer[MAX_NAME_LENGTH]=""; int linecentre=(int) width/2; int linepos= 6*line; int inlength=strlen(inbuff); diff --git a/Src/Plugin/TransX/mfdvartypes.cpp b/Src/Plugin/TransX/mfdvartypes.cpp index 41376cef9..09ea8adc7 100644 --- a/Src/Plugin/TransX/mfdvartypes.cpp +++ b/Src/Plugin/TransX/mfdvartypes.cpp @@ -199,7 +199,7 @@ void MFDvarmoon::ch_adjmode() void MFDvarmoon::showadjustment(Sketchpad *sketchpad, int width, int line) const // This shows the mode of adjustment currently in force for the current MFDvariable { - char buffer[20]; + char buffer[20]=""; int ypos=int(7*line); int xpos=int(width/2); int length; @@ -286,7 +286,7 @@ bool MFDvarmoon::validate() bool MFDvarmoon::show(Sketchpad *sketchpad, int width, int line) { - char buffer[20]; + char buffer[20]=""; if (target!=NULL) { oapiGetObjectName(target,buffer,20); @@ -337,7 +337,7 @@ void MFDvarfloat::init(MFDvarhandler *vars,int viewmode1,int viewmode2,char *vna bool MFDvarshiplist::show(Sketchpad *sketchpad,int width,int line) { - char buffer[20]; + char buffer[20]=""; liststring *entry=static_cast(iterator->current());//It is this type if (entry==NULL) strcpy(buffer,"New Plan"); @@ -374,7 +374,7 @@ void MFDvarshiplist::dec_variable() bool MFDvarfloat::show(Sketchpad *sketchpad, int width, int line) { - char buffer[20]; + char buffer[20]=""; int linecentre=(int) width/2; int linepos= 6*line; strcpy(buffer,name); @@ -433,7 +433,7 @@ void MFDvarfloat::chm_adjmode() void MFDvarfloat::showadjustment(Sketchpad *sketchpad, int width, int line) const // This shows the mode of adjustment currently in force for the current MFDvariable { - char buffer[MAX_NAME_LENGTH]; + char buffer[MAX_NAME_LENGTH]=""; int ypos=int(7*line); int xpos=int(width/2); int length; @@ -550,7 +550,7 @@ MFDvarfloat::~MFDvarfloat() bool MFDsemiintdiscrete::show(Sketchpad *sketchpad, int width, int line) { - char buffer[20]; + char buffer[20]=""; double temp=value*0.5; sprintf(buffer,"%.1f",temp); showgeneric(sketchpad, width, line,buffer); @@ -559,7 +559,7 @@ bool MFDsemiintdiscrete::show(Sketchpad *sketchpad, int width, int line) bool MFDvarMJD::show(Sketchpad *sketchpad, int width, int line) { - char buffer[20]; + char buffer[20]=""; sprintf(buffer,"%.4f", value); showgeneric(sketchpad, width, line, buffer); return true; @@ -668,7 +668,7 @@ void MFDvarangle::init(MFDvarhandler *vars,char *vname, bool vloop) bool MFDvarangle::show(Sketchpad *sketchpad, int width, int line) { - char buffer[20]; + char buffer[20]=""; sprintf(buffer,"%.4f'", value/PI*180); showgeneric(sketchpad, width,line,buffer); return true; diff --git a/Src/Plugin/TransX/planfunction.cpp b/Src/Plugin/TransX/planfunction.cpp index 9f0861302..5ba4701b4 100644 --- a/Src/Plugin/TransX/planfunction.cpp +++ b/Src/Plugin/TransX/planfunction.cpp @@ -322,7 +322,7 @@ void slingshot::graphupdate(Sketchpad *sketchpad, Graph *graph,basefunction *bas void minorejectplan::wordupdate(Sketchpad *sketchpad, int width, int height, basefunction *base) { - char buffer[20]; + char buffer[20]=""; int linespacing=height/24; int pos=16*linespacing; int len; diff --git a/Src/Plugin/TransX/transxstate.cpp b/Src/Plugin/TransX/transxstate.cpp index 82c277d4f..20c8cb6ee 100644 --- a/Src/Plugin/TransX/transxstate.cpp +++ b/Src/Plugin/TransX/transxstate.cpp @@ -219,7 +219,7 @@ void transxstate::savecurrent(FILEHANDLE scn) if (saveflag) return; saveflag=true; //Save each function - char buffer[20];//Too big, but who cares! + char buffer[20]="";//Too big, but who cares! strcpy(buffer,"FNumber"); oapiWriteScenario_int(scn,buffer,baselist.size()); std::deque::iterator a; @@ -492,7 +492,7 @@ bool transxstate::doupdate(Sketchpad *sketchpad, int tw, int th,unsigned int cur cvarfunction->processvisiblevars();//Update any visibility changes cfunction->doupdate(sketchpad,tw,th,currview); } - char buffer[20]; + char buffer[20]=""; int length=snprintf(buffer,sizeof(buffer)-1,"Stage %i:%i",curfunction,(int)baselist.size()); sketchpad->Text(tw/2,0,buffer,length); length=sprintf(buffer,"Vars Stage %i",curvarfunction); diff --git a/Src/Vessel/DeltaGlider/DockingSubsys.cpp b/Src/Vessel/DeltaGlider/DockingSubsys.cpp index 5389c2ff2..3c987ab25 100644 --- a/Src/Vessel/DeltaGlider/DockingSubsys.cpp +++ b/Src/Vessel/DeltaGlider/DockingSubsys.cpp @@ -393,7 +393,7 @@ bool NoseconeIndicator::RedrawVC (DEVMESHHANDLE hMesh, SURFHANDLE surf) GROUPEDITSPEC ges; static WORD vtxofs = VC_NCONE_INDICATOR_vofs; static const DWORD nvtx = 2; - static WORD vidx[nvtx] = {vtxofs,vtxofs+1}; + static WORD vidx[nvtx] = {vtxofs,WORD(vtxofs+1)}; static float v[2] = {0.2427f,0.3003f}; NTVERTEX vtx[nvtx]; for (DWORD i = 0; i < nvtx; i++) diff --git a/Src/Vessel/DeltaGlider/MomentInd.cpp b/Src/Vessel/DeltaGlider/MomentInd.cpp index e2f5cbc82..73bf29033 100644 --- a/Src/Vessel/DeltaGlider/MomentInd.cpp +++ b/Src/Vessel/DeltaGlider/MomentInd.cpp @@ -51,7 +51,7 @@ void AngRateIndicator::Reset2D (int panelid, MESHHANDLE hMesh) if (!vtxbuf_2D) { vtxbuf_2D = new NTVERTEX[nvtx]; memcpy (vtxbuf_2D, grp->Vtx+vtxofs, nvtx*sizeof(NTVERTEX)); - w0_2D = vtxbuf_2D[0].x - vtxbuf_2D[1].x; + w0_2D = (double)vtxbuf_2D[0].x - (double)vtxbuf_2D[1].x; for (int i = 0; i < 3; i++) { xcnt_2D[i] = vtxbuf_2D[6+i*7].x; ycnt_2D[i] = vtxbuf_2D[6+i*21].y; @@ -75,7 +75,7 @@ void AngRateIndicator::ResetVC (DEVMESHHANDLE hMesh) vtxbuf_VC = new NTVERTEX[nvtx]; GROUPREQUESTSPEC grs = {vtxbuf_VC, nvtx, 0, 0, 0, 0, 0, 0}; oapiGetMeshGroup(hMesh, GRP_ANGVEL_DISP_OVR_VC, &grs); - w0_VC = vtxbuf_VC[0].x - vtxbuf_VC[1].x; + w0_VC = (double)vtxbuf_VC[0].x - (double)vtxbuf_VC[1].x; for (i = 0; i < 3; i++) { xcnt_VC[i] = vtxbuf_VC[6+i*7].x; ycnt_VC[i] = vtxbuf_VC[6+i*21].y;