diff --git a/CMakeLists.txt b/CMakeLists.txt index ace93b2d4..c63516aef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,10 @@ cmake_minimum_required(VERSION 3.19) # Set the project name project (Orbiter VERSION 21.7.24) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + # Some functions to simplify debugging CMake scripts include(CMakePrintHelpers) diff --git a/OVP/D3D7Client/D3D7Config.cpp b/OVP/D3D7Client/D3D7Config.cpp index 086b99179..421118a6e 100644 --- a/OVP/D3D7Client/D3D7Config.cpp +++ b/OVP/D3D7Client/D3D7Config.cpp @@ -14,7 +14,7 @@ #include "D3D7Config.h" #include "orbitersdk.h" -static char *cfgfile = "D3D7Client.cfg"; +static const char *cfgfile = "D3D7Client.cfg"; // ============================================================== // default values @@ -56,17 +56,17 @@ bool D3D7Config::ReadParams () FILEHANDLE hFile = oapiOpenFile (cfgfile, FILE_IN, ROOT); if (!hFile) return false; - if (oapiReadItem_int (hFile, "PlanetPreloadMode", i)) + if (oapiReadItem_int (hFile, (char*)"PlanetPreloadMode", i)) PlanetPreloadMode = max (0, min (1, i)); - if (oapiReadItem_int (hFile, "PlanetTexLoadFreq", i)) + if (oapiReadItem_int (hFile, (char*)"PlanetTexLoadFreq", i)) PlanetLoadFrequency = max (1, min (1000, i)); - if (oapiReadItem_int (hFile, "PlanetMipmapMode", i)) + if (oapiReadItem_int (hFile, (char*)"PlanetMipmapMode", i)) PlanetMipmapMode = max (0, min (2, i)); - if (oapiReadItem_int (hFile, "PlanetAnisoMode", i)) + if (oapiReadItem_int (hFile, (char*)"PlanetAnisoMode", i)) PlanetAnisoMode = max (1, min (16, i)); - if (oapiReadItem_int (hFile, "PlanetTileLoadFlags", i)) + if (oapiReadItem_int (hFile, (char*)"PlanetTileLoadFlags", i)) PlanetTileLoadFlags = max(1, min (3, i)); - if (oapiReadItem_float (hFile, "PlanetMipmapBias", d)) + if (oapiReadItem_float (hFile, (char*)"PlanetMipmapBias", d)) PlanetMipmapBias = max (-1.0, min (1.0, d)); oapiCloseFile (hFile, FILE_IN); return true; @@ -75,11 +75,11 @@ bool D3D7Config::ReadParams () void D3D7Config::WriteParams () { FILEHANDLE hFile = oapiOpenFile (cfgfile, FILE_OUT, ROOT); - oapiWriteItem_int (hFile, "PlanetPreloadMode", PlanetPreloadMode); - oapiWriteItem_int (hFile, "PlanetTexLoadFreq", PlanetLoadFrequency); - oapiWriteItem_int (hFile, "PlanetAnisoMode", PlanetAnisoMode); - oapiWriteItem_int (hFile, "PlanetMipmapMode", PlanetMipmapMode); - oapiWriteItem_int (hFile, "PlanetTileLoadFlags", PlanetTileLoadFlags); - oapiWriteItem_float (hFile, "PlanetMipmapBias", PlanetMipmapBias); + oapiWriteItem_int (hFile, (char*)"PlanetPreloadMode", PlanetPreloadMode); + oapiWriteItem_int (hFile, (char*)"PlanetTexLoadFreq", PlanetLoadFrequency); + oapiWriteItem_int (hFile, (char*)"PlanetAnisoMode", PlanetAnisoMode); + oapiWriteItem_int (hFile, (char*)"PlanetMipmapMode", PlanetMipmapMode); + oapiWriteItem_int (hFile, (char*)"PlanetTileLoadFlags", PlanetTileLoadFlags); + oapiWriteItem_float (hFile, (char*)"PlanetMipmapBias", PlanetMipmapBias); oapiCloseFile (hFile, FILE_OUT); -} \ No newline at end of file +} diff --git a/OVP/D3D7Client/D3D7Extra.cpp b/OVP/D3D7Client/D3D7Extra.cpp index 835467d62..60b3aecbc 100644 --- a/OVP/D3D7Client/D3D7Extra.cpp +++ b/OVP/D3D7Client/D3D7Extra.cpp @@ -20,14 +20,12 @@ char *D3D7ClientCfg::Name () { - static char *name = "D3D7 Graphics Configuration"; - return name; + return (char*)"D3D7 Graphics Configuration"; } char *D3D7ClientCfg::Description () { - static char *desc = "Configure the D3D7 graphics client plugin.\r\n\r\nThis allows to fine-tune rendering options and visual quality."; - return desc; + return (char*)"Configure the D3D7 graphics client plugin.\r\n\r\nThis allows to fine-tune rendering options and visual quality."; } @@ -39,14 +37,12 @@ D3D7PlanetRenderCfg::D3D7PlanetRenderCfg (oapi::D3D7Client *_gc) char *D3D7PlanetRenderCfg::Name () { - static char *name = "Planet Rendering Options"; - return name; + return (char*)"Planet Rendering Options"; } char *D3D7PlanetRenderCfg::Description () { - static char *desc = "Configure the rendering options for planets and other celestial objects."; - return desc; + return (char*)"Configure the rendering options for planets and other celestial objects."; } bool D3D7PlanetRenderCfg::clbkOpen (HWND hLaunchpad) diff --git a/OVP/D3D7Client/RingMgr.h b/OVP/D3D7Client/RingMgr.h index 0e5a5df1c..000c8c751 100644 --- a/OVP/D3D7Client/RingMgr.h +++ b/OVP/D3D7Client/RingMgr.h @@ -42,7 +42,7 @@ class RingManager { protected: D3D7Mesh *CreateRing (double irad, double orad, int nsect); - DWORD RingManager::LoadTextures (); + DWORD LoadTextures (); private: static const oapi::D3D7Client *gc; @@ -54,4 +54,4 @@ class RingManager { double irad, orad; }; -#endif // !__RINGMGR_H \ No newline at end of file +#endif // !__RINGMGR_H diff --git a/OVP/D3D7Client/TileMgr.h b/OVP/D3D7Client/TileMgr.h index 2af6720ac..dfac41e7b 100644 --- a/OVP/D3D7Client/TileMgr.h +++ b/OVP/D3D7Client/TileMgr.h @@ -59,6 +59,8 @@ typedef struct { class D3D7Config; class vPlanet; +void ApplyPatchTextureCoordinates (VBMESH &mesh, LPDIRECT3DVERTEXBUFFER7 vtx, const TEXCRDRANGE &range); + class TileManager { friend class TileBuffer; friend class CSphereManager; @@ -192,8 +194,6 @@ class TileManager { double objsize; // planet radius bool bfog; // distance fog flag } RenderParam; - - friend void ApplyPatchTextureCoordinates (VBMESH &mesh, LPDIRECT3DVERTEXBUFFER7 vtx, const TEXCRDRANGE &range); }; @@ -243,4 +243,4 @@ class TileBuffer { } loadqueue[MAXQUEUE]; }; -#endif // !__TILEMGR_H \ No newline at end of file +#endif // !__TILEMGR_H diff --git a/OVP/D3D7Client/VObject.cpp b/OVP/D3D7Client/VObject.cpp index 702f3b516..1dd5b55c3 100644 --- a/OVP/D3D7Client/VObject.cpp +++ b/OVP/D3D7Client/VObject.cpp @@ -71,7 +71,7 @@ void vObject::GlobalInit (const D3D7Client *gclient) gc = gclient; for (int i = 0; i < 3; i++) { - static char *fname[3] = {"Ball.dds","Ball2.dds","Ball3.dds"}; + static const char *fname[3] = {"Ball.dds","Ball2.dds","Ball3.dds"}; gc->GetTexMgr()->LoadTexture (fname[i], blobtex+i, 0); } } diff --git a/OVP/D3D7Client/tilemgr2_imp.hpp b/OVP/D3D7Client/tilemgr2_imp.hpp index 6652436e1..62770f7d6 100644 --- a/OVP/D3D7Client/tilemgr2_imp.hpp +++ b/OVP/D3D7Client/tilemgr2_imp.hpp @@ -15,6 +15,7 @@ #ifndef __TILEMGR2_IMP_HPP #define __TILEMGR2_IMP_HPP +#include "Camera.h" #include "tilemgr2.h" // ----------------------------------------------------------------------- @@ -292,4 +293,4 @@ void TileManager2::CheckCoverage (const QuadTreeNode *node, } } -#endif // !__TILEMGR2_IMP_HPP \ No newline at end of file +#endif // !__TILEMGR2_IMP_HPP diff --git a/OVP/D3D7Client/ztreemgr.h b/OVP/D3D7Client/ztreemgr.h index 3c9129bfc..63d957153 100644 --- a/OVP/D3D7Client/ztreemgr.h +++ b/OVP/D3D7Client/ztreemgr.h @@ -43,8 +43,8 @@ class TreeFileHeader { public: TreeFileHeader(); - size_t TreeFileHeader::fwrite(FILE *f); - bool TreeFileHeader::fread(FILE *f); + size_t fwrite(FILE *f); + bool fread(FILE *f); private: BYTE magic[4]; // file ID and version diff --git a/OVP/D3D9Client/AtmoControls.cpp b/OVP/D3D9Client/AtmoControls.cpp index a9543ff71..e4ec33b13 100644 --- a/OVP/D3D9Client/AtmoControls.cpp +++ b/OVP/D3D9Client/AtmoControls.cpp @@ -115,7 +115,7 @@ void Create() vObj = NULL; hDlg = NULL; - dwCmd = oapiRegisterCustomCmd("D3D9 Atmospheric Controls", "This dialog allows to control various atmospheric parameters and effects", OpenDlgClbk, NULL); + dwCmd = oapiRegisterCustomCmd((char*)"D3D9 Atmospheric Controls", (char*)"This dialog allows to control various atmospheric parameters and effects", OpenDlgClbk, NULL); memset(Slider,0,sizeof(Slider)); @@ -238,30 +238,30 @@ void OpenDlgClbk(void *context) ConfigSlider(IDC_ATM_AUX4, 0.0, 8.0); // Mie Phase-B ConfigSlider(IDC_ATM_AUX5, 0.0, 5.0, 8); // Clouds intensity // ------------------------------------------------------- - CreateToolTip(IDC_ATM_TW_DST, hDlg, "Light travel distance behind terminator"); - CreateToolTip(IDC_ATM_GREEN, hDlg, "Green wave lenght. (Green balance)"); - CreateToolTip(IDC_ATM_TW_BRI, hDlg, "Terrain brightness during twilight"); - CreateToolTip(IDC_ATM_RPOW, hDlg, "Main control for atmospheric rayleigh color composition (4.0 for the Earth)"); - CreateToolTip(IDC_ATM_MPOW, hDlg, "Main control for atmospheric mie color composition"); - CreateToolTip(IDC_ATM_HEIGHT, hDlg, "Atmosphere Ray scale height (7km - 9km for the Earth)"); - CreateToolTip(IDC_ATM_M_HEIGHT, hDlg, "Atmosphere Mie scale height (0.6km - 2km for the Earth)"); + CreateToolTip(IDC_ATM_TW_DST, hDlg, (char*)"Light travel distance behind terminator"); + CreateToolTip(IDC_ATM_GREEN, hDlg, (char*)"Green wave lenght. (Green balance)"); + CreateToolTip(IDC_ATM_TW_BRI, hDlg, (char*)"Terrain brightness during twilight"); + CreateToolTip(IDC_ATM_RPOW, hDlg, (char*)"Main control for atmospheric rayleigh color composition (4.0 for the Earth)"); + CreateToolTip(IDC_ATM_MPOW, hDlg, (char*)"Main control for atmospheric mie color composition"); + CreateToolTip(IDC_ATM_HEIGHT, hDlg, (char*)"Atmosphere Ray scale height (7km - 9km for the Earth)"); + CreateToolTip(IDC_ATM_M_HEIGHT, hDlg, (char*)"Atmosphere Mie scale height (0.6km - 2km for the Earth)"); // ------------------------------------------------------- - CreateToolTip(IDC_ATM_TRB, hDlg, "Terrain/Ocean brightness control (default 1.0)"); - CreateToolTip(IDC_ATM_TRGAMMA, hDlg, "Terrain/Ocean gamma control value (default 1.0)"); - CreateToolTip(IDC_ATM_TRLIGHTSHAD, hDlg, "Terrain light and shadow boost"); + CreateToolTip(IDC_ATM_TRB, hDlg, (char*)"Terrain/Ocean brightness control (default 1.0)"); + CreateToolTip(IDC_ATM_TRGAMMA, hDlg, (char*)"Terrain/Ocean gamma control value (default 1.0)"); + CreateToolTip(IDC_ATM_TRLIGHTSHAD, hDlg, (char*)"Terrain light and shadow boost"); // ------------------------------------------------------- - CreateToolTip(IDC_ATM_RAY, hDlg, "Overall control for rayleigh scattering (i.e. Haze stickness, atmosphere transparency, optical depth"); - CreateToolTip(IDC_ATM_IN, hDlg, "Rayleigh in-scatter out-scatter ratio (1.0 nominal)"); - CreateToolTip(IDC_ATM_RPHASE, hDlg, "Ambient light level for buildings"); + CreateToolTip(IDC_ATM_RAY, hDlg, (char*)"Overall control for rayleigh scattering (i.e. Haze stickness, atmosphere transparency, optical depth"); + CreateToolTip(IDC_ATM_IN, hDlg, (char*)"Rayleigh in-scatter out-scatter ratio (1.0 nominal)"); + CreateToolTip(IDC_ATM_RPHASE, hDlg, (char*)"Ambient light level for buildings"); // ------------------------------------------------------- - CreateToolTip(IDC_ATM_MIE, hDlg, "Overall scale factor for mie scattering. (Mie-particle density)"); - CreateToolTip(IDC_ATM_MPHASE, hDlg, "Directional strength of Henyey-Greenstein phase function"); - CreateToolTip(IDC_ATM_MIEIN, hDlg, "Mie in-scatter out-scatter ratio (1.0 nominal)"); + CreateToolTip(IDC_ATM_MIE, hDlg, (char*)"Overall scale factor for mie scattering. (Mie-particle density)"); + CreateToolTip(IDC_ATM_MPHASE, hDlg, (char*)"Directional strength of Henyey-Greenstein phase function"); + CreateToolTip(IDC_ATM_MIEIN, hDlg, (char*)"Mie in-scatter out-scatter ratio (1.0 nominal)"); // ------------------------------------------------------- - CreateToolTip(IDC_ATM_AUX2, hDlg, "Altitude for cloud lighting calculations"); - CreateToolTip(IDC_ATM_AUX3, hDlg, "'HDR' Exposure factor"); - CreateToolTip(IDC_ATM_AUX4, hDlg, "Omnidirectional mie scattering scale factor"); - CreateToolTip(IDC_ATM_AUX5, hDlg, "[Dual purpose] Clouds intensity [on surface]. Multiscatter light level [on orbit]"); + CreateToolTip(IDC_ATM_AUX2, hDlg, (char*)"Altitude for cloud lighting calculations"); + CreateToolTip(IDC_ATM_AUX3, hDlg, (char*)"'HDR' Exposure factor"); + CreateToolTip(IDC_ATM_AUX4, hDlg, (char*)"Omnidirectional mie scattering scale factor"); + CreateToolTip(IDC_ATM_AUX5, hDlg, (char*)"[Dual purpose] Clouds intensity [on surface]. Multiscatter light level [on orbit]"); SendDlgItemMessageA(hDlg, IDC_ATM_MODE, CB_RESETCONTENT, 0, 0); SendDlgItemMessageA(hDlg, IDC_ATM_MODE, CB_ADDSTRING, 0, (LPARAM)"Auto"); diff --git a/OVP/D3D9Client/CloudMgr.cpp b/OVP/D3D9Client/CloudMgr.cpp index fb3d9e162..dbe9d6dd6 100644 --- a/OVP/D3D9Client/CloudMgr.cpp +++ b/OVP/D3D9Client/CloudMgr.cpp @@ -176,12 +176,12 @@ void CloudManager::RenderTile (int lvl, int hemisp, int ilat, int nlat, int ilng VBMESH &mesh = PATCH_TPL[lvl][ilat]; // patch template if (range.tumin == 0 && range.tumax == 1) { - HR(FX->SetVector(eTexOff, &D3DXVECTOR4(1.0f, 0.0f, 1.0f, 0.0f))); + HR(FX->SetVector(eTexOff, ptr(D3DXVECTOR4(1.0f, 0.0f, 1.0f, 0.0f)))); } else { float tuscale = range.tumax-range.tumin, tuofs = range.tumin; float tvscale = range.tvmax-range.tvmin, tvofs = range.tvmin; - HR(FX->SetVector(eTexOff, &D3DXVECTOR4(tuscale,tuofs,tvscale,tvofs))); + HR(FX->SetVector(eTexOff, ptr(D3DXVECTOR4(tuscale,tuofs,tvscale,tvofs)))); } HR(FX->SetMatrix(eW, &mWorld)); HR(FX->SetTexture(eTex0, tex)); // Diffuse Texture diff --git a/OVP/D3D9Client/D3D9Client.cpp b/OVP/D3D9Client/D3D9Client.cpp index 5ddacecd9..ddb836442 100644 --- a/OVP/D3D9Client/D3D9Client.cpp +++ b/OVP/D3D9Client/D3D9Client.cpp @@ -708,26 +708,26 @@ void D3D9Client::SketchPadTest() pSkp->QuickPen(0xA0000000, 3.0f); pSkp->PushWorldTransform(); - pSkp->SetWorldScaleTransform2D(&FVECTOR2(100.0f, 100.0f), &pos0); + pSkp->SetWorldScaleTransform2D(ptr(FVECTOR2(100.0f, 100.0f)), &pos0); pSkp->DrawPoly(hColors); pSkp->DrawPoly(hOutline); - pSkp->SetWorldScaleTransform2D(&FVECTOR2(100.0f, 100.0f), &pos1); + pSkp->SetWorldScaleTransform2D(ptr(FVECTOR2(100.0f, 100.0f)), &pos1); pSkp->DrawPoly(hOutline2); - pSkp->SetWorldScaleTransform2D(&FVECTOR2(100.0f, 100.0f), &pos2); + pSkp->SetWorldScaleTransform2D(ptr(FVECTOR2(100.0f, 100.0f)), &pos2); pSkp->DrawPoly(hStrip); - pSkp->SetWorldScaleTransform2D(&FVECTOR2(100.0f, 100.0f), &pos3); + pSkp->SetWorldScaleTransform2D(ptr(FVECTOR2(100.0f, 100.0f)), &pos3); pSkp->DrawPoly(hStrip2); - pSkp->SetWorldScaleTransform2D(&FVECTOR2(100.0f, 100.0f), &pos4); + pSkp->SetWorldScaleTransform2D(ptr(FVECTOR2(100.0f, 100.0f)), &pos4); pSkp->QuickPen(0xFF000000, 25.0f); pSkp->DrawPoly(hOutline); hSrc = clbkLoadSurface("generic/noisep.dds", OAPISURFACE_TEXTURE); - pSkp->SetWorldScaleTransform2D(&FVECTOR2(1.0f, 1.0f), &pos5); + pSkp->SetWorldScaleTransform2D(ptr(FVECTOR2(1.0f, 1.0f)), &pos5); FVECTOR2 pt[4]; pt[0] = FVECTOR2(-100.0f, -100.0f); @@ -823,7 +823,7 @@ void D3D9Client::clbkCloseSession(bool fastclose) void D3D9Client::clbkDestroyRenderWindow (bool fastclose) { _TRACE; - oapiWriteLog("D3D9: [Destroy Render Window Called]"); + oapiWriteLog((char*)"D3D9: [Destroy Render Window Called]"); LogAlw("============= clbkDestroyRenderWindow ==========="); #ifdef _NVAPI_H @@ -986,7 +986,7 @@ void D3D9Client::PushSketchpad(SURFHANDLE surf, D3D9Pad *pSkp) const void D3D9Client::PushRenderTarget(LPDIRECT3DSURFACE9 pColor, LPDIRECT3DSURFACE9 pDepthStencil, int code) const { - static char *labels[] = { "NULL", "MAIN", "ENV", "CUSTOMCAM", "SHADOWMAP", "PICK", "SKETCHPAD", "OVERLAY" }; + static const char *labels[] = { "NULL", "MAIN", "ENV", "CUSTOMCAM", "SHADOWMAP", "PICK", "SKETCHPAD", "OVERLAY" }; RenderTgtData data; data.pColor = pColor; @@ -1025,7 +1025,7 @@ void D3D9Client::AlterRenderTarget(LPDIRECT3DSURFACE9 pColor, LPDIRECT3DSURFACE9 void D3D9Client::PopRenderTargets() const { - static char *labels[] = { "NULL", "MAIN", "ENV", "CUSTOMCAM", "SHADOWMAP", "PICK", "SKETCHPAD", "OVERLAY" }; + static const char *labels[] = { "NULL", "MAIN", "ENV", "CUSTOMCAM", "SHADOWMAP", "PICK", "SKETCHPAD", "OVERLAY" }; assert(RenderStack.empty() == false); @@ -2324,7 +2324,7 @@ bool D3D9Client::clbkScaleBlt (SURFHANDLE tgt, DWORD tgtx, DWORD tgty, DWORD tgt SURFHANDLE src, DWORD srcx, DWORD srcy, DWORD srcw, DWORD srch, DWORD flag) const { - if (src==NULL) { oapiWriteLog("ERROR: oapiBlt() Source surface is NULL"); return false; } + if (src==NULL) { oapiWriteLog((char*)"ERROR: oapiBlt() Source surface is NULL"); return false; } if (tgt==NULL) tgt = pFramework->GetBackBufferHandle(); @@ -2893,7 +2893,7 @@ void D3D9Client::SplashScreen() SetTextColor(hDC, 0xE0A0A0); SetBkMode(hDC,TRANSPARENT); - char *months[]={"???","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","???"}; + const char *months[]={"???","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","???"}; DWORD d = oapiGetOrbiterVersion(); DWORD y = d/10000; d-=y*10000; diff --git a/OVP/D3D9Client/D3D9Config.cpp b/OVP/D3D9Client/D3D9Config.cpp index 126cc8260..46330dc25 100644 --- a/OVP/D3D9Client/D3D9Config.cpp +++ b/OVP/D3D9Client/D3D9Config.cpp @@ -9,7 +9,7 @@ #include "D3D9Config.h" #include "Orbitersdk.h" -static char *cfgfile = "D3D9Client.cfg"; +static const char *cfgfile = "D3D9Client.cfg"; class D3D9Config *Config; // configuration manager @@ -126,85 +126,85 @@ bool D3D9Config::ReadParams () FILEHANDLE hFile = oapiOpenFile(cfgfile, FILE_IN_ZEROONFAIL, ROOT); if (!hFile) return false; - if (oapiReadItem_float (hFile, "FrameRate", d)) FrameRate = max(0.0, min(300.0, d)); - if (oapiReadItem_int (hFile, "EnableLimiter", i)) EnableLimiter = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "CustomCamMode", i)) CustomCamMode = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "PlanetPreloadMode", i)) PlanetPreloadMode = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "PlanetTexLoadFreq", i)) PlanetLoadFrequency = max(1, min(1000, i)); - if (oapiReadItem_int (hFile, "Anisotrophy", i)) Anisotrophy = max(1, min(16, i)); - if (oapiReadItem_int (hFile, "SceneAntialias", i)) SceneAntialias = i; - if (oapiReadItem_int (hFile, "SketchpadFont", i)) SketchpadFont = max(0, min(2, i)); - if (oapiReadItem_int (hFile, "PreLoadBaseVisuals", i)) PreLBaseVis = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "EnableNormalMapping", i)) UseNormalMap = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "NearClipPlaneMode", i)) NearClipPlane = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "RwyLightAnimate", i)) RwyLightAnimate = max(0, min(1, i)); - if (oapiReadItem_float (hFile, "RwyLightAngle", d)) RwyLightAngle = max(10.0, min(180.0, d)); - if (oapiReadItem_float (hFile, "RwyBrightness", d)) RwyBrightness = max(0.3, min(3.0, d)); - if (oapiReadItem_float (hFile, "NightLightsAngle", d)) SunAngle = max(0.1, min(20.0, d)); - if (oapiReadItem_float (hFile, "BumpMapAmplitude", d)) BumpAmp = max(0.1, min(10.0, d)); - if (oapiReadItem_float (hFile, "PlanetGlow", d)) PlanetGlow = max(0.01, min(2.5, d)); - if (oapiReadItem_int (hFile, "EnvMapSize", i)) EnvMapSize = max(64, min(512, i)); - if (oapiReadItem_int (hFile, "EnvMapMode", i)) EnvMapMode = max(0, min(2, i)); - if (oapiReadItem_int (hFile, "EnvMapFaces", i)) EnvMapFaces = max(1, min(3, i)); - if (oapiReadItem_int (hFile, "ShadowMapMode", i)) ShadowMapMode = max(0, min(3, i)); - if (oapiReadItem_int (hFile, "ShadowMapFilter", i)) ShadowFilter = max(0, min(5, i)); - if (oapiReadItem_int (hFile, "ShadowMapSize", i)) ShadowMapSize = max(512, min(4096, i)); - if (oapiReadItem_int (hFile, "EnableGlass", i)) EnableGlass = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "TerrainShadowing", i)) TerrainShadowing = max(0, min(2, i)); - if (oapiReadItem_int (hFile, "EnableMeshDbg", i)) EnableMeshDbg = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "TileMipmaps", i)) TileMipmaps = max(0, min(2, i)); - if (oapiReadItem_int (hFile, "TextureMips", i)) TextureMips = max(0, min(2, i)); - if (oapiReadItem_int (hFile, "TileDebug", i)) TileDebug = max(0, min(1, i)); - if (oapiReadItem_float (hFile, "StereoSeparation", d)) Separation = max(10.0, min(100.0, d)); - if (oapiReadItem_float (hFile, "StereoConvergence", d)) Convergence = max(0.05, min(1.0, d)); - if (oapiReadItem_int (hFile, "DebugLvl", i)) DebugLvl = i; - if (oapiReadItem_float (hFile, "VCNearPlane", d)) VCNearPlane = max(-1.0, min(1.0, d)); - if (oapiReadItem_int (hFile, "LightCongiguration", i)) LightConfig = max(min(4, i), 0); // Old typo stored? - if (oapiReadItem_int (hFile, "LightConfiguration", i)) LightConfig = max(min(4, i), 0); // ...this will override it anyhow - if (oapiReadItem_int (hFile, "DisableDrvMgm", i)) DisableDriverManagement = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "NVPerfHUD", i)) NVPerfHUD = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "DebugLineFontSize", i)) DebugFontSize = i; - if (oapiReadItem_int (hFile, "DisableVisualHelperReadout", i)) DisableVisualHelperReadout = max(0, min(1, i)); - if (oapiReadItem_float (hFile, "LODBias", d)) LODBias = max(-2.0, min(2.0, d)); - if (oapiReadItem_int (hFile, "MeshRes", i)) MeshRes = max(0, min(2, i)); - if (oapiReadItem_int (hFile, "MicroMode", i)) MicroMode = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "MicroFilter", i)) MicroFilter = max(0, min(5, i)); - if (oapiReadItem_int (hFile, "BlendMode", i)) BlendMode = max(0, min(2, i)); - if (oapiReadItem_int (hFile, "MicroBias", i)) MicroBias = max(0, min(10, i)); - if (oapiReadItem_int (hFile, "CloudMicro", i)) CloudMicro = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "PostProcess", i)) PostProcess = max(0, min(2, i)); - if (oapiReadItem_int (hFile, "ShaderDebug", i)) ShaderDebug = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "PresentLocation", i)) PresentLocation = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "PlanetTileLoadFlags", i)) PlanetTileLoadFlags = max(1, min(3, i)); - if (oapiReadItem_int (hFile, "LabelDisplayFlags", i)) LabelDisplayFlags = max(0, min(3, i)); - if (oapiReadItem_int (hFile, "GDIOverlay", i)) GDIOverlay = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "gcGUIMode", i)) gcGUIMode = max(0, min(3, i)); - if (oapiReadItem_int (hFile, "AbsoluteAnimations", i)) bAbsAnims = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "NormalmappedClouds", i)) bCloudNormals = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "TerrainFlats", i)) bFlats = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "SunGlare", i)) bGlares = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "LightsGlare", i)) bLocalGlares = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "Irradiance", i)) bIrradiance = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "AtmoQuality", i)) bAtmoQuality = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "DebugBreak", i)) DebugBreak = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "ShaderCacheUse", i)) ShaderCacheUse = max(0, min(1, i)); - if (oapiReadItem_int (hFile, "NoPlanetAA", i)) NoPlanetAA = max(0, min(1, i)); - if (oapiReadItem_float (hFile, "OrbitalShadowMult", d)) OrbitalShadowMult = max(0.5, min(10.0, d)); + if (oapiReadItem_float (hFile, (char*)"FrameRate", d)) FrameRate = max(0.0, min(300.0, d)); + if (oapiReadItem_int (hFile, (char*)"EnableLimiter", i)) EnableLimiter = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"CustomCamMode", i)) CustomCamMode = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"PlanetPreloadMode", i)) PlanetPreloadMode = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"PlanetTexLoadFreq", i)) PlanetLoadFrequency = max(1, min(1000, i)); + if (oapiReadItem_int (hFile, (char*)"Anisotrophy", i)) Anisotrophy = max(1, min(16, i)); + if (oapiReadItem_int (hFile, (char*)"SceneAntialias", i)) SceneAntialias = i; + if (oapiReadItem_int (hFile, (char*)"SketchpadFont", i)) SketchpadFont = max(0, min(2, i)); + if (oapiReadItem_int (hFile, (char*)"PreLoadBaseVisuals", i)) PreLBaseVis = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"EnableNormalMapping", i)) UseNormalMap = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"NearClipPlaneMode", i)) NearClipPlane = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"RwyLightAnimate", i)) RwyLightAnimate = max(0, min(1, i)); + if (oapiReadItem_float (hFile, (char*)"RwyLightAngle", d)) RwyLightAngle = max(10.0, min(180.0, d)); + if (oapiReadItem_float (hFile, (char*)"RwyBrightness", d)) RwyBrightness = max(0.3, min(3.0, d)); + if (oapiReadItem_float (hFile, (char*)"NightLightsAngle", d)) SunAngle = max(0.1, min(20.0, d)); + if (oapiReadItem_float (hFile, (char*)"BumpMapAmplitude", d)) BumpAmp = max(0.1, min(10.0, d)); + if (oapiReadItem_float (hFile, (char*)"PlanetGlow", d)) PlanetGlow = max(0.01, min(2.5, d)); + if (oapiReadItem_int (hFile, (char*)"EnvMapSize", i)) EnvMapSize = max(64, min(512, i)); + if (oapiReadItem_int (hFile, (char*)"EnvMapMode", i)) EnvMapMode = max(0, min(2, i)); + if (oapiReadItem_int (hFile, (char*)"EnvMapFaces", i)) EnvMapFaces = max(1, min(3, i)); + if (oapiReadItem_int (hFile, (char*)"ShadowMapMode", i)) ShadowMapMode = max(0, min(3, i)); + if (oapiReadItem_int (hFile, (char*)"ShadowMapFilter", i)) ShadowFilter = max(0, min(5, i)); + if (oapiReadItem_int (hFile, (char*)"ShadowMapSize", i)) ShadowMapSize = max(512, min(4096, i)); + if (oapiReadItem_int (hFile, (char*)"EnableGlass", i)) EnableGlass = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"TerrainShadowing", i)) TerrainShadowing = max(0, min(2, i)); + if (oapiReadItem_int (hFile, (char*)"EnableMeshDbg", i)) EnableMeshDbg = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"TileMipmaps", i)) TileMipmaps = max(0, min(2, i)); + if (oapiReadItem_int (hFile, (char*)"TextureMips", i)) TextureMips = max(0, min(2, i)); + if (oapiReadItem_int (hFile, (char*)"TileDebug", i)) TileDebug = max(0, min(1, i)); + if (oapiReadItem_float (hFile, (char*)"StereoSeparation", d)) Separation = max(10.0, min(100.0, d)); + if (oapiReadItem_float (hFile, (char*)"StereoConvergence", d)) Convergence = max(0.05, min(1.0, d)); + if (oapiReadItem_int (hFile, (char*)"DebugLvl", i)) DebugLvl = i; + if (oapiReadItem_float (hFile, (char*)"VCNearPlane", d)) VCNearPlane = max(-1.0, min(1.0, d)); + if (oapiReadItem_int (hFile, (char*)"LightCongiguration", i)) LightConfig = max(min(4, i), 0); // Old typo stored? + if (oapiReadItem_int (hFile, (char*)"LightConfiguration", i)) LightConfig = max(min(4, i), 0); // ...this will override it anyhow + if (oapiReadItem_int (hFile, (char*)"DisableDrvMgm", i)) DisableDriverManagement = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"NVPerfHUD", i)) NVPerfHUD = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"DebugLineFontSize", i)) DebugFontSize = i; + if (oapiReadItem_int (hFile, (char*)"DisableVisualHelperReadout", i)) DisableVisualHelperReadout = max(0, min(1, i)); + if (oapiReadItem_float (hFile, (char*)"LODBias", d)) LODBias = max(-2.0, min(2.0, d)); + if (oapiReadItem_int (hFile, (char*)"MeshRes", i)) MeshRes = max(0, min(2, i)); + if (oapiReadItem_int (hFile, (char*)"MicroMode", i)) MicroMode = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"MicroFilter", i)) MicroFilter = max(0, min(5, i)); + if (oapiReadItem_int (hFile, (char*)"BlendMode", i)) BlendMode = max(0, min(2, i)); + if (oapiReadItem_int (hFile, (char*)"MicroBias", i)) MicroBias = max(0, min(10, i)); + if (oapiReadItem_int (hFile, (char*)"CloudMicro", i)) CloudMicro = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"PostProcess", i)) PostProcess = max(0, min(2, i)); + if (oapiReadItem_int (hFile, (char*)"ShaderDebug", i)) ShaderDebug = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"PresentLocation", i)) PresentLocation = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"PlanetTileLoadFlags", i)) PlanetTileLoadFlags = max(1, min(3, i)); + if (oapiReadItem_int (hFile, (char*)"LabelDisplayFlags", i)) LabelDisplayFlags = max(0, min(3, i)); + if (oapiReadItem_int (hFile, (char*)"GDIOverlay", i)) GDIOverlay = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"gcGUIMode", i)) gcGUIMode = max(0, min(3, i)); + if (oapiReadItem_int (hFile, (char*)"AbsoluteAnimations", i)) bAbsAnims = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"NormalmappedClouds", i)) bCloudNormals = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"TerrainFlats", i)) bFlats = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"SunGlare", i)) bGlares = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"LightsGlare", i)) bLocalGlares = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"Irradiance", i)) bIrradiance = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"AtmoQuality", i)) bAtmoQuality = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"DebugBreak", i)) DebugBreak = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"ShaderCacheUse", i)) ShaderCacheUse = max(0, min(1, i)); + if (oapiReadItem_int (hFile, (char*)"NoPlanetAA", i)) NoPlanetAA = max(0, min(1, i)); + if (oapiReadItem_float (hFile, (char*)"OrbitalShadowMult", d)) OrbitalShadowMult = max(0.5, min(10.0, d)); - if (oapiReadItem_float (hFile, "GFXIntensity", d)) GFXIntensity = max(0.0, min(1.0, d)); - if (oapiReadItem_float (hFile, "GFXDistance", d)) GFXDistance = max(0.0, min(1.0, d)); - if (oapiReadItem_float (hFile, "GFXThreshold", d)) GFXThreshold = max(0.5, min(2.0, d)); - if (oapiReadItem_float (hFile, "GFXGamma", d)) GFXGamma = max(0.3, min(2.5, d)); - if (oapiReadItem_float (hFile, "GFXSunIntensity", d)) GFXSunIntensity = max(0.5, min(2.5, d)); - if (oapiReadItem_float (hFile, "GFXLocalMax", d)) GFXLocalMax = max(0.001, min(1.0, d)); - if (oapiReadItem_float (hFile, "GFXGlare", d)) GFXGlare = max(0.1, min(10.0, d)); + if (oapiReadItem_float (hFile, (char*)"GFXIntensity", d)) GFXIntensity = max(0.0, min(1.0, d)); + if (oapiReadItem_float (hFile, (char*)"GFXDistance", d)) GFXDistance = max(0.0, min(1.0, d)); + if (oapiReadItem_float (hFile, (char*)"GFXThreshold", d)) GFXThreshold = max(0.5, min(2.0, d)); + if (oapiReadItem_float (hFile, (char*)"GFXGamma", d)) GFXGamma = max(0.3, min(2.5, d)); + if (oapiReadItem_float (hFile, (char*)"GFXSunIntensity", d)) GFXSunIntensity = max(0.5, min(2.5, d)); + if (oapiReadItem_float (hFile, (char*)"GFXLocalMax", d)) GFXLocalMax = max(0.001, min(1.0, d)); + if (oapiReadItem_float (hFile, (char*)"GFXGlare", d)) GFXGlare = max(0.1, min(10.0, d)); - oapiReadItem_string (hFile, "SolCfg", SolCfg); - oapiReadItem_string (hFile, "DebugLineFont", DebugFont); + oapiReadItem_string (hFile, (char*)"SolCfg", SolCfg); + oapiReadItem_string (hFile, (char*)"DebugLineFont", DebugFont); char Temp[256]; - if (oapiReadItem_string(hFile, "EarthAtmoCfg", Temp)) AtmoCfg["Earth"] = Temp; + if (oapiReadItem_string(hFile, (char*)"EarthAtmoCfg", Temp)) AtmoCfg["Earth"] = Temp; oapiCloseFile (hFile, FILE_IN_ZEROONFAIL); @@ -216,82 +216,82 @@ void D3D9Config::WriteParams () { FILEHANDLE hFile = oapiOpenFile (cfgfile, FILE_OUT, ROOT); - oapiWriteItem_float (hFile, "FrameRate", FrameRate); - oapiWriteItem_int (hFile, "EnableLimiter", EnableLimiter); - oapiWriteItem_int (hFile, "CustomCamMode", CustomCamMode); - oapiWriteItem_int (hFile, "PlanetPreloadMode", PlanetPreloadMode); - oapiWriteItem_int (hFile, "PlanetTexLoadFreq", PlanetLoadFrequency); - oapiWriteItem_int (hFile, "Anisotrophy", Anisotrophy); - oapiWriteItem_int (hFile, "SceneAntialias", SceneAntialias); - oapiWriteItem_int (hFile, "SketchpadFont", SketchpadFont); - oapiWriteItem_int (hFile, "PreLoadBaseVisuals", PreLBaseVis); - oapiWriteItem_int (hFile, "EnableNormalMapping", UseNormalMap); - oapiWriteItem_int (hFile, "NearClipPlaneMode", NearClipPlane); - oapiWriteItem_int (hFile, "RwyLightAnimate", RwyLightAnimate); - oapiWriteItem_float (hFile, "RwyLightAngle", RwyLightAngle); - oapiWriteItem_float (hFile, "RwyBrightness", RwyBrightness); - oapiWriteItem_float (hFile, "NightLightsAngle", SunAngle); - oapiWriteItem_float (hFile, "BumpMapAmplitude", BumpAmp); - oapiWriteItem_float (hFile, "PlanetGlow", PlanetGlow); - oapiWriteItem_int (hFile, "EnvMapSize", EnvMapSize); - oapiWriteItem_int (hFile, "EnvMapMode", EnvMapMode); - oapiWriteItem_int (hFile, "EnvMapFaces", EnvMapFaces); - oapiWriteItem_int (hFile, "ShadowMapMode", ShadowMapMode); - oapiWriteItem_int (hFile, "ShadowMapFilter", ShadowFilter); - oapiWriteItem_int (hFile, "ShadowMapSize", ShadowMapSize); - oapiWriteItem_int (hFile, "TerrainShadowing", TerrainShadowing); - oapiWriteItem_int (hFile, "EnableGlass", EnableGlass); - oapiWriteItem_int (hFile, "EnableMeshDbg", EnableMeshDbg); - oapiWriteItem_int (hFile, "TileMipmaps", TileMipmaps); - oapiWriteItem_int (hFile, "TextureMips", TextureMips); - oapiWriteItem_int (hFile, "TileDebug", TileDebug); - oapiWriteItem_float (hFile, "StereoSeparation", Separation); - oapiWriteItem_float (hFile, "StereoConvergence", Convergence); - oapiWriteItem_int (hFile, "DebugLvl", DebugLvl); - oapiWriteItem_float (hFile, "VCNearPlane", VCNearPlane); - oapiWriteItem_int (hFile, "LightConfiguration", LightConfig); - oapiWriteItem_int (hFile, "DisableDrvMgm", DisableDriverManagement); - oapiWriteItem_int (hFile, "NVPerfHUD", NVPerfHUD); - oapiWriteItem_int (hFile, "DebugLineFontSize", DebugFontSize); - oapiWriteItem_int (hFile, "DisableVisualHelperReadout", DisableVisualHelperReadout); - oapiWriteItem_float (hFile, "LODBias", LODBias); - oapiWriteItem_int (hFile, "MeshRes", MeshRes); - oapiWriteItem_int (hFile, "MicroMode", MicroMode); - oapiWriteItem_int (hFile, "MicroFilter", MicroFilter); - oapiWriteItem_int (hFile, "BlendMode", BlendMode); - oapiWriteItem_int (hFile, "MicroBias", MicroBias); - oapiWriteItem_int (hFile, "CloudMicro", CloudMicro); - oapiWriteItem_int (hFile, "PostProcess", PostProcess); - oapiWriteItem_int (hFile, "ShaderDebug", ShaderDebug); - oapiWriteItem_int (hFile, "PresentLocation", PresentLocation); - oapiWriteItem_int (hFile, "PlanetTileLoadFlags", PlanetTileLoadFlags); - oapiWriteItem_int (hFile, "LabelDisplayFlags", LabelDisplayFlags); - oapiWriteItem_int (hFile, "GDIOverlay", GDIOverlay); - oapiWriteItem_int (hFile, "gcGUIMode", gcGUIMode); - oapiWriteItem_int (hFile, "AbsoluteAnimations", bAbsAnims); - oapiWriteItem_int (hFile, "NormalmappedClouds", bCloudNormals); - oapiWriteItem_int (hFile, "TerrainFlats", bFlats); - oapiWriteItem_int (hFile, "SunGlare", bGlares); - oapiWriteItem_int (hFile, "LightsGlare", bLocalGlares); - oapiWriteItem_int (hFile, "Irradiance", bIrradiance); - oapiWriteItem_int (hFile, "AtmoQuality", bAtmoQuality); - oapiWriteItem_int (hFile, "DebugBreak", DebugBreak); - oapiWriteItem_int (hFile, "ShaderCacheUse", ShaderCacheUse); - oapiWriteItem_int (hFile, "NoPlanetAA", NoPlanetAA); + oapiWriteItem_float (hFile, (char*)"FrameRate", FrameRate); + oapiWriteItem_int (hFile, (char*)"EnableLimiter", EnableLimiter); + oapiWriteItem_int (hFile, (char*)"CustomCamMode", CustomCamMode); + oapiWriteItem_int (hFile, (char*)"PlanetPreloadMode", PlanetPreloadMode); + oapiWriteItem_int (hFile, (char*)"PlanetTexLoadFreq", PlanetLoadFrequency); + oapiWriteItem_int (hFile, (char*)"Anisotrophy", Anisotrophy); + oapiWriteItem_int (hFile, (char*)"SceneAntialias", SceneAntialias); + oapiWriteItem_int (hFile, (char*)"SketchpadFont", SketchpadFont); + oapiWriteItem_int (hFile, (char*)"PreLoadBaseVisuals", PreLBaseVis); + oapiWriteItem_int (hFile, (char*)"EnableNormalMapping", UseNormalMap); + oapiWriteItem_int (hFile, (char*)"NearClipPlaneMode", NearClipPlane); + oapiWriteItem_int (hFile, (char*)"RwyLightAnimate", RwyLightAnimate); + oapiWriteItem_float (hFile, (char*)"RwyLightAngle", RwyLightAngle); + oapiWriteItem_float (hFile, (char*)"RwyBrightness", RwyBrightness); + oapiWriteItem_float (hFile, (char*)"NightLightsAngle", SunAngle); + oapiWriteItem_float (hFile, (char*)"BumpMapAmplitude", BumpAmp); + oapiWriteItem_float (hFile, (char*)"PlanetGlow", PlanetGlow); + oapiWriteItem_int (hFile, (char*)"EnvMapSize", EnvMapSize); + oapiWriteItem_int (hFile, (char*)"EnvMapMode", EnvMapMode); + oapiWriteItem_int (hFile, (char*)"EnvMapFaces", EnvMapFaces); + oapiWriteItem_int (hFile, (char*)"ShadowMapMode", ShadowMapMode); + oapiWriteItem_int (hFile, (char*)"ShadowMapFilter", ShadowFilter); + oapiWriteItem_int (hFile, (char*)"ShadowMapSize", ShadowMapSize); + oapiWriteItem_int (hFile, (char*)"TerrainShadowing", TerrainShadowing); + oapiWriteItem_int (hFile, (char*)"EnableGlass", EnableGlass); + oapiWriteItem_int (hFile, (char*)"EnableMeshDbg", EnableMeshDbg); + oapiWriteItem_int (hFile, (char*)"TileMipmaps", TileMipmaps); + oapiWriteItem_int (hFile, (char*)"TextureMips", TextureMips); + oapiWriteItem_int (hFile, (char*)"TileDebug", TileDebug); + oapiWriteItem_float (hFile, (char*)"StereoSeparation", Separation); + oapiWriteItem_float (hFile, (char*)"StereoConvergence", Convergence); + oapiWriteItem_int (hFile, (char*)"DebugLvl", DebugLvl); + oapiWriteItem_float (hFile, (char*)"VCNearPlane", VCNearPlane); + oapiWriteItem_int (hFile, (char*)"LightConfiguration", LightConfig); + oapiWriteItem_int (hFile, (char*)"DisableDrvMgm", DisableDriverManagement); + oapiWriteItem_int (hFile, (char*)"NVPerfHUD", NVPerfHUD); + oapiWriteItem_int (hFile, (char*)"DebugLineFontSize", DebugFontSize); + oapiWriteItem_int (hFile, (char*)"DisableVisualHelperReadout", DisableVisualHelperReadout); + oapiWriteItem_float (hFile, (char*)"LODBias", LODBias); + oapiWriteItem_int (hFile, (char*)"MeshRes", MeshRes); + oapiWriteItem_int (hFile, (char*)"MicroMode", MicroMode); + oapiWriteItem_int (hFile, (char*)"MicroFilter", MicroFilter); + oapiWriteItem_int (hFile, (char*)"BlendMode", BlendMode); + oapiWriteItem_int (hFile, (char*)"MicroBias", MicroBias); + oapiWriteItem_int (hFile, (char*)"CloudMicro", CloudMicro); + oapiWriteItem_int (hFile, (char*)"PostProcess", PostProcess); + oapiWriteItem_int (hFile, (char*)"ShaderDebug", ShaderDebug); + oapiWriteItem_int (hFile, (char*)"PresentLocation", PresentLocation); + oapiWriteItem_int (hFile, (char*)"PlanetTileLoadFlags", PlanetTileLoadFlags); + oapiWriteItem_int (hFile, (char*)"LabelDisplayFlags", LabelDisplayFlags); + oapiWriteItem_int (hFile, (char*)"GDIOverlay", GDIOverlay); + oapiWriteItem_int (hFile, (char*)"gcGUIMode", gcGUIMode); + oapiWriteItem_int (hFile, (char*)"AbsoluteAnimations", bAbsAnims); + oapiWriteItem_int (hFile, (char*)"NormalmappedClouds", bCloudNormals); + oapiWriteItem_int (hFile, (char*)"TerrainFlats", bFlats); + oapiWriteItem_int (hFile, (char*)"SunGlare", bGlares); + oapiWriteItem_int (hFile, (char*)"LightsGlare", bLocalGlares); + oapiWriteItem_int (hFile, (char*)"Irradiance", bIrradiance); + oapiWriteItem_int (hFile, (char*)"AtmoQuality", bAtmoQuality); + oapiWriteItem_int (hFile, (char*)"DebugBreak", DebugBreak); + oapiWriteItem_int (hFile, (char*)"ShaderCacheUse", ShaderCacheUse); + oapiWriteItem_int (hFile, (char*)"NoPlanetAA", NoPlanetAA); - oapiWriteItem_float (hFile, "OrbitalShadowMult", OrbitalShadowMult); - oapiWriteItem_float (hFile, "GFXIntensity", GFXIntensity); - oapiWriteItem_float (hFile, "GFXDistance", GFXDistance); - oapiWriteItem_float (hFile, "GFXThreshold", GFXThreshold); - oapiWriteItem_float (hFile, "GFXGamma", GFXGamma); - oapiWriteItem_float (hFile, "GFXSunIntensity", GFXSunIntensity); - oapiWriteItem_float (hFile, "GFXLocalMax", GFXLocalMax); - oapiWriteItem_float (hFile, "GFXGlare", GFXGlare); + oapiWriteItem_float (hFile, (char*)"OrbitalShadowMult", OrbitalShadowMult); + oapiWriteItem_float (hFile, (char*)"GFXIntensity", GFXIntensity); + oapiWriteItem_float (hFile, (char*)"GFXDistance", GFXDistance); + oapiWriteItem_float (hFile, (char*)"GFXThreshold", GFXThreshold); + oapiWriteItem_float (hFile, (char*)"GFXGamma", GFXGamma); + oapiWriteItem_float (hFile, (char*)"GFXSunIntensity", GFXSunIntensity); + oapiWriteItem_float (hFile, (char*)"GFXLocalMax", GFXLocalMax); + oapiWriteItem_float (hFile, (char*)"GFXGlare", GFXGlare); - oapiWriteItem_string (hFile, "SolCfg", SolCfg); - oapiWriteItem_string (hFile, "DebugLineFont", DebugFont); + oapiWriteItem_string (hFile,(char*) "SolCfg", SolCfg); + oapiWriteItem_string (hFile,(char*) "DebugLineFont", DebugFont); - oapiWriteItem_string(hFile, "EarthAtmoCfg", (char *)AtmoCfg["Earth"].c_str()); + oapiWriteItem_string(hFile, (char*)"EarthAtmoCfg", (char *)AtmoCfg["Earth"].c_str()); oapiCloseFile (hFile, FILE_OUT); } diff --git a/OVP/D3D9Client/D3D9ControlPanel.cpp b/OVP/D3D9Client/D3D9ControlPanel.cpp index 3af623c04..0b172745b 100644 --- a/OVP/D3D9Client/D3D9ControlPanel.cpp +++ b/OVP/D3D9Client/D3D9ControlPanel.cpp @@ -90,8 +90,8 @@ void D3D9Client::DrawTimeBar(double t, double s, double f, DWORD color, const ch void D3D9Client::RenderControlPanel() { - static char *OnOff[]={"Off","On"}; - static char *SkpU[]={"Auto","GDI"}; + static const char *OnOff[]={"Off","On"}; + static const char *SkpU[]={"Auto","GDI"}; // static double sim_time = 0.0; @@ -108,8 +108,8 @@ void D3D9Client::RenderControlPanel() oapi::Pen * pen = oapiCreatePen(1, 10, 0xFFFF00); oapi::Pen * nullp = oapiCreatePen(0, 1, 0xFFFFFF); oapi::Brush *brush = oapiCreateBrush(0xA0000000); - oapi::Font *largef = oapiCreateFont(38,false,"Arial", FONT_BOLD); - oapi::Font *smallf = oapiCreateFont(22,false,"Fixed"); + oapi::Font *largef = oapiCreateFont(38,false,(char*)"Arial", FONT_BOLD); + oapi::Font *smallf = oapiCreateFont(22,false,(char*)"Fixed"); pItemsSkp->SetPen(nullp); diff --git a/OVP/D3D9Client/D3D9Effect.cpp b/OVP/D3D9Client/D3D9Effect.cpp index 873754ed1..8c40c0f18 100644 --- a/OVP/D3D9Client/D3D9Effect.cpp +++ b/OVP/D3D9Client/D3D9Effect.cpp @@ -497,9 +497,9 @@ void D3D9Effect::D3D9TechInit(D3D9Client *_gc, LPDIRECT3DDEVICE9 _pDev, const ch // FX->SetInt(eHazeMode, 0); FX->SetBool(eInSpace, false); - FX->SetVector(eAttennuate, &D3DXVECTOR4(1,1,1,1)); - FX->SetVector(eInScatter, &D3DXVECTOR4(0,0,0,0)); - FX->SetVector(eColor, &D3DXVECTOR4(0, 0, 0, 0)); + FX->SetVector(eAttennuate, ptr(D3DXVECTOR4(1,1,1,1))); + FX->SetVector(eInScatter, ptr(D3DXVECTOR4(0,0,0,0))); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0, 0, 0, 0))); //if (Config->ShadowFilter>=3) FX->SetValue(eKernel, &shadow_kernel2, sizeof(shadow_kernel2)); FX->SetValue(eKernel, &shadow_kernel, sizeof(shadow_kernel)); @@ -599,10 +599,10 @@ void D3D9Effect::UpdateEffectCamera(OBJHANDLE hPlanet) if (rl>1e-3) atm_color *= pow(rl, 1.5f); else atm_color = D3DXVECTOR4(0,0,0,1); - FX->SetValue(eEast, &D3DXVEC(east), sizeof(D3DXVECTOR3)); - FX->SetValue(eNorth, &D3DXVEC(north), sizeof(D3DXVECTOR3)); - FX->SetValue(eCameraPos, &D3DXVEC(cam), sizeof(D3DXVECTOR3)); - FX->SetVector(eRadius, &D3DXVECTOR4((float)rad, radlimit, (float)len, (float)(len-rad))); + FX->SetValue(eEast, ptr(D3DXVEC(east)), sizeof(D3DXVECTOR3)); + FX->SetValue(eNorth, ptr(D3DXVEC(north)), sizeof(D3DXVECTOR3)); + FX->SetValue(eCameraPos, ptr(D3DXVEC(cam)), sizeof(D3DXVECTOR3)); + FX->SetVector(eRadius, ptr(D3DXVECTOR4((float)rad, radlimit, (float)len, (float)(len-rad)))); FX->SetFloat(ePointScale, 0.5f*float(height)/tan(ap)); FX->SetFloat(eProxySize, cos(proxy_size)); FX->SetFloat(eInvProxySize, 1.0f/(1.0f-cos(proxy_size))); @@ -615,7 +615,7 @@ void D3D9Effect::UpdateEffectCamera(OBJHANDLE hPlanet) void D3D9Effect::EnablePlanetGlow(bool bEnabled) { if (bEnabled) FX->SetVector(eAtmColor, &atm_color); - else FX->SetVector(eAtmColor, &D3DXVECTOR4(0,0,0,0)); + else FX->SetVector(eAtmColor, ptr(D3DXVECTOR4(0,0,0,0))); } @@ -830,7 +830,7 @@ void D3D9Effect::RenderExhaust(const LPD3DXMATRIX pW, VECTOR3 &cdir, EXHAUSTSPEC } -void D3D9Effect::RenderBoundingBox(const LPD3DXMATRIX pW, const LPD3DXMATRIX pGT, const D3DXVECTOR4 *bmin, const D3DXVECTOR4 *bmax, const LPD3DXVECTOR4 color) +void D3D9Effect::RenderBoundingBox(const LPD3DXMATRIX pW, const LPD3DXMATRIX pGT, const D3DXVECTOR4 *bmin, const D3DXVECTOR4 *bmax, const D3DXVECTOR4 *color) { D3DXMATRIX ident; D3DXMatrixIdentity(&ident); @@ -907,7 +907,7 @@ void D3D9Effect::RenderLines(const D3DXVECTOR3 *pVtx, const WORD *pIdx, int nVtx UINT numPasses = 0; pDev->SetVertexDeclaration(pPositionDecl); FX->SetMatrix(eW, pW); - FX->SetVector(eColor, (const D3DXVECTOR4 *)&D3DXCOLOR(color)); + FX->SetVector(eColor, (const D3DXVECTOR4 *)ptr(D3DXCOLOR(color))); FX->SetTechnique(eTBBTech); FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE); FX->BeginPass(0); @@ -917,14 +917,14 @@ void D3D9Effect::RenderLines(const D3DXVECTOR3 *pVtx, const WORD *pIdx, int nVtx } -void D3D9Effect::RenderBoundingSphere(const LPD3DXMATRIX pW, const LPD3DXMATRIX pGT, const D3DXVECTOR4 *bs, const LPD3DXVECTOR4 color) +void D3D9Effect::RenderBoundingSphere(const LPD3DXMATRIX pW, const LPD3DXMATRIX pGT, const D3DXVECTOR4 *bs, const D3DXVECTOR4 *color) { D3DXMATRIX mW; D3DXVECTOR3 vCam; D3DXVECTOR3 vPos; - D3DXVec3TransformCoord(&vPos, &D3DXVECTOR3(bs->x, bs->y, bs->z), pW); + D3DXVec3TransformCoord(&vPos, ptr(D3DXVECTOR3(bs->x, bs->y, bs->z)), pW); D3DXVec3Normalize(&vCam, &vPos); D3DMAT_CreateX_Billboard(&vCam, &vPos, bs->w, &mW); diff --git a/OVP/D3D9Client/D3D9Effect.h b/OVP/D3D9Client/D3D9Effect.h index a9e2f8a31..c9213f372 100644 --- a/OVP/D3D9Client/D3D9Effect.h +++ b/OVP/D3D9Client/D3D9Effect.h @@ -57,8 +57,8 @@ class D3D9Effect { static void RenderLines(const D3DXVECTOR3 *pVtx, const WORD *pIdx, int nVtx, int nIdx, const D3DXMATRIX *pW, DWORD color); static void RenderTileBoundingBox(const LPD3DXMATRIX pW, VECTOR4 *pVtx, const LPD3DXVECTOR4 color); - static void RenderBoundingBox(const LPD3DXMATRIX pW, const LPD3DXMATRIX pGT, const D3DXVECTOR4 *bmin, const D3DXVECTOR4 *bmax, const LPD3DXVECTOR4 color); - static void RenderBoundingSphere(const LPD3DXMATRIX pW, const LPD3DXMATRIX pGT, const D3DXVECTOR4 *bs, const LPD3DXVECTOR4 color); + static void RenderBoundingBox(const LPD3DXMATRIX pW, const LPD3DXMATRIX pGT, const D3DXVECTOR4 *bmin, const D3DXVECTOR4 *bmax, const D3DXVECTOR4 *color); + static void RenderBoundingSphere(const LPD3DXMATRIX pW, const LPD3DXMATRIX pGT, const D3DXVECTOR4 *bs, const D3DXVECTOR4 *color); static void RenderBillboard(const LPD3DXMATRIX pW, LPDIRECT3DTEXTURE9 pTex, float alpha = 1.0f); static void RenderExhaust(const LPD3DXMATRIX pW, VECTOR3 &cdir, EXHAUSTSPEC *es, SURFHANDLE def); static void RenderSpot(float intens, const LPD3DXCOLOR color, const LPD3DXMATRIX pW, SURFHANDLE pTex); diff --git a/OVP/D3D9Client/D3D9Frame.cpp b/OVP/D3D9Client/D3D9Frame.cpp index 7edb76540..5c49984be 100644 --- a/OVP/D3D9Client/D3D9Frame.cpp +++ b/OVP/D3D9Client/D3D9Frame.cpp @@ -35,7 +35,7 @@ IDirect3DVertexDeclaration9 *pPatchVertexDecl = NULL; IDirect3DVertexDeclaration9 *pSketchpadDecl = NULL; IDirect3DVertexDeclaration9 *pLocalLightsDecl = NULL; -static char *d3dmessage={"Required DirectX version (June 2010 or newer) not found\0"}; +static const char *d3dmessage={"Required DirectX version (June 2010 or newer) not found\0"}; //----------------------------------------------------------------------------- // Name: CD3DFramework9() @@ -399,11 +399,11 @@ HRESULT CD3DFramework9::Initialize(HWND _hWnd, GraphicsClient::VIDEODATA *vData) // if ((caps.Caps2&D3DCAPS2_CANAUTOGENMIPMAP)==0) { LogWrn("[No Hardware MipMap auto generation]"); - oapiWriteLog("D3D9: WARNING: [No Hardware MipMap auto generation]"); + oapiWriteLog((char*)"D3D9: WARNING: [No Hardware MipMap auto generation]"); } if (bFail) { - oapiWriteLog("D3D9: FAIL: !! Graphics card doesn't meet the minimum requirements to run !!"); + oapiWriteLog((char*)"D3D9: FAIL: !! Graphics card doesn't meet the minimum requirements to run !!"); MessageBoxA(NULL, "Graphics card doesn't meet the minimum requirements to run D3D9Client.", "D3D9Client Error",MB_OK); return -1; } diff --git a/OVP/D3D9Client/D3D9Pad.cpp b/OVP/D3D9Client/D3D9Pad.cpp index 11d690b00..6b04fecc3 100644 --- a/OVP/D3D9Client/D3D9Pad.cpp +++ b/OVP/D3D9Client/D3D9Pad.cpp @@ -652,7 +652,7 @@ void D3D9Pad::SetupDevice(Topo tNew) if ((w & 1) == 0) offset = 0.5f; HR(FX->SetValue(ePen, &pencolor.fclr, sizeof(D3DXCOLOR))); HR(FX->SetBool(eDashEn, IsDashed())); - HR(FX->SetValue(eWidth, &D3DXVECTOR3(GetPenWidth(), pattern*0.13f, offset), sizeof(D3DXVECTOR3))); + HR(FX->SetValue(eWidth, ptr(D3DXVECTOR3(GetPenWidth(), pattern*0.13f, offset)), sizeof(D3DXVECTOR3))); } @@ -686,7 +686,7 @@ void D3D9Pad::SetupDevice(Topo tNew) if (ClipData[0].bEnable || ClipData[1].bEnable) { HR(FX->SetValue(ePos, &ClipData[0].uDir, sizeof(D3DXVECTOR3))); HR(FX->SetValue(ePos2, &ClipData[1].uDir, sizeof(D3DXVECTOR3))); - HR(FX->SetValue(eCov, &D3DXVECTOR4(ClipData[0].ca, ClipData[0].dst, ClipData[1].ca, ClipData[1].dst), sizeof(D3DXVECTOR4))); + HR(FX->SetValue(eCov, ptr(D3DXVECTOR4(ClipData[0].ca, ClipData[0].dst, ClipData[1].ca, ClipData[1].dst)), sizeof(D3DXVECTOR4))); } } @@ -719,7 +719,7 @@ void D3D9Pad::SetupDevice(Topo tNew) } } - HR(FX->SetVector(eSize, &D3DXVECTOR4(tw, th, 1.0f, 1.0f))); + HR(FX->SetVector(eSize, ptr(D3DXVECTOR4(tw, th, 1.0f, 1.0f)))); HR(FX->SetBool(eTexEn, (hTexture != NULL))); HR(FX->SetBool(eFntEn, (hFontTex != NULL))); } @@ -1172,7 +1172,7 @@ void D3D9Pad::Line (int x0, int y0, int x1, int y1) // =============================================================================================== // -void D3D9Pad::FillRect(int l, int t, int r, int b, SkpColor &c) +void D3D9Pad::FillRect(int l, int t, int r, int b, const SkpColor &c) { if (r == l) return; if (b == t) return; @@ -1653,7 +1653,7 @@ void D3D9Pad::AppendLineVertexList(const Type *pt, int _npt, bool bLoop) pp = _DXV2(pt[i]); - if (IsDashed()) length += D3DXVec2Length(&(np - pp)); + if (IsDashed()) length += D3DXVec2Length(ptr(np - pp)); } // Last segment --------------------------------------------------------- @@ -1804,9 +1804,9 @@ using namespace oapi; D3D9PadFont::D3D9PadFont(int height, bool prop, const char *face, FontStyle style, int orientation, DWORD flags) : Font(height, prop, face, style, orientation) { - char *def_fixedface = "Courier New"; - char *def_sansface = "Arial"; - char *def_serifface = "Times New Roman"; + const char *def_fixedface = "Courier New"; + const char *def_sansface = "Arial"; + const char *def_serifface = "Times New Roman"; if (face[0]!='*') { if (!_stricmp (face, "fixed")) face = def_fixedface; diff --git a/OVP/D3D9Client/D3D9Pad.h b/OVP/D3D9Client/D3D9Pad.h index 4eaadac73..cb4c1a2ad 100644 --- a/OVP/D3D9Client/D3D9Pad.h +++ b/OVP/D3D9Client/D3D9Pad.h @@ -130,7 +130,7 @@ inline void SkpVtxFC(SkpVtx& v, float _x, float _y, DWORD c) } // Fill Rect, Ellipse, Polygon [only] -inline void SkpVtxIC(SkpVtx &v, int _x, int _y, SkpColor &c) +inline void SkpVtxIC(SkpVtx &v, int _x, int _y, const SkpColor &c) { v.x = float(_x) - 0.5f; v.y = float(_y) - 0.5f; @@ -488,8 +488,8 @@ class D3D9Pad : public Sketchpad void SetWorldTransform(const FMATRIX4 *pWT = NULL); void SetWorldTransform2D(float scale=1.0f, float rot=0.0f, const IVECTOR2 *c=NULL, const IVECTOR2 *t=NULL); int DrawMeshGroup(const MESHHANDLE hMesh, DWORD grp, Sketchpad::MeshFlags flags, const SURFHANDLE hTex = NULL); - void CopyRect(const SURFHANDLE hSrc, const LPRECT src, int tx, int ty); - void StretchRect(const SURFHANDLE hSrc, const LPRECT src, const LPRECT tgt); + void CopyRect(const SURFHANDLE hSrc, const RECT *src, int tx, int ty); + void StretchRect(const SURFHANDLE hSrc, const RECT *src, const RECT *tgt); void RotateRect(const SURFHANDLE hSrc, const LPRECT src, int cx, int cy, float angle, float sw = 1.0f, float sh = 1.0f); void ColorKey(const SURFHANDLE hSrc, const LPRECT src, int tx, int ty); void TextEx(float x, float y, const char *str, float scale = 100.0f, float angle = 0.0f); @@ -561,7 +561,7 @@ class D3D9Pad : public Sketchpad void LoadDefaults(); void CopyRectNative(LPDIRECT3DTEXTURE9 pSrc, const LPRECT s, int tx, int ty); - void StretchRectNative(LPDIRECT3DTEXTURE9 pSrc, const LPRECT s, const LPRECT t); + void StretchRectNative(LPDIRECT3DTEXTURE9 pSrc, const RECT *s, const RECT *t); private: @@ -580,13 +580,13 @@ class D3D9Pad : public Sketchpad void Reset(); bool Flush(HPOLY hPoly = NULL); void AddRectIdx(WORD aV); - void FillRect(int l, int t, int r, int b, SkpColor &c); + void FillRect(int l, int t, int r, int b, const SkpColor &c); void TexChange(SURFHANDLE hNew); bool TexChangeNative(LPDIRECT3DTEXTURE9 hNew); - const LPRECT CheckRectNative(LPDIRECT3DTEXTURE9 hSrc, const LPRECT s); + const RECT *CheckRectNative(LPDIRECT3DTEXTURE9 hSrc, const RECT *s); void SetFontTextureNative(LPDIRECT3DTEXTURE9 hNew); void SetupDevice(Topo tNew); - LPRECT CheckRect(SURFHANDLE hSrc, const LPRECT s); + const RECT *CheckRect(SURFHANDLE hSrc, const RECT *s); void IsLineTopologyAllowed(); DWORD ColorComp(DWORD c) const; SkpColor ColorComp(const SkpColor &c) const; diff --git a/OVP/D3D9Client/D3D9Pad2.cpp b/OVP/D3D9Client/D3D9Pad2.cpp index fa5879d16..ca86f2d40 100644 --- a/OVP/D3D9Client/D3D9Pad2.cpp +++ b/OVP/D3D9Client/D3D9Pad2.cpp @@ -87,7 +87,7 @@ void D3D9Pad::AddRectIdx(WORD aV) // =============================================================================================== // -LPRECT D3D9Pad::CheckRect(SURFHANDLE hSrc, const LPRECT s) +const RECT *D3D9Pad::CheckRect(SURFHANDLE hSrc, const RECT *s) { if (s) return s; src.left = 0; @@ -100,7 +100,7 @@ LPRECT D3D9Pad::CheckRect(SURFHANDLE hSrc, const LPRECT s) // =============================================================================================== // -void D3D9Pad::CopyRect(const SURFHANDLE hSrc, const LPRECT _s, int tx, int ty) +void D3D9Pad::CopyRect(const SURFHANDLE hSrc, const RECT *_s, int tx, int ty) { #ifdef SKPDBG Log("CopyRect(0x%X)", DWORD(hSrc)); @@ -110,7 +110,7 @@ void D3D9Pad::CopyRect(const SURFHANDLE hSrc, const LPRECT _s, int tx, int ty) if (Topology(TRIANGLE)) { - LPRECT s = CheckRect(hSrc, _s); + const RECT *s = CheckRect(hSrc, _s); int h = abs(s->bottom - s->top); int w = abs(s->right - s->left); @@ -134,7 +134,7 @@ void D3D9Pad::CopyRect(const SURFHANDLE hSrc, const LPRECT _s, int tx, int ty) // =============================================================================================== // -void D3D9Pad::StretchRect(const SURFHANDLE hSrc, const LPRECT _s, const LPRECT _t) +void D3D9Pad::StretchRect(const SURFHANDLE hSrc, const RECT *_s, const RECT *_t) { #ifdef SKPDBG Log("StretchRect(0x%X)", DWORD(hSrc)); @@ -144,8 +144,8 @@ void D3D9Pad::StretchRect(const SURFHANDLE hSrc, const LPRECT _s, const LPRECT _ if (Topology(TRIANGLE)) { - LPRECT s = CheckRect(hSrc, _s); - LPRECT t = _t ? _t : &tgt; + const RECT *s = CheckRect(hSrc, _s); + const RECT *t = _t ? _t : &tgt; AddRectIdx(vI); @@ -176,7 +176,7 @@ void D3D9Pad::RotateRect(const SURFHANDLE hSrc, const LPRECT _s, int tcx, int tc if (Topology(TRIANGLE)) { - LPRECT s = CheckRect(hSrc, _s); + const RECT *s = CheckRect(hSrc, _s); float w = float(s->right - s->left) * sw; float h = float(s->bottom - s->top) * sh; @@ -225,7 +225,7 @@ void D3D9Pad::ColorKey(const SURFHANDLE hSrc, const LPRECT _s, int tx, int ty) if (Topology(TRIANGLE)) { - LPRECT s = CheckRect(hSrc, _s); + const RECT *s = CheckRect(hSrc, _s); int h = abs(s->bottom - s->top); int w = abs(s->right - s->left); @@ -263,8 +263,8 @@ void D3D9Pad::ColorKeyStretch(const SURFHANDLE hSrc, const LPRECT _s, const LPRE if (Topology(TRIANGLE)) { - LPRECT s = CheckRect(hSrc, _s); - LPRECT t = _t ? _t : &tgt; + const RECT *s = CheckRect(hSrc, _s); + const RECT *t = _t ? _t : &tgt; AddRectIdx(vI); @@ -297,7 +297,7 @@ void D3D9Pad::CopyRectNative(const LPDIRECT3DTEXTURE9 pSrc, const LPRECT _s, int if (Topology(TRIANGLE)) { - LPRECT s = CheckRectNative(pSrc, _s); + const RECT *s = CheckRectNative(pSrc, _s); int h = abs(s->bottom - s->top); int w = abs(s->right - s->left); @@ -321,7 +321,7 @@ void D3D9Pad::CopyRectNative(const LPDIRECT3DTEXTURE9 pSrc, const LPRECT _s, int // =============================================================================================== // -void D3D9Pad::StretchRectNative(const LPDIRECT3DTEXTURE9 pSrc, const LPRECT _s, const LPRECT t) +void D3D9Pad::StretchRectNative(const LPDIRECT3DTEXTURE9 pSrc, const RECT *_s, const RECT *t) { #ifdef SKPDBG Log("StretchRectNative(0x%X)", DWORD(pSrc)); @@ -331,7 +331,7 @@ void D3D9Pad::StretchRectNative(const LPDIRECT3DTEXTURE9 pSrc, const LPRECT _s, if (Topology(TRIANGLE)) { - LPRECT s = CheckRectNative(pSrc, _s); + const RECT *s = CheckRectNative(pSrc, _s); AddRectIdx(vI); @@ -368,7 +368,7 @@ void D3D9Pad::CopyTetragon(const SURFHANDLE hSrc, const LPRECT _s, const FVECTOR if (Topology(TRIANGLE)) { - LPRECT s = CheckRect(hSrc, _s); + const RECT *s = CheckRect(hSrc, _s); sp[0] = FVECTOR2(s->left, s->top); sp[1] = FVECTOR2(s->left, s->bottom); @@ -817,7 +817,7 @@ int D3D9Pad::DrawMeshGroup(const MESHHANDLE hMesh, DWORD grp, Sketchpad::MeshFla // =============================================================================================== // -const LPRECT D3D9Pad::CheckRectNative(LPDIRECT3DTEXTURE9 hSrc, const LPRECT s) +const RECT *D3D9Pad::CheckRectNative(LPDIRECT3DTEXTURE9 hSrc, const RECT *s) { if (s) return s; D3DSURFACE_DESC desc; @@ -947,7 +947,7 @@ void D3D9PolyLine::Update(const FVECTOR2 *_pt, int _npt, bool bConnect) vI+=2; // -------------------------------------- pp = pt[i]; - length += D3DXVec2Length(&(np - pp)); + length += D3DXVec2Length(ptr(np - pp)); } if (bLoop) { diff --git a/OVP/D3D9Client/D3D9Pad3.cpp b/OVP/D3D9Client/D3D9Pad3.cpp index f1f7db9d2..ec653e005 100644 --- a/OVP/D3D9Client/D3D9Pad3.cpp +++ b/OVP/D3D9Client/D3D9Pad3.cpp @@ -269,19 +269,19 @@ void D3D9Pad::StretchRegion(const skpRegion *rgn, const SURFHANDLE hSrc, const L int ty2 = ty3 - (y3 - y2); // Corners - if (x0 != x1 && y0 != y1) CopyRect(hSrc, &_R(x0, y0, x1, y1), tx0, ty0); // TOP-LEFT - if (x2 != x3 && y0 != y1) CopyRect(hSrc, &_R(x2, y0, x3, y1), tx2, ty0); // TOP-RIGHT - if (x0 != x1 && y2 != y3) CopyRect(hSrc, &_R(x0, y2, x1, y3), tx0, ty2); // BTM-LEFT - if (x2 != x3 && y2 != y3) CopyRect(hSrc, &_R(x2, y2, x3, y3), tx2, ty2); // BTM-RIGHT + if (x0 != x1 && y0 != y1) CopyRect(hSrc, ptr(_R(x0, y0, x1, y1)), tx0, ty0); // TOP-LEFT + if (x2 != x3 && y0 != y1) CopyRect(hSrc, ptr(_R(x2, y0, x3, y1)), tx2, ty0); // TOP-RIGHT + if (x0 != x1 && y2 != y3) CopyRect(hSrc, ptr(_R(x0, y2, x1, y3)), tx0, ty2); // BTM-LEFT + if (x2 != x3 && y2 != y3) CopyRect(hSrc, ptr(_R(x2, y2, x3, y3)), tx2, ty2); // BTM-RIGHT // Sides - if (x1 != x2 && y0 != y1) StretchRect(hSrc, &_R(x1, y0, x2, y1), &_R(tx1, ty0, tx2, ty1)); // TOP - if (x1 != x2 && y2 != y3) StretchRect(hSrc, &_R(x1, y2, x2, y3), &_R(tx1, ty2, tx2, ty3)); // BOTTOM - if (x0 != x1 && y1 != y2) StretchRect(hSrc, &_R(x0, y1, x1, y2), &_R(tx0, ty1, tx1, ty2)); // LEFT - if (x2 != x3 && y1 != y2) StretchRect(hSrc, &_R(x2, y1, x3, y2), &_R(tx2, ty1, tx3, ty2)); // RIGHT + if (x1 != x2 && y0 != y1) StretchRect(hSrc, ptr(_R(x1, y0, x2, y1)), ptr(_R(tx1, ty0, tx2, ty1))); // TOP + if (x1 != x2 && y2 != y3) StretchRect(hSrc, ptr(_R(x1, y2, x2, y3)), ptr(_R(tx1, ty2, tx2, ty3))); // BOTTOM + if (x0 != x1 && y1 != y2) StretchRect(hSrc, ptr(_R(x0, y1, x1, y2)), ptr(_R(tx0, ty1, tx1, ty2))); // LEFT + if (x2 != x3 && y1 != y2) StretchRect(hSrc, ptr(_R(x2, y1, x3, y2)), ptr(_R(tx2, ty1, tx3, ty2))); // RIGHT // Center - StretchRect(hSrc, &_R(x1, y1, x2, y2), &_R(tx1, ty1, tx2, ty2)); + StretchRect(hSrc, ptr(_R(x1, y1, x2, y2)), ptr(_R(tx1, ty1, tx2, ty2))); } // =============================================================================================== diff --git a/OVP/D3D9Client/D3D9Surface.cpp b/OVP/D3D9Client/D3D9Surface.cpp index af99a5968..41d2e119f 100644 --- a/OVP/D3D9Client/D3D9Surface.cpp +++ b/OVP/D3D9Client/D3D9Surface.cpp @@ -29,12 +29,12 @@ void NatCheckFlags(DWORD &flags) if (flags & OAPISURFACE_RENDERTARGET) { if (flags & OAPISURFACE_GDI) { - oapiWriteLog("OAPISURFACE_GDI is incomaptible with OAPISURFACE_RENDERTARGET and OAPISURFACE_SKETCHPAD"); + oapiWriteLog((char*)"OAPISURFACE_GDI is incomaptible with OAPISURFACE_RENDERTARGET and OAPISURFACE_SKETCHPAD"); HALT(); } if (flags & OAPISURFACE_SYSMEM) { - oapiWriteLog("OAPISURFACE_SYSMEM is incomaptible with OAPISURFACE_RENDERTARGET and OAPISURFACE_SKETCHPAD"); + oapiWriteLog((char*)"OAPISURFACE_SYSMEM is incomaptible with OAPISURFACE_RENDERTARGET and OAPISURFACE_SKETCHPAD"); HALT(); } } @@ -42,12 +42,12 @@ void NatCheckFlags(DWORD &flags) if (flags & OAPISURFACE_MIPMAPS) { if ((flags & OAPISURFACE_TEXTURE) == 0) { - oapiWriteLog("OAPISURFACE_MIPMAPS can be only assigned to a OAPISURFACE_TEXTURE"); + oapiWriteLog((char*)"OAPISURFACE_MIPMAPS can be only assigned to a OAPISURFACE_TEXTURE"); HALT(); } if (flags & OAPISURFACE_SYSMEM) { - oapiWriteLog("OAPISURFACE_MIPMAPS is incomaptible with OAPISURFACE_SYSMEM"); + oapiWriteLog((char*)"OAPISURFACE_MIPMAPS is incomaptible with OAPISURFACE_SYSMEM"); HALT(); } } @@ -242,7 +242,7 @@ bool NatSaveSurface(const char* file, LPDIRECT3DRESOURCE9 pResource) { LPDIRECT3DSURFACE9 pSurf = static_cast(pResource); if (D3DXSaveSurfaceToFileA(file, fmt, pSurf, NULL, NULL) == S_OK) return true; - oapiWriteLog("NatSaveSurface(SURF):"); + oapiWriteLog((char*)"NatSaveSurface(SURF):"); NatDumpResource(pResource); return false; } @@ -256,7 +256,7 @@ bool NatSaveSurface(const char* file, LPDIRECT3DRESOURCE9 pResource) if (desc.Pool == D3DPOOL_SYSTEMMEM || desc.Usage & D3DUSAGE_DYNAMIC) { if (D3DXSaveTextureToFileA(file, fmt, pTex, NULL) == S_OK) return true; - oapiWriteLog("NatSaveSurface(TEX):"); + oapiWriteLog((char*)"NatSaveSurface(TEX):"); NatDumpResource(pResource); return false; } @@ -283,7 +283,7 @@ bool NatSaveSurface(const char* file, LPDIRECT3DRESOURCE9 pResource) if (D3DXSaveTextureToFileA(file, fmt, pTex, NULL) == S_OK) return true; } - oapiWriteLog("NatSaveSurface():"); + oapiWriteLog((char*)"NatSaveSurface():"); NatDumpResource(pResource); return false; } diff --git a/OVP/D3D9Client/D3D9Util.cpp b/OVP/D3D9Client/D3D9Util.cpp index e39e17596..17f6f140b 100644 --- a/OVP/D3D9Client/D3D9Util.cpp +++ b/OVP/D3D9Client/D3D9Util.cpp @@ -450,16 +450,16 @@ int fgets2(char *buf, int cmax, FILE *file, DWORD param) //bool bEquality, bool // trim from start std::string <rim (std::string &s) { - s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun(std::isspace)))); - //s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](auto c) { return !std::isspace(c); })); + //s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun(std::isspace)))); + s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](auto c) { return !std::isspace(c); })); return s; } // trim from end std::string &rtrim (std::string &s) { - s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun(std::isspace))).base(), s.end()); - //s.erase(std::find_if(s.rbegin(), s.rend(), [](auto c) { return !std::isspace(c); }).base(), s.end()); + //s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun(std::isspace))).base(), s.end()); + s.erase(std::find_if(s.rbegin(), s.rend(), [](auto c) { return !std::isspace(c); }).base(), s.end()); return s; } @@ -544,8 +544,10 @@ std::pair &splitAssignment (const std::string &line, c // ...convert to 'comment part length' if comment found cmtPos -= cmtPos != std::string::npos ? delPos + 1 : 0; - ret.first = trim(line.substr(0, delPos)); - ret.second = trim(line.substr(delPos + 1, cmtPos)); + ret.first = line.substr(0, delPos); + trim(ret.first); + ret.second = line.substr(delPos + 1, cmtPos); + trim(ret.second); return ret; } @@ -1299,7 +1301,7 @@ void D3D9Light::UpdateLight(const LightEmitter *_le, const class vObject *vo) // ----------------------------------------------------------------------------- - D3DXVec3TransformCoord(&Position, &D3DXVEC(le->GetPosition()), vo->MWorld()); + D3DXVec3TransformCoord(&Position, ptr(D3DXVEC(le->GetPosition())), vo->MWorld()); Dst2 = D3DXVec3Dot(&Position, &Position); // ----------------------------------------------------------------------------- @@ -1372,7 +1374,7 @@ void D3D9Light::UpdateLight(const LightEmitter *_le, const class vObject *vo) // ----------------------------------------------------------------------------- if (Type != 0) { - D3DXVec3TransformNormal(&Direction, &D3DXVEC(le->GetDirection()), vo->MWorld()); + D3DXVec3TransformNormal(&Direction, ptr(D3DXVEC(le->GetDirection())), vo->MWorld()); float angle = acos(dot(unit(Position), Direction)); cone = ilerp(U * 0.5f, P * 0.5f, angle); } diff --git a/OVP/D3D9Client/D3D9Util.h b/OVP/D3D9Client/D3D9Util.h index c84c08285..4de121553 100644 --- a/OVP/D3D9Client/D3D9Util.h +++ b/OVP/D3D9Client/D3D9Util.h @@ -69,6 +69,11 @@ const char *_PTR(const void *p); #define SURFACE(x) ((class SurfNative *)x) +// helper function to get address of a temporary +// NB: use with caution +template +const T* ptr(const T& x) { return &x; } + // ------------------------------------------------------------------------------------ // Vertex Declaration equal to NTVERTEX // ------------------------------------------------------------------------------------ @@ -500,9 +505,9 @@ inline MATRIX4 _MATRIX4(const LPD3DXMATRIX M) inline void TransformVertex(NMVERTEX *pVrt, LPD3DXMATRIX pW) { D3DXVECTOR3 p,n,t; - D3DXVec3TransformCoord(&p, &D3DXVECTOR3(pVrt->x, pVrt->y, pVrt->z), pW); - D3DXVec3TransformNormal(&n, &D3DXVECTOR3(pVrt->nx, pVrt->ny, pVrt->nz), pW); - D3DXVec3TransformNormal(&t, &D3DXVECTOR3(pVrt->tx, pVrt->ty, pVrt->tz), pW); + D3DXVec3TransformCoord(&p, ptr(D3DXVECTOR3(pVrt->x, pVrt->y, pVrt->z)), pW); + D3DXVec3TransformNormal(&n, ptr(D3DXVECTOR3(pVrt->nx, pVrt->ny, pVrt->nz)), pW); + D3DXVec3TransformNormal(&t, ptr(D3DXVECTOR3(pVrt->tx, pVrt->ty, pVrt->tz)), pW); pVrt->x = p.x; pVrt->y = p.y; pVrt->z = p.z; pVrt->nx = n.x; pVrt->ny = n.y; pVrt->nz = n.z; pVrt->tx = t.x; pVrt->ty = t.y; pVrt->tz = t.z; diff --git a/OVP/D3D9Client/DebugControls.cpp b/OVP/D3D9Client/DebugControls.cpp index 100728a9d..a93c67e63 100644 --- a/OVP/D3D9Client/DebugControls.cpp +++ b/OVP/D3D9Client/DebugControls.cpp @@ -171,13 +171,13 @@ void Create() cpr = cpg = cpb = cpa = 0.0f; if (Config->EnableMeshDbg) { - dwCmd = oapiRegisterCustomCmd("D3D9 Debug Controls", "This dialog allows to control various debug and development features", OpenDlgClbk, NULL); + dwCmd = oapiRegisterCustomCmd((char*)"D3D9 Debug Controls", (char*)"This dialog allows to control various debug and development features", OpenDlgClbk, NULL); } else { dwCmd = 0; } - dwGFX = oapiRegisterCustomCmd("D3D9 Graphics Controls", "This dialog allows to control various graphics options", OpenGFXDlgClbk, NULL); + dwGFX = oapiRegisterCustomCmd((char*)"D3D9 Graphics Controls", (char*)"This dialog allows to control various graphics options", OpenGFXDlgClbk, NULL); resbias = 4.0 + Config->LODBias; @@ -480,22 +480,22 @@ void OpenDlgClbk(void *context) UpdateFlags(); - CreateToolTip(IDC_DBG_TARGET, hDlg, "Select a target where the resulting image is assigned"); - CreateToolTip(IDC_DBG_SEAMS, hDlg, "Enable seams reduction at each mipmap level"); - CreateToolTip(IDC_DBG_FADE, hDlg, "Enable mipmap post processing. Contrast and detail is reduced from each mipmap to prevent 'stripes' (See:Fa,Fb)"); - CreateToolTip(IDC_DBG_NORM, hDlg, "Center color channels at 0.5f to prevent lightening/darkening the results"); - CreateToolTip(IDC_DBG_VARA, hDlg, "Attennuates high contrast components. Leaves low contrast parts unchanged [1.0 to 1.6]"); - CreateToolTip(IDC_DBG_VARB, hDlg, "Attennuates everything equally. Typical range [0.00 to 0.03]"); - CreateToolTip(IDC_DBG_VARC, hDlg, "Apply noise to main level and all mipmaps before attennuation (Fa,Fb)"); - CreateToolTip(IDC_DBG_MORE, hDlg, "Click to show/hide more options"); - CreateToolTip(IDC_DBG_EXTEND, hDlg, "Extend Diffuse/Roughess material range beyond 1.0f to allow texture fine tuning."); - CreateToolTip(IDC_DBG_LINK, hDlg, "Adjust all color channels at the same time"); - CreateToolTip(IDC_DBG_DEFINED, hDlg, "Use the material property for rendering and save it"); - - hTipRed = CreateToolTip(IDC_DBG_RED, hDlg, "Red"); - hTipGrn = CreateToolTip(IDC_DBG_GREEN, hDlg, "Green"); - hTipBlu = CreateToolTip(IDC_DBG_BLUE, hDlg, "Blue"); - hTipAlp = CreateToolTip(IDC_DBG_ALPHA, hDlg, "Alpha"); + CreateToolTip(IDC_DBG_TARGET, hDlg, (char*)"Select a target where the resulting image is assigned"); + CreateToolTip(IDC_DBG_SEAMS, hDlg, (char*)"Enable seams reduction at each mipmap level"); + CreateToolTip(IDC_DBG_FADE, hDlg, (char*)"Enable mipmap post processing. Contrast and detail is reduced from each mipmap to prevent 'stripes' (See:Fa,Fb)"); + CreateToolTip(IDC_DBG_NORM, hDlg, (char*)"Center color channels at 0.5f to prevent lightening/darkening the results"); + CreateToolTip(IDC_DBG_VARA, hDlg, (char*)"Attennuates high contrast components. Leaves low contrast parts unchanged [1.0 to 1.6]"); + CreateToolTip(IDC_DBG_VARB, hDlg, (char*)"Attennuates everything equally. Typical range [0.00 to 0.03]"); + CreateToolTip(IDC_DBG_VARC, hDlg, (char*)"Apply noise to main level and all mipmaps before attennuation (Fa,Fb)"); + CreateToolTip(IDC_DBG_MORE, hDlg, (char*)"Click to show/hide more options"); + CreateToolTip(IDC_DBG_EXTEND, hDlg, (char*)"Extend Diffuse/Roughess material range beyond 1.0f to allow texture fine tuning."); + CreateToolTip(IDC_DBG_LINK, hDlg, (char*)"Adjust all color channels at the same time"); + CreateToolTip(IDC_DBG_DEFINED, hDlg, (char*)"Use the material property for rendering and save it"); + + hTipRed = CreateToolTip(IDC_DBG_RED, hDlg, (char*)"Red"); + hTipGrn = CreateToolTip(IDC_DBG_GREEN, hDlg, (char*)"Green"); + hTipBlu = CreateToolTip(IDC_DBG_BLUE, hDlg, (char*)"Blue"); + hTipAlp = CreateToolTip(IDC_DBG_ALPHA, hDlg, (char*)"Alpha"); // Diffuse Params[0].var[0] = DefVar(0, 1, 2, SQRT, "Red"); @@ -1400,7 +1400,7 @@ struct PCParam { // ============================================================================================= // -D3DXCOLOR ProcessColor(D3DXVECTOR4 &C, PCParam *prm, int x, int y) +D3DXCOLOR ProcessColor(D3DXVECTOR4 C, PCParam *prm, int x, int y) { float fMip = float(prm->Mip); float a = prm->a; @@ -2141,14 +2141,14 @@ void OpenGFXDlgClbk(void *context) SendMessage(GetDlgItem(hGfxDlg, IDC_GFX_LOCALMAX_RESET), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hImg); SendMessage(GetDlgItem(hGfxDlg, IDC_GFX_GLARE_RESET), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hImg); - CreateToolTip(IDC_GFX_INTENSITY_RESET, hGfxDlg, "Reset to default"); - CreateToolTip(IDC_GFX_DISTANCE_RESET, hGfxDlg, "Reset to default"); - CreateToolTip(IDC_GFX_THRESHOLD_RESET, hGfxDlg, "Reset to default"); - CreateToolTip(IDC_GFX_GAMMA_RESET, hGfxDlg, "Reset to default"); - CreateToolTip(IDC_GFX_SUNLIGHT_RESET, hGfxDlg, "Reset to default"); - CreateToolTip(IDC_GFX_IRRADIANCE_RESET, hGfxDlg, "Reset to default"); - CreateToolTip(IDC_GFX_LOCALMAX_RESET, hGfxDlg, "Reset to default"); - CreateToolTip(IDC_GFX_GLARE_RESET, hGfxDlg, "Reset to default"); + CreateToolTip(IDC_GFX_INTENSITY_RESET, hGfxDlg, (char*)"Reset to default"); + CreateToolTip(IDC_GFX_DISTANCE_RESET, hGfxDlg, (char*)"Reset to default"); + CreateToolTip(IDC_GFX_THRESHOLD_RESET, hGfxDlg, (char*)"Reset to default"); + CreateToolTip(IDC_GFX_GAMMA_RESET, hGfxDlg, (char*)"Reset to default"); + CreateToolTip(IDC_GFX_SUNLIGHT_RESET, hGfxDlg, (char*)"Reset to default"); + CreateToolTip(IDC_GFX_IRRADIANCE_RESET, hGfxDlg, (char*)"Reset to default"); + CreateToolTip(IDC_GFX_LOCALMAX_RESET, hGfxDlg, (char*)"Reset to default"); + CreateToolTip(IDC_GFX_GLARE_RESET, hGfxDlg, (char*)"Reset to default"); SetGFXSliders(); } diff --git a/OVP/D3D9Client/HazeMgr.cpp b/OVP/D3D9Client/HazeMgr.cpp index bfa397d0a..2ea8594ac 100644 --- a/OVP/D3D9Client/HazeMgr.cpp +++ b/OVP/D3D9Client/HazeMgr.cpp @@ -313,15 +313,15 @@ void HazeManager2::RenderSky(VECTOR3 cpos, VECTOR3 cdir, double rad, double apr) D3DXMATRIX mWL, mL; D3DMAT_Identity(&mWL); - D3DMAT_FromAxisT(&mWL, &_D3DXVECTOR3(ux), &_D3DXVECTOR3(ur), &_D3DXVECTOR3(uy)); + D3DMAT_FromAxisT(&mWL, ptr(_D3DXVECTOR3(ux)), ptr(_D3DXVECTOR3(ur)), ptr(_D3DXVECTOR3(uy))); double a = 15.0*RAD; double b = (PI-asin(rad/cr))/6.0; D3DXVECTOR3 vTileCenter = D3DXVECTOR3(float(sin(15.0*RAD)), 1.0f, float(1.0+cos(15.0*RAD))) * 0.5; - D3DXMatrixRotationAxis(&mL, &_D3DXVECTOR3(ur), float(-a*0.5)); + D3DXMatrixRotationAxis(&mL, ptr(_D3DXVECTOR3(ur)), float(-a*0.5)); D3DXMatrixMultiply(&mWL, &mWL, &mL); - D3DXMatrixRotationAxis(&mL, &_D3DXVECTOR3(ur), float(-a)); + D3DXMatrixRotationAxis(&mL, ptr(_D3DXVECTOR3(ur)), float(-a)); //vp->GetScatterConst()->mVP = vp->GetScene()->PushCameraFrustumLimits(hd * 0.1, hd * 5.0); @@ -406,7 +406,7 @@ void HazeManager2::RenderRing(VECTOR3 cpos, VECTOR3 cdir, double rad, double hra D3DXMATRIX mW; D3DMAT_Identity(&mW); - D3DMAT_FromAxisT(&mW, &_D3DXVECTOR3(ux), &_D3DXVECTOR3(ur), &_D3DXVECTOR3(uy)); + D3DMAT_FromAxisT(&mW, ptr(_D3DXVECTOR3(ux)), ptr(_D3DXVECTOR3(ur)), ptr(_D3DXVECTOR3(uy))); ShaderParams sprm; memcpy_s(&sprm.mWorld, sizeof(sprm.mWorld), &mW, sizeof(mW)); diff --git a/OVP/D3D9Client/IProcess.cpp b/OVP/D3D9Client/IProcess.cpp index 4936bd405..8e104f505 100644 --- a/OVP/D3D9Client/IProcess.cpp +++ b/OVP/D3D9Client/IProcess.cpp @@ -187,7 +187,7 @@ bool ImageProcessing::SetupViewPort() HR(pDevice->SetViewport(&iVP)); HR(pVSConst->SetMatrix(pDevice, hVP, &mVP)); - HR(pVSConst->SetVector(pDevice, hSiz, &D3DXVECTOR4(float(desc.Width), float(desc.Height), 1.0f/float(desc.Width), 1.0f/float(desc.Height)))); + HR(pVSConst->SetVector(pDevice, hSiz, ptr(D3DXVECTOR4(float(desc.Width), float(desc.Height), 1.0f/float(desc.Width), 1.0f/float(desc.Height))))); HR(pVSConst->SetVector(pDevice, hPos, &vTemplate)); return true; } diff --git a/OVP/D3D9Client/Log.cpp b/OVP/D3D9Client/Log.cpp index 8cc70a1a1..ac8e1152b 100644 --- a/OVP/D3D9Client/Log.cpp +++ b/OVP/D3D9Client/Log.cpp @@ -145,7 +145,7 @@ void D3D9DebugLogVec(const char* lbl, oapi::FVECTOR4 &v) //------------------------------------------------------------------------------------------- // -void D3D9InitLog(char *file) +void D3D9InitLog(const char *file) { QueryPerformanceFrequency((LARGE_INTEGER*)&qpcFrq); QueryPerformanceCounter((LARGE_INTEGER*)&qpcStart); diff --git a/OVP/D3D9Client/Log.h b/OVP/D3D9Client/Log.h index 34bb7c08f..ad115f36d 100644 --- a/OVP/D3D9Client/Log.h +++ b/OVP/D3D9Client/Log.h @@ -47,7 +47,7 @@ extern std::queue D3D9DebugQueue; void RuntimeError(const char* File, const char* Fnc, UINT Line); void D3D9DebugLog(const char *format, ...); void D3D9DebugLogVec(const char* lbl, oapi::FVECTOR4 &v); -void D3D9InitLog(char *file); +void D3D9InitLog(const char *file); void D3D9CloseLog(); void LogTrace(const char *format, ...); void LogErr(const char *format, ...); diff --git a/OVP/D3D9Client/Mesh.cpp b/OVP/D3D9Client/Mesh.cpp index ac5d5f312..bf72285ea 100644 --- a/OVP/D3D9Client/Mesh.cpp +++ b/OVP/D3D9Client/Mesh.cpp @@ -1312,8 +1312,8 @@ void D3D9Mesh::SetupFog(const LPD3DXMATRIX pW) { _TRACE; if (!IsOK()) return; - FX->SetVector(eAttennuate, &D3DXVECTOR4(1,1,1,1)); - FX->SetVector(eInScatter, &D3DXVECTOR4(0,0,0,0)); + FX->SetVector(eAttennuate, ptr(D3DXVECTOR4(1,1,1,1))); + FX->SetVector(eInScatter, ptr(D3DXVECTOR4(0,0,0,0))); } // =========================================================================================== @@ -1543,7 +1543,7 @@ void D3D9Mesh::Render(const LPD3DXMATRIX pW, int iTech, LPDIRECT3DCUBETEXTURE9 * FX->SetBool(eTuneEnabled, false); FX->SetBool(eLightsEnabled, false); FX->SetBool(eOITEnable, false); - FX->SetVector(eColor, &D3DXVECTOR4(0, 0, 0, 0)); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0, 0, 0, 0))); ConfigureAtmo(); @@ -1562,7 +1562,7 @@ void D3D9Mesh::Render(const LPD3DXMATRIX pW, int iTech, LPDIRECT3DCUBETEXTURE9 * if (pLights && nSceneLights>0) { D3DXVECTOR3 pos; - D3DXVec3TransformCoord(&pos, &D3DXVECTOR3f4(BBox.bs), pW); + D3DXVec3TransformCoord(&pos, ptr(D3DXVECTOR3f4(BBox.bs)), pW); // Find all local lights effecting this mesh ------------------------------------------ // @@ -1654,16 +1654,16 @@ void D3D9Mesh::Render(const LPD3DXMATRIX pW, int iTech, LPDIRECT3DCUBETEXTURE9 * if (displ==3 && g!=selgrp) continue; - FX->SetVector(eColor, &D3DXVECTOR4(0, 0, 0, 0)); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0, 0, 0, 0))); if (flags&DBG_FLAGS_HLMESH) { if (uCurrentMesh==selmsh) { - FX->SetVector(eColor, &D3DXVECTOR4(0.0f, 0.0f, 0.5f, 0.5f)); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0.0f, 0.0f, 0.5f, 0.5f))); } } if (flags&DBG_FLAGS_HLGROUP) { if (g==selgrp && uCurrentMesh==selmsh) { - FX->SetVector(eColor, &D3DXVECTOR4(0.0f, 0.5f, 0.0f, 0.5f)); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0.0f, 0.5f, 0.0f, 0.5f))); } } } @@ -1952,7 +1952,7 @@ void D3D9Mesh::Render(const LPD3DXMATRIX pW, int iTech, LPDIRECT3DCUBETEXTURE9 * HR(FX->End()); if (flags&(DBG_FLAGS_BOXES|DBG_FLAGS_SPHERES)) RenderBoundingBox(pW); - FX->SetVector(eColor, &D3DXVECTOR4(0, 0, 0, 0)); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0, 0, 0, 0))); if (flags&DBG_FLAGS_DUALSIDED) pDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); } @@ -1998,7 +1998,7 @@ void D3D9Mesh::RenderSimplified(const LPD3DXMATRIX pW, LPDIRECT3DCUBETEXTURE9 *p FX->SetBool(eEnvMapEnable, false); FX->SetBool(eTuneEnabled, false); FX->SetBool(eLightsEnabled, false); - FX->SetVector(eColor, &D3DXVECTOR4(0, 0, 0, 0)); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0, 0, 0, 0))); FX->SetMatrix(eW, pW); ConfigureAtmo(); @@ -2016,7 +2016,7 @@ void D3D9Mesh::RenderSimplified(const LPD3DXMATRIX pW, LPDIRECT3DCUBETEXTURE9 *p int nMeshLights = 0; D3DXVECTOR3 pos; - D3DXVec3TransformCoord(&pos, &D3DXVECTOR3f4(BBox.bs), pW); + D3DXVec3TransformCoord(&pos, ptr(D3DXVECTOR3f4(BBox.bs)), pW); // Find all local lights effecting this mesh ------------------------------------------ // @@ -2293,7 +2293,7 @@ void D3D9Mesh::RenderFast(const LPD3DXMATRIX pW, int iTech) FX->SetTechnique(eVesselTech); FX->SetBool(eTuneEnabled, false); FX->SetBool(eLightsEnabled, false); - FX->SetVector(eColor, &D3DXVECTOR4(0, 0, 0, 0)); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0, 0, 0, 0))); ConfigureAtmo(); @@ -2312,7 +2312,7 @@ void D3D9Mesh::RenderFast(const LPD3DXMATRIX pW, int iTech) int nMeshLights = 0; D3DXVECTOR3 pos; - D3DXVec3TransformCoord(&pos, &D3DXVECTOR3f4(BBox.bs), pW); + D3DXVec3TransformCoord(&pos, ptr(D3DXVECTOR3f4(BBox.bs)), pW); // Find all local lights effecting this mesh ------------------------------------------ // @@ -2365,16 +2365,16 @@ void D3D9Mesh::RenderFast(const LPD3DXMATRIX pW, int iTech) if (displ == 3 && g != selgrp) continue; - FX->SetVector(eColor, &D3DXVECTOR4(0, 0, 0, 0)); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0, 0, 0, 0))); if (flags&DBG_FLAGS_HLMESH) { if (uCurrentMesh == selmsh) { - FX->SetVector(eColor, &D3DXVECTOR4(0.0f, 0.0f, 0.5f, 0.5f)); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0.0f, 0.0f, 0.5f, 0.5f))); } } if (flags&DBG_FLAGS_HLGROUP) { if (g == selgrp && uCurrentMesh == selmsh) { - FX->SetVector(eColor, &D3DXVECTOR4(0.0f, 0.5f, 0.0f, 0.5f)); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0.0f, 0.5f, 0.0f, 0.5f))); } } } @@ -2530,7 +2530,7 @@ void D3D9Mesh::RenderFast(const LPD3DXMATRIX pW, int iTech) HR(FX->End()); if (flags&(DBG_FLAGS_BOXES | DBG_FLAGS_SPHERES)) RenderBoundingBox(pW); - FX->SetVector(eColor, &D3DXVECTOR4(0, 0, 0, 0)); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0, 0, 0, 0))); if (flags&DBG_FLAGS_DUALSIDED) pDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); } @@ -2609,7 +2609,7 @@ void D3D9Mesh::RenderBaseTile(const LPD3DXMATRIX pW) FX->SetTechnique(eBaseTile); - FX->SetVector(eColor, &D3DXVECTOR4(0, 0, 0, 0)); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0, 0, 0, 0))); FX->SetMatrix(eGT, gc->GetIdentity()); FX->SetMatrix(eW, pW); @@ -2804,7 +2804,7 @@ void D3D9Mesh::RenderStencilShadows(float alpha, const LPD3DXMATRIX pP, const LP FX->SetTechnique(eShadowTech); if (elev) FX->SetVector(eInScatter, elev); - else FX->SetVector(eInScatter, &D3DXVECTOR4(0,1,0,0)); + else FX->SetVector(eInScatter, ptr(D3DXVECTOR4(0,1,0,0))); FX->SetFloat(eMix, alpha); FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE); @@ -2873,7 +2873,7 @@ void D3D9Mesh::RenderShadowsEx(float alpha, const LPD3DXMATRIX pP, const LPD3DXM FX->SetMatrix(eGT, pP); FX->SetFloat(eMix, alpha); if (light) FX->SetVector(eColor, light); - else FX->SetVector(eColor, &D3DXVECTOR4(0,1,0,0)); + else FX->SetVector(eColor, ptr(D3DXVECTOR4(0,1,0,0))); FX->SetVector(eTexOff, param); @@ -2966,7 +2966,7 @@ void D3D9Mesh::RenderBoundingBox(const LPD3DXMATRIX pW) // ---------------------------------------------------------------- FX->SetMatrix(eW, pW); - FX->SetVector(eColor, &D3DXVECTOR4(0, 1, 0, 0.5f)); + FX->SetVector(eColor, ptr(D3DXVECTOR4(0, 1, 0, 0.5f))); FX->SetTechnique(eBBTech); // ---------------------------------------------------------------- @@ -3007,11 +3007,11 @@ void D3D9Mesh::RenderBoundingBox(const LPD3DXMATRIX pW) for (DWORD g=0; gSetTechnique(eAxisTech)); @@ -3372,7 +3372,7 @@ void D3D9Mesh::RenderRings2(const LPD3DXMATRIX pW, LPDIRECT3DTEXTURE9 pTex, floa HR(FX->SetTexture(eTex0, pTex)); FX->SetValue(eSun, &sunLight, sizeof(D3D9Sun)); HR(FX->SetValue(eMtrl, &defmat, sizeof(D3D9MatExt)-4)); - HR(FX->SetVector(eTexOff, &D3DXVECTOR4(irad, orad, 0, 0))); + HR(FX->SetVector(eTexOff, ptr(D3DXVECTOR4(irad, orad, 0, 0)))); HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE)); HR(FX->BeginPass(0)); RenderGroup(0); diff --git a/OVP/D3D9Client/Mesh.h b/OVP/D3D9Client/Mesh.h index 7c9429104..c199f9e54 100644 --- a/OVP/D3D9Client/Mesh.h +++ b/OVP/D3D9Client/Mesh.h @@ -296,7 +296,7 @@ class D3D9Mesh : private D3D9Effect void RenderShadowsEx(float alpha, const LPD3DXMATRIX pP, const LPD3DXMATRIX pW, const D3DXVECTOR4 *light, const D3DXVECTOR4 *param); void RenderRings(const LPD3DXMATRIX pW, LPDIRECT3DTEXTURE9 pTex); void RenderRings2(const LPD3DXMATRIX pW, LPDIRECT3DTEXTURE9 pTex, float irad, float orad); - void RenderAxisVector(LPD3DXMATRIX pW, const LPD3DXCOLOR pColor, float len); + void RenderAxisVector(LPD3DXMATRIX pW, const D3DXCOLOR *pColor, float len); void RenderSimplified(const LPD3DXMATRIX pW, LPDIRECT3DCUBETEXTURE9 *pEnv = NULL, int nEnv = 0, bool bSP = false); void CheckMeshStatus(); void ResetTransformations(); diff --git a/OVP/D3D9Client/OapiExtension.cpp b/OVP/D3D9Client/OapiExtension.cpp index f6ea3ff32..84669640c 100644 --- a/OVP/D3D9Client/OapiExtension.cpp +++ b/OVP/D3D9Client/OapiExtension.cpp @@ -197,29 +197,29 @@ bool OapiExtension::GetConfigParameter(void) } } - if (oapiReadItem_string(f, "ElevationMode", string)) { + if (oapiReadItem_string(f, (char*)"ElevationMode", string)) { if (1 == sscanf_s(string, "%lu", &flags)) { elevationMode = flags; } } // Get planet rendering parameters - oapiReadItem_bool(f, "TileLoadThread", tileLoadThread); + oapiReadItem_bool(f, (char*)"TileLoadThread", tileLoadThread); // Get directory config - if (oapiReadItem_string(f, "ConfigDir", string)) { + if (oapiReadItem_string(f, (char*)"ConfigDir", string)) { configDir = string; } - if (oapiReadItem_string(f, "MeshDir", string)) { + if (oapiReadItem_string(f, (char*)"MeshDir", string)) { meshDir = string; } - if (oapiReadItem_string(f, "TextureDir", string)) { + if (oapiReadItem_string(f, (char*)"TextureDir", string)) { textureDir = string; } - if (oapiReadItem_string(f, "HightexDir", string)) { + if (oapiReadItem_string(f, (char*)"HightexDir", string)) { hightexDir = string; } - if (oapiReadItem_string(f, "ScenarioDir", string)) { + if (oapiReadItem_string(f, (char*)"ScenarioDir", string)) { scenarioDir = string; } @@ -234,16 +234,16 @@ bool OapiExtension::GetConfigParameter(void) oapiWriteLogV("%-11s: %s%s", name, buff, result); } }; - oapiWriteLog("---------------------------------------------------------------"); + oapiWriteLog((char*)"---------------------------------------------------------------"); logPath("BaseDir" , ".\\"); logPath("ConfigDir" , configDir); logPath("MeshDir" , meshDir); logPath("TextureDir" , textureDir); logPath("HightexDir" , hightexDir); logPath("ScenarioDir", scenarioDir); - oapiWriteLog("---------------------------------------------------------------"); + oapiWriteLog((char*)"---------------------------------------------------------------"); LogD3D9Modules(); - oapiWriteLog("---------------------------------------------------------------"); + oapiWriteLog((char*)"---------------------------------------------------------------"); } @@ -286,7 +286,8 @@ std::string OapiExtension::ScanCommandLine (void) size_t pos = rfind_ci(commandLine, "-s"); if (pos != std::string::npos) { - std::string scenarioName = trim( commandLine.substr(pos+2, std::string::npos) ); + std::string scenarioName = commandLine.substr(pos+2, std::string::npos); + trim(scenarioName); // Remove (optional) quotes std::replace(scenarioName.begin(), scenarioName.end(), '"', ' '); diff --git a/OVP/D3D9Client/RunwayLights.cpp b/OVP/D3D9Client/RunwayLights.cpp index b6efbc1fd..7689b2f1f 100644 --- a/OVP/D3D9Client/RunwayLights.cpp +++ b/OVP/D3D9Client/RunwayLights.cpp @@ -652,7 +652,7 @@ void RunwayLights::SetPAPIColors(BeaconArray *pPAPI, LPD3DXMATRIX world, int i) DWORD white = 0xFFFFEECC; D3DXVECTOR3 vPos, vUp, vFront; - D3DXVec3TransformNormal(&vUp, &D3DXVECTOR3(0,1,0), world); + D3DXVec3TransformNormal(&vUp, ptr(D3DXVECTOR3(0,1,0)), world); D3DXVECTOR3 vRef1 = pVrt[0].pos; D3DXVec3Normalize(&vFront, D3DXVec3TransformCoord(&vPos, &vRef1, world)); @@ -705,9 +705,9 @@ void RunwayLights::Render(LPDIRECT3DDEVICE9 dev, LPD3DXMATRIX world, bool night) VECTOR3 camDir = scene->GetCameraGDir(); D3DXVECTOR3 dirGlo; - D3DXVec3TransformNormal(&dirGlo, &D3DXVEC(dir), world); + D3DXVec3TransformNormal(&dirGlo, ptr(D3DXVEC(dir)), world); - if (D3DXVec3Dot(&D3DXVEC(camDir), &dirGlo) > 0) + if (D3DXVec3Dot(ptr(D3DXVEC(camDir)), &dirGlo) > 0) { if (night && beacons1) beacons1->Render(dev, world, currentTime); diff --git a/OVP/D3D9Client/Scene.cpp b/OVP/D3D9Client/Scene.cpp index e5832e6b4..b8edb212f 100644 --- a/OVP/D3D9Client/Scene.cpp +++ b/OVP/D3D9Client/Scene.cpp @@ -2185,7 +2185,7 @@ void Scene::RenderMainScene() if (pLocalResults) { pSketch = GetPooledSketchpad(SKETCHPAD_2D_OVERLAY); pSketch->SetBlendState(Sketchpad::BlendState::FILTER_POINT); - pSketch->StretchRectNative(pLocalResults, NULL, &_RECT(0, 0, viewW, 10)); + pSketch->StretchRectNative(pLocalResults, NULL, ptr(_RECT(0, 0, viewW, 10))); pSketch->SetBlendState(Sketchpad::BlendState::FILTER_LINEAR); pSketch->EndDrawing(); } @@ -2207,19 +2207,19 @@ void Scene::RenderMainScene() D3DSURFACE_DESC desc; if (pTab) { pTab->GetLevelDesc(0, &desc); - pSketch->StretchRectNative(pTab, NULL, &_R(0, y - desc.Height, desc.Width, y)); + pSketch->StretchRectNative(pTab, NULL, ptr(_R(0, y - desc.Height, desc.Width, y))); y -= (desc.Height + 5); } pTab = vP->GetScatterTable(MIE_LAND); if (pTab) { pTab->GetLevelDesc(0, &desc); - pSketch->StretchRectNative(pTab, NULL, &_R(0, y - desc.Height, desc.Width, y)); + pSketch->StretchRectNative(pTab, NULL, ptr(_R(0, y - desc.Height, desc.Width, y))); y -= (desc.Height + 5); } pTab = vP->GetScatterTable(ATN_LAND); if (pTab) { pTab->GetLevelDesc(0, &desc); - pSketch->StretchRectNative(pTab, NULL, &_R(0, y - desc.Height, desc.Width, y)); + pSketch->StretchRectNative(pTab, NULL, ptr(_R(0, y - desc.Height, desc.Width, y))); y -= (desc.Height + 5); } for (int i=0;i<9;i++) @@ -2335,7 +2335,7 @@ Scene::SUNVISPARAMS Scene::GetSunScreenVisualState() DWORD matIndex = pick.pMesh->GetMeshGroupMaterialIdx(pick.group); D3D9MatExt material; pick.pMesh->GetMaterial(&material, matIndex); - D3DXCOLOR surfCol = material.Diffuse; + D3DXCOLOR surfCol(material.Diffuse.x, material.Diffuse.y, material.Diffuse.z, material.Diffuse.w); result.visible = (surfCol.a != 1.0f); if (result.visible) @@ -2500,7 +2500,7 @@ int Scene::RenderShadowMap(D3DXVECTOR3 &pos, D3DXVECTOR3 &ld, float rad, bool bI D3DXVECTOR3 lp = pos + ld * smap.dist; - D3DXMatrixLookAtRH(&smap.mView, &lp, &pos, &D3DXVECTOR3(0, 1, 0)); + D3DXMatrixLookAtRH(&smap.mView, &lp, &pos, ptr(D3DXVECTOR3(0, 1, 0))); D3DXMatrixMultiply(&smap.mViewProj, &smap.mView, &smap.mProj); float lod = log2f(float(Config->ShadowMapSize) / (rsmax*1.5f)); @@ -2795,7 +2795,7 @@ bool Scene::IntegrateIrradiance(vVessel *vV, LPDIRECT3DCUBETEXTURE9 pSrc, LPDIRE // Pre-Integrate Irradiance Cube // pIrradiance->Activate("PSPreInteg"); - pIrradiance->SetFloat("fD", &D3DXVECTOR2(1.0f / float(desc.Width), 1.0f / float(desc.Height)), sizeof(D3DXVECTOR2)); + pIrradiance->SetFloat("fD", ptr(D3DXVECTOR2(1.0f / float(desc.Width), 1.0f / float(desc.Height))), sizeof(D3DXVECTOR2)); for (DWORD i = 0; i < 6; i++) { @@ -2854,7 +2854,7 @@ bool Scene::IntegrateIrradiance(vVessel *vV, LPDIRECT3DCUBETEXTURE9 pSrc, LPDIRE // Post Blur // pIrradiance->Activate("PSPostBlur"); - pIrradiance->SetFloat("fD", &D3DXVECTOR2(1.0f / float(desc_out.Width), 1.0f / float(desc_out.Height)), sizeof(D3DXVECTOR2)); + pIrradiance->SetFloat("fD", ptr(D3DXVECTOR2(1.0f / float(desc_out.Width), 1.0f / float(desc_out.Height))), sizeof(D3DXVECTOR2)); pIrradiance->SetOutputNative(0, pOuts); pIrradiance->SetTextureNative("tSrc", pIrradTemp3, IPF_POINT | IPF_WRAP); @@ -2964,7 +2964,7 @@ void Scene::RenderMesh(DEVMESHHANDLE hMesh, const oapi::FMATRIX4 *pWorld) if (shd->pShadowMap) { HR(D3D9Effect::FX->SetTexture(D3D9Effect::eShadowMap, shd->pShadowMap)); - HR(D3D9Effect::FX->SetVector(D3D9Effect::eSHD, &D3DXVECTOR4(sr, 1.0f / s, float(oapiRand()), 1.0f / shd->depth))); + HR(D3D9Effect::FX->SetVector(D3D9Effect::eSHD, ptr(D3DXVECTOR4(sr, 1.0f / s, float(oapiRand()), 1.0f / shd->depth)))); HR(D3D9Effect::FX->SetBool(D3D9Effect::eShadowToggle, true)); } else { @@ -3265,7 +3265,7 @@ D3D9Pick Scene::PickScene(short xpos, short ypos) D3D9Pick Scene::PickMesh(DEVMESHHANDLE hMesh, const LPD3DXMATRIX pW, short xpos, short ypos) { D3D9Mesh *pMesh = (D3D9Mesh *)hMesh; - return pMesh->Pick(pW, NULL, &GetPickingRay(xpos, ypos)); + return pMesh->Pick(pW, NULL, ptr(GetPickingRay(xpos, ypos))); } // =========================================================================================== @@ -3685,7 +3685,7 @@ void Scene::RenderGlares() // =========================================================================================== // -bool Scene::IsVisibleInCamera(D3DXVECTOR3 *pCnt, float radius) +bool Scene::IsVisibleInCamera(const D3DXVECTOR3 *pCnt, float radius) { float z = Camera.z.x*pCnt->x + Camera.z.y*pCnt->y + Camera.z.z*pCnt->z; if (z<(-radius)) return false; diff --git a/OVP/D3D9Client/Scene.h b/OVP/D3D9Client/Scene.h index 9482428f4..4635a487a 100644 --- a/OVP/D3D9Client/Scene.h +++ b/OVP/D3D9Client/Scene.h @@ -185,7 +185,7 @@ class Scene { void OnOptionChanged(int cat, int item); - const D3D9Sun *Scene::GetSun() const { return &sunLight; } + const D3D9Sun *GetSun() const { return &sunLight; } const D3D9Light *GetLight(int index) const; const D3D9Light *GetLights() const { return Lights; } DWORD GetLightCount() const { return nLights; } @@ -342,7 +342,7 @@ class Scene { bool CameraPan(VECTOR3 pan, double speed); // Check if a sphere located in pCnt (relative to cam) with a specified radius is visible in a camera - bool IsVisibleInCamera(D3DXVECTOR3 *pCnt, float radius); + bool IsVisibleInCamera(const D3DXVECTOR3 *pCnt, float radius); bool IsProxyMesh(); bool CameraDirection2Viewport(const VECTOR3 &dir, int &x, int &y); double GetTanAp() const { return tan(Camera.aperture); } diff --git a/OVP/D3D9Client/Spherepatch.cpp b/OVP/D3D9Client/Spherepatch.cpp index 44f929f87..20186ba27 100644 --- a/OVP/D3D9Client/Spherepatch.cpp +++ b/OVP/D3D9Client/Spherepatch.cpp @@ -66,7 +66,7 @@ VBMESH::~VBMESH () void VBMESH::ComputeSphere() { bsCnt = D3DXVECTOR3(float(Box[0].x + Box[7].x), float(Box[0].y + Box[7].y), float(Box[0].z + Box[7].z)) * 0.5f; - bsRad = D3DXVec3Length(&(D3DXVECTOR3(float(Box[0].x - Box[7].x), float(Box[0].y - Box[7].y), float(Box[0].z - Box[7].z)) * 0.5f)); + bsRad = D3DXVec3Length(ptr(D3DXVECTOR3(float(Box[0].x - Box[7].x), float(Box[0].y - Box[7].y), float(Box[0].z - Box[7].z)) * 0.5f)); } diff --git a/OVP/D3D9Client/SurfMgr.cpp b/OVP/D3D9Client/SurfMgr.cpp index 2e7b89821..395031ba1 100644 --- a/OVP/D3D9Client/SurfMgr.cpp +++ b/OVP/D3D9Client/SurfMgr.cpp @@ -92,9 +92,9 @@ void SurfaceManager::RenderSimple(int level, int npatch, TILEDESC *tile, LPD3DXM HR(FX->SetMatrix(eW, mWrld)); HR(FX->SetValue(eWater, &watermat, sizeof(D3DMATERIAL9))); HR(FX->SetValue(eMat, &def_mat, sizeof(D3DMATERIAL9))); - HR(FX->SetValue(eColor, &D3DXCOLOR(cAmbient), sizeof(D3DXCOLOR))); + HR(FX->SetValue(eColor, ptr(D3DXCOLOR(cAmbient)), sizeof(D3DXCOLOR))); HR(FX->SetFloat(eTime, float(fmod(oapiGetSimTime(),60.0)))); - HR(FX->SetVector(eTexOff, &D3DXVECTOR4(1.0f, 0.0f, 1.0f, 0.0f))); + HR(FX->SetVector(eTexOff, ptr(D3DXVECTOR4(1.0f, 0.0f, 1.0f, 0.0f)))); HR(FX->SetFloat(eMix, 0.0f)); LPDIRECT3DDEVICE9 pDev = gc->GetDevice(); @@ -148,7 +148,7 @@ void SurfaceManager::InitRenderTile() HR(FX->SetValue(eSun, gc->GetScene()->GetSun(), sizeof(D3D9Sun))); HR(FX->SetValue(eMat, &def_mat, sizeof(D3DMATERIAL9))); HR(FX->SetValue(eWater, &watermat, sizeof(D3DMATERIAL9))); - HR(FX->SetValue(eColor, &D3DXCOLOR(cAmbient), sizeof(D3DXCOLOR))); + HR(FX->SetValue(eColor, ptr(D3DXCOLOR(cAmbient)), sizeof(D3DXCOLOR))); HR(FX->SetFloat(eTime, float(fmod(oapiGetSimTime(),60.0)))); LPDIRECT3DDEVICE9 pDev = gc->GetDevice(); @@ -176,12 +176,12 @@ void SurfaceManager::RenderTile (int lvl, int hemisp, int ilat, int nlat, int il VBMESH &mesh = PATCH_TPL[lvl][ilat]; // patch template if (range.tumin == 0 && range.tumax == 1) { - HR(FX->SetVector(eTexOff, &D3DXVECTOR4(1.0f, 0.0f, 1.0f, 0.0f))); + HR(FX->SetVector(eTexOff, ptr(D3DXVECTOR4(1.0f, 0.0f, 1.0f, 0.0f)))); } else { float tuscale = range.tumax-range.tumin, tuofs = range.tumin; float tvscale = range.tvmax-range.tvmin, tvofs = range.tvmin; - HR(FX->SetVector(eTexOff, &D3DXVECTOR4(tuscale,tuofs,tvscale,tvofs))); + HR(FX->SetVector(eTexOff, ptr(D3DXVECTOR4(tuscale,tuofs,tvscale,tvofs)))); } DWORD flags = *(DWORD*)gc->GetConfigParam(CFGPRM_GETDEBUGFLAGS); @@ -190,13 +190,13 @@ void SurfaceManager::RenderTile (int lvl, int hemisp, int ilat, int nlat, int il if (flags&DBG_FLAGS_TILES) { float x = 0.6f; switch(lvl) { - case 14: FX->SetVector(eColor, &D3DXVECTOR4(x, 0, 0, 0)); break; - case 13: FX->SetVector(eColor, &D3DXVECTOR4(0, x, 0, 0)); break; - case 12: FX->SetVector(eColor, &D3DXVECTOR4(0, 0, x, 0)); break; - case 11: FX->SetVector(eColor, &D3DXVECTOR4(x, x, 0, 0)); break; - case 10: FX->SetVector(eColor, &D3DXVECTOR4(x, 0, x, 0)); break; - case 9: FX->SetVector(eColor, &D3DXVECTOR4(0, x, x, 0)); break; - default: FX->SetVector(eColor, &D3DXVECTOR4(0, 0, 0, 0)); break; + case 14: FX->SetVector(eColor, ptr(D3DXVECTOR4(x, 0, 0, 0))); break; + case 13: FX->SetVector(eColor, ptr(D3DXVECTOR4(0, x, 0, 0))); break; + case 12: FX->SetVector(eColor, ptr(D3DXVECTOR4(0, 0, x, 0))); break; + case 11: FX->SetVector(eColor, ptr(D3DXVECTOR4(x, x, 0, 0))); break; + case 10: FX->SetVector(eColor, ptr(D3DXVECTOR4(x, 0, x, 0))); break; + case 9: FX->SetVector(eColor, ptr(D3DXVECTOR4(0, x, x, 0))); break; + default: FX->SetVector(eColor, ptr(D3DXVECTOR4(0, 0, 0, 0))); break; } } } diff --git a/OVP/D3D9Client/TileLabel.cpp b/OVP/D3D9Client/TileLabel.cpp index 5d4f1c80d..bd9f85976 100644 --- a/OVP/D3D9Client/TileLabel.cpp +++ b/OVP/D3D9Client/TileLabel.cpp @@ -8,6 +8,7 @@ #include "TileLabel.h" #include +#include #include TileLabel *TileLabel::Create (const SurfTile *stile) @@ -66,7 +67,7 @@ TileLabel::~TileLabel () // --------------------------------------------------------------------------- static int _wbufferSize = 0; -static std::auto_ptr _wbuffer; // this should get destroyed @ shutdown +static std::unique_ptr _wbuffer; // this should get destroyed @ shutdown static LPWSTR GetWBuffer (const std::string &name, int *_len, int _stopLen = -1) { diff --git a/OVP/D3D9Client/Tilemgr2.cpp b/OVP/D3D9Client/Tilemgr2.cpp index f3b7296c5..6818d7ddd 100644 --- a/OVP/D3D9Client/Tilemgr2.cpp +++ b/OVP/D3D9Client/Tilemgr2.cpp @@ -315,7 +315,7 @@ bool Tile::Pick(const LPD3DXMATRIX pW, const D3DXVECTOR3 *vDir, TILEPICK &result VERTEX_2TEX *vtx = mesh->vtx; D3DXMatrixInverse(&mWI, &det, pW); - D3DXVec3TransformCoord(&pos, &D3DXVECTOR3(0, 0, 0), &mWI); + D3DXVec3TransformCoord(&pos, ptr(D3DXVECTOR3(0, 0, 0)), &mWI); D3DXVec3TransformNormal(&dir, vDir, &mWI); int idx = -1; @@ -332,7 +332,7 @@ bool Tile::Pick(const LPD3DXMATRIX pW, const D3DXVECTOR3 *vDir, TILEPICK &result float u, v, dst; - D3DXVec3Cross(&cp, &(_c - _b), &(_a - _b)); + D3DXVec3Cross(&cp, ptr(_c - _b), ptr(_a - _b)); if (D3DXVec3Dot(&cp, &dir)<0) { if (D3DXIntersectTri(&_c, &_b, &_a, &pos, &dir, &u, &v, &dst)) { @@ -364,7 +364,7 @@ bool Tile::Pick(const LPD3DXMATRIX pW, const D3DXVECTOR3 *vDir, TILEPICK &result _b = D3DXVECTOR3(vtx[b].x, vtx[b].y, vtx[b].z); _c = D3DXVECTOR3(vtx[c].x, vtx[c].y, vtx[c].z); - D3DXVec3Cross(&cp, &(_c - _b), &(_a - _b)); + D3DXVec3Cross(&cp, ptr(_c - _b), ptr(_a - _b)); D3DXVec3TransformNormal(&cp, &cp, pW); D3DXVec3Normalize(&result._n, &cp); diff --git a/OVP/D3D9Client/VBase.cpp b/OVP/D3D9Client/VBase.cpp index d6c5efb1a..a748e7a12 100644 --- a/OVP/D3D9Client/VBase.cpp +++ b/OVP/D3D9Client/VBase.cpp @@ -44,7 +44,7 @@ void CheckMeshStats(MESHHANDLE hMesh, MeshStats *stats) int nGrp = oapiMeshGroupCount(hMesh); if (nGrp == 0) return; - XMVECTOR mi = XMLoadFloat3(&XMFLOAT3(1e12f, 1e12f, 1e12f)); + XMVECTOR mi = XMLoadFloat3(ptr(XMFLOAT3(1e12f, 1e12f, 1e12f))); XMVECTOR mx = -mi; for (int i = 0; i < nGrp; i++) { @@ -65,7 +65,7 @@ void CheckMeshStats(MESHHANDLE hMesh, MeshStats *stats) stats->height = stats->max.y - stats->min.y; stats->length = stats->max.z - stats->min.z; stats->pos = (stats->max + stats->min) * 0.5f; - stats->rad = D3DXVec3Length(&(stats->max + stats->min)) * 0.5f; + stats->rad = D3DXVec3Length(ptr(stats->max + stats->min)) * 0.5f; } @@ -460,7 +460,7 @@ void vBase::RenderRunwayLights(LPDIRECT3DDEVICE9 dev) if (flags&DBG_FLAGS_SELVISONLY && this!=DebugControls::GetVisual()) return; // Used for debugging if (flags&DBG_FLAGS_BOXES) { D3DXMATRIX id; - D3D9Effect::RenderBoundingBox(&mWorld, D3DXMatrixIdentity(&id), &BBox.min, &BBox.max, &D3DXVECTOR4(1,0,1,0.75f)); + D3D9Effect::RenderBoundingBox(&mWorld, D3DXMatrixIdentity(&id), &BBox.min, &BBox.max, ptr(D3DXVECTOR4(1,0,1,0.75f))); } } } diff --git a/OVP/D3D9Client/VObject.cpp b/OVP/D3D9Client/VObject.cpp index 2e66f6389..ebbf6c569 100644 --- a/OVP/D3D9Client/VObject.cpp +++ b/OVP/D3D9Client/VObject.cpp @@ -94,7 +94,7 @@ vObject *vObject::Create(OBJHANDLE _hObj, const Scene *scene) void vObject::GlobalInit(D3D9Client *gclient) { _TRACE; - static char *fname[3] = {"Ball.dds","Ball2.dds","Ball3.dds"}; + static const char *fname[3] = {"Ball.dds","Ball2.dds","Ball3.dds"}; gc = gclient; for (int i=0;i<3;i++) blobtex[i] = SURFACE(gc->clbkLoadTexture(fname[i])); @@ -258,7 +258,7 @@ bool vObject::IsVisible() if ((objtp == OBJTP_VESSEL) && apprad < 0.005*apr) return false; if ((objtp == OBJTP_SURFBASE) && apprad < 0.02*apr) return false; - return gc->GetScene()->IsVisibleInCamera(&D3DXVEC(pos), rad); + return gc->GetScene()->IsVisibleInCamera(ptr(D3DXVEC(pos)), rad); /* if (bVis) { @@ -360,24 +360,24 @@ void vObject::RenderVectors (LPDIRECT3DDEVICE9 dev, D3D9Pad* pSkp) //scale *= 0.99f; // 1% "slimmer" to avoid z-fighting with force vector(s) float ascale = float(size) * sclset * 0.5f; - RenderAxisVector(pSkp, &D3DXCOLOR(1, 0, 0, alpha), _V(1, 0, 0), ascale, scale); - RenderAxisLabel(pSkp, &D3DXCOLOR(1, 0, 0, alpha), _V(1, 0, 0), ascale, scale, "+X"); + RenderAxisVector(pSkp, ptr(D3DXCOLOR(1, 0, 0, alpha)), _V(1, 0, 0), ascale, scale); + RenderAxisLabel(pSkp, ptr(D3DXCOLOR(1, 0, 0, alpha)), _V(1, 0, 0), ascale, scale, "+X"); - RenderAxisVector(pSkp, &D3DXCOLOR(0, 1, 0, alpha), _V(0, 1, 0), ascale, scale); - RenderAxisLabel(pSkp, &D3DXCOLOR(0, 1, 0, alpha), _V(0, 1, 0), ascale, scale, "+Y"); + RenderAxisVector(pSkp, ptr(D3DXCOLOR(0, 1, 0, alpha)), _V(0, 1, 0), ascale, scale); + RenderAxisLabel(pSkp, ptr(D3DXCOLOR(0, 1, 0, alpha)), _V(0, 1, 0), ascale, scale, "+Y"); - RenderAxisVector(pSkp, &D3DXCOLOR(0, 0, 1, alpha), _V(0, 0, 1), ascale, scale); - RenderAxisLabel(pSkp, &D3DXCOLOR(0, 0, 1, alpha), _V(0, 0, 1), ascale, scale, "+Z"); + RenderAxisVector(pSkp, ptr(D3DXCOLOR(0, 0, 1, alpha)), _V(0, 0, 1), ascale, scale); + RenderAxisLabel(pSkp, ptr(D3DXCOLOR(0, 0, 1, alpha)), _V(0, 0, 1), ascale, scale, "+Z"); if (favmode & FAV_NEGATIVE) { - RenderAxisVector(pSkp, &D3DXCOLOR(1, 0, 0, alpha * 0.5f), _V(-1, 0, 0), ascale, scale); - RenderAxisLabel(pSkp, &D3DXCOLOR(1, 0, 0, alpha), _V(-1, 0, 0), ascale, scale, "-X"); + RenderAxisVector(pSkp, ptr(D3DXCOLOR(1, 0, 0, alpha * 0.5f)), _V(-1, 0, 0), ascale, scale); + RenderAxisLabel(pSkp, ptr(D3DXCOLOR(1, 0, 0, alpha)), _V(-1, 0, 0), ascale, scale, "-X"); - RenderAxisVector(pSkp, &D3DXCOLOR(0, 1, 0, alpha * 0.5f), _V(0, -1, 0), ascale, scale); - RenderAxisLabel(pSkp, &D3DXCOLOR(0, 1, 0, alpha), _V(0, -1, 0), ascale, scale, "-Y"); + RenderAxisVector(pSkp, ptr(D3DXCOLOR(0, 1, 0, alpha * 0.5f)), _V(0, -1, 0), ascale, scale); + RenderAxisLabel(pSkp, ptr(D3DXCOLOR(0, 1, 0, alpha)), _V(0, -1, 0), ascale, scale, "-Y"); - RenderAxisVector(pSkp, &D3DXCOLOR(0, 0, 1, alpha * 0.5f), _V(0, 0, -1), ascale, scale); - RenderAxisLabel(pSkp, &D3DXCOLOR(0, 0, 1, alpha), _V(0, 0, -1), ascale, scale, "-Z"); + RenderAxisVector(pSkp, ptr(D3DXCOLOR(0, 0, 1, alpha * 0.5f)), _V(0, 0, -1), ascale, scale); + RenderAxisLabel(pSkp, ptr(D3DXCOLOR(0, 0, 1, alpha)), _V(0, 0, -1), ascale, scale, "-Z"); } } } @@ -387,7 +387,7 @@ void vObject::RenderVectors (LPDIRECT3DDEVICE9 dev, D3D9Pad* pSkp) // =========================================================================================== // -void vObject::RenderAxisVector(D3D9Pad *pSkp, LPD3DXCOLOR pColor, VECTOR3 vector, float lscale, float size, bool bLog) +void vObject::RenderAxisVector(D3D9Pad *pSkp, const D3DXCOLOR *pColor, VECTOR3 vector, float lscale, float size, bool bLog) { D3DXMATRIX W; @@ -422,7 +422,7 @@ void vObject::RenderAxisVector(D3D9Pad *pSkp, LPD3DXCOLOR pColor, VECTOR3 vector // =========================================================================================== // -void vObject::RenderAxisLabel(D3D9Pad *pSkp, LPD3DXCOLOR clr, VECTOR3 vector, float lscale, float size, const char *label, bool bLog) +void vObject::RenderAxisLabel(D3D9Pad *pSkp, const D3DXCOLOR *clr, VECTOR3 vector, float lscale, float size, const char *label, bool bLog) { D3DXVECTOR3 homog, ws; D3DXMATRIX W; @@ -452,7 +452,7 @@ void vObject::RenderAxisLabel(D3D9Pad *pSkp, LPD3DXCOLOR clr, VECTOR3 vector, fl if (bLog) len = max(0.0f, 13.0f + log(len)) * lscale / size; else len = len * lscale / size; - D3DXVec3TransformCoord(&ws, &D3DXVECTOR3(0, len, 0), &W); + D3DXVec3TransformCoord(&ws, ptr(D3DXVECTOR3(0, len, 0)), &W); D3DXVec3TransformCoord(&homog, &ws, scn->GetProjectionViewMatrix()); if (D3DXVec3Dot(&ws, scn->GetCameraZ()) < 0) return; diff --git a/OVP/D3D9Client/VObject.h b/OVP/D3D9Client/VObject.h index e54b530c4..c5a438439 100644 --- a/OVP/D3D9Client/VObject.h +++ b/OVP/D3D9Client/VObject.h @@ -240,8 +240,8 @@ class vObject: public oapi::VisObject { protected: void RenderSpot(LPDIRECT3DDEVICE9 dev, const VECTOR3 *ofs, float size, const VECTOR3 &col, bool lighting, int shape); - void RenderAxisVector(D3D9Pad *pSkp, LPD3DXCOLOR pColor, VECTOR3 vector, float lscale, float size, bool bLog=false); - void RenderAxisLabel(D3D9Pad *pSkp, LPD3DXCOLOR clr, VECTOR3 vector, float lscale, float size, const char *label, bool bLog=false); + void RenderAxisVector(D3D9Pad *pSkp, const D3DXCOLOR *pColor, VECTOR3 vector, float lscale, float size, bool bLog=false); + void RenderAxisLabel(D3D9Pad *pSkp, const D3DXCOLOR *clr, VECTOR3 vector, float lscale, float size, const char *label, bool bLog=false); static oapi::D3D9Client *gc; // graphics client instance pointer diff --git a/OVP/D3D9Client/VPlanet.cpp b/OVP/D3D9Client/VPlanet.cpp index 761d91f6b..693a0ee62 100644 --- a/OVP/D3D9Client/VPlanet.cpp +++ b/OVP/D3D9Client/VPlanet.cpp @@ -930,7 +930,7 @@ bool vPlanet::Render(LPDIRECT3DDEVICE9 dev) float qw = 1.0f / float(Config->ShadowMapSize); HR(D3D9Effect::FX->SetMatrix(D3D9Effect::eLVP, &shd->mViewProj)); HR(D3D9Effect::FX->SetTexture(D3D9Effect::eShadowMap, shd->pShadowMap)); - HR(D3D9Effect::FX->SetVector(D3D9Effect::eSHD, &D3DXVECTOR4(s, is, qw, 0))); + HR(D3D9Effect::FX->SetVector(D3D9Effect::eSHD, ptr(D3DXVECTOR4(s, is, qw, 0)))); HR(D3D9Effect::FX->SetBool(D3D9Effect::eShadowToggle, true)); } } diff --git a/OVP/D3D9Client/VPlanetAtmo.cpp b/OVP/D3D9Client/VPlanetAtmo.cpp index 85a604b10..daa37e727 100644 --- a/OVP/D3D9Client/VPlanetAtmo.cpp +++ b/OVP/D3D9Client/VPlanetAtmo.cpp @@ -91,7 +91,7 @@ void vPlanet::GlobalInitAtmosphere(oapi::D3D9Client* gc) pIP->CompileShader("LandViewAtten"); if (!pIP->IsOK()) { - oapiWriteLog("InitializeScatteringEx() FAILED"); + oapiWriteLog((char*)"InitializeScatteringEx() FAILED"); return; } @@ -197,8 +197,8 @@ FVECTOR2 vPlanet::Gauss7(float cos_dir, float r0, float dist, FVECTOR2 ih0) float ray = 0.0f; float mie = 0.0f; for (int i = 0; i < 7; i++) { - ray += exp(-clamp(a[i] * ih0.x, -20.0f, 20.0f)) * w[i]; - mie += exp(-clamp(a[i] * ih0.y, -20.0f, 20.0f)) * w[i]; + ray += exp(-::clamp(a[i] * ih0.x, -20.0f, 20.0f)) * w[i]; + mie += exp(-::clamp(a[i] * ih0.y, -20.0f, 20.0f)) * w[i]; } return FVECTOR2(ray, mie) * 0.5f * dist; } @@ -223,8 +223,8 @@ FVECTOR2 vPlanet::Gauss4(float cos_dir, float r0, float dist, FVECTOR2 ih0) float ray = 0.0f; float mie = 0.0f; for (int i = 0; i < 4; i++) { - ray += exp(-clamp(a[i] * ih0.x, -20.0f, 20.0f)) * w[i]; - mie += exp(-clamp(a[i] * ih0.y, -20.0f, 20.0f)) * w[i]; + ray += exp(-::clamp(a[i] * ih0.x, -20.0f, 20.0f)) * w[i]; + mie += exp(-::clamp(a[i] * ih0.y, -20.0f, 20.0f)) * w[i]; } return FVECTOR2(ray, mie) * 0.5f * dist; } @@ -454,7 +454,7 @@ FVECTOR4 vPlanet::SunLightColor(VECTOR3 relpos, double rf) if (r > ar) rm = Gauss7(qr - size, 0.0f, cp.PlanetRad, cp.AtmoRad, cp.iH) * 2.0f; // Ray passes through atmosphere from space to space else rm = Gauss7(r - size, -ca, cp.PlanetRad, cp.AtmoRad, cp.iH); // Sample point 'pos' lies with-in atmosphere - rm *= cp.rmO * rf; + rm = rm * (cp.rmO * rf); return FVECTOR4(exp(-(cp.RayWave * rm.x + cp.MieWave * rm.y)) * svb, svb); } @@ -959,8 +959,8 @@ bool vPlanet::LoadAtmoConfig() LogAlw("Loading Atmospheric Configuration file [%s] Handle=%s", path, _PTR(hFile)); - if (oapiReadItem_string(hFile, "Shader", ShaderName) == false) strcpy_s(ShaderName, 32, "Auto"); - if (oapiReadItem_string(hFile, "ConfigName", AtmoConfigName) == false) strcpy_s(AtmoConfigName, 32, "Custom"); + if (oapiReadItem_string(hFile, (char*)"Shader", ShaderName) == false) strcpy_s(ShaderName, 32, "Auto"); + if (oapiReadItem_string(hFile, (char*)"ConfigName", AtmoConfigName) == false) strcpy_s(AtmoConfigName, 32, "Custom"); LoadStruct(hFile, &SPrm, 0); LoadStruct(hFile, &OPrm, 1); @@ -1023,14 +1023,14 @@ void vPlanet::LoadStruct(FILEHANDLE hFile, ScatterParams* prm, int iCnf) { VECTOR3 v3; iConfig = iCnf; - oapiReadItem_float(hFile, "OrbitAlt", prm->orbalt); - oapiReadItem_float(hFile, "AtmoVisualAlt", prm->visalt); - oapiReadItem_float(hFile, "Red", prm->red); - oapiReadItem_float(hFile, "Blue", prm->blue); - oapiReadItem_float(hFile, "SunI", prm->suni); - oapiReadItem_vec(hFile, "zcolor", v3); prm->zcolor = v3; - oapiReadItem_vec(hFile, "hcolor", v3); prm->hcolor = v3; - oapiReadItem_vec(hFile, "acolor", v3); prm->acolor = v3; + oapiReadItem_float(hFile, (char*)"OrbitAlt", prm->orbalt); + oapiReadItem_float(hFile, (char*)"AtmoVisualAlt", prm->visalt); + oapiReadItem_float(hFile, (char*)"Red", prm->red); + oapiReadItem_float(hFile, (char*)"Blue", prm->blue); + oapiReadItem_float(hFile, (char*)"SunI", prm->suni); + oapiReadItem_vec(hFile, (char*)"zcolor", v3); prm->zcolor = v3; + oapiReadItem_vec(hFile, (char*)"hcolor", v3); prm->hcolor = v3; + oapiReadItem_vec(hFile, (char*)"acolor", v3); prm->acolor = v3; // ----------------------------------------------------------------- @@ -1082,18 +1082,18 @@ void vPlanet::SaveAtmoConfig() FILEHANDLE hFile = oapiOpenFile(path, FILE_OUT, CONFIG); - oapiWriteItem_string(hFile, ";", "Shader(s) = [Earth, Mars, Moon, Giant, Auto]"); - oapiWriteItem_string(hFile, "Shader", ShaderName); - oapiWriteItem_string(hFile, "Planet", name); - oapiWriteItem_string(hFile, "ConfigName", AtmoConfigName); - oapiWriteItem_float(hFile, "OrbitAlt", SPrm.orbalt); - oapiWriteItem_float(hFile, "AtmoVisualAlt", SPrm.visalt); - oapiWriteItem_float(hFile, "Red", SPrm.red); - oapiWriteItem_float(hFile, "Blue", SPrm.blue); - oapiWriteItem_float(hFile, "SunI", SPrm.suni); - oapiWriteItem_vec(hFile, "zcolor", SPrm.zcolor._V()); - oapiWriteItem_vec(hFile, "hcolor", SPrm.hcolor._V()); - oapiWriteItem_vec(hFile, "acolor", SPrm.acolor._V()); + oapiWriteItem_string(hFile, (char*)";", (char*)"Shader(s) = [Earth, Mars, Moon, Giant, Auto]"); + oapiWriteItem_string(hFile, (char*)"Shader", ShaderName); + oapiWriteItem_string(hFile, (char*)"Planet", name); + oapiWriteItem_string(hFile, (char*)"ConfigName", AtmoConfigName); + oapiWriteItem_float(hFile, (char*)"OrbitAlt", SPrm.orbalt); + oapiWriteItem_float(hFile, (char*)"AtmoVisualAlt", SPrm.visalt); + oapiWriteItem_float(hFile, (char*)"Red", SPrm.red); + oapiWriteItem_float(hFile, (char*)"Blue", SPrm.blue); + oapiWriteItem_float(hFile, (char*)"SunI", SPrm.suni); + oapiWriteItem_vec(hFile, (char*)"zcolor", SPrm.zcolor._V()); + oapiWriteItem_vec(hFile, (char*)"hcolor", SPrm.hcolor._V()); + oapiWriteItem_vec(hFile, (char*)"acolor", SPrm.acolor._V()); SaveStruct(hFile, &SPrm, 0); SaveStruct(hFile, &OPrm, 1); diff --git a/OVP/D3D9Client/VVessel.cpp b/OVP/D3D9Client/VVessel.cpp index c460b2293..25361aa44 100644 --- a/OVP/D3D9Client/VVessel.cpp +++ b/OVP/D3D9Client/VVessel.cpp @@ -590,7 +590,7 @@ bool vVessel::IsInsideShadows() { D3DXVECTOR3 bc; const Scene::SHADOWMAPPARAM *shd = scn->GetSMapData(); - D3DXVec3TransformCoord(&bc, &D3DXVECTOR3f4(BBox.bs), &mWorld); + D3DXVec3TransformCoord(&bc, ptr(D3DXVECTOR3f4(BBox.bs)), &mWorld); bc = bc - shd->pos; float x = D3DXVec3Dot(&bc, &(shd->ld)); @@ -606,7 +606,7 @@ bool vVessel::IntersectShadowVolume() { D3DXVECTOR3 bc; const Scene::SHADOWMAPPARAM *shd = scn->GetSMapData(); - D3DXVec3TransformCoord(&bc, &D3DXVECTOR3f4(BBox.bs), &mWorld); + D3DXVec3TransformCoord(&bc, ptr(D3DXVECTOR3f4(BBox.bs)), &mWorld); bc = bc - shd->pos; float x = D3DXVec3Dot(&bc, &(shd->ld)); if (sqrt(D3DXVec3Dot(&bc, &bc) - x*x) > (shd->rad + BBox.bs.w)) return false; @@ -620,7 +620,7 @@ bool vVessel::IntersectShadowTarget() { D3DXVECTOR3 bc; const Scene::SHADOWMAPPARAM *shd = scn->GetSMapData(); - D3DXVec3TransformCoord(&bc, &D3DXVECTOR3f4(BBox.bs), &mWorld); + D3DXVec3TransformCoord(&bc, ptr(D3DXVECTOR3f4(BBox.bs)), &mWorld); bc = bc - shd->pos; if (D3DXVec3Length(&bc) < (shd->rad + BBox.bs.w)) return true; return false; @@ -633,7 +633,7 @@ void vVessel::GetMinMaxLightDist(float *mind, float *maxd) { D3DXVECTOR3 bc; const Scene::SHADOWMAPPARAM *shd = scn->GetSMapData(); - D3DXVec3TransformCoord(&bc, &D3DXVECTOR3f4(BBox.bs), &mWorld); + D3DXVec3TransformCoord(&bc, ptr(D3DXVECTOR3f4(BBox.bs)), &mWorld); bc -= shd->pos; float x = D3DXVec3Dot(&bc, &(shd->ld)); *mind = min(*mind, x - shd->rad); @@ -702,7 +702,7 @@ bool vVessel::Render(LPDIRECT3DDEVICE9 dev, bool internalpass) if (shd->pShadowMap && (scn->GetRenderPass() == RENDERPASS_MAINSCENE)) { HR(D3D9Effect::FX->SetTexture(D3D9Effect::eShadowMap, shd->pShadowMap)); - HR(D3D9Effect::FX->SetVector(D3D9Effect::eSHD, &D3DXVECTOR4(sr, 1.0f / s, float(oapiRand()), 1.0f / shd->depth))); + HR(D3D9Effect::FX->SetVector(D3D9Effect::eSHD, ptr(D3DXVECTOR4(sr, 1.0f / s, float(oapiRand()), 1.0f / shd->depth)))); HR(D3D9Effect::FX->SetBool(D3D9Effect::eShadowToggle, true)); } else { @@ -815,7 +815,7 @@ bool vVessel::Render(LPDIRECT3DDEVICE9 dev, bool internalpass) if (flags&DBG_FLAGS_SELVISONLY && this != DebugControls::GetVisual()) return true; if (flags&DBG_FLAGS_BOXES && !internalpass) { D3DXMATRIX id; - D3D9Effect::RenderBoundingBox(&mWorld, D3DXMatrixIdentity(&id), &BBox.min, &BBox.max, &D3DXVECTOR4(1, 0, 0, 0.75f)); + D3D9Effect::RenderBoundingBox(&mWorld, D3DXMatrixIdentity(&id), &BBox.min, &BBox.max, ptr(D3DXVECTOR4(1, 0, 0, 0.75f))); } RenderLightCone(&mWorld); @@ -874,54 +874,54 @@ void vVessel::RenderVectors (LPDIRECT3DDEVICE9 dev, D3D9Pad *pSkp) if (bfvmode & BFV_DRAG) { vessel->GetDragVector(vector); if (length(vector) > threshold) { - RenderAxisVector(pSkp, &D3DXCOLOR(1,0,0,alpha), vector, lscale, scale, bLog); + RenderAxisVector(pSkp, ptr(D3DXCOLOR(1,0,0,alpha)), vector, lscale, scale, bLog); sprintf_s(label, 64, "D = %sN", value_string(length(vector))); - RenderAxisLabel(pSkp, &D3DXCOLOR(1,0,0,alpha), vector, lscale, scale, label, bLog); + RenderAxisLabel(pSkp, ptr(D3DXCOLOR(1,0,0,alpha)), vector, lscale, scale, label, bLog); } } if (bfvmode & BFV_WEIGHT) { vessel->GetWeightVector(vector); if (length(vector) > threshold) { - RenderAxisVector(pSkp, &D3DXCOLOR(1,1,0,alpha), vector, lscale, scale, bLog); + RenderAxisVector(pSkp, ptr(D3DXCOLOR(1,1,0,alpha)), vector, lscale, scale, bLog); sprintf_s(label, 64, "G = %sN", value_string(length(vector))); - RenderAxisLabel(pSkp, &D3DXCOLOR(1,1,0,alpha), vector, lscale, scale, label, bLog); + RenderAxisLabel(pSkp, ptr(D3DXCOLOR(1,1,0,alpha)), vector, lscale, scale, label, bLog); } } if (bfvmode & BFV_THRUST) { vessel->GetThrustVector(vector); if (length(vector) > threshold) { - RenderAxisVector(pSkp, &D3DXCOLOR(0,0,1,alpha), vector, lscale, scale, bLog); + RenderAxisVector(pSkp, ptr(D3DXCOLOR(0,0,1,alpha)), vector, lscale, scale, bLog); sprintf_s(label, 64, "T = %sN", value_string(length(vector))); - RenderAxisLabel(pSkp, &D3DXCOLOR(0,0,1,alpha), vector, lscale, scale, label, bLog); + RenderAxisLabel(pSkp, ptr(D3DXCOLOR(0,0,1,alpha)), vector, lscale, scale, label, bLog); } } if (bfvmode & BFV_LIFT) { vessel->GetLiftVector(vector); if (length(vector) > threshold) { - RenderAxisVector(pSkp, &D3DXCOLOR(0,1,0,alpha), vector, lscale, scale, bLog); + RenderAxisVector(pSkp, ptr(D3DXCOLOR(0,1,0,alpha)), vector, lscale, scale, bLog); sprintf_s(label, 64, "L = %sN", value_string(length(vector))); - RenderAxisLabel(pSkp, &D3DXCOLOR(0,1,0,alpha), vector, lscale, scale, label, bLog); + RenderAxisLabel(pSkp, ptr(D3DXCOLOR(0,1,0,alpha)), vector, lscale, scale, label, bLog); } } if (bfvmode & BFV_TOTAL) { vessel->GetForceVector(vector); if (length(vector) > threshold) { - RenderAxisVector(pSkp, &D3DXCOLOR(1,1,1,alpha), vector, lscale, scale, bLog); + RenderAxisVector(pSkp, ptr(D3DXCOLOR(1,1,1,alpha)), vector, lscale, scale, bLog); sprintf_s(label, 64, "F = %sN", value_string(length(vector))); - RenderAxisLabel(pSkp, &D3DXCOLOR(1,1,1,alpha), vector, lscale, scale, label, bLog); + RenderAxisLabel(pSkp, ptr(D3DXCOLOR(1,1,1,alpha)), vector, lscale, scale, label, bLog); } } if (bfvmode & BFV_TORQUE) { vessel->GetTorqueVector(vector); if (length(vector) > threshold) { - RenderAxisVector(pSkp, &D3DXCOLOR(1,0,1,alpha), vector, lscale, scale, bLog); + RenderAxisVector(pSkp, ptr(D3DXCOLOR(1,0,1,alpha)), vector, lscale, scale, bLog); sprintf_s(label, 64, "M = %sNm", value_string(length(vector))); - RenderAxisLabel(pSkp, &D3DXCOLOR(1,0,1,alpha), vector, lscale, scale, label, bLog); + RenderAxisLabel(pSkp, ptr(D3DXCOLOR(1,0,1,alpha)), vector, lscale, scale, label, bLog); } } } @@ -1010,7 +1010,7 @@ void vVessel::RenderGrapplePoints (LPDIRECT3DDEVICE9 dev) { hAtt = vessel->GetAttachmentHandle(true, i); vessel->GetAttachmentParams(hAtt, pos, dir, rot); - D3D9Effect::RenderArrow(hVessel, &pos, &dir, &rot, size, &D3DXCOLOR(1,0,0,alpha)); + D3D9Effect::RenderArrow(hVessel, &pos, &dir, &rot, size, ptr(D3DXCOLOR(1,0,0,alpha))); } // attachment points to children @@ -1018,7 +1018,7 @@ void vVessel::RenderGrapplePoints (LPDIRECT3DDEVICE9 dev) { hAtt = vessel->GetAttachmentHandle(false, i); vessel->GetAttachmentParams(hAtt, pos, dir, rot); - D3D9Effect::RenderArrow(hVessel, &pos, &dir, &rot, size, &D3DXCOLOR(0,0.5,1,alpha)); + D3D9Effect::RenderArrow(hVessel, &pos, &dir, &rot, size, ptr(D3DXCOLOR(0,0.5,1,alpha))); } } @@ -1884,8 +1884,8 @@ int vVessel::GetMatrixTransform(gcCore::MatrixId func, DWORD mi, DWORD gi, FMATR if (pMesh == NULL) return -2; if (gi >= pMesh->GetGroupCount()) return -3; - if (func == gcCore::MatrixId::MESH) memcpy_s(pMat, sizeof(FMATRIX4), &(pMesh->GetTransform(-1, false)), sizeof(D3DXMATRIX)); - if (func == gcCore::MatrixId::GROUP) memcpy_s(pMat, sizeof(FMATRIX4), &(pMesh->GetTransform(gi, false)), sizeof(D3DXMATRIX)); + if (func == gcCore::MatrixId::MESH) memcpy_s(pMat, sizeof(FMATRIX4), ptr(pMesh->GetTransform(-1, false)), sizeof(D3DXMATRIX)); + if (func == gcCore::MatrixId::GROUP) memcpy_s(pMat, sizeof(FMATRIX4), ptr(pMesh->GetTransform(gi, false)), sizeof(D3DXMATRIX)); if (func == gcCore::MatrixId::OFFSET) { if (meshlist[mi].trans) memcpy_s(pMat, sizeof(FMATRIX4), meshlist[mi].trans, sizeof(D3DXMATRIX)); diff --git a/OVP/D3D9Client/VideoTab.cpp b/OVP/D3D9Client/VideoTab.cpp index 6a850e5af..02a30c18b 100644 --- a/OVP/D3D9Client/VideoTab.cpp +++ b/OVP/D3D9Client/VideoTab.cpp @@ -1085,8 +1085,8 @@ bool VideoTab::GetConfigName(const char* file, string& cfg, string& planet) FILEHANDLE hFile = oapiOpenFile(filename.c_str(), FILE_IN_ZEROONFAIL, CONFIG); if (hFile) { char ConfigName[32] = {}; char PlanetName[32] = {}; - bool bA = oapiReadItem_string(hFile, "ConfigName", ConfigName); - bool bB = oapiReadItem_string(hFile, "Planet", PlanetName); + bool bA = oapiReadItem_string(hFile, (char*)"ConfigName", ConfigName); + bool bB = oapiReadItem_string(hFile, (char*)"Planet", PlanetName); oapiCloseFile(hFile, FILE_IN_ZEROONFAIL); cfg = string(ConfigName); planet = string(PlanetName); diff --git a/OVP/D3D9Client/WindowMgr.cpp b/OVP/D3D9Client/WindowMgr.cpp index f2eacd7c3..60449ff02 100644 --- a/OVP/D3D9Client/WindowMgr.cpp +++ b/OVP/D3D9Client/WindowMgr.cpp @@ -620,7 +620,7 @@ WindowManager::~WindowManager() { oapiUnregisterCustomCmd(Cmd); - for each (SideBar* sb in sbList) delete sb; + for(SideBar* sb : sbList) delete sb; UnregisterClass("SideBarWnd", hInst); UnregisterClass("Floater", hInst); @@ -664,7 +664,7 @@ HBITMAP WindowManager::GetBitmap(int id) const SideBar * WindowManager::GetSideBar(HWND hWnd) { if (sbList.size() == 0) return NULL; - for each (SideBar * sb in sbList) if (sb->GetHWND() == hWnd) return sb; + for (SideBar * sb : sbList) if (sb->GetHWND() == hWnd) return sb; return NULL; } @@ -789,7 +789,7 @@ void WindowManager::UpdateSize(HWND hDlg) // HNODE WindowManager::GetNode(HWND hDlg) { - for each (SideBar* sb in sbList) + for (SideBar* sb : sbList) { HNODE hNode = (HNODE)sb->FindNode(hDlg); if (hNode) return hNode; @@ -848,7 +848,7 @@ bool WindowManager::UnRegister(HNODE hNode) // bool WindowManager::DoesExist(Node *pn) { - for each (SideBar *sb in sbList) if (sb->DoesExists(pn)) return true; + for (SideBar *sb : sbList) if (sb->DoesExists(pn)) return true; return false; } @@ -910,7 +910,7 @@ void WindowManager::Animate() // SideBar *WindowManager::NewSideBar(Node *pAN) { - for each (SideBar* sb in sbList) if (sb->IsInactive() && sb->IsEmpty()) { + for (SideBar* sb : sbList) if (sb->IsInactive() && sb->IsEmpty()) { sb->SetState(gcGUI::DS_FLOAT); return sb; } @@ -956,9 +956,9 @@ SideBar* WindowManager::StartDrag(Node *pAN, int x, int y) vector tmp; - for each (Node * an in pSBOld->wList) if (an->pParent == pAN) tmp.push_back(an); + for (Node * an : pSBOld->wList) if (an->pParent == pAN) tmp.push_back(an); - for each (Node * an in tmp) + for (Node * an : tmp) { pSBOld->RemoveWindow(an); // Cant remove directly from a list being browsed pSBNew->AddWindow(an); @@ -1050,11 +1050,11 @@ SideBar *WindowManager::FindDestination() int z = 0; SideBar *pOld = sbDest; sbDest = NULL; - for each (SideBar* sb in sbList) { + for (SideBar* sb : sbList) { if (sb->IsInactive()) continue; if (sb != sbDrag) { RECT out; - IntersectRect(&out, &(sb->GetRect()), &(sbDrag->GetRect())); + IntersectRect(&out, ptr(sb->GetRect()), ptr(sbDrag->GetRect())); int a = (out.right - out.left) * (out.bottom - out.top); if (a > z) { z = a; sbDest = sb; } } @@ -1201,7 +1201,7 @@ SideBar::SideBar(class WindowManager *_pMgr, DWORD _state) // SideBar::~SideBar() { - for each (Node *v in wList) + for (Node *v : wList) { if (v->hDlg) DestroyWindow(v->hDlg); delete v; @@ -1223,7 +1223,7 @@ void SideBar::ToggleLock() // void SideBar::ManageButtons() { - for each (Node* nd in wList) + for (Node* nd : wList) { nd->bClose = false; @@ -1386,7 +1386,7 @@ void SideBar::RescaleWindow() // Node* SideBar::FindNode(HWND hDlg) { - for each (Node* nd in wList) if (nd->hDlg == hDlg) return nd; + for (Node* nd : wList) if (nd->hDlg == hDlg) return nd; return NULL; } @@ -1396,11 +1396,11 @@ Node* SideBar::FindNode(HWND hDlg) void SideBar::GetVisualList(vector &tmp) { if (Config->gcGUIMode == 3) { - for each (Node* ap in wList) if (ap->hDlg) tmp.push_back(ap); + for (Node* ap : wList) if (ap->hDlg) tmp.push_back(ap); } else { - for each (Node* ap in wList) { + for (Node* ap : wList) { Node* pPar = ap->pParent; if (pPar) { if (pPar->pSB == this) { @@ -1420,11 +1420,11 @@ void SideBar::GetVisualList(vector &tmp) void SideBar::Sort() { vector tmp; - for each (Node* ap in wList) { + for (Node* ap : wList) { Node* pPar = ap->pParent; if (pPar == NULL) { tmp.push_back(ap); // Root Node - for each (Node* ch in wList) if (ch->pParent == ap) tmp.push_back(ch); // Child + for (Node* ch : wList) if (ch->pParent == ap) tmp.push_back(ch); // Child } else if (pPar->GetSideBar()!=this) tmp.push_back(ap); // Foreing Child } @@ -1469,7 +1469,7 @@ Node *SideBar::GetTopNode() // bool SideBar::DoesExists(Node *pX) { - for each (Node* ap in wList) if (ap == pX) return true; + for (Node* ap : wList) if (ap == pX) return true; return false; } @@ -1482,7 +1482,7 @@ Node *SideBar::FindClosest(vector &vis, Node *pRoot, int yval) int y = rollpos; Node *out = NULL; if (!pRoot) if (abs(y - yval) < d) d = abs(y - yval); - for each (Node* ap in vis) { + for (Node* ap : vis) { y += ap->CellSize(); if (ap->pParent == pRoot || ap == pRoot || ap == vis.back()) { if (abs(y - yval) < d) d = abs(y - yval), out = ap; @@ -1520,7 +1520,7 @@ bool SideBar::TryInsert(SideBar *sbIn) if (!DoesExists(pParent)) pParent = NULL; Node *pPlace = FindClosest(drawList, pParent, yp); - for each (Node* an in sbIn->wList) wIns[an] = pPlace; + for (Node* an : sbIn->wList) wIns[an] = pPlace; return wIns != wPrev; } @@ -1537,7 +1537,7 @@ bool SideBar::Apply() if ((pIns->pTgt == this) && (pIns->List.size()>0)) { - for each (auto &var in pIns->List) + for (auto &var : pIns->List) { Node *pAfter = var.second; Node *pSrc = var.first; @@ -1599,7 +1599,7 @@ LRESULT SideBar::SideBarWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar xpos = GET_X_LPARAM(lParam); ypos = GET_Y_LPARAM(lParam); - for each (Node* nd in wList) + for (Node* nd : wList) { Node *pPar = nd->pParent; @@ -1767,12 +1767,12 @@ int SideBar::ComputeLength() bool bInsert = (pIns->pTgt == this) && (wIns.size() > 0); - if (bInsert) for each (auto &var in wIns) if (var.second == NULL) y += var.first->CellSize(); + if (bInsert) for (auto &var : wIns) if (var.second == NULL) y += var.first->CellSize(); - for each (Node* ap in drawList) + for (Node* ap : drawList) { y += ap->CellSize(); - if (bInsert) for each (auto &var in wIns) if (var.second == ap) y += var.first->CellSize(); + if (bInsert) for (auto &var : wIns) if (var.second == ap) y += var.first->CellSize(); } wndlen = y; @@ -1799,12 +1799,12 @@ void SideBar::PaintWindow() bool bInsert = (pIns->pTgt == this) && (wIns.size() > 0); - if (bInsert) for each (auto &var in wIns) + if (bInsert) for (auto &var : wIns) { if (var.second == NULL) y = var.first->Spacer(hDC, y); } - for each (Node* ap in drawList) + for (Node* ap : drawList) { if (ap != drawList.front()) if (ap->pParent == NULL) { RECT fr = { 0, y, width, y + 3 }; @@ -1814,7 +1814,7 @@ void SideBar::PaintWindow() y = ap->Paint(hDC, y); - if (bInsert) for each (auto &var in wIns) + if (bInsert) for (auto &var : wIns) { if (var.second == ap) y = var.first->Spacer(hDC, y); } @@ -1838,9 +1838,9 @@ void SideBar::PaintWindow() EndPaint(hBar, &ps); // Move dialogs in place - for each (Node* ap in wList) { + for (Node* ap : wList) { bool bFound = false; - for each (Node* q in drawList) if (q == ap) { bFound = true; break; } + for (Node* q : drawList) if (q == ap) { bFound = true; break; } if (bFound && ap->hDlg) { if (ap->bOpen) ap->Move(); diff --git a/OVP/D3D9Client/samples/DX9ExtMFD/ExtMFD.cpp b/OVP/D3D9Client/samples/DX9ExtMFD/ExtMFD.cpp index e5e92db94..0f21c19ca 100644 --- a/OVP/D3D9Client/samples/DX9ExtMFD/ExtMFD.cpp +++ b/OVP/D3D9Client/samples/DX9ExtMFD/ExtMFD.cpp @@ -48,8 +48,8 @@ DLLCLBK void InitModule (HINSTANCE hDLL) // To allow the user to open our new dialog box, we create // an entry in the "Custom Functions" list which is accessed // in Orbiter via Ctrl-F4. - g_dwCmd = oapiRegisterCustomCmd ("DX9 External MFD", - "Opens a multifunctional display in an external window", + g_dwCmd = oapiRegisterCustomCmd ((char*)"DX9 External MFD", + (char*)"Opens a multifunctional display in an external window", OpenDlgClbk, NULL); // Load the bitmap for the "pin" title button diff --git a/OVP/D3D9Client/samples/DrawOrbits/Draw.cpp b/OVP/D3D9Client/samples/DrawOrbits/Draw.cpp index 901996e20..1e981566d 100644 --- a/OVP/D3D9Client/samples/DrawOrbits/Draw.cpp +++ b/OVP/D3D9Client/samples/DrawOrbits/Draw.cpp @@ -146,7 +146,7 @@ void Orbits::clbkSimulationStart(RenderMode rm) { upidx = 0; - oapiWriteLog("oapi::Module::clbkSimulationStart"); + oapiWriteLog((char*)"oapi::Module::clbkSimulationStart"); size_t bcnt{ oapiGetGbodyCount() }; Ref = new ReferenceClass(); @@ -158,7 +158,7 @@ void Orbits::clbkSimulationStart(RenderMode rm) if (pCore) { hTex = oapiLoadTexture("samples/DrawOrbits/Orbits.dds"); - hFnt = oapiCreateFontEx(15, "Arial"); + hFnt = oapiCreateFontEx(15, (char*)"Arial"); pCore->RegisterRenderProc(RenderOrbitClbk, RENDERPROC_PLANETARIUM, this); @@ -176,7 +176,7 @@ void Orbits::clbkSimulationStart(RenderMode rm) } } } - else oapiWriteLog("Error: No pCore"); + else oapiWriteLog((char*)"Error: No pCore"); } @@ -184,7 +184,7 @@ void Orbits::clbkSimulationStart(RenderMode rm) // void Orbits::clbkSimulationEnd() { - oapiWriteLog("oapi::Module::clbkSimulationEnd"); + oapiWriteLog((char*)"oapi::Module::clbkSimulationEnd"); if (pCore) { diff --git a/OVP/D3D9Client/samples/DrawOrbits/Orbit.cpp b/OVP/D3D9Client/samples/DrawOrbits/Orbit.cpp index 418d34f6a..4000c42df 100644 --- a/OVP/D3D9Client/samples/DrawOrbits/Orbit.cpp +++ b/OVP/D3D9Client/samples/DrawOrbits/Orbit.cpp @@ -414,14 +414,14 @@ void COrbit::CreateFromStateVectors(const VECTOR3 &_pos, const VECTOR3 &_vel, do double v2 = sqrlen(_vel); double r2 = sqrlen(_pos); double r = sqrt(r2); - double or = 1.0 / r; + double Or = 1.0 / r; double om = 1.0 / mu; // Eccentricity VECTOR3 - _P = ((_pos * (v2 - mu* or )) - (_vel * dotp(_pos, _vel))) * om; + _P = ((_pos * (v2 - mu* Or )) - (_vel * dotp(_pos, _vel))) * om; _H = crossp_LH(_pos, _vel); _Q = unit(crossp_LH(_H, _P)); - _R = _pos* or ; + _R = _pos* Or ; // Eccentricity ecc = length(_P); diff --git a/OVP/D3D9Client/samples/DrawOrbits/Tools.cpp b/OVP/D3D9Client/samples/DrawOrbits/Tools.cpp index fa9c370b1..03d35471b 100644 --- a/OVP/D3D9Client/samples/DrawOrbits/Tools.cpp +++ b/OVP/D3D9Client/samples/DrawOrbits/Tools.cpp @@ -29,13 +29,13 @@ const char *ValueToText(double real, int digits) double v = fabs(real); int n; - char *c = { "" }; - char *k = { "k" }; - char *k2 = { "M" }; - char *k3 = { "G" }; - char *k5 = { "m" }; - char *k6 = { "ĩ" }; - char *k7 = { "T" }; + const char *c = { "" }; + const char *k = { "k" }; + const char *k2 = { "M" }; + const char *k3 = { "G" }; + const char *k5 = { "m" }; + const char *k6 = { "ĩ" }; + const char *k7 = { "T" }; n = (int)floor(log10(v)) + 1; diff --git a/OVP/D3D9Client/samples/GenericCamera/MFD.cpp b/OVP/D3D9Client/samples/GenericCamera/MFD.cpp index 7275a6ad1..e82da5702 100644 --- a/OVP/D3D9Client/samples/GenericCamera/MFD.cpp +++ b/OVP/D3D9Client/samples/GenericCamera/MFD.cpp @@ -16,6 +16,11 @@ #define ENABLE_OVERLAY false +// helper function to get address of a temporary +// NB: use with caution +template +const T* ptr(const T& x) { return &x; } + // ============================================================================================================ // Global variables @@ -60,9 +65,8 @@ DLLCLBK void InitModule (HINSTANCE hDLL) ShellMFD::InitModule(hDLL); - static char *name = "Generic Camera"; // MFD mode name MFDMODESPECEX spec; - spec.name = name; + spec.name = (char*)"Generic Camera"; // MFD mode name; spec.key = OAPI_KEY_C; // MFD mode selection key spec.context = NULL; spec.msgproc = ShellMFD::MsgProc; // MFD mode callback function @@ -301,8 +305,8 @@ void CameraMFD::PreviousAttachment() char *CameraMFD::ButtonLabel (int bt) { // The labels for the two buttons used by our MFD mode - static char *label[] = {"NA", "PA", "ND", "PD", "FWD", "BWD", "VES", "NV", "ZM+", "ZM-", "PAR", "CRS"}; - return (bt < ARRAYSIZE(label) ? label[bt] : 0); + static const char *label[] = {"NA", "PA", "ND", "PD", "FWD", "BWD", "VES", "NV", "ZM+", "ZM-", "PAR", "CRS"}; + return (char*)(bt < ARRAYSIZE(label) ? label[bt] : 0); } @@ -357,9 +361,9 @@ bool CameraMFD::Update(oapi::Sketchpad *pSkp) if (nDock != 0 || nAtch != 0) { if (bNightVis) { - pSkp->SetBrightness(&FVECTOR4(0.0, 4.0, 0.0, 1.0)); - pSkp->SetRenderParam(Sketchpad::RenderParam::PRM_GAMMA, &FVECTOR4(0.5f, 0.5f, 0.5f, 1.0f)); - pSkp->SetRenderParam(Sketchpad::RenderParam::PRM_NOISE, &FVECTOR4(0.0f, 0.3f, 0.0f, 0.0f)); + pSkp->SetBrightness(ptr(FVECTOR4(0.0, 4.0, 0.0, 1.0))); + pSkp->SetRenderParam(Sketchpad::RenderParam::PRM_GAMMA, ptr(FVECTOR4(0.5f, 0.5f, 0.5f, 1.0f))); + pSkp->SetRenderParam(Sketchpad::RenderParam::PRM_NOISE, ptr(FVECTOR4(0.0f, 0.3f, 0.0f, 0.0f))); } @@ -403,20 +407,20 @@ bool CameraMFD::Update(oapi::Sketchpad *pSkp) } } else { - static char *msg = { "No Graphics API" }; + static const char *msg = { "No Graphics API" }; pSkp->Text(W / 2, H / 2, msg, lstrlen(msg)); return true; } if (!hCamera) { - static char *msg = { "Custom Cameras Disabled" }; + static const char *msg = { "Custom Cameras Disabled" }; pSkp->Text(W / 2, H / 2, msg, lstrlen(msg)); return true; } if (nDock == 0 && nAtch == 0) { - static char *msg = { "No Dock/Attachment points" }; + static const char *msg = { "No Dock/Attachment points" }; pSkp->Text(W / 2, H / 2, msg, lstrlen(msg)); return true; } @@ -510,7 +514,7 @@ bool CameraMFD::ConsumeKeyBuffered(DWORD key) case OAPI_KEY_7: // Select Vessel - oapiOpenInputBox("Keyboard Input:", DataInput, 0, 32, (void*)this); + oapiOpenInputBox((char*)"Keyboard Input:", DataInput, 0, 32, (void*)this); return true; @@ -594,7 +598,7 @@ void CameraMFD::DrawOverlay(oapi::Sketchpad *pSkp, void *pParam) void CameraMFD::WriteStatus(FILEHANDLE scn) const { if (pMask) { - oapiWriteScenario_string(scn, "ATCH_MASK", pMask); + oapiWriteScenario_string(scn, (char*)"ATCH_MASK", pMask); } } diff --git a/OVP/D3D9Client/samples/TerrainToolBox/Basics.cpp b/OVP/D3D9Client/samples/TerrainToolBox/Basics.cpp index 1416bc1d9..c404116d8 100644 --- a/OVP/D3D9Client/samples/TerrainToolBox/Basics.cpp +++ b/OVP/D3D9Client/samples/TerrainToolBox/Basics.cpp @@ -158,7 +158,7 @@ void ToolKit::RenderTileBounds(QTree *tn, DWORD color) void ToolKit::RenderSelection(sSelection *sel, int mode, DWORD color) { if (mode == 0) { - for each (selentry se in sel->area) RenderTileBounds(se.pNode, color); + for (selentry se : sel->area) RenderTileBounds(se.pNode, color); return; } @@ -167,7 +167,7 @@ void ToolKit::RenderSelection(sSelection *sel, int mode, DWORD color) if (mode == 1) { - for each (selentry se in sel->area) { + for (selentry se : sel->area) { gcCore::PickGround pg = pCore->GetTileData(hMgr, se.pNode->clng, se.pNode->clat, se.pNode->level); emin = min(emin, pg.emin); emax = max(emax, pg.emax); @@ -278,7 +278,7 @@ SURFHANDLE ToolKit::GetBaseElevation(int elev_fmt) if (elev_fmt == 0) pInt = new INT16[Width * Height]; if (elev_fmt == 1) pFloat = new float[Width * Height]; - for each (selentry se in selection.area) + for (selentry se : selection.area) { int pos = se.x * 256 + se.y * 256 * Width; INT16 *pElev = se.pNode->GetElevation(); diff --git a/OVP/D3D9Client/samples/TerrainToolBox/ExportImport.cpp b/OVP/D3D9Client/samples/TerrainToolBox/ExportImport.cpp index e30651efd..2b707428c 100644 --- a/OVP/D3D9Client/samples/TerrainToolBox/ExportImport.cpp +++ b/OVP/D3D9Client/samples/TerrainToolBox/ExportImport.cpp @@ -93,7 +93,7 @@ void ToolKit::Export() oapiReleaseTexture(hSrf); } - else oapiWriteLog("hSrf == NULL"); + else oapiWriteLog((char*)"hSrf == NULL"); } @@ -102,7 +102,7 @@ void ToolKit::Export() void ToolKit::ExportElev() { - for each (selentry se in selection.area) + for (selentry se : selection.area) { INT16 *pElev = se.pNode->GetElevation(); if (!pElev) { diff --git a/OVP/D3D9Client/samples/TerrainToolBox/ToolBox.cpp b/OVP/D3D9Client/samples/TerrainToolBox/ToolBox.cpp index 7490fd06b..6a848c273 100644 --- a/OVP/D3D9Client/samples/TerrainToolBox/ToolBox.cpp +++ b/OVP/D3D9Client/samples/TerrainToolBox/ToolBox.cpp @@ -28,6 +28,10 @@ using namespace std; ToolKit *g_pTK = NULL; gcCore2* g_pCore = NULL; +// helper function to get address of a temporary +// NB: use with caution +template +const T* ptr(const T& x) { return &x; } // ================================================================================================= @@ -109,7 +113,7 @@ BOOL ToolKit::DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) case IDC_BLUE: case IDC_ALPHAEDG: { - if (!UpdateOverlays()) oapiWriteLog("UpdateOverlays() Failed"); + if (!UpdateOverlays()) oapiWriteLog((char*)"UpdateOverlays() Failed"); break; } @@ -130,7 +134,7 @@ BOOL ToolKit::DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) if (CreateOverlays()) { AutoSelectCorners(); - if (!UpdateOverlays()) oapiWriteLog("UpdateOverlays() Failed in IDC_STARTIMPORT"); + if (!UpdateOverlays()) oapiWriteLog((char*)"UpdateOverlays() Failed in IDC_STARTIMPORT"); } break; } @@ -192,7 +196,7 @@ BOOL ToolKit::DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) case IDC_CORNERS: { AutoSelectCorners(); - if (!UpdateOverlays()) oapiWriteLog("UpdateOverlays() Failed in IDC_CORNERS"); + if (!UpdateOverlays()) oapiWriteLog((char*)"UpdateOverlays() Failed in IDC_CORNERS"); break; } @@ -247,7 +251,7 @@ ToolKit::ToolKit(HINSTANCE hInst) : gcGUIApp(), Module(hInst) bGo = false; // Can do very little here since graphics servises are not yet running - dwCmd = oapiRegisterCustomCmd("TerrainToolBox", "ToolBox for terrain and base editing", OpenToolsClbk, this); + dwCmd = oapiRegisterCustomCmd((char*)"TerrainToolBox", (char*)"ToolBox for terrain and base editing", OpenToolsClbk, this); gcPropertyTreeInitialize(hInst); mIdent.Ident(); @@ -371,7 +375,7 @@ bool ToolKit::Initialize() dmSphere = pCore->LoadDevMeshGlobal("D3D9Sphere"); if (!dmSphere) { - oapiWriteLog("TerrainToolKit: Failed to load a file [D3D9Sphere.msh]"); + oapiWriteLog((char*)"TerrainToolKit: Failed to load a file [D3D9Sphere.msh]"); return false; } @@ -864,7 +868,7 @@ bool ToolKit::UpdateOverlay(int olay) { if (bSurf && pLr) { pSkp->SetColorMatrix(&mColor); // Setup a color matrix for corrections - pSkp->SetRenderParam(Sketchpad::RenderParam::PRM_GAMMA, &FVECTOR4(adj.y, adj.y, adj.y, 1.0f)); // Setup gamma correction + pSkp->SetRenderParam(Sketchpad::RenderParam::PRM_GAMMA, ptr(FVECTOR4(adj.y, adj.y, adj.y, 1.0f))); // Setup gamma correction pSkp->SetBlendState(Sketchpad::BlendState::ALPHABLEND); pSkp->CopyTetragon(pLr->hSource, NULL, pt); } @@ -879,7 +883,7 @@ bool ToolKit::UpdateOverlay(int olay) if (bNight && pLr) { pSkp->SetColorMatrix(&mColor); // Setup a color matrix for corrections - pSkp->SetRenderParam(Sketchpad::RenderParam::PRM_GAMMA, &FVECTOR4(adj.y, adj.y, adj.y, 1.0f)); // Setup gamma correction + pSkp->SetRenderParam(Sketchpad::RenderParam::PRM_GAMMA, ptr(FVECTOR4(adj.y, adj.y, adj.y, 1.0f))); // Setup gamma correction int mode = pLr->GetWaterMode(); @@ -1172,7 +1176,7 @@ bool ToolKit::clbkProcessMouse(UINT event, DWORD state, DWORD x, DWORD y) points[down_corner].lng = pg.lng; points[down_corner].lat = pg.lat; points[down_corner].elev = pg.elev; - if (!UpdateOverlays()) oapiWriteLog("UpdateOverlays() Failed in clbkProcessMouse()"); + if (!UpdateOverlays()) oapiWriteLog((char*)"UpdateOverlays() Failed in clbkProcessMouse()"); else for (auto x : pLr) if (x) x->ComputeLevel(points); } diff --git a/OVP/D3D9Client/samples/TerrainToolBox/gcTableView.cpp b/OVP/D3D9Client/samples/TerrainToolBox/gcTableView.cpp index 07fa55d23..f7a1f9e05 100644 --- a/OVP/D3D9Client/samples/TerrainToolBox/gcTableView.cpp +++ b/OVP/D3D9Client/samples/TerrainToolBox/gcTableView.cpp @@ -18,13 +18,13 @@ list g_gcPropertyTrees; // LRESULT CALLBACK gcPropertyTreeProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - for each (gcPropertyTree * ptr in g_gcPropertyTrees) + for (gcPropertyTree * ptr : g_gcPropertyTrees) if (ptr->GetHWND() == hWnd) return ptr->WndProc(hWnd, uMsg, wParam, lParam); HWND hParent = GetParent(hWnd); if (hParent) - for each (gcPropertyTree * ptr in g_gcPropertyTrees) + for (gcPropertyTree * ptr : g_gcPropertyTrees) if (ptr->GetHWND() == hParent) return ptr->WndProc(hWnd, uMsg, wParam, lParam); return DefWindowProc(hWnd, uMsg, wParam, lParam); @@ -78,10 +78,10 @@ gcPropertyTree::gcPropertyTree(gcGUIApp *_pApp, HWND _hWnd, WORD _idc, DLGPROC p hIcons = pCore->LoadBitmapFromFile("D3D9\\Icons18.png"); if (!hIcons) { - oapiWriteLog("gcPropertyTree: FAILED to load Textures/D3D9/Icons18.png"); + oapiWriteLog((char*)"gcPropertyTree: FAILED to load Textures/D3D9/Icons18.png"); } if (!pCore) { - oapiWriteLog("gcPropertyTree: No core interface !!"); + oapiWriteLog((char*)"gcPropertyTree: No core interface !!"); } DWORD style = GetWindowLong(hWnd, GWL_STYLE); @@ -123,7 +123,7 @@ gcPropertyTree::~gcPropertyTree() { g_gcPropertyTrees.remove(this); - for each (HPROP hp in Data) + for (HPROP hp : Data) { if (hp->hCtrl) DestroyWindow(hp->hCtrl); if (hp->pSlider) delete hp->pSlider; @@ -177,7 +177,7 @@ void gcPropertyTree::CopyToClipboard() // void gcPropertyTree::CloseTree(HPROP hPar) { - for each (HPROP hp in Data) + for (HPROP hp : Data) { if (hp->parent == hPar) { if (hp->bChildren) CloseTree(hp); @@ -198,7 +198,7 @@ LRESULT gcPropertyTree::WndProc(HWND hCtrl, UINT uMsg, WPARAM wParam, LPARAM lPa // Post Slider Messages to Main DlgProc // if (uMsg == WM_HSCROLL || uMsg == WM_COMMAND) { - for each (HPROP hp in Data) { + for (HPROP hp : Data) { if (hp->style != Style::SLIDER) continue; if (hp->hCtrl != HWND(lParam)) continue; if (hp->pSlider) { @@ -231,7 +231,7 @@ LRESULT gcPropertyTree::WndProc(HWND hCtrl, UINT uMsg, WPARAM wParam, LPARAM lPa // Post Edit and ComboBox Messages to Main DlgProc // if (uMsg == WM_COMMAND) { - for each (HPROP hp in Data) { + for (HPROP hp : Data) { if (hp->style == Style::TEXTBOX || hp->style == Style::COMBOBOX) { if (hp->hCtrl == HWND(lParam) && hp->hCtrl != NULL) { if (pCallback) pCallback(hDlg, WM_COMMAND, MAKELONG(hp->idc, HIWORD(wParam)), LPARAM(hp)); @@ -264,7 +264,7 @@ LRESULT gcPropertyTree::WndProc(HWND hCtrl, UINT uMsg, WPARAM wParam, LPARAM lPa case WM_LBUTTONDOWN: { POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - for each (HPROP hp in Data) { + for (HPROP hp : Data) { if (PtInRect(&hp->rect, pt) && hp->bVisible) { pDown = hp; if (hp->bChildren == false && hp->hCtrl == NULL) { @@ -392,7 +392,7 @@ void gcPropertyTree::Paint(HDC _hDC) wlbl = 0; - for each (HPROP hp in Data) + for (HPROP hp : Data) { hp->bVisible = false; @@ -418,7 +418,7 @@ void gcPropertyTree::Paint(HDC _hDC) oapiWriteLogV("gcPropertyTree: BitBlt Failed Error=%u", GetLastError()); } - for each (HPROP hp in Data) if (hp->bVisible) if (hp->hCtrl) InvalidateRect(hp->hCtrl, NULL, false); + for (HPROP hp : Data) if (hp->bVisible) if (hp->hCtrl) InvalidateRect(hp->hCtrl, NULL, false); SelectClipRgn(_hDC, NULL); DeleteObject(hRgn); @@ -447,7 +447,7 @@ int gcPropertyTree::PaintSection(HDC _hDC, HPROP hPar, int ident, int wlbl, int BITMAP ic; GetObject(hIcons, sizeof(BITMAP), &ic); - for each (HPROP hp in Data) + for (HPROP hp : Data) { if (hp->bOn == false) continue; if (hp->parent != hPar) continue; @@ -550,7 +550,7 @@ int gcPropertyTree::PaintSection(HDC _hDC, HPROP hPar, int ident, int wlbl, int int gcPropertyTree::GetSubsentionLength(HPROP hPar) { int q = 0; - for each (HPROP hp in Data) + for (HPROP hp : Data) { if (hp->bOn) { if (hp->parent == hPar) { @@ -723,7 +723,7 @@ HPROP gcPropertyTree::GetEntry(int idx) HPROP gcPropertyTree::GetEntry(HWND hCtrl) { if (hCtrl == NULL) return NULL; - for each (HPROP hp in Data) if (hp->hCtrl == hCtrl) return hp; + for (HPROP hp : Data) if (hp->hCtrl == hCtrl) return hp; return NULL; } diff --git a/OVP/GDIClient/GDIClient.cpp b/OVP/GDIClient/GDIClient.cpp index 7f479a9c3..37f6cf047 100644 --- a/OVP/GDIClient/GDIClient.cpp +++ b/OVP/GDIClient/GDIClient.cpp @@ -356,9 +356,9 @@ void GDIPad::PolyPolyline (const IVECTOR2 *pt, const int *npt, const int nline) GDIFont::GDIFont (int height, bool prop, const char *face, FontStyle style, int orientation): oapi::Font (height, prop, face, style, orientation) { - char *def_fixedface = "Courier New"; - char *def_sansface = "Arial"; - char *def_serifface = "Times New Roman"; + const char *def_fixedface = "Courier New"; + const char *def_sansface = "Arial"; + const char *def_serifface = "Times New Roman"; if (!_stricmp (face, "fixed")) { face = def_fixedface; diff --git a/Orbitersdk/include/OrbiterAPI.h b/Orbitersdk/include/OrbiterAPI.h index 1f24d6cd1..8f372c420 100644 --- a/Orbitersdk/include/OrbiterAPI.h +++ b/Orbitersdk/include/OrbiterAPI.h @@ -7521,7 +7521,7 @@ inline VECTOR3 POINTERTOREF (VECTOR3 *p) #ifdef ORBITER_MODULE void dummy(); void calldummy () { dummy(); } -DLLCLBK char *ModuleDate () { return __DATE__; } +DLLCLBK char *ModuleDate () { return (char*)__DATE__; } #endif #endif // !__ORBITERAPI_H \ No newline at end of file diff --git a/Sound/XRSound/src/ModuleXRSoundEngine.cpp b/Sound/XRSound/src/ModuleXRSoundEngine.cpp index d3f2f996e..ee8651c09 100644 --- a/Sound/XRSound/src/ModuleXRSoundEngine.cpp +++ b/Sound/XRSound/src/ModuleXRSoundEngine.cpp @@ -84,7 +84,7 @@ bool ModuleXRSoundEngine::SetDefaultSoundGroupFolder(const XRSound::DefaultSound // Default sound groups are not supported for modules const char *ModuleXRSoundEngine::GetDefaultSoundGroupFolder(const XRSound::DefaultSoundID groupSoundID) const { - return false; + return nullptr; } // Update the playback state & volume of a single sound based. Unlike vessel-played sounds, all module sounds play as "global" diff --git a/Sound/XRSound/src/VesselXRSoundEngine.cpp b/Sound/XRSound/src/VesselXRSoundEngine.cpp index 22ccd6e4c..9dbdbbc91 100644 --- a/Sound/XRSound/src/VesselXRSoundEngine.cpp +++ b/Sound/XRSound/src/VesselXRSoundEngine.cpp @@ -174,7 +174,7 @@ bool VesselXRSoundEngine::SetDefaultSoundGroupFolder(const XRSound::DefaultSound const char *VesselXRSoundEngine::GetDefaultSoundGroupFolder(const XRSound::DefaultSoundID defaultSoundID) const { if (!IsKlangEngineInitialized()) - return false; + return nullptr; const char *pSoundFolder = nullptr; diff --git a/Src/Celbody/Galsat/Galsat.h b/Src/Celbody/Galsat/Galsat.h index 18bfce1aa..f6ad30e80 100644 --- a/Src/Celbody/Galsat/Galsat.h +++ b/Src/Celbody/Galsat/Galsat.h @@ -44,7 +44,7 @@ DLLEXPORT void JupiterBaryFastEphemeris (double simt, double *ret, Sample *sp); // Lieske driver functions // =========================================================== -int cd2com (char *fname); // read data from file +int cd2com (const char *fname); // read data from file void chkgal (void); // set up data void galsat (double *r, double *rorb, double tjd, int ksat, int kflag); // calculate ephemerides diff --git a/Src/Celbody/Galsat/Lieske.cpp b/Src/Celbody/Galsat/Lieske.cpp index b37f045fc..dfca7b214 100644 --- a/Src/Celbody/Galsat/Lieske.cpp +++ b/Src/Celbody/Galsat/Lieske.cpp @@ -709,7 +709,7 @@ void unkod (int *kode, int *kod, int *kmin) /* = = = = = = = = = = = = = = = = = = = = = = = = = = = */ /* = = = = = = = = = = = = = = = = = = = = = = = = = = = */ -int cd2com (char *fname) +int cd2com (const char *fname) { /* ********************************************** */ /* read the 'card' file (output as punch file from kodlod or the */ diff --git a/Src/Celbody/Moon/Moon.cpp b/Src/Celbody/Moon/Moon.cpp index f68afdb64..0635a2232 100644 --- a/Src/Celbody/Moon/Moon.cpp +++ b/Src/Celbody/Moon/Moon.cpp @@ -50,7 +50,7 @@ Moon::Moon (OBJHANDLE hObj): CELBODY2 (hObj) void Moon::clbkInit (FILEHANDLE cfg) { - oapiReadItem_float (cfg, "ErrorLimit", prec); + oapiReadItem_float (cfg, (char*)"ErrorLimit", prec); ELP82_read (prec); CELBODY2::clbkInit (cfg); diff --git a/Src/Celbody/Satsat/Satsat.cpp b/Src/Celbody/Satsat/Satsat.cpp index 40ea6d8ec..5565734f3 100644 --- a/Src/Celbody/Satsat/Satsat.cpp +++ b/Src/Celbody/Satsat/Satsat.cpp @@ -16,7 +16,7 @@ using namespace std; static void SatEphem (int ksat, double mjd, double *ret); static void SampleEphem (int ksat, double simt, double *ret); -static char *satname[NSAT] = { +static const char *satname[NSAT] = { "Mimas", "Enceladus", "Tethys", "Dione", "Rhea", "Titan", "Hyperion", "Iapetus" }; diff --git a/Src/Celbody/Satsat/Satsat.h b/Src/Celbody/Satsat/Satsat.h index 3e550e317..7f29de0ec 100644 --- a/Src/Celbody/Satsat/Satsat.h +++ b/Src/Celbody/Satsat/Satsat.h @@ -47,6 +47,6 @@ DLLEXPORT void SaturnFastEphemeris (double simt, double *ret); int posired (double dj, int is, double *xyz, double *vxyz); int nterm (int is); -void ReadData (char *fname, int res); +void ReadData (const char *fname, int res); #endif // !__SATSAT_H \ No newline at end of file diff --git a/Src/Celbody/Satsat/Tass17.cpp b/Src/Celbody/Satsat/Tass17.cpp index cf08846b7..b0baf68b1 100644 --- a/Src/Celbody/Satsat/Tass17.cpp +++ b/Src/Celbody/Satsat/Tass17.cpp @@ -178,7 +178,7 @@ int calclon (double dj, const SeriesData *sd, double *dlo) // ========================================================== // Read perturbation terms -void ReadData (char *fname, int res) +void ReadData (const char *fname, int res) { SeriesData *sd = sdata; diff --git a/Src/Celbody/Vsop87/Earth/Atmosphere/EarthAtm2006/EarthAtm2006.cpp b/Src/Celbody/Vsop87/Earth/Atmosphere/EarthAtm2006/EarthAtm2006.cpp index c301413c1..143a9c714 100644 --- a/Src/Celbody/Vsop87/Earth/Atmosphere/EarthAtm2006/EarthAtm2006.cpp +++ b/Src/Celbody/Vsop87/Earth/Atmosphere/EarthAtm2006/EarthAtm2006.cpp @@ -21,8 +21,7 @@ bool EarthAtmosphere_2006::clbkConstants (ATMCONST *atmc) const const char *EarthAtmosphere_2006::clbkName () const { - static char *name = "2006 Edition model"; - return name; + return "2006 Edition model"; } bool EarthAtmosphere_2006::clbkParams (const PRM_IN *prm_in, PRM_OUT *prm) @@ -117,12 +116,10 @@ DLLCLBK void DeleteAtmosphere (ATMOSPHERE *atm) DLLCLBK char *ModelName () { - static char *name = "Orbiter 2006 Legacy Model"; - return name; + return (char*)"Orbiter 2006 Legacy Model"; } DLLCLBK char *ModelDesc () { - static char *desc = "A simple static atmosphere model. This model was used in Orbiter 2006. It underestimates atmospheric density and pressure above ~120km and terminates at 200km, which simplifies orbit-keeping for LEO objects."; - return desc; + return (char*)"A simple static atmosphere model. This model was used in Orbiter 2006. It underestimates atmospheric density and pressure above ~120km and terminates at 200km, which simplifies orbit-keeping for LEO objects."; } \ No newline at end of file diff --git a/Src/Celbody/Vsop87/Earth/Atmosphere/EarthAtmJ71G/EarthAtmJ71G.cpp b/Src/Celbody/Vsop87/Earth/Atmosphere/EarthAtmJ71G/EarthAtmJ71G.cpp index 595cce711..f8bdcf0a8 100644 --- a/Src/Celbody/Vsop87/Earth/Atmosphere/EarthAtmJ71G/EarthAtmJ71G.cpp +++ b/Src/Celbody/Vsop87/Earth/Atmosphere/EarthAtmJ71G/EarthAtmJ71G.cpp @@ -36,8 +36,7 @@ EarthAtmosphere_J71G::EarthAtmosphere_J71G (CELBODY2 *body): ATMOSPHERE (body) const char *EarthAtmosphere_J71G::clbkName () const { - static char *name = "J71G"; - return name; + return "J71G"; } // =========================================================================== @@ -833,12 +832,10 @@ DLLCLBK void DeleteAtmosphere (ATMOSPHERE *atm) DLLCLBK char *ModelName () { - static char *name = "Jacchia71-Gill Atmospheric Model"; - return name; + return (char*)"Jacchia71-Gill Atmospheric Model"; } DLLCLBK char *ModelDesc () { - static char *desc = "An implementation of the Jacchia71-Gill (J71C) atmospheric model. This uses a static US Standard Atmosphere model up to 90km, and a diffusion-equilibrium solution from 90 to 2500km altitude.\r\n\r\nSee Doc\\Technotes\\earth_atm.pdf for details."; - return desc; + return (char*)"An implementation of the Jacchia71-Gill (J71C) atmospheric model. This uses a static US Standard Atmosphere model up to 90km, and a diffusion-equilibrium solution from 90 to 2500km altitude.\r\n\r\nSee Doc\\Technotes\\earth_atm.pdf for details."; } \ No newline at end of file diff --git a/Src/Celbody/Vsop87/Earth/Atmosphere/EarthAtmNRLMSISE00/EarthAtmNRLMSISE00.cpp b/Src/Celbody/Vsop87/Earth/Atmosphere/EarthAtmNRLMSISE00/EarthAtmNRLMSISE00.cpp index 90ecb5745..13c2ee64e 100644 --- a/Src/Celbody/Vsop87/Earth/Atmosphere/EarthAtmNRLMSISE00/EarthAtmNRLMSISE00.cpp +++ b/Src/Celbody/Vsop87/Earth/Atmosphere/EarthAtmNRLMSISE00/EarthAtmNRLMSISE00.cpp @@ -18,8 +18,7 @@ EarthAtmosphere_NRLMSISE00::EarthAtmosphere_NRLMSISE00 (CELBODY2 *body): ATMOSPH const char *EarthAtmosphere_NRLMSISE00::clbkName () const { - static char *name = "NRLMSISE00"; - return name; + return "NRLMSISE00"; } bool EarthAtmosphere_NRLMSISE00::clbkConstants (ATMCONST *atmc) const @@ -123,12 +122,10 @@ DLLCLBK void DeleteAtmosphere (ATMOSPHERE *atm) DLLCLBK char *ModelName () { - static char *name = "NRLMSIS-00 atmosphere model"; - return name; + return (char*)"NRLMSIS-00 atmosphere model"; } DLLCLBK char *ModelDesc () { - static char *desc = "An empirical atmosphere model developed by Mike Picone, Alan Hedin, and Doug Drob based on the MSISE90 model. The MSISE90 model describes the neutral temperature and densities in Earth's atmosphere from ground to thermospheric heights.\r\n\r\nSee Doc\\Technotes\\earth_atm.pdf for details."; - return desc; + return (char*)"An empirical atmosphere model developed by Mike Picone, Alan Hedin, and Doug Drob based on the MSISE90 model. The MSISE90 model describes the neutral temperature and densities in Earth's atmosphere from ground to thermospheric heights.\r\n\r\nSee Doc\\Technotes\\earth_atm.pdf for details."; } \ No newline at end of file diff --git a/Src/Celbody/Vsop87/Mars/Atmosphere/MarsAtm2006/MarsAtm2006.cpp b/Src/Celbody/Vsop87/Mars/Atmosphere/MarsAtm2006/MarsAtm2006.cpp index e6de79bb7..bad16ad91 100644 --- a/Src/Celbody/Vsop87/Mars/Atmosphere/MarsAtm2006/MarsAtm2006.cpp +++ b/Src/Celbody/Vsop87/Mars/Atmosphere/MarsAtm2006/MarsAtm2006.cpp @@ -21,8 +21,7 @@ bool MarsAtmosphere_2006::clbkConstants (ATMCONST *atmc) const const char *MarsAtmosphere_2006::clbkName () const { - static char *name = "2006 Edition model"; - return name; + return "2006 Edition model"; } bool MarsAtmosphere_2006::clbkParams (const PRM_IN *prm_in, PRM_OUT *prm) @@ -101,12 +100,10 @@ DLLCLBK void DeleteAtmosphere (ATMOSPHERE *atm) DLLCLBK char *ModelName () { - static char *name = "Orbiter 2006 Mars atmosphere model"; - return name; + return (char*)"Orbiter 2006 Mars atmosphere model"; } DLLCLBK char *ModelDesc () { - static char *desc = "A simple static Mars atmosphere model. This is the model used in Orbiter 2006."; - return desc; + return (char*)"A simple static Mars atmosphere model. This is the model used in Orbiter 2006."; } \ No newline at end of file diff --git a/Src/Celbody/Vsop87/Venus/Atmosphere/VenusAtm2006/VenusAtm2006.cpp b/Src/Celbody/Vsop87/Venus/Atmosphere/VenusAtm2006/VenusAtm2006.cpp index 6351d448b..5a1d78124 100644 --- a/Src/Celbody/Vsop87/Venus/Atmosphere/VenusAtm2006/VenusAtm2006.cpp +++ b/Src/Celbody/Vsop87/Venus/Atmosphere/VenusAtm2006/VenusAtm2006.cpp @@ -21,8 +21,7 @@ bool VenusAtmosphere_2006::clbkConstants (ATMCONST *atmc) const const char *VenusAtmosphere_2006::clbkName () const { - static char *name = "2006 Edition model"; - return name; + return "2006 Edition model"; } bool VenusAtmosphere_2006::clbkParams (const PRM_IN *prm_in, PRM_OUT *prm) @@ -92,12 +91,10 @@ DLLCLBK void DeleteAtmosphere (ATMOSPHERE *atm) DLLCLBK char *ModelName () { - static char *name = "Orbiter 2006 Venus atmosphere model"; - return name; + return (char*)"Orbiter 2006 Venus atmosphere model"; } DLLCLBK char *ModelDesc () { - static char *desc = "A simple static Venus atmosphere model. This is the model used in Orbiter 2006."; - return desc; + return (char*)"A simple static Venus atmosphere model. This is the model used in Orbiter 2006."; } \ No newline at end of file diff --git a/Src/Celbody/Vsop87/Vsop87.cpp b/Src/Celbody/Vsop87/Vsop87.cpp index 3731ca4fd..1af896999 100644 --- a/Src/Celbody/Vsop87/Vsop87.cpp +++ b/Src/Celbody/Vsop87/Vsop87.cpp @@ -45,8 +45,8 @@ bool VSOPOBJ::bEphemeris () const void VSOPOBJ::clbkInit (FILEHANDLE cfg) { CELBODY2::clbkInit (cfg); - oapiReadItem_float (cfg, "ErrorLimit", prec); // read custom precision from config file - oapiReadItem_float (cfg, "SamplingInterval", interval); + oapiReadItem_float (cfg, (char*)"ErrorLimit", prec); // read custom precision from config file + oapiReadItem_float (cfg, (char*)"SamplingInterval", interval); } void VSOPOBJ::SetSeries (char series) @@ -57,7 +57,7 @@ void VSOPOBJ::SetSeries (char series) if (sid == 'E') fmtflag |= EPHEM_PARENTBARY; } -bool VSOPOBJ::ReadData (char *name) +bool VSOPOBJ::ReadData (const char *name) { int nterm, cooidx, alpha, i, iused, nused = 0, ntot = 0; double a, b, c, tfac, err; diff --git a/Src/Celbody/Vsop87/Vsop87.h b/Src/Celbody/Vsop87/Vsop87.h index 2c4d83fdd..581dd04a7 100644 --- a/Src/Celbody/Vsop87/Vsop87.h +++ b/Src/Celbody/Vsop87/Vsop87.h @@ -28,7 +28,7 @@ class DLLEXPORT VSOPOBJ: public CELBODY2 { void SetSeries (char series); // Set VSOP series ('A' to 'E') - bool ReadData (char *name); + bool ReadData (const char *name); // Read perturbation terms up to required accuracy from data file void Init (); diff --git a/Src/Module/LuaScript/LuaInline/LuaInline.cpp b/Src/Module/LuaScript/LuaInline/LuaInline.cpp index bf02d2be4..8620a16a3 100644 --- a/Src/Module/LuaScript/LuaInline/LuaInline.cpp +++ b/Src/Module/LuaScript/LuaInline/LuaInline.cpp @@ -47,7 +47,7 @@ InterpreterList::Environment::~Environment() interp->EndExec(); // give the thread opportunity to close if (WaitForSingleObject (hThread, 1000) != 0) { - oapiWriteLog("LuaInline: timeout while waiting for interpreter thread"); + oapiWriteLog((char*)"LuaInline: timeout while waiting for interpreter thread"); TerminateThread (hThread, 0); } CloseHandle (hThread); diff --git a/Src/Module/LuaScript/LuaInterpreter/Interpreter.cpp b/Src/Module/LuaScript/LuaInterpreter/Interpreter.cpp index 60fa8dffb..5be81a08b 100644 --- a/Src/Module/LuaScript/LuaInterpreter/Interpreter.cpp +++ b/Src/Module/LuaScript/LuaInterpreter/Interpreter.cpp @@ -16,6 +16,7 @@ Module oapi: General Orbiter API interface functions std::list g_notehandles; +int OpenHelp (void *context); // ============================================================================ // nonmember functions @@ -412,7 +413,7 @@ MATRIX3 Interpreter::lua_tomatrix (lua_State *L, int idx) int Interpreter::lua_ismatrix (lua_State *L, int idx) { if (!lua_istable (L, idx)) return 0; - static char *fieldname[9] = {"m11","m12","m13","m21","m22","m23","m31","m32","m33"}; + static const char *fieldname[9] = {"m11","m12","m13","m21","m22","m23","m31","m32","m33"}; int i, ii, n; bool fail; @@ -1087,7 +1088,7 @@ void Interpreter::warn_obsolete(lua_State *L, const char *funcname) int Interpreter::AssertPrmtp(lua_State *L, const char *fname, int idx, int prm, int tp) { - char *tpname = ""; + char *tpname = (char*)""; char cbuf[1024]; int res = 1; @@ -1099,31 +1100,31 @@ int Interpreter::AssertPrmtp(lua_State *L, const char *fname, int idx, int prm, switch (tp) { case PRMTP_NUMBER: - tpname = "number"; + tpname = (char*)"number"; res = lua_isnumber(L,idx); break; case PRMTP_VECTOR: - tpname = "vector"; + tpname = (char*)"vector"; res = lua_isvector(L,idx); break; case PRMTP_STRING: - tpname = "string"; + tpname = (char*)"string"; res = lua_isstring(L,idx); break; case PRMTP_LIGHTUSERDATA: - tpname = "handle"; + tpname = (char*)"handle"; res = lua_islightuserdata(L,idx); break; case PRMTP_TABLE: - tpname = "table"; + tpname = (char*)"table"; res = lua_istable(L,idx); break; case PRMTP_BOOLEAN: - tpname = "boolean"; + tpname = (char*)"boolean"; res = lua_isboolean(L, idx); break; case PRMTP_MATRIX: - tpname = "matrix"; + tpname = (char*)"matrix"; res = lua_ismatrix(L, idx); break; } @@ -1244,7 +1245,7 @@ int Interpreter::help (lua_State *L) if (!narg) { if (!interp->is_term) return 0; // no terminal help without terminal - sorry static const int nline = 10; - static char *stdhelp[nline] = { + static const char *stdhelp[nline] = { "Orbiter script interpreter", "Based on Lua script language (" LUA_RELEASE ")", " " LUA_COPYRIGHT, diff --git a/Src/Module/LuaScript/LuaInterpreter/lua_vessel_mtd.cpp b/Src/Module/LuaScript/LuaInterpreter/lua_vessel_mtd.cpp index 5cb54276f..1422e80bc 100644 --- a/Src/Module/LuaScript/LuaInterpreter/lua_vessel_mtd.cpp +++ b/Src/Module/LuaScript/LuaInterpreter/lua_vessel_mtd.cpp @@ -62,7 +62,7 @@ TOUCHDOWNVTX Interpreter::lua_totouchdownvtx (lua_State *L, int idx) int Interpreter::lua_istouchdownvtx (lua_State *L, int idx) { if (!lua_istable(L, idx)) return 0; - static char *fieldname[5] = { "pos", "stiffness", "damping", "mu", "mu_lng" }; + static const char *fieldname[5] = { "pos", "stiffness", "damping", "mu", "mu_lng" }; int i, ii, n; bool fail; @@ -642,7 +642,7 @@ General properties int Interpreter::v_version (lua_State *L) { - static char *funcname = "version"; + static const char *funcname = "version"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushinteger(L, v->Version()); @@ -657,7 +657,7 @@ Returns a handle to the vessel object. */ int Interpreter::v_get_handle (lua_State *L) { - static char *funcname = "get_handle"; + static const char *funcname = "get_handle"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); const OBJHANDLE hV = v->GetHandle(); @@ -684,7 +684,7 @@ or */ int Interpreter::v_get_name (lua_State *L) { - static char *funcname = "get_name"; + static const char *funcname = "get_name"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushstring (L, v->GetName()); @@ -702,7 +702,7 @@ The class name identifies the vessel type. */ int Interpreter::v_get_classname (lua_State *L) { - static char *funcname = "get_classname"; + static const char *funcname = "get_classname"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushstring (L, v->GetClassName()); @@ -730,7 +730,7 @@ and higher thrust ratings in the simplified model, less severe damage limits, et */ int Interpreter::v_get_flightmodel (lua_State *L) { - static char *funcname = "get_flightmodel"; + static const char *funcname = "get_flightmodel"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetFlightModel()); @@ -760,7 +760,7 @@ failures. */ int Interpreter::v_get_damagemodel (lua_State *L) { - static char *funcname = "get_damagemodel"; + static const char *funcname = "get_damagemodel"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetDamageModel()); @@ -790,7 +790,7 @@ not be useful. */ int Interpreter::v_get_enablefocus (lua_State *L) { - static char *funcname = "get_enablefocus"; + static const char *funcname = "get_enablefocus"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushboolean (L, v->GetEnableFocus()); @@ -820,7 +820,7 @@ not be useful. */ int Interpreter::v_set_enablefocus (lua_State *L) { - static char *funcname = "set_enablefocus"; + static const char *funcname = "set_enablefocus"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); bool enable = luamtd_toboolean_safe(L, 2, funcname); @@ -839,7 +839,7 @@ Provides an approximate measure of the vessel size. */ int Interpreter::v_get_size (lua_State *L) { - static char *funcname = "get_size"; + static const char *funcname = "get_size"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetSize()); @@ -866,7 +866,7 @@ for vessels entirely configured by Lua script (see ScriptVessel). */ int Interpreter::v_set_size (lua_State *L) { - static char *funcname = "set_size"; + static const char *funcname = "set_size"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_Number size = luamtd_tonumber_safe(L, 2, funcname); @@ -883,7 +883,7 @@ Returns the vessel's empty (dry) mass, excluding propellant mass. */ int Interpreter::v_get_emptymass (lua_State *L) { - static char *funcname = "get_emptymass"; + static const char *funcname = "get_emptymass"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetEmptyMass()); @@ -906,7 +906,7 @@ separation, but not for fuel consumption, which is done directly by Orbiter. */ int Interpreter::v_set_emptymass (lua_State *L) { - static char *funcname = "set_emptymass"; + static const char *funcname = "set_emptymass"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_Number emass = luamtd_tonumber_safe(L, 2, funcname); @@ -940,7 +940,7 @@ For more details, see Doc\Technotes\composite.pdf. */ int Interpreter::v_get_pmi (lua_State *L) { - static char *funcname = "get_pmi"; + static const char *funcname = "get_pmi"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 pmi; @@ -963,7 +963,7 @@ For more details, see Doc\Technotes\composite.pdf. */ int Interpreter::v_set_pmi (lua_State *L) { - static char *funcname = "set_pmi"; + static const char *funcname = "set_pmi"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 pmi = luamtd_tovector_safe(L, 2, funcname); @@ -980,7 +980,7 @@ Returns the vessel's cross sections projected in the direction of the vessel's p */ int Interpreter::v_get_crosssections (lua_State *L) { - static char *funcname = "get_crosssections"; + static const char *funcname = "get_crosssections"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 cs; @@ -1000,7 +1000,7 @@ z-axis into the xy plane, respectively [m²] */ int Interpreter::v_set_crosssections (lua_State *L) { - static char *funcname = "set_crosssections"; + static const char *funcname = "set_crosssections"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 cs = luamtd_tovector_safe(L, 2, funcname); @@ -1027,7 +1027,7 @@ function always returns 0. */ int Interpreter::v_get_gravitygradientdamping (lua_State *L) { - static char *funcname = "get_gravitygradientdamping"; + static const char *funcname = "get_gravitygradientdamping"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double ggd = v->GetGravityGradientDamping(); @@ -1048,7 +1048,7 @@ function returns false and has no other effect. */ int Interpreter::v_set_gravitygradientdamping (lua_State *L) { - static char *funcname = "set_gravitygradientdamping"; + static const char *funcname = "set_gravitygradientdamping"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double ggd = luamtd_tonumber_safe(L, 2, funcname); @@ -1065,7 +1065,7 @@ Returns the number of touchdown points defining the impact hull of the vessel. */ int Interpreter::v_get_touchdownpointcount (lua_State *L) { - static char *funcname = "get_touchdownpointcount"; + static const char *funcname = "get_touchdownpointcount"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushinteger(L, v->GetTouchdownPointCount()); @@ -1086,7 +1086,7 @@ points when touched down on a planetary surface (e.g. landing gear). */ int Interpreter::v_get_touchdownpoints (lua_State *L) { - static char *funcname = "get_touchdownpoints"; + static const char *funcname = "get_touchdownpoints"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); @@ -1137,7 +1137,7 @@ by small amounts over time (proportional to simulation time steps). */ int Interpreter::v_set_touchdownpoints (lua_State *L) { - static char *funcname = "set_touchdownpoints"; + static const char *funcname = "set_touchdownpoints"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); @@ -1217,7 +1217,7 @@ spotlimit = 1e-3. */ int Interpreter::v_set_visibilitylimit (lua_State *L) { - static char *funcname = "set_visibilitylimit"; + static const char *funcname = "set_visibilitylimit"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double vislimit, spotlimit = -1.0; @@ -1260,7 +1260,7 @@ representation [m]. */ int Interpreter::v_get_clipradius (lua_State *L) { - static char *funcname = "get_clipradius"; + static const char *funcname = "get_clipradius"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); @@ -1289,7 +1289,7 @@ for each component. */ int Interpreter::v_set_albedoRGB (lua_State *L) { - static char *funcname = "set_albedoRGB"; + static const char *funcname = "set_albedoRGB"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 albedo = luamtd_tovector_safe(L, 2, funcname); @@ -1334,7 +1334,7 @@ representation [m]. */ int Interpreter::v_set_clipradius (lua_State *L) { - static char *funcname = "set_clipradius"; + static const char *funcname = "set_clipradius"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double rad = luamtd_tonumber_safe(L ,2, funcname); @@ -1376,7 +1376,7 @@ The longitudinal and lateral directions are defined by the */ int Interpreter::v_set_surfacefrictioncoeff (lua_State *L) { - static char *funcname = "set_surfacefrictioncoeff"; + static const char *funcname = "set_surfacefrictioncoeff"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double mu_lng = luamtd_tonumber_safe(L, 2, funcname); @@ -1401,7 +1401,7 @@ By definition, the vessel's centre of gravity coincides with the */ int Interpreter::v_get_COG_elev (lua_State *L) { - static char *funcname = "get_COG_elev"; + static const char *funcname = "get_COG_elev"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber(L, v->GetCOG_elev()); @@ -1422,7 +1422,7 @@ Returns the vessel's current total mass. */ int Interpreter::v_get_mass (lua_State *L) { - static char *funcname = "get_mass"; + static const char *funcname = "get_mass"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetMass()); @@ -1442,7 +1442,7 @@ ecliptic frame at epoch J2000.0. */ int Interpreter::v_get_globalpos (lua_State *L) { - static char *funcname = "get_globalpos"; + static const char *funcname = "get_globalpos"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 pos; @@ -1463,7 +1463,7 @@ ecliptic frame at epoch J2000.0. */ int Interpreter::v_get_globalvel (lua_State *L) { - static char *funcname = "get_globalvel"; + static const char *funcname = "get_globalvel"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 vel; @@ -1487,7 +1487,7 @@ Results are returned in the ecliptic frame (ecliptic and equinox of J2000.0). */ int Interpreter::v_get_relativepos (lua_State *L) { - static char *funcname = "get_relativepos"; + static const char *funcname = "get_relativepos"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); OBJHANDLE hRef = (OBJHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -1512,7 +1512,7 @@ Results are returned in the ecliptic frame (ecliptic and equinox of J2000.0). */ int Interpreter::v_get_relativevel (lua_State *L) { - static char *funcname = "get_relativevel"; + static const char *funcname = "get_relativevel"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); OBJHANDLE hRef = (OBJHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -1548,7 +1548,7 @@ origin at the solar system's barycentre. */ int Interpreter::v_get_rotationmatrix (lua_State *L) { - static char *funcname = "get_rotationmatrix"; + static const char *funcname = "get_rotationmatrix"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); MATRIX3 rot; @@ -1564,7 +1564,7 @@ To be documented */ int Interpreter::v_get_status (lua_State *L) { - static char *funcname = "get_status"; + static const char *funcname = "get_status"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); @@ -1606,7 +1606,7 @@ To be documented */ int Interpreter::v_defset_status (lua_State *L) { - static char *funcname = "defset_status"; + static const char *funcname = "defset_status"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); @@ -1808,7 +1808,7 @@ as a vector. */ int Interpreter::v_get_angvel (lua_State *L) { - static char *funcname = "get_angvel"; + static const char *funcname = "get_angvel"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 av; @@ -1826,7 +1826,7 @@ Sets the vessel's angular velocity components around its principal axes. */ int Interpreter::v_set_angvel (lua_State *L) { - static char *funcname = "set_angvel"; + static const char *funcname = "set_angvel"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 av = luamtd_tovector_safe(L, 2, funcname); @@ -1847,7 +1847,7 @@ Otherwise it returns nil. */ int Interpreter::v_is_landed (lua_State *L) { - static char *funcname = "is_landed"; + static const char *funcname = "is_landed"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DWORD status = v->GetFlightStatus(); @@ -1870,7 +1870,7 @@ reference points is in contact with a planet surface). */ int Interpreter::v_get_groundcontact (lua_State *L) { - static char *funcname = "get_groundcontact"; + static const char *funcname = "get_groundcontact"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushboolean (L, v->GroundContact() ? 1:0); @@ -1891,7 +1891,7 @@ The returned vector contains the angular accelerations */ int Interpreter::v_get_angularacc (lua_State *L) { - static char *funcname = "get_angularacc"; + static const char *funcname = "get_angularacc"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 aacc; @@ -1912,7 +1912,7 @@ The returned vector is the vector sum of all forces (gravity, */ int Interpreter::v_get_linearmoment (lua_State *L) { - static char *funcname = "get_linearmoment"; + static const char *funcname = "get_linearmoment"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 F; @@ -1936,7 +1936,7 @@ Given all force components Fi acting on the vessel at */ int Interpreter::v_get_angularmoment (lua_State *L) { - static char *funcname = "get_angularmoment"; + static const char *funcname = "get_angularmoment"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 amom; @@ -1971,7 +1971,7 @@ The components of the returned vector arot = \f$ (\alpha, \beta, \gamma) \f$ */ int Interpreter::v_get_globalorientation (lua_State *L) { - static char *funcname = "get_globalorientation"; + static const char *funcname = "get_globalorientation"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 arot; @@ -1998,7 +1998,7 @@ Given the rotation matrix R which transforms from the */ int Interpreter::v_set_globalorientation (lua_State *L) { - static char *funcname = "set_globalorientation"; + static const char *funcname = "set_globalorientation"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 arot = luamtd_tovector_safe(L, 2, funcname); @@ -2027,7 +2027,7 @@ Stabilised mode reduces the effect of deteriorating orbits due */ int Interpreter::v_is_orbitstabilised (lua_State *L) { - static char *funcname = "is_orbitstabilised"; + static const char *funcname = "is_orbitstabilised"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushboolean(L, v->OrbitStabilised()); @@ -2056,7 +2056,7 @@ If the user has enabled orbit stabilisation in the Launchpad, */ int Interpreter::v_is_nonsphericalgravityenabled (lua_State *L) { - static char *funcname = "is_nonsphericalgravityenabled"; + static const char *funcname = "is_nonsphericalgravityenabled"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushboolean(L, v->NonsphericalGravityEnabled()); @@ -2074,7 +2074,7 @@ Toggles a navigation mode on/off. */ int Interpreter::v_toggle_navmode (lua_State *L) { - static char *funcname = "toggle_navmode"; + static const char *funcname = "toggle_navmode"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int mode = luamtd_tointeger_safe(L, 2, funcname); @@ -2098,7 +2098,7 @@ If the function returns false, the values pointed to by alt and */ int Interpreter::v_get_hoverholdaltitude (lua_State *L) { - static char *funcname = "get_hoverholdaltitude"; + static const char *funcname = "get_hoverholdaltitude"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double alt = 0; @@ -2133,7 +2133,7 @@ To deactivate the hover hold alt program, use */ int Interpreter::v_set_hoverholdaltitude (lua_State *L) { - static char *funcname = "set_hoverholdaltitude"; + static const char *funcname = "set_hoverholdaltitude"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double alt = luamtd_tonumber_safe(L, 2, funcname); @@ -2158,7 +2158,7 @@ vessel's current position. */ int Interpreter::v_get_gravityref (lua_State *L) { - static char *funcname = "get_gravityref"; + static const char *funcname = "get_gravityref"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushlightuserdata (L, v->GetGravityRef()); @@ -2177,7 +2177,7 @@ The returned mean longitude parameter (L) refers to the the current epoch. */ int Interpreter::v_get_elements (lua_State *L) { - static char *funcname = "get_elements"; + static const char *funcname = "get_elements"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); ELEMENTS el; @@ -2210,7 +2210,7 @@ The returned mean longitude parameter (L) refers to the the current epoch. */ int Interpreter::v_get_elementsex (lua_State *L) { - static char *funcname = "get_elementsex"; + static const char *funcname = "get_elementsex"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); ELEMENTS el; @@ -2288,7 +2288,7 @@ Default: 0. */ int Interpreter::v_set_elements (lua_State *L) { - static char *funcname = "set_elements"; + static const char *funcname = "set_elements"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); @@ -2338,7 +2338,7 @@ vessel's frame of reference. */ int Interpreter::v_get_progradedir (lua_State *L) { - static char *funcname = "get_progradedir"; + static const char *funcname = "get_progradedir"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); OBJHANDLE hRef = v->GetGravityRef(); @@ -2366,7 +2366,7 @@ The semi-minor axis is the smallest semi-diameter of the */ int Interpreter::v_get_smi (lua_State *L) { - static char *funcname = "get_smi"; + static const char *funcname = "get_smi"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double smi; @@ -2395,7 +2395,7 @@ The argument of periapsis is the angle between periapsis and the */ int Interpreter::v_get_argper (lua_State *L) { - static char *funcname = "get_argper"; + static const char *funcname = "get_argper"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double arg; @@ -2424,7 +2424,7 @@ The periapsis distance is the smallest radius of the orbit (see */ int Interpreter::v_get_pedist (lua_State *L) { - static char *funcname = "get_pedist"; + static const char *funcname = "get_pedist"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double pedist; @@ -2453,7 +2453,7 @@ The apoapsis distance is the largest radius of the orbit (see */ int Interpreter::v_get_apdist (lua_State *L) { - static char *funcname = "get_apdist"; + static const char *funcname = "get_apdist"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double apdist; @@ -2486,7 +2486,7 @@ closest to the current vessel position. */ int Interpreter::v_get_surfaceref (lua_State *L) { - static char *funcname = "get_surfaceref"; + static const char *funcname = "get_surfaceref"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushlightuserdata (L, v->GetSurfaceRef()); @@ -2515,7 +2515,7 @@ closest to the current vessel position. */ int Interpreter::v_get_altitude (lua_State *L) { - static char *funcname = "get_altitude"; + static const char *funcname = "get_altitude"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); AltitudeMode mode = ALTMODE_MEANRAD; @@ -2541,7 +2541,7 @@ vessel's positive z-axis and the normal to the local horizon. */ int Interpreter::v_get_pitch (lua_State *L) { - static char *funcname = "get_pitch"; + static const char *funcname = "get_pitch"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetPitch()); @@ -2562,7 +2562,7 @@ into the x-y plane. */ int Interpreter::v_get_bank (lua_State *L) { - static char *funcname = "get_bank"; + static const char *funcname = "get_bank"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetBank()); @@ -2583,7 +2583,7 @@ the local horizon "north" direction. */ int Interpreter::v_get_yaw (lua_State *L) { - static char *funcname = "get_yaw"; + static const char *funcname = "get_yaw"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetYaw()); @@ -2600,7 +2600,7 @@ latitude above the reference radius. */ int Interpreter::v_get_surfaceelevation (lua_State *L) { - static char *funcname = "get_surfaceelevation"; + static const char *funcname = "get_surfaceelevation"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber(L, v->GetSurfaceElevation()); @@ -2616,7 +2616,7 @@ current position. */ int Interpreter::v_get_surfacenormal (lua_State *L) { - static char *funcname = "get_surfacenormal"; + static const char *funcname = "get_surfacenormal"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushvector(L, v->GetSurfaceNormal()); @@ -2638,7 +2638,7 @@ currently moving through, or nil if the vessel is not inside an atmosphere. */ int Interpreter::v_get_atmref (lua_State *L) { - static char *funcname = "get_atmref"; + static const char *funcname = "get_atmref"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); OBJHANDLE hA = v->GetAtmRef(); @@ -2659,7 +2659,7 @@ as defined by the planets' AtmAltLimit parameters. */ int Interpreter::v_get_atmtemperature (lua_State *L) { - static char *funcname = "get_atmtemperature"; + static const char *funcname = "get_atmtemperature"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double temp = v->GetAtmTemperature(); @@ -2679,7 +2679,7 @@ as defined by the planets' AtmAltLimit parameters. */ int Interpreter::v_get_atmdensity (lua_State *L) { - static char *funcname = "get_atmdensity"; + static const char *funcname = "get_atmdensity"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double rho = v->GetAtmDensity(); @@ -2699,7 +2699,7 @@ as defined by the planets' AtmAltLimit parameters. */ int Interpreter::v_get_atmpressure (lua_State *L) { - static char *funcname = "get_atmpressure"; + static const char *funcname = "get_atmpressure"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double p = v->GetAtmPressure(); @@ -2724,7 +2724,7 @@ airflow vector V. */ int Interpreter::v_get_dynpressure (lua_State *L) { - static char *funcname = "get_dynpressure"; + static const char *funcname = "get_dynpressure"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetDynPressure()); @@ -2745,7 +2745,7 @@ over speed of sound. */ int Interpreter::v_get_machnumber (lua_State *L) { - static char *funcname = "get_machnumber"; + static const char *funcname = "get_machnumber"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetMachNumber()); @@ -2764,7 +2764,7 @@ vessel location fixed in the reference planet's frame of reference. */ int Interpreter::v_get_groundspeed (lua_State *L) { - static char *funcname = "get_groundspeed"; + static const char *funcname = "get_groundspeed"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetGroundspeed ()); @@ -2789,7 +2789,7 @@ Valid entries for frame are: */ int Interpreter::v_get_groundspeedvector (lua_State *L) { - static char *funcname = "get_groundspeedvector"; + static const char *funcname = "get_groundspeedvector"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); REFFRAME frame = (REFFRAME)lua_tointeger_safe(L, 2, funcname); @@ -2812,7 +2812,7 @@ from ground speed, since an atmospheric drag effect is assumed. */ int Interpreter::v_get_airspeed (lua_State *L) { - static char *funcname = "get_airspeed"; + static const char *funcname = "get_airspeed"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetAirspeed ()); @@ -2837,7 +2837,7 @@ Valid entries for frame are: */ int Interpreter::v_get_airspeedvector (lua_State *L) { - static char *funcname = "get_airspeedvector"; + static const char *funcname = "get_airspeedvector"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); REFFRAME frame = (REFFRAME)luamtd_tointeger_safe(L, 2, funcname); @@ -2850,7 +2850,7 @@ int Interpreter::v_get_airspeedvector (lua_State *L) // intentionally not documented int Interpreter::v_get_shipairspeedvector (lua_State *L) { - static char *funcname = "get_shipairspeedvector"; + static const char *funcname = "get_shipairspeedvector"; warn_obsolete(L, funcname); AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); @@ -2863,7 +2863,7 @@ int Interpreter::v_get_shipairspeedvector (lua_State *L) // intentionally not documented int Interpreter::v_get_horizonairspeedvector (lua_State *L) { - static char *funcname = "get_horizonairspeedvector"; + static const char *funcname = "get_horizonairspeedvector"; warn_obsolete(L, funcname); AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); @@ -2886,7 +2886,7 @@ coordinate system. */ int Interpreter::v_get_aoa (lua_State *L) { - static char *funcname = "get_aoa"; + static const char *funcname = "get_aoa"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetAOA()); @@ -2906,7 +2906,7 @@ and the vessel's longitudinal axis. */ int Interpreter::v_get_slipangle (lua_State *L) { - static char *funcname = "get_slipangle"; + static const char *funcname = "get_slipangle"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetSlipAngle()); @@ -3003,7 +3003,7 @@ not support lift forces. */ int Interpreter::v_create_airfoil (lua_State *L) { - static char *funcname = "create_airfoil"; + static const char *funcname = "create_airfoil"; AssertMtdMinPrmCount(L, 7, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); AIRFOIL_ORIENTATION ao = (AIRFOIL_ORIENTATION)(int)(luamtd_tointeger_safe(L, 2, funcname)); @@ -3022,7 +3022,7 @@ int Interpreter::v_create_airfoil (lua_State *L) int Interpreter::v_edit_airfoil (lua_State *L) { - static char *funcname = "edit_airfoil"; + static const char *funcname = "edit_airfoil"; AssertMtdMinPrmCount(L, 7, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); @@ -3059,7 +3059,7 @@ the obsolete legacy atmospheric flight model. */ int Interpreter::v_del_airfoil (lua_State *L) { - static char *funcname = "del_airfoil"; + static const char *funcname = "del_airfoil"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); AIRFOILHANDLE ha = (AIRFOILHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -3115,7 +3115,7 @@ with neutral surface position at state 0.5. */ int Interpreter::v_create_controlsurface (lua_State *L) { - static char *funcname = "create_controlsurface"; + static const char *funcname = "create_controlsurface"; AssertMtdMinPrmCount(L, 5, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); AIRCTRL_TYPE type = (AIRCTRL_TYPE)luamtd_tointeger_safe(L, 2, funcname); @@ -3163,7 +3163,7 @@ surfaces. */ int Interpreter::v_get_adcmode (lua_State *L) { - static char *funcname = "get_adcmode"; + static const char *funcname = "get_adcmode"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int mode = v->GetADCtrlMode(); @@ -3189,7 +3189,7 @@ all control surfaces. */ int Interpreter::v_set_adcmode (lua_State *L) { - static char *funcname = "set_adcmode"; + static const char *funcname = "set_adcmode"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); ASSERT_MTDNUMBER(L,2); @@ -3212,7 +3212,7 @@ call to @{set_adclevel}. */ int Interpreter::v_get_adclevel (lua_State *L) { - static char *funcname = "get_adclevel"; + static const char *funcname = "get_adclevel"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); AIRCTRL_TYPE surfid = (AIRCTRL_TYPE)luamtd_tointeger_safe(L, 2, funcname); @@ -3240,7 +3240,7 @@ clamped to the range [-1...+1] */ int Interpreter::v_set_adclevel (lua_State *L) { - static char *funcname = "set_adclevel"; + static const char *funcname = "set_adclevel"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); AIRCTRL_TYPE surfid = (AIRCTRL_TYPE)luamtd_tointeger_safe(L, 2, funcname); @@ -3274,7 +3274,7 @@ and vertical direction are assumed symmetric. */ int Interpreter::v_get_cw (lua_State *L) { - static char *funcname = "get_cw"; + static const char *funcname = "get_cw"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 cw; @@ -3308,7 +3308,7 @@ be assigned via vector operations, but the 'zn' field must be added manually. */ int Interpreter::v_set_cw (lua_State *L) { - static char *funcname = "set_cw"; + static const char *funcname = "set_cw"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 cw = luamtd_tovector_safe(L, 2, funcname); @@ -3333,7 +3333,7 @@ The aspect ratio is used in the calculation of induced drag. */ int Interpreter::v_get_wingaspect (lua_State *L) { - static char *funcname = "get_wingaspect"; + static const char *funcname = "get_wingaspect"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double aspect = v->GetWingAspect (); @@ -3356,7 +3356,7 @@ The aspect ratio is used in the calculation of induced drag. */ int Interpreter::v_set_wingaspect (lua_State *L) { - static char *funcname = "set_wingaspect"; + static const char *funcname = "set_wingaspect"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double aspect = luamtd_tonumber_safe(L, 2, funcname); @@ -3383,7 +3383,7 @@ rectangular wings. */ int Interpreter::v_get_wingeffectiveness (lua_State *L) { - static char *funcname = "get_wingeffectiveness"; + static const char *funcname = "get_wingeffectiveness"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double eff = v->GetWingEffectiveness (); @@ -3410,7 +3410,7 @@ rectangular wings. If set_wingeffectiveness is not called, the default value is */ int Interpreter::v_set_wingeffectiveness (lua_State *L) { - static char *funcname = "set_wingeffectiveness"; + static const char *funcname = "set_wingeffectiveness"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double eff = luamtd_tonumber_safe(L, 2, funcname); @@ -3436,7 +3436,7 @@ the vessel's cross section projected along the vertical (y) axis. */ int Interpreter::v_get_rotdrag (lua_State *L) { - static char *funcname = "get_rotdrag"; + static const char *funcname = "get_rotdrag"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 rd; @@ -3463,7 +3463,7 @@ the vessel's cross section projected along the vertical (y) axis. */ int Interpreter::v_set_rotdrag (lua_State *L) { - static char *funcname = "set_rotdrag"; + static const char *funcname = "set_rotdrag"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 rd = luamtd_tovector_safe(L, 2, funcname); @@ -3488,7 +3488,7 @@ been defined. */ int Interpreter::v_get_pitchmomentscale (lua_State *L) { - static char *funcname = "get_pitchmomentscale"; + static const char *funcname = "get_pitchmomentscale"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double pms = v->GetPitchMomentScale (); @@ -3515,7 +3515,7 @@ The default value is 0. */ int Interpreter::v_set_pitchmomentscale (lua_State *L) { - static char *funcname = "set_pitchmomentscale"; + static const char *funcname = "set_pitchmomentscale"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double pms = luamtd_tonumber_safe(L, 2, funcname); @@ -3539,7 +3539,7 @@ been defined. */ int Interpreter::v_get_yawmomentscale (lua_State *L) { - static char *funcname = "get_yawmomentscale"; + static const char *funcname = "get_yawmomentscale"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double yms = v->GetYawMomentScale (); @@ -3565,7 +3565,7 @@ The default value is 0. */ int Interpreter::v_set_yawmomentscale (lua_State *L) { - static char *funcname = "set_yawmomentscale"; + static const char *funcname = "set_yawmomentscale"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double yms = luamtd_tonumber_safe(L, 2, funcname); @@ -3586,7 +3586,7 @@ It is only used with the old atmospheric flight model (if no airfoils have been */ int Interpreter::v_get_trimscale (lua_State *L) { - static char *funcname = "get_trimscale"; + static const char *funcname = "get_trimscale"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double ts = v->GetTrimScale (); @@ -3609,7 +3609,7 @@ If ts is set to zero (default) the vessel does not have a pitch trim control. */ int Interpreter::v_set_trimscale (lua_State *L) { - static char *funcname = "set_trimscale"; + static const char *funcname = "set_trimscale"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double ts = luamtd_tonumber_safe(L, 2, funcname); @@ -3634,7 +3634,7 @@ Return value is the sum of lift components from all airfoils. */ int Interpreter::v_get_lift (lua_State *L) { - static char *funcname = "get_lift"; + static const char *funcname = "get_lift"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetLift()); @@ -3652,7 +3652,7 @@ Return value is the sum of drag components from all airfoils. */ int Interpreter::v_get_drag (lua_State *L) { - static char *funcname = "get_drag"; + static const char *funcname = "get_drag"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetDrag()); @@ -3675,7 +3675,7 @@ is returned. */ int Interpreter::v_get_weightvector (lua_State *L) { - static char *funcname = "get_weightvector"; + static const char *funcname = "get_weightvector"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 G; @@ -3701,7 +3701,7 @@ about the angular moment (torque) induced. */ int Interpreter::v_get_thrustvector (lua_State *L) { - static char *funcname = "get_thrustvector"; + static const char *funcname = "get_thrustvector"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 T; @@ -3724,7 +3724,7 @@ drag vector) and has zero x-component. */ int Interpreter::v_get_liftvector (lua_State *L) { - static char *funcname = "get_liftvector"; + static const char *funcname = "get_liftvector"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 Lf; @@ -3751,7 +3751,7 @@ The drag vector is parallel to the relative wind (direction of */ int Interpreter::v_get_dragvector (lua_State *L) { - static char *funcname = "get_dragvector"; + static const char *funcname = "get_dragvector"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 D; @@ -3779,7 +3779,7 @@ This may not be equal to the sum of weight, thrust, lift and */ int Interpreter::v_get_forcevector (lua_State *L) { - static char *funcname = "get_forcevector"; + static const char *funcname = "get_forcevector"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 F; @@ -3805,7 +3805,7 @@ On return, M contains the total torque vector acting on the */ int Interpreter::v_get_torquevector (lua_State *L) { - static char *funcname = "get_torquevector"; + static const char *funcname = "get_torquevector"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 M; @@ -3836,7 +3836,7 @@ The force is applied only for the next time step. add_force will */ int Interpreter::v_add_force (lua_State *L) { - static char *funcname = "add_force"; + static const char *funcname = "add_force"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 F = luamtd_tovector_safe(L, 2, funcname), @@ -3878,7 +3878,7 @@ If mass < 0 or not specified, then mass = maxmass is substituted. */ int Interpreter::v_create_propellantresource (lua_State *L) { - static char *funcname = "create_propellantresource"; + static const char *funcname = "create_propellantresource"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double maxmass = 1.0; @@ -3907,7 +3907,7 @@ to a new fuel resource. */ int Interpreter::v_del_propellantresource (lua_State *L) { - static char *funcname = "del_propellantresource"; + static const char *funcname = "del_propellantresource"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); PROPELLANT_HANDLE hPrp = (PROPELLANT_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -3926,7 +3926,7 @@ are linked to new resources. */ int Interpreter::v_clear_propellantresources (lua_State *L) { - static char *funcname = "clear_propellantresources"; + static const char *funcname = "clear_propellantresources"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); v->ClearPropellantResources(); @@ -3942,7 +3942,7 @@ Returns the current number of vessel propellant resources. */ int Interpreter::v_get_propellantcount (lua_State *L) { - static char *funcname = "get_propellantcount"; + static const char *funcname = "get_propellantcount"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DWORD n = v->GetPropellantCount(); @@ -3966,7 +3966,7 @@ handle remains valid until the corresponding resource is deleted. */ int Interpreter::v_get_propellanthandle (lua_State *L) { - static char *funcname = "get_propellanthandle"; + static const char *funcname = "get_propellanthandle"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int idx = luamtd_tointeger_safe(L, 2, funcname); @@ -3986,7 +3986,7 @@ Returns the maximum capacity of a propellant resource. */ int Interpreter::v_get_propellantmaxmass (lua_State *L) { - static char *funcname = "get_propellantmaxmass"; + static const char *funcname = "get_propellantmaxmass"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); PROPELLANT_HANDLE hp = (PROPELLANT_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4008,7 +4008,7 @@ mass is reduced to the maximum capacity. */ int Interpreter::v_set_propellantmaxmass (lua_State *L) { - static char *funcname = "set_propellantmaxmass"; + static const char *funcname = "set_propellantmaxmass"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); PROPELLANT_HANDLE hp = (PROPELLANT_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4029,7 +4029,7 @@ Returns the current mass of a propellant resource. */ int Interpreter::v_get_propellantmass (lua_State *L) { - static char *funcname = "get_propellantmass"; + static const char *funcname = "get_propellantmass"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); PROPELLANT_HANDLE hProp = (PROPELLANT_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4054,7 +4054,7 @@ internally by the Orbiter core). */ int Interpreter::v_set_propellantmass (lua_State *L) { - static char *funcname = "set_propellantmass"; + static const char *funcname = "set_propellantmass"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); PROPELLANT_HANDLE hp = (PROPELLANT_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4073,7 +4073,7 @@ Returns the vessel's current total propellant mass. */ int Interpreter::v_get_totalpropellantmass (lua_State *L) { - static char *funcname = "get_totalpropellantmass"; + static const char *funcname = "get_totalpropellantmass"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetTotalPropellantMass()); @@ -4094,7 +4094,7 @@ R [kg/s], thrust F [N], efficiency e and fuel-specific impulse Isp [m/s]. */ int Interpreter::v_get_propellantefficiency (lua_State *L) { - static char *funcname = "get_propellantefficiency"; + static const char *funcname = "get_propellantefficiency"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); PROPELLANT_HANDLE hp = (PROPELLANT_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4116,7 +4116,7 @@ R [kg/s], thrust F [N], efficiency e and fuel-specific impulse Isp [m/s]. */ int Interpreter::v_set_propellantefficiency (lua_State *L) { - static char *funcname = "set_propellantefficiency"; + static const char *funcname = "set_propellantefficiency"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); PROPELLANT_HANDLE hp = (PROPELLANT_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4139,7 +4139,7 @@ R [kg/s], thrust F [N], efficiency e and fuel-specific impulse Isp [m/s]. */ int Interpreter::v_get_propellantflowrate (lua_State *L) { - static char *funcname = "get_propellantflowrate"; + static const char *funcname = "get_propellantflowrate"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); PROPELLANT_HANDLE hp = (PROPELLANT_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4157,7 +4157,7 @@ Returns the current total mass flow rate, summed over all propellant resources. */ int Interpreter::v_get_totalpropellantflowrate (lua_State *L) { - static char *funcname = "get_totalpropellantflowrate"; + static const char *funcname = "get_totalpropellantflowrate"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double rate = v->GetTotalPropellantFlowrate (); @@ -4212,7 +4212,7 @@ _pr_=101.4e3 Pa is assumed (Earth surface pressure). */ int Interpreter::v_create_thruster (lua_State *L) { - static char *funcname = "create_thruster"; + static const char *funcname = "create_thruster"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); AssertMtdPrmType(L, 2, PRMTP_TABLE, funcname); @@ -4261,7 +4261,7 @@ All exhaust render definitions which refer to the deleted thruster are removed. */ int Interpreter::v_del_thruster (lua_State *L) { - static char *funcname = "del_thruster"; + static const char *funcname = "del_thruster"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4283,7 +4283,7 @@ It also removes all previously defined exhaust render definitions. */ int Interpreter::v_clear_thrusters (lua_State *L) { - static char *funcname = "clear_thrusters"; + static const char *funcname = "clear_thrusters"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); v->ClearThrusterDefinitions(); @@ -4299,7 +4299,7 @@ Returns the number of thrusters currently defined. */ int Interpreter::v_get_thrustercount (lua_State *L) { - static char *funcname = "get_thrustercount"; + static const char *funcname = "get_thrustercount"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DWORD count = v->GetThrusterCount(); @@ -4324,7 +4324,7 @@ remains valid until the corresponding thruster is deleted. */ int Interpreter::v_get_thrusterhandle (lua_State *L) { - static char *funcname = "get_thrusterhandle"; + static const char *funcname = "get_thrusterhandle"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int idx = luamtd_tointeger_safe(L, 2, funcname); @@ -4344,7 +4344,7 @@ Returns a handle for the propellant resource feeding the thruster. */ int Interpreter::v_get_thrusterresource (lua_State *L) { - static char *funcname = "get_thrusterresource"; + static const char *funcname = "get_thrusterresource"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4369,7 +4369,7 @@ To disconnect the thruster from its current tank, use _hProp_ = _nil_. */ int Interpreter::v_set_thrusterresource (lua_State *L) { - static char *funcname = "set_thrusterresource"; + static const char *funcname = "set_thrusterresource"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4392,7 +4392,7 @@ frame of reference. */ int Interpreter::v_get_thrusterpos (lua_State *L) { - static char *funcname = "get_thrusterpos"; + static const char *funcname = "get_thrusterpos"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4423,7 +4423,7 @@ thruster, but it affects the induced torque. */ int Interpreter::v_set_thrusterpos (lua_State *L) { - static char *funcname = "set_thrusterpos"; + static const char *funcname = "set_thrusterpos"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4442,7 +4442,7 @@ Returns the force direction of a thruster. */ int Interpreter::v_get_thrusterdir (lua_State *L) { - static char *funcname = "get_thrusterdir"; + static const char *funcname = "get_thrusterdir"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4465,7 +4465,7 @@ thruster gimbal mechanism) */ int Interpreter::v_set_thrusterdir (lua_State *L) { - static char *funcname = "set_thrusterdir"; + static const char *funcname = "set_thrusterdir"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4487,7 +4487,7 @@ presence of ambient atmospheric pressure), use @{get_thrustermax}. */ int Interpreter::v_get_thrustermax0 (lua_State *L) { - static char *funcname = "get_thrustermax0"; + static const char *funcname = "get_thrustermax0"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4509,7 +4509,7 @@ than the vacuum thrust if a pressure-dependent Isp value has been defined. */ int Interpreter::v_set_thrustermax0 (lua_State *L) { - static char *funcname = "set_thrustermax0"; + static const char *funcname = "set_thrustermax0"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4535,7 +4535,7 @@ current vessel position. */ int Interpreter::v_get_thrustermax (lua_State *L) { - static char *funcname = "get_thrustermax"; + static const char *funcname = "get_thrustermax"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4561,7 +4561,7 @@ Equivalent to @{get_thrusterisp} (hThruster,0). */ int Interpreter::v_get_thrusterisp0 (lua_State *L) { - static char *funcname = "get_thrusterisp0"; + static const char *funcname = "get_thrusterisp0"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4587,7 +4587,7 @@ vessel position. */ int Interpreter::v_get_thrusterisp (lua_State *L) { - static char *funcname = "get_thrusterisp"; + static const char *funcname = "get_thrusterisp"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4630,7 +4630,7 @@ The Isp rating at arbitrary pressure p is then computed as */ int Interpreter::v_set_thrusterisp (lua_State *L) { - static char *funcname = "set_thrusterisp"; + static const char *funcname = "set_thrusterisp"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4661,7 +4661,7 @@ level with the max. thrust rating returned by @{get_thrustermax}. */ int Interpreter::v_get_thrusterlevel (lua_State *L) { - static char *funcname = "get_thrusterlevel"; + static const char *funcname = "get_thrusterlevel"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4684,7 +4684,7 @@ joystick throttle control for main thrusters), which may override this function. */ int Interpreter::v_set_thrusterlevel (lua_State *L) { - static char *funcname = "set_thrusterlevel"; + static const char *funcname = "set_thrusterlevel"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4707,7 +4707,7 @@ range [0..1]. */ int Interpreter::v_inc_thrusterlevel (lua_State *L) { - static char *funcname = "inc_thrusterlevel"; + static const char *funcname = "inc_thrusterlevel"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4733,7 +4733,7 @@ This method overrides the thruster's permanent thrust level */ int Interpreter::v_set_thrusterlevel_singlestep (lua_State *L) { - static char *funcname = "set_thrusterlevel_singlestep"; + static const char *funcname = "set_thrusterlevel_singlestep"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE th = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4759,7 +4759,7 @@ setting. */ int Interpreter::v_inc_thrusterlevel_singlestep (lua_State *L) { - static char *funcname = "inc_thrusterlevel_singlestep"; + static const char *funcname = "inc_thrusterlevel_singlestep"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -4794,7 +4794,7 @@ If the _type_ parameter is omitted, THGROUP.USER is assumed. */ int Interpreter::v_create_thrustergroup (lua_State *L) { - static char *funcname = "create_thrustergroup"; + static const char *funcname = "create_thrustergroup"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); AssertMtdPrmType(L, 2, PRMTP_TABLE, funcname); @@ -4854,7 +4854,7 @@ However, thruster groups created with THGROUP.USER can only be deleted by handle */ int Interpreter::v_del_thrustergroup (lua_State *L) { - static char *funcname = "del_thrustergroup"; + static const char *funcname = "del_thrustergroup"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); AssertMtdPrmType(L, 2, PRMTP_NUMBER | PRMTP_LIGHTUSERDATA, funcname); @@ -4880,7 +4880,7 @@ If the requested thruster group is not defined by the vessel, this method return */ int Interpreter::v_get_thrustergrouphandle (lua_State *L) { - static char *funcname = "get_thrustergrouphandle"; + static const char *funcname = "get_thrustergrouphandle"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int i = luamtd_tointeger_safe(L, 2, funcname); @@ -4905,7 +4905,7 @@ groups, use @{get_thrustergrouphandle} instead. */ int Interpreter::v_get_thrustergrouphandlebyindex (lua_State *L) { - static char *funcname = "get_thrustergrouphandlebyindex"; + static const char *funcname = "get_thrustergrouphandlebyindex"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int idx = luamtd_tointeger_safe(L, 2, funcname); @@ -4932,7 +4932,7 @@ number of thrusters. */ int Interpreter::v_get_groupthrustercount (lua_State *L) { - static char *funcname = "get_groupthrustercount"; + static const char *funcname = "get_groupthrustercount"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int count; @@ -4962,7 +4962,7 @@ _nil_. */ int Interpreter::v_get_groupthruster (lua_State *L) { - static char *funcname = "get_groupthruster"; + static const char *funcname = "get_groupthruster"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int idx = (int)luamtd_tointeger_safe(L, 3, funcname); @@ -4997,7 +4997,7 @@ thrust rating and the same thrust direction. */ int Interpreter::v_get_thrustergrouplevel (lua_State *L) { - static char *funcname = "get_thrustergrouplevel"; + static const char *funcname = "get_thrustergrouplevel"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double level; @@ -5023,7 +5023,7 @@ Sets the thrust level for all thrusters in a group. */ int Interpreter::v_set_thrustergrouplevel (lua_State *L) { - static char *funcname = "set_thrustergrouplevel"; + static const char *funcname = "set_thrustergrouplevel"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double level = luamtd_tonumber_safe(L, 3, funcname); @@ -5051,7 +5051,7 @@ The resulting thrust levels are automatically truncated to the range */ int Interpreter::v_inc_thrustergrouplevel (lua_State *L) { - static char *funcname = "inc_thrustergrouplevel"; + static const char *funcname = "inc_thrustergrouplevel"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double dlevel = luamtd_tonumber_safe(L, 3, funcname); @@ -5081,7 +5081,7 @@ level needs to be modulated continuously (e.g. attitude control, etc.). */ int Interpreter::v_inc_thrustergrouplevel_singlestep (lua_State *L) { - static char *funcname = "inc_thrustergrouplevel_singlestep"; + static const char *funcname = "inc_thrustergrouplevel_singlestep"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double dlevel = luamtd_tonumber_safe(L, 3, funcname); @@ -5125,7 +5125,7 @@ Not all vessel classes may define a complete RCS. */ int Interpreter::v_get_rcsmode (lua_State *L) { - static char *funcname = "get_rcsmode"; + static const char *funcname = "get_rcsmode"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int mode = v->GetAttitudeMode(); @@ -5149,7 +5149,7 @@ Set mode=RCSMODE.OFF to disable the RCS. */ int Interpreter::v_set_rcsmode (lua_State *L) { - static char *funcname = "set_rcsmode"; + static const char *funcname = "set_rcsmode"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int mode = luamtd_tointeger_safe(L, 2, funcname); @@ -5170,7 +5170,7 @@ During playback, this method does nothing and returns the current RCS mode. */ int Interpreter::v_toggle_RCSmode (lua_State *L) { - static char *funcname = "toggle_RCSmode"; + static const char *funcname = "toggle_RCSmode"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushinteger(L, v->ToggleAttitudeMode()); @@ -5187,7 +5187,7 @@ Returns the activation state of an automated orbital navigation mode. */ int Interpreter::v_get_navmode (lua_State *L) { - static char *funcname = "get_navmode"; + static const char *funcname = "get_navmode"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int mode = luamtd_tointeger_safe(L, 2, funcname); @@ -5213,7 +5213,7 @@ second conflicting navmode is activated. */ int Interpreter::v_set_navmode (lua_State *L) { - static char *funcname = "set_navmode"; + static const char *funcname = "set_navmode"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int mode = (int)luamtd_tointeger_safe(L, 2, funcname); @@ -5254,7 +5254,7 @@ anti-parallel, and their longitudinal alignment vectors (_rot_) are parallel. */ int Interpreter::v_create_dock (lua_State *L) { - static char *funcname = "create_dock"; + static const char *funcname = "create_dock"; AssertMtdMinPrmCount(L, 4, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 pos = luamtd_tovector_safe(L, 2, funcname); @@ -5279,7 +5279,7 @@ used. */ int Interpreter::v_del_dock (lua_State *L) { - static char *funcname = "del_dock"; + static const char *funcname = "del_dock"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DOCKHANDLE hDock = (DOCKHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5297,7 +5297,7 @@ Any docked objects will be undocked before deleting the docking ports. */ int Interpreter::v_clear_dockdefinitions (lua_State *L) { - static char *funcname = "clear_dockdefinitions"; + static const char *funcname = "clear_dockdefinitions"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); v->ClearDockDefinitions(); @@ -5324,7 +5324,7 @@ The _dir_ and _rot_ direction vectors should be normalised to length 1. */ int Interpreter::v_set_dockparams (lua_State *L) { - static char *funcname = "set_dockparams"; + static const char *funcname = "set_dockparams"; AssertMtdMinPrmCount(L, 4, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DOCKHANDLE hDock = 0; @@ -5356,7 +5356,7 @@ Returns the paramters of a docking port. */ int Interpreter::v_get_dockparams (lua_State *L) { - static char *funcname = "get_dockparams"; + static const char *funcname = "get_dockparams"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DOCKHANDLE hDock = (DOCKHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5377,7 +5377,7 @@ Returns the number of docking ports available on the vessel. */ int Interpreter::v_get_dockcount (lua_State *L) { - static char *funcname = "get_dockcount"; + static const char *funcname = "get_dockcount"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushinteger (L, v->DockCount()); @@ -5394,7 +5394,7 @@ Returns a handle for a vessel docking port. */ int Interpreter::v_get_dockhandle (lua_State *L) { - static char *funcname = "get_dockhandle"; + static const char *funcname = "get_dockhandle"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int idx = luamtd_tointeger_safe(L, 2, funcname); @@ -5416,7 +5416,7 @@ Otherwise the function returns nil. */ int Interpreter::v_get_dockstatus (lua_State *L) { - static char *funcname = "get_dockstatus"; + static const char *funcname = "get_dockstatus"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DOCKHANDLE hDock = (DOCKHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5439,7 +5439,7 @@ This method has the same functionality as */ int Interpreter::v_dockingstatus (lua_State *L) { - static char *funcname = "dockingstatus"; + static const char *funcname = "dockingstatus"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); UINT port = luamtd_tointeger_safe(L, 2, funcname); @@ -5458,7 +5458,7 @@ simultaneously from all docking ports. */ int Interpreter::v_undock (lua_State *L) { - static char *funcname = "undock"; + static const char *funcname = "undock"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); UINT idx = (UINT)luamtd_tointeger_safe(L, 2, funcname); @@ -5504,7 +5504,7 @@ vessel:get_attachmentparams, vessel:get_attachmenthandle, vessel:attach_child, v */ int Interpreter::v_create_attachment (lua_State *L) { - static char *funcname = "create_attachment"; + static const char *funcname = "create_attachment"; AssertMtdMinPrmCount(L, 6, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); bool toparent = luamtd_toboolean_safe(L, 2, funcname); @@ -5536,7 +5536,7 @@ After this function returns successfully, the attachment handle is no longer val */ int Interpreter::v_del_attachment (lua_State *L) { - static char *funcname = "del_attachment"; + static const char *funcname = "del_attachment"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); ATTACHMENTHANDLE hAttachment = (ATTACHMENTHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5556,7 +5556,7 @@ After this function returns, all previously defined attachment handles will no l */ int Interpreter::v_clear_attachments (lua_State *L) { - static char *funcname = "clear_attachments"; + static const char *funcname = "clear_attachments"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); v->ClearAttachments(); @@ -5581,7 +5581,7 @@ orthogonal. */ int Interpreter::v_set_attachmentparams (lua_State *L) { - static char *funcname = "set_attachmentparams"; + static const char *funcname = "set_attachmentparams"; AssertMtdMinPrmCount(L, 5, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); ATTACHMENTHANDLE hAttachment = (ATTACHMENTHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5604,7 +5604,7 @@ Retrieves the parameters of an attachment point. */ int Interpreter::v_get_attachmentparams (lua_State *L) { - static char *funcname = "get_attachmentparams"; + static const char *funcname = "get_attachmentparams"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); ATTACHMENTHANDLE hAttachment = (ATTACHMENTHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5626,7 +5626,7 @@ Retrieves attachment identifier string. */ int Interpreter::v_get_attachmentid (lua_State *L) { - static char *funcname = "get_attachmentid"; + static const char *funcname = "get_attachmentid"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); ATTACHMENTHANDLE hAttachment = (ATTACHMENTHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5648,7 +5648,7 @@ attached. */ int Interpreter::v_get_attachmentstatus (lua_State *L) { - static char *funcname = "get_attachmentstatus"; + static const char *funcname = "get_attachmentstatus"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); ATTACHMENTHANDLE hAttachment = (ATTACHMENTHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5669,7 +5669,7 @@ Otherwise, return the number of attachment points to children. */ int Interpreter::v_get_attachmentcount (lua_State *L) { - static char *funcname = "get_attachmentcount"; + static const char *funcname = "get_attachmentcount"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); bool toparent = luamtd_toboolean_safe(L, 2, funcname); @@ -5693,7 +5693,7 @@ attachments. The returned index should therefore be used only within the current */ int Interpreter::v_get_attachmentindex (lua_State *L) { - static char *funcname = "get_attachmentindex"; + static const char *funcname = "get_attachmentindex"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); ATTACHMENTHANDLE hAttachment = (ATTACHMENTHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5713,7 +5713,7 @@ Otherwise, return a handle for an attachment point to a child. */ int Interpreter::v_get_attachmenthandle (lua_State *L) { - static char *funcname = "get_attachmenthandle"; + static const char *funcname = "get_attachmenthandle"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); bool toparent = luamtd_toboolean_safe(L, 2, funcname); @@ -5747,7 +5747,7 @@ refuse to connect. In that case, the function returns _false_. */ int Interpreter::v_attach_child (lua_State *L) { - static char *funcname = "attach_child"; + static const char *funcname = "attach_child"; AssertMtdMinPrmCount(L, 4, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); OBJHANDLE hChild = (OBJHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5769,7 +5769,7 @@ Breaks an existing attachment to a child. */ int Interpreter::v_detach_child (lua_State *L) { - static char *funcname = "detach_child"; + static const char *funcname = "detach_child"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); ATTACHMENTHANDLE hAttachment = (ATTACHMENTHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5804,7 +5804,7 @@ a different frequency. */ int Interpreter::v_enable_transponder (lua_State *L) { - static char *funcname = "enable_transponder"; + static const char *funcname = "enable_transponder"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int enable = luamtd_toboolean_safe(L, 2, funcname); @@ -5832,7 +5832,7 @@ as current frequency. */ int Interpreter::v_get_transponder (lua_State *L) { - static char *funcname = "get_transponder"; + static const char *funcname = "get_transponder"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); NAVHANDLE hTrans = v->GetTransponder(); @@ -5857,7 +5857,7 @@ f = (108.0 + 0.05 ch) MHz. */ int Interpreter::v_set_transponderchannel (lua_State *L) { - static char *funcname = "set_transponderchannel"; + static const char *funcname = "set_transponderchannel"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DWORD ch = (DWORD)luamtd_tointeger_safe(L, 2, funcname); @@ -5880,7 +5880,7 @@ initially set to 0 (transmitter frequency 108.00 MHz). Use */ int Interpreter::v_enable_ids (lua_State *L) { - static char *funcname = "enable_ids"; + static const char *funcname = "enable_ids"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DOCKHANDLE hDock = (DOCKHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5909,7 +5909,7 @@ about the transmitter, such as sender frequency. */ int Interpreter::v_get_ids (lua_State *L) { - static char *funcname = "get_ids"; + static const char *funcname = "get_ids"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DOCKHANDLE hDock = (DOCKHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5938,7 +5938,7 @@ of @{del_dock} or @{clear_dockdefinitions}. */ int Interpreter::v_set_idschannel (lua_State *L) { - static char *funcname = "set_idschannel"; + static const char *funcname = "set_idschannel"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DOCKHANDLE hDock = (DOCKHANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -5965,7 +5965,7 @@ Default is 2 NAV receivers. */ int Interpreter::v_init_navradios (lua_State *L) { - static char *funcname = "init_navradios"; + static const char *funcname = "init_navradios"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DWORD nnav = (DWORD)luamtd_tointeger_safe(L, 2, funcname); @@ -5983,7 +5983,7 @@ Returns the number of NAV receivers. */ int Interpreter::v_get_navcount (lua_State *L) { - static char *funcname = "get_navcount"; + static const char *funcname = "get_navcount"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushnumber (L, v->GetNavCount()); @@ -6003,7 +6003,7 @@ corresponding to channels 0 to 639. */ int Interpreter::v_set_navchannel (lua_State *L) { - static char *funcname = "set_navchannel"; + static const char *funcname = "set_navchannel"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DWORD n = (DWORD)lua_tointeger_safe(L, 2, funcname); @@ -6025,7 +6025,7 @@ If the receiver index _navIdx_ is out of range, this function returns 0. */ int Interpreter::v_get_navchannel (lua_State *L) { - static char *funcname = "get_navchannel"; + static const char *funcname = "get_navchannel"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DWORD n = (DWORD)lua_tointeger_safe(L, 2, funcname); @@ -6053,7 +6053,7 @@ receiver. */ int Interpreter::v_get_navsource (lua_State *L) { - static char *funcname = "get_navsource"; + static const char *funcname = "get_navsource"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DWORD n = (DWORD)lua_tointeger_safe(L, 2, funcname); @@ -6079,7 +6079,7 @@ Returns the activation state of the nose-wheel steering system. */ int Interpreter::v_set_nosewheelsteering (lua_State *L) { - static char *funcname = "set_nosewheelsteering"; + static const char *funcname = "set_nosewheelsteering"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); bool activate = luamtd_toboolean_safe(L, 2, funcname)!=0; @@ -6097,7 +6097,7 @@ Returns the activation state of the nose-wheel steering system. */ int Interpreter::v_get_nosewheelsteering (lua_State *L) { - static char *funcname = "get_nosewheelsteering"; + static const char *funcname = "get_nosewheelsteering"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); lua_pushboolean(L, v->GetNosewheelSteering()); @@ -6114,7 +6114,7 @@ system. */ int Interpreter::v_set_maxwheelbrakeforce (lua_State *L) { - static char *funcname = "set_maxwheelbrakeforce"; + static const char *funcname = "set_maxwheelbrakeforce"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double f = luamtd_tonumber_safe(L, 2, funcname); @@ -6134,7 +6134,7 @@ Apply the wheel brake. */ int Interpreter::v_set_wheelbrakelevel (lua_State *L) { - static char *funcname = "set_wheelbrakelevel"; + static const char *funcname = "set_wheelbrakelevel"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double level = luamtd_tonumber_safe(L, 2, funcname); @@ -6154,7 +6154,7 @@ Returns the current wheel brake level. */ int Interpreter::v_get_wheelbrakelevel (lua_State *L) { - static char *funcname = "get_wheelbrakelevel"; + static const char *funcname = "get_wheelbrakelevel"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int which = luamtd_tointeger_safe(L, 2, funcname); @@ -6210,7 +6210,7 @@ diffuse. If diffuse is also missing, it is substituted with {r=1,g=1,b=1}. */ int Interpreter::v_add_pointlight (lua_State *L) { - static char *funcname = "add_pointlight"; + static const char *funcname = "add_pointlight"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 pos = luamtd_tovector_safe(L, 2, funcname); @@ -6297,7 +6297,7 @@ diffuse. If diffuse is also missing, it is substituted with {r=1,g=1,b=1}. */ int Interpreter::v_add_spotlight (lua_State *L) { - static char *funcname = "add_spotlight"; + static const char *funcname = "add_spotlight"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 pos = luamtd_tovector_safe(L, 2, funcname); @@ -6353,7 +6353,7 @@ Returns a pointer to a light source object identified by index. */ int Interpreter::v_get_lightemitter (lua_State *L) { - static char *funcname = "get_lightemitter"; + static const char *funcname = "get_lightemitter"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DWORD idx = (DWORD)luamtd_tointeger_safe(L, 2, funcname); @@ -6372,7 +6372,7 @@ Returns the number of light sources defined for the vessel. */ int Interpreter::v_get_lightemittercount (lua_State *L) { - static char *funcname = "get_lightemittercount"; + static const char *funcname = "get_lightemittercount"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DWORD n = v->LightEmitterCount(); @@ -6393,7 +6393,7 @@ be referenced. */ int Interpreter::v_del_lightemitter (lua_State *L) { - static char *funcname = "del_lightemitter"; + static const char *funcname = "del_lightemitter"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); LightEmitter *le = lua_tolightemitter(L, 2); @@ -6410,7 +6410,7 @@ Removes all light sources defined for the vessel. */ int Interpreter::v_clear_lightemitters (lua_State *L) { - static char *funcname = "clear_lightemitters"; + static const char *funcname = "clear_lightemitters"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); v->ClearLightEmitters(); @@ -6456,7 +6456,7 @@ within visual range of the observer camera). */ int Interpreter::v_add_mesh (lua_State *L) { - static char *funcname = "add_mesh"; + static const char *funcname = "add_mesh"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); UINT midx; @@ -6507,7 +6507,7 @@ The return value is always equal to _idx_. */ int Interpreter::v_insert_mesh (lua_State *L) { - static char *funcname = "insert_mesh"; + static const char *funcname = "insert_mesh"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); UINT midx, idx = (UINT)lua_tointeger_safe(L, 3, funcname); @@ -6553,7 +6553,7 @@ retaining the animations of deleted meshes can lead to undefined behaviour. */ int Interpreter::v_del_mesh (lua_State *L) { - static char *funcname = "del_mesh"; + static const char *funcname = "del_mesh"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); ASSERT_MTDNUMBER(L,2); @@ -6582,7 +6582,7 @@ the behaviour of the animations becomes undefined. */ int Interpreter::v_clear_meshes (lua_State *L) { - static char *funcname = "clear_meshes"; + static const char *funcname = "clear_meshes"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); bool retain_anim = false; @@ -6602,7 +6602,7 @@ Returns the number of meshes defined for the vessel. */ int Interpreter::v_get_meshcount (lua_State *L) { - static char *funcname = "get_meshcount"; + static const char *funcname = "get_meshcount"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); UINT count = v->GetMeshCount(); @@ -6630,7 +6630,7 @@ position instantly. */ int Interpreter::v_shift_mesh (lua_State *L) { - static char *funcname = "shift_mesh"; + static const char *funcname = "shift_mesh"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); ASSERT_MTDNUMBER(L,2); @@ -6653,7 +6653,7 @@ This function is useful when resetting a vessel's centre of gravity, in combinat */ int Interpreter::v_shift_meshes (lua_State *L) { - static char *funcname = "shift_meshes"; + static const char *funcname = "shift_meshes"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 ofs = luamtd_tovector_safe(L, 2, funcname); @@ -6671,7 +6671,7 @@ Returns the mesh offset in the vessel frame. */ int Interpreter::v_get_meshoffset (lua_State *L) { - static char *funcname = "get_meshoffset"; + static const char *funcname = "get_meshoffset"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); UINT idx = (UINT)luamtd_tointeger_safe(L, 2, funcname); @@ -6707,7 +6707,7 @@ mesh file, set initialState to 1. */ int Interpreter::v_create_animation (lua_State *L) { - static char *funcname = "create_animation"; + static const char *funcname = "create_animation"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double istate = luamtd_tonumber_safe(L, 2, funcname); @@ -6734,7 +6734,7 @@ default state. */ int Interpreter::v_del_animation (lua_State *L) { - static char *funcname = "del_animation"; + static const char *funcname = "del_animation"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); UINT anim = (UINT)luamtd_tointeger_safe(L, 2, funcname); @@ -6759,7 +6759,7 @@ SetAnimation in such a way as to provide a smooth movement of the animated parts */ int Interpreter::v_set_animation (lua_State *L) { - static char *funcname = "set_animation"; + static const char *funcname = "set_animation"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); UINT anim = (UINT)luamtd_tointeger_safe(L, 2, funcname); @@ -6771,7 +6771,7 @@ int Interpreter::v_set_animation (lua_State *L) int Interpreter::v_get_animation (lua_State *L) { - static char *funcname = "get_animation"; + static const char *funcname = "get_animation"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); UINT anim = luamtd_tointeger_safe(L, 2, funcname); @@ -6807,7 +6807,7 @@ handle returned by the add_animationcomponent call for the parent. */ int Interpreter::v_add_animationcomponent (lua_State *L) { - static char *funcname = "add_animationcomponent"; + static const char *funcname = "add_animationcomponent"; AssertMtdMinPrmCount(L, 5, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); UINT anim = (UINT)luamtd_tointeger_safe(L, 2, funcname); @@ -6841,7 +6841,7 @@ In the current implementation, the component must not have children */ int Interpreter::v_del_animationcomponent (lua_State *L) { - static char *funcname = "del_animationcomponent"; + static const char *funcname = "del_animationcomponent"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); UINT anim = luamtd_tointeger_safe(L, 2, funcname); @@ -6881,7 +6881,7 @@ The @{register_animation} mechanism leaves the actual implementation of */ int Interpreter::v_register_animation (lua_State *L) { - static char *funcname = "register_animation"; + static const char *funcname = "register_animation"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); v->RegisterAnimation(); @@ -6903,7 +6903,7 @@ The call to UnregisterAnimation should not be placed in the body of */ int Interpreter::v_unregister_animation (lua_State *L) { - static char *funcname = "unregister_animation"; + static const char *funcname = "unregister_animation"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); v->UnregisterAnimation(); @@ -6947,7 +6947,7 @@ The shift of meshes (and any other reference positions defined in */ int Interpreter::v_shift_centreofmass (lua_State *L) { - static char *funcname = "shift_centreofmass"; + static const char *funcname = "shift_centreofmass"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 shift = luamtd_tovector_safe(L, 2, funcname); @@ -6984,7 +6984,7 @@ This function should be called after a vessel has undergone a */ int Interpreter::v_shiftCG (lua_State *L) { - static char *funcname = "shiftCG"; + static const char *funcname = "shiftCG"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 shift = luamtd_tovector_safe(L, 2, funcname); @@ -7007,7 +7007,7 @@ If the vessel is not part of a superstructure, cg returns (0,0,0). */ int Interpreter::v_get_superstructureCG (lua_State *L) { - static char *funcname = "get_superstructureCG"; + static const char *funcname = "get_superstructureCG"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 cg; @@ -7038,7 +7038,7 @@ The user is responsible for providing a valid rotation matrix. */ int Interpreter::v_set_rotationmatrix (lua_State *L) { - static char *funcname = "set_rotationmatrix"; + static const char *funcname = "set_rotationmatrix"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); MATRIX3 R = luamtd_tomatrix_safe(L, 2, funcname); @@ -7064,7 +7064,7 @@ Should be used to transform \e directions. To transform */ int Interpreter::v_globalrot (lua_State *L) { - static char *funcname = "globalrot"; + static const char *funcname = "globalrot"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 rloc = luamtd_tovector_safe(L, 2, funcname); @@ -7090,7 +7090,7 @@ The local horizon frame is defined as follows: */ int Interpreter::v_horizonrot (lua_State *L) { - static char *funcname = "horizonrot"; + static const char *funcname = "horizonrot"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 rloc = luamtd_tovector_safe(L, 2, funcname); @@ -7114,7 +7114,7 @@ This function performs the inverse operation of \ref */ int Interpreter::v_horizoninvrot (lua_State *L) { - static char *funcname = "horizoninvrot"; + static const char *funcname = "horizoninvrot"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 rhorizon = luamtd_tovector_safe(L, 2, funcname); @@ -7144,7 +7144,7 @@ The transform has the form */ int Interpreter::v_local2global (lua_State *L) { - static char *funcname = "local2global"; + static const char *funcname = "local2global"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 local = luamtd_tovector_safe(L, 2, funcname); @@ -7174,7 +7174,7 @@ The transformation has the form */ int Interpreter::v_global2local (lua_State *L) { - static char *funcname = "global2local"; + static const char *funcname = "global2local"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 global = luamtd_tovector_safe(L, 2, funcname); @@ -7212,7 +7212,7 @@ The transformation has the form */ int Interpreter::v_local2rel (lua_State *L) { - static char *funcname = "local2rel"; + static const char *funcname = "local2rel"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 local = luamtd_tovector_safe(L, 2, funcname); @@ -7271,7 +7271,7 @@ This version uses a user-defined position and direction for the exhaust. */ int Interpreter::v_add_exhaust (lua_State *L) { - static char *funcname = "add_exhaust"; + static const char *funcname = "add_exhaust"; AssertMtdMinPrmCount(L, 4, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -7317,7 +7317,7 @@ Removes an exhaust render definition. */ int Interpreter::v_del_exhaust (lua_State *L) { - static char *funcname = "del_exhaust"; + static const char *funcname = "del_exhaust"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); UINT idx = (UINT)luamtd_tointeger_safe(L, 2, funcname); @@ -7335,7 +7335,7 @@ Returns the number of exhaust render definitions for the vessel. */ int Interpreter::v_get_exhaustcount (lua_State *L) { - static char *funcname = "get_exhaustcount"; + static const char *funcname = "get_exhaustcount"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); DWORD count = v->GetExhaustCount(); @@ -7372,7 +7372,7 @@ function will return nil. The module must be able to cope with this case. */ int Interpreter::v_add_exhauststream (lua_State *L) { - static char *funcname = "add_exhauststream"; + static const char *funcname = "add_exhauststream"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); THRUSTER_HANDLE ht = (THRUSTER_HANDLE)luamtd_tolightuserdata_safe(L, 2, funcname); @@ -7473,7 +7473,7 @@ Returns the current camera position for internal (cockpit) view. */ int Interpreter::v_get_cameraoffset (lua_State *L) { - static char *funcname = "get_cameraoffset"; + static const char *funcname = "get_cameraoffset"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 ofs; @@ -7494,7 +7494,7 @@ The default offset is (0,0,0). */ int Interpreter::v_set_cameraoffset (lua_State *L) { - static char *funcname = "set_cameraoffset"; + static const char *funcname = "set_cameraoffset"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 ofs = luamtd_tovector_safe(L, 2, funcname); @@ -7548,7 +7548,7 @@ In Orbiter, the user can return to the default direction by pressing the */ int Interpreter::v_set_cameradefaultdirection (lua_State *L) { - static char *funcname = "set_cameradefaultdirection"; + static const char *funcname = "set_cameradefaultdirection"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 cd = luamtd_tovector_safe(L, 2, funcname); @@ -7576,7 +7576,7 @@ The returned direction vector is normalised to length 1. */ int Interpreter::v_get_cameradefaultdirection (lua_State *L) { - static char *funcname = "get_cameradefaultdirection"; + static const char *funcname = "get_cameradefaultdirection"; AssertMtdMinPrmCount(L, 1, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 cd; @@ -7606,7 +7606,7 @@ To reset the catchment angle globally for all cockpit views of the vessel, */ int Interpreter::v_set_cameracatchangle (lua_State *L) { - static char *funcname = "set_cameracatchangle"; + static const char *funcname = "set_cameracatchangle"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double cangle = luamtd_tonumber_safe(L, 2, funcname); @@ -7638,7 +7638,7 @@ The default values are 0.8Pi for left and right ranges, and 0.4Pi for up and dow */ int Interpreter::v_set_camerarotationrange (lua_State *L) { - static char *funcname = "set_camerarotationrange"; + static const char *funcname = "set_camerarotationrange"; AssertMtdMinPrmCount(L, 5, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); double left = luamtd_tonumber_safe(L, 2, funcname); @@ -7686,7 +7686,7 @@ In addition to the linear movement, the camera also turns left when leaning left */ int Interpreter::v_set_camerashiftrange (lua_State *L) { - static char *funcname = "set_camerashiftrange"; + static const char *funcname = "set_camerashiftrange"; AssertMtdMinPrmCount(L, 4, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 fpos = luamtd_tovector_safe(L, 2, funcname); @@ -7721,7 +7721,7 @@ It is more versatile, because in addition to the linear camera movement vectors, */ int Interpreter::v_set_cameramovement (lua_State *L) { - static char *funcname = "set_cameramovement"; + static const char *funcname = "set_cameramovement"; AssertMtdMinPrmCount(L, 10, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); VECTOR3 fpos, lpos, rpos; @@ -7762,7 +7762,7 @@ The redraw notification is ignored if the requested panel is not currently */ int Interpreter::v_trigger_panelredrawarea (lua_State *L) { - static char *funcname = "trigger_panelredrawarea"; + static const char *funcname = "trigger_panelredrawarea"; AssertMtdMinPrmCount(L, 3, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int panel_id = luamtd_tointeger_safe(L, 2, funcname); @@ -7793,7 +7793,7 @@ If the calling vessel doesn't have input focus (and therefore doesn't own the */ int Interpreter::v_trigger_redrawarea (lua_State *L) { - static char *funcname = "trigger_redrawarea"; + static const char *funcname = "trigger_redrawarea"; AssertMtdMinPrmCount(L, 4, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int panel_id = luamtd_tointeger_safe(L, 2, funcname); @@ -7825,7 +7825,7 @@ The return value is 1 if the vessel could process the key message, or 0 otherwis */ int Interpreter::v_send_bufferedkey (lua_State *L) { - static char *funcname = "send_bufferedkey"; + static const char *funcname = "send_bufferedkey"; AssertMtdMinPrmCount(L, 2, funcname); VESSEL *v = lua_tovessel_safe(L, 1, funcname); int key = luamtd_tointeger_safe (L, 2, funcname); diff --git a/Src/Orbiter/Camera.cpp b/Src/Orbiter/Camera.cpp index 942a0bb51..327bc84e6 100644 --- a/Src/Orbiter/Camera.cpp +++ b/Src/Orbiter/Camera.cpp @@ -1698,7 +1698,7 @@ void CameraMode_Track::Init (char *str) void CameraMode_Track::Store (char *str) { - static char *tmstr[6] = {"CURRENT","RELATIVE", "ABSDIR", "GLOBAL", "TARGETTOREF", "TARGETFROMREF"}; + static const char *tmstr[6] = {"CURRENT","RELATIVE", "ABSDIR", "GLOBAL", "TARGETTOREF", "TARGETFROMREF"}; sprintf (str, "Track:%s%:%0.2f:%s %0.3f %0.3f %0.3f", target ? ((Body*)target)->Name() : "-", fov, tmstr[tmode], reldist, phi, theta); diff --git a/Src/Orbiter/CelSphereAPI.cpp b/Src/Orbiter/CelSphereAPI.cpp index 9de7fa8fe..9b41a2f4c 100644 --- a/Src/Orbiter/CelSphereAPI.cpp +++ b/Src/Orbiter/CelSphereAPI.cpp @@ -517,7 +517,7 @@ MATRIX3 oapi::CelestialSphere::Ecliptic_CelestialAtEpoch() const { // Set up rotation for celestial grid rendering MATRIX3 R; - OBJHANDLE hEarth = oapiGetGbodyByName("Earth"); + OBJHANDLE hEarth = oapiGetGbodyByName((char*)"Earth"); if (!hEarth) return Ecliptic_CelestialJ2000(); // best we can do diff --git a/Src/Orbiter/Celbody.cpp b/Src/Orbiter/Celbody.cpp index bab91eb52..2da03460b 100644 --- a/Src/Orbiter/Celbody.cpp +++ b/Src/Orbiter/Celbody.cpp @@ -896,7 +896,7 @@ void CELBODY2::clbkInit (FILEHANDLE cfg) oapiGetObjectName (hBody, name, 256); strcat (name, "\\Atmosphere.cfg"); FILEHANDLE hFile = oapiOpenFile (name, FILE_IN, CONFIG); - if (oapiReadItem_string (hFile, "MODULE_ATM", fname) || oapiReadItem_string (cfg, "MODULE_ATM", fname)) { + if (oapiReadItem_string (hFile, (char*)"MODULE_ATM", fname) || oapiReadItem_string (cfg, (char*)"MODULE_ATM", fname)) { if (_stricmp (fname, "[None]")) LoadAtmosphereModule (fname); } diff --git a/Src/Orbiter/Config.cpp b/Src/Orbiter/Config.cpp index 64cd3b836..1f9b1a35e 100644 --- a/Src/Orbiter/Config.cpp +++ b/Src/Orbiter/Config.cpp @@ -1443,7 +1443,7 @@ void Config::DelActiveModule (const std::string& name) m_activeModules.erase(it); } -bool Config::GetString (istream &is, char *category, char *val) +bool Config::GetString (istream &is, const char *category, char *val) { char cbuf[512]; int i; @@ -1469,25 +1469,25 @@ bool Config::GetString (istream &is, char *category, char *val) return true; } -bool Config::GetReal (istream &is, char *category, double &val) +bool Config::GetReal (istream &is, const char *category, double &val) { if (!GetString (is, category, g_cbuf)) return false; return (sscanf (g_cbuf, "%lf", &val) == 1); } -bool Config::GetInt (istream &is, char *category, int &val) +bool Config::GetInt (istream &is, const char *category, int &val) { if (!GetString (is, category, g_cbuf)) return false; return (sscanf (g_cbuf, "%d", &val) == 1); } -bool Config::GetSize(istream& is, char* category, size_t& val) +bool Config::GetSize (istream& is, const char* category, size_t& val) { if (!GetString(is, category, g_cbuf)) return false; return (sscanf(g_cbuf, "%zu", &val) == 1); } -bool Config::GetBool (istream &is, char *category, bool &val) +bool Config::GetBool (istream &is, const char *category, bool &val) { if (!GetString (is, category, g_cbuf)) return false; if (!_strnicmp (g_cbuf, "true", 4)) { val = true; return true; } @@ -1495,7 +1495,7 @@ bool Config::GetBool (istream &is, char *category, bool &val) return false; } -bool Config::GetVector (istream &is, char *category, Vector &val) +bool Config::GetVector (istream &is, const char *category, Vector &val) { double x, y, z; if (!GetString (is, category, g_cbuf)) return false; @@ -1504,7 +1504,7 @@ bool Config::GetVector (istream &is, char *category, Vector &val) return true; } -bool Config::GetString (char *category, char *val) +bool Config::GetString (const char *category, char *val) { if (!Root) return false; ifstream ifs (Root); @@ -1512,7 +1512,7 @@ bool Config::GetString (char *category, char *val) return GetString (ifs, category, val); } -bool Config::GetReal (char *category, double &val) +bool Config::GetReal (const char *category, double &val) { if (!Root) return false; ifstream ifs (Root); @@ -1520,7 +1520,7 @@ bool Config::GetReal (char *category, double &val) return GetReal (ifs, category, val); } -bool Config::GetInt (char *category, int &val) +bool Config::GetInt (const char *category, int &val) { if (!Root) return false; ifstream ifs (Root); @@ -1528,7 +1528,7 @@ bool Config::GetInt (char *category, int &val) return GetInt (ifs, category, val); } -bool Config::GetSize(char* category, size_t& val) +bool Config::GetSize (const char* category, size_t& val) { if (!Root) return false; ifstream ifs(Root); @@ -1536,7 +1536,7 @@ bool Config::GetSize(char* category, size_t& val) return GetSize(ifs, category, val); } -bool Config::GetBool (char *category, bool &val) +bool Config::GetBool (const char *category, bool &val) { if (!Root) return false; ifstream ifs (Root); @@ -1544,7 +1544,7 @@ bool Config::GetBool (char *category, bool &val) return GetBool (ifs, category, val); } -bool Config::GetVector (char *category, Vector &val) +bool Config::GetVector (const char *category, Vector &val) { if (!Root) return false; ifstream ifs (Root); diff --git a/Src/Orbiter/Config.h b/Src/Orbiter/Config.h index 1299dfdf5..1f67c209c 100644 --- a/Src/Orbiter/Config.h +++ b/Src/Orbiter/Config.h @@ -431,20 +431,20 @@ class Config { // return a specific parameter setting (paramtype defined in GraphicsAPI.h) // Read items from master config - bool GetString (char *category, char *val); - bool GetReal (char *category, double &val); - bool GetInt (char *category, int &val); - bool GetSize (char* category, size_t& val); - bool GetBool (char *category, bool &val); - bool GetVector (char *category, Vector &val); + bool GetString (const char *category, char *val); + bool GetReal (const char *category, double &val); + bool GetInt (const char *category, int &val); + bool GetSize (const char* category, size_t& val); + bool GetBool (const char *category, bool &val); + bool GetVector (const char *category, Vector &val); private: - bool GetString (std::istream &is, char *category, char *val); - bool GetReal (std::istream &is, char *category, double &val); - bool GetInt (std::istream &is, char *category, int &val); - bool GetSize (std::istream& is, char* category, size_t& val); - bool GetBool (std::istream &is, char *category, bool &val); - bool GetVector (std::istream &is, char *category, Vector &val); + bool GetString (std::istream &is, const char *category, char *val); + bool GetReal (std::istream &is, const char *category, double &val); + bool GetInt (std::istream &is, const char *category, int &val); + bool GetSize (std::istream& is, const char* category, size_t& val); + bool GetBool (std::istream &is, const char *category, bool &val); + bool GetVector (std::istream &is, const char *category, Vector &val); mutable char cfgpath[256]; // buffer for creating full path names char mshpath[256]; diff --git a/Src/Orbiter/D3d7enum.cpp b/Src/Orbiter/D3d7enum.cpp index 08a089246..aa715ad89 100644 --- a/Src/Orbiter/D3d7enum.cpp +++ b/Src/Orbiter/D3d7enum.cpp @@ -272,7 +272,7 @@ static BOOL WINAPI DriverEnumCallback (GUID* pGUID, TCHAR* strDesc, TCHAR* strNa // Name: D3D7Enum_ReadDeviceList() // Read device information from file // ------------------------------------------------------------------------------------ -int D3D7Enum_ReadDeviceList (CHAR *fname) +int D3D7Enum_ReadDeviceList (const CHAR *fname) { int i; FILE *ifs = fopen (fname, "rb"); @@ -295,7 +295,7 @@ int D3D7Enum_ReadDeviceList (CHAR *fname) // Name: D3D7Enum_WriteDeviceList() // Write the device information stored in the device list to a file (binary format) // ------------------------------------------------------------------------------------ -VOID D3D7Enum_WriteDeviceList (CHAR *fname) +VOID D3D7Enum_WriteDeviceList (const CHAR *fname) { FILE *ofs = fopen (fname, "wb"); DWORD i, n = g_dwNumDevices; diff --git a/Src/Orbiter/D3d7enum.h b/Src/Orbiter/D3d7enum.h index 599a8c0bf..2b48c4f62 100644 --- a/Src/Orbiter/D3d7enum.h +++ b/Src/Orbiter/D3d7enum.h @@ -91,12 +91,12 @@ D3D7Enum_DeviceInfo *D3D7Enum_GetDevice (DWORD idx); // Desc: Read device information from file // Return value is number of devices (0=error) // ------------------------------------------------------------------------------------ -int D3D7Enum_ReadDeviceList (CHAR *fname); +int D3D7Enum_ReadDeviceList (const CHAR *fname); // ------------------------------------------------------------------------------------ // Name: D3D7Enum_WriteDeviceList() // Desc: Write the device information stored in the device list to a file (binary) // ------------------------------------------------------------------------------------ -VOID D3D7Enum_WriteDeviceList (CHAR *fname); +VOID D3D7Enum_WriteDeviceList (const CHAR *fname); #endif // !D3D7ENUM_H \ No newline at end of file diff --git a/Src/Orbiter/Defpanel.cpp b/Src/Orbiter/Defpanel.cpp index 19fd19cf1..6d85728da 100644 --- a/Src/Orbiter/Defpanel.cpp +++ b/Src/Orbiter/Defpanel.cpp @@ -10,7 +10,7 @@ extern Orbiter *g_pOrbiter; extern Vessel *g_focusobj; extern char DBG_MSG[256]; -static char *btmlbl[3] = {"PWR","SEL","MNU"}; +static const char *btmlbl[3] = {"PWR","SEL","MNU"}; int nnv0 = 7; // number of nav modes available // texture dimensions diff --git a/Src/Orbiter/DlgCamera.cpp b/Src/Orbiter/DlgCamera.cpp index 9506aa5ee..b6bf34197 100644 --- a/Src/Orbiter/DlgCamera.cpp +++ b/Src/Orbiter/DlgCamera.cpp @@ -236,8 +236,7 @@ TabControl::TabControl (HWND hParentTab): CameraTab (hParentTab, IDD_CAM_PG_CONT char *TabControl::HelpContext () const { - static char *context = "/cam_control.htm"; - return context; + return (char*)"/cam_control.htm"; } // ====================================================================== @@ -468,8 +467,7 @@ TabTarget::TabTarget (HWND hParentTab): CameraTab (hParentTab, IDD_CAM_PG_TARGET char *TabTarget::HelpContext () const { - static char *context = "/cam_target.htm"; - return context; + return (char*)"/cam_target.htm"; } // ====================================================================== @@ -634,8 +632,7 @@ TabView::TabView (HWND hParentTab): CameraTab (hParentTab, IDD_CAM_PG_VIEW, DlgP char *TabView::HelpContext () const { - static char *context = "/cam_track.htm"; - return context; + return (char*)"/cam_track.htm"; } // ====================================================================== @@ -732,8 +729,7 @@ void TabGround::Show (bool show) char *TabGround::HelpContext () const { - static char *context = "/cam_ground.htm"; - return context; + return (char*)"/cam_ground.htm"; } // ====================================================================== @@ -1048,8 +1044,7 @@ TabFov::TabFov (HWND hParentTab): CameraTab (hParentTab, IDD_CAM_PG_FOV, DlgProc char *TabFov::HelpContext () const { - static char *context = "/cam_fov.htm"; - return context; + return (char*)"/cam_fov.htm"; } // ====================================================================== @@ -1137,8 +1132,7 @@ TabPreset::TabPreset (HWND hParentTab): CameraTab (hParentTab, IDD_CAM_PG_PRESET char *TabPreset::HelpContext () const { - static char *context = "/cam_preset.htm"; - return context; + return (char*)"/cam_preset.htm"; } // ====================================================================== @@ -1162,7 +1156,7 @@ INT_PTR CALLBACK TabPreset::DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM case WM_COMMAND: switch (LOWORD (wParam)) { case IDHELP: - DefHelpContext.topic = "/cam_preset.htm"; + DefHelpContext.topic = (char*)"/cam_preset.htm"; g_pOrbiter->OpenHelp (&DefHelpContext); return TRUE; case IDC_CAM_PRE_NEW: diff --git a/Src/Orbiter/DlgCapture.cpp b/Src/Orbiter/DlgCapture.cpp index 45e81dd02..c853c0cb5 100644 --- a/Src/Orbiter/DlgCapture.cpp +++ b/Src/Orbiter/DlgCapture.cpp @@ -115,7 +115,7 @@ BOOL DlgCapture::OnCommand (HWND hDlg, WORD id, WORD code, HWND hControl) OnInitDialog (hDlg, 0, 0); return TRUE; case IDHELP: { - char *topic = "/capture.htm"; + char *topic = (char*)"/capture.htm"; DefHelpContext.topic = topic; g_pOrbiter->OpenHelp (&DefHelpContext); } return TRUE; diff --git a/Src/Orbiter/DlgFocus.cpp b/Src/Orbiter/DlgFocus.cpp index bc2ed2c0c..37441ea29 100644 --- a/Src/Orbiter/DlgFocus.cpp +++ b/Src/Orbiter/DlgFocus.cpp @@ -51,12 +51,12 @@ BOOL DlgFocus::OnInitDialog (HWND hWnd, WPARAM wParam, LPARAM lParam) EnableThemeDialogTexture (hWnd, ETDT_ENABLETAB); const int ntab = 4; - char *label[ntab] = {"All", "Nearby", "Location", "Class"}; + const char *label[ntab] = {"All", "Nearby", "Location", "Class"}; TC_ITEM tie; tie.mask = TCIF_TEXT; tie.iImage = -1; for (int i = 0; i < ntab; i++) { - tie.pszText = label[i]; + tie.pszText = (char*)label[i]; SendDlgItemMessage (hWnd, IDC_TAB1, TCM_INSERTITEM, i, (LPARAM)&tie); } ctab = g_pOrbiter->Cfg()->CfgUIPrm.SelVesselTab; @@ -148,7 +148,7 @@ BOOL DlgFocus::OnCommand (HWND hDlg, WORD id, WORD code, HWND hControl) SelectPreviousVessel (hDlg); return TRUE; case IDHELP: - DefHelpContext.topic = "/selvessel.htm"; + DefHelpContext.topic = (char*)"/selvessel.htm"; g_pOrbiter->OpenHelp (&DefHelpContext); return TRUE; case IDOK: diff --git a/Src/Orbiter/DlgFunction.cpp b/Src/Orbiter/DlgFunction.cpp index a2c876f0d..bcff7a976 100644 --- a/Src/Orbiter/DlgFunction.cpp +++ b/Src/Orbiter/DlgFunction.cpp @@ -65,7 +65,7 @@ BOOL DlgFunction::OnCommand (HWND hDlg, WORD id, WORD code, HWND hControl) { switch (id) { case IDHELP: - DefHelpContext.topic = "/customcmd.htm"; + DefHelpContext.topic = (char*)"/customcmd.htm"; g_pOrbiter->OpenHelp (&DefHelpContext); return TRUE; case IDOK: diff --git a/Src/Orbiter/DlgHelp.cpp b/Src/Orbiter/DlgHelp.cpp index 2f3da31f9..5da8fd73b 100644 --- a/Src/Orbiter/DlgHelp.cpp +++ b/Src/Orbiter/DlgHelp.cpp @@ -210,7 +210,7 @@ INT_PTR CALLBACK DlgHelp::DlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l case WM_COMMAND: switch (LOWORD (wParam)) { case IDHELP: - DefHelpContext.topic = "/help.htm"; + DefHelpContext.topic = (char*)"/help.htm"; g_pOrbiter->OpenHelp (&DefHelpContext); return TRUE; case IDCANCEL: diff --git a/Src/Orbiter/DlgInfo.cpp b/Src/Orbiter/DlgInfo.cpp index 1775fa7e0..87c574342 100644 --- a/Src/Orbiter/DlgInfo.cpp +++ b/Src/Orbiter/DlgInfo.cpp @@ -1057,7 +1057,7 @@ BOOL DlgInfo::OnCommand (HWND hDlg, WORD id, WORD code, HWND hControl) { switch (id) { case IDHELP: - DefHelpContext.topic = "/objinfo.htm"; + DefHelpContext.topic = (char*)"/objinfo.htm"; g_pOrbiter->OpenHelp (&DefHelpContext); return TRUE; case IDC_INFO_MAP: diff --git a/Src/Orbiter/DlgMap.cpp b/Src/Orbiter/DlgMap.cpp index 74ad9c0b2..b2c365b8f 100644 --- a/Src/Orbiter/DlgMap.cpp +++ b/Src/Orbiter/DlgMap.cpp @@ -717,7 +717,7 @@ BOOL DlgMap::OnCommand (HWND hDlg, WORD id, WORD code, HWND hControl) switch (id) { case IDHELP: - DefHelpContext.topic = "/map.htm"; + DefHelpContext.topic = (char*)"/map.htm"; g_pOrbiter->OpenHelp (&DefHelpContext); return TRUE; case IDC_MAP_OPTIONS: diff --git a/Src/Orbiter/DlgMenuCfg.cpp b/Src/Orbiter/DlgMenuCfg.cpp index fc2832a42..765c65f48 100644 --- a/Src/Orbiter/DlgMenuCfg.cpp +++ b/Src/Orbiter/DlgMenuCfg.cpp @@ -85,7 +85,7 @@ BOOL DlgMenuCfg::OnCommand (HWND hDlg, WORD id, WORD code, HWND hControl) { switch (id) { case IDHELP: - DefHelpContext.topic = "/menucfg.htm"; + DefHelpContext.topic = (char*)"/menucfg.htm"; g_pOrbiter->OpenHelp (&DefHelpContext); return TRUE; case IDC_MNUCFG_SHOWMENU: diff --git a/Src/Orbiter/DlgMgr.h b/Src/Orbiter/DlgMgr.h index cad62867a..e85475641 100644 --- a/Src/Orbiter/DlgMgr.h +++ b/Src/Orbiter/DlgMgr.h @@ -7,10 +7,12 @@ #define STRICT 1 #include #include + #include "DialogWin.h" +#include "Orbiter.h" -class Orbiter; class oapi::GraphicsClient; +extern Orbiter *g_pOrbiter; struct DIALOGENTRY { DialogWin *dlg; diff --git a/Src/Orbiter/DlgRecorder.cpp b/Src/Orbiter/DlgRecorder.cpp index 911245b1e..068912f47 100644 --- a/Src/Orbiter/DlgRecorder.cpp +++ b/Src/Orbiter/DlgRecorder.cpp @@ -33,7 +33,7 @@ void DlgRecorder::SetupDialog (HWND hDlg) static int RecItem[4] = {IDC_REC_GRPRECORD, IDC_REC_SCNLABEL, IDC_REC_SCENARIO, IDC_REC_ROLLDOWN}; static int RecItem2[3] = {IDC_REC_SCNLABEL, IDC_REC_SCENARIO, IDC_REC_SYSSAMPLE}; static int PlayItem[6] = {IDC_REC_GRPREPLAY, IDC_REC_SHOWNOTES, IDC_REC_PLAYRECSPEED, IDC_REC_USECAM, IDC_REC_USEFOCUS, IDC_REC_EDITOR}; - static char *statestr[3] = {"Status:\nNormal", "Status:\nRecording", "Status:\nPlaying"}; + static const char *statestr[3] = {"Status:\nNormal", "Status:\nRecording", "Status:\nPlaying"}; int i, status = g_pOrbiter->RecorderStatus(); @@ -190,7 +190,7 @@ BOOL DlgRecorder::OnCommand (HWND hDlg, WORD id, WORD code, HWND hControl) break; case IDC_REC_HELP1: case IDC_REC_HELP2: - DefHelpContext.topic = "/recorder.htm"; + DefHelpContext.topic = (char*)"/recorder.htm"; g_pOrbiter->OpenHelp (&DefHelpContext); return TRUE; case IDCANCEL: diff --git a/Src/Orbiter/DlgTacc.cpp b/Src/Orbiter/DlgTacc.cpp index 5a01f1fef..16b63ebcb 100644 --- a/Src/Orbiter/DlgTacc.cpp +++ b/Src/Orbiter/DlgTacc.cpp @@ -75,7 +75,7 @@ BOOL DlgTacc::OnCommand (HWND hDlg, WORD id, WORD code, HWND hControl) { switch (id) { case IDHELP: - DefHelpContext.topic = "/timeacc.htm"; + DefHelpContext.topic = (char*)"/timeacc.htm"; g_pOrbiter->OpenHelp (&DefHelpContext); return TRUE; case IDC_WARP_01: diff --git a/Src/Orbiter/ExtraRender.cpp b/Src/Orbiter/ExtraRender.cpp index ceb2d1bbc..47b2db865 100644 --- a/Src/Orbiter/ExtraRender.cpp +++ b/Src/Orbiter/ExtraRender.cpp @@ -16,26 +16,24 @@ char *Extra_RenderOptions::Name () { - return "Visualisation parameters"; + return (char*)"Visualisation parameters"; } char *Extra_RenderOptions::Description () { - static char *desc = "Configure advanced rendering options affecting the appearance of the 3D world.\r\n\r\nCommon options can be accessed under the 'Visual effects' tab."; - return desc; + return (char*)"Configure advanced rendering options affecting the appearance of the 3D world.\r\n\r\nCommon options can be accessed under the 'Visual effects' tab."; } //============================================================================= char *Extra_PlanetRenderOptions::Name () { - return "Planet rendering options"; + return (char*)"Planet rendering options"; } char *Extra_PlanetRenderOptions::Description () { - static char *desc = "Options affecting the visual quality and appearance of planetary bodies."; - return desc; + return (char*)"Options affecting the visual quality and appearance of planetary bodies."; } bool Extra_PlanetRenderOptions::clbkOpen (HWND hParent) diff --git a/Src/Orbiter/GraphicsAPI.cpp b/Src/Orbiter/GraphicsAPI.cpp index 42981cc35..6ebaff809 100644 --- a/Src/Orbiter/GraphicsAPI.cpp +++ b/Src/Orbiter/GraphicsAPI.cpp @@ -25,7 +25,7 @@ extern Pane *g_pane; using namespace oapi; -char *strWndClass = "Orbiter Render Window"; +const char *strWndClass = "Orbiter Render Window"; OAPIFUNC LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); // Render window callback (calls RenderWndProc) @@ -522,7 +522,7 @@ bool GraphicsClient::WriteImageDataToFile (const ImageData &data, // customize output PROPBAG2 option = { 0 }; - option.pstrName = L"ImageQuality"; + option.pstrName = (wchar_t*)L"ImageQuality"; VARIANT varValue; VariantInit (&varValue); varValue.vt = VT_R4; @@ -658,7 +658,7 @@ HWND GraphicsClient::InitRenderWnd (HWND hWnd) // store class instance with window for access in the message handler char title[256], cbuf[128]; - extern TCHAR *g_strAppTitle; + extern const TCHAR *g_strAppTitle; strcpy (title, g_strAppTitle); GetWindowText (hWnd, cbuf, 128); if (cbuf[0]) { diff --git a/Src/Orbiter/Keymap.cpp b/Src/Orbiter/Keymap.cpp index c17bb92fe..86c216c5c 100644 --- a/Src/Orbiter/Keymap.cpp +++ b/Src/Orbiter/Keymap.cpp @@ -11,7 +11,7 @@ using namespace std; struct { BYTE id; - char *name; + const char *name; } keyname[NKEY] = { {OAPI_KEY_ESCAPE, "ESC"}, // 0x01: Escape {OAPI_KEY_1, "1"}, // 0x02: 1 @@ -232,7 +232,7 @@ void Keymap::SetDefault () func[i] = lkeyspec[i].defkey; } -void Keymap::Write (char *fname) +void Keymap::Write (const char *fname) { char cbuf[256]; ofstream ofs (fname); @@ -240,7 +240,7 @@ void Keymap::Write (char *fname) ofs << lkeyspec[i].itemstr << " = " << PrintStr (cbuf, func[i]) << endl; } -bool Keymap::Read (char *fname) +bool Keymap::Read (const char *fname) { char cbuf[256]; ifstream ifs (fname, ios::in); diff --git a/Src/Orbiter/Keymap.h b/Src/Orbiter/Keymap.h index cef69c947..fd1daecd8 100644 --- a/Src/Orbiter/Keymap.h +++ b/Src/Orbiter/Keymap.h @@ -29,10 +29,10 @@ class Keymap { void SetDefault (); // set orbiter-default key mapping - bool Read (char *fname); + bool Read (const char *fname); // parse keymap table from file - void Write (char *fname); + void Write (const char *fname); // write keymap table to file bool IsLogicalKey (char *kstate, int lfunc) const; diff --git a/Src/Orbiter/Launchpad.cpp b/Src/Orbiter/Launchpad.cpp index 159cc11e2..7b740b237 100644 --- a/Src/Orbiter/Launchpad.cpp +++ b/Src/Orbiter/Launchpad.cpp @@ -561,7 +561,7 @@ int orbiter::LaunchpadDialog::SelectDemoScenario () // "Extra Parameters" page // **************************************************************************** -static char *desc_fixedstep = "Force Orbiter to advance the simulation by a fixed time interval in each frame."; +static const char *desc_fixedstep = "Force Orbiter to advance the simulation by a fixed time interval in each frame."; void OpenDynamics (HINSTANCE, HWND); diff --git a/Src/Orbiter/Log.cpp b/Src/Orbiter/Log.cpp index 673f379ec..b899ac8f7 100644 --- a/Src/Orbiter/Log.cpp +++ b/Src/Orbiter/Log.cpp @@ -22,7 +22,7 @@ static DWORD t0 = 0; static LogOutFunc logOut = 0; -void InitLog (char *logfile, bool append) +void InitLog (const char *logfile, bool append) { strcpy (logname, logfile); ofstream ofs (logname, append ? ios::app : ios::out); @@ -355,7 +355,7 @@ void LogOut_Warning(const char* func, const char* file, int line, const char* ms va_end(ap); } -void LogOut_Obsolete(char* func, char* msg) +void LogOut_Obsolete(const char* func, const char* msg) { LogOut_Obsolete_Start(); LogOut("Obsolete API function used: %s", func); diff --git a/Src/Orbiter/Log.h b/Src/Orbiter/Log.h index 9961dd753..37d9d5972 100644 --- a/Src/Orbiter/Log.h +++ b/Src/Orbiter/Log.h @@ -12,7 +12,7 @@ typedef void (*LogOutFunc)(const char* msg); // The following routines are for message output into a log file -void InitLog (char *logfile, bool append); // Set log file name and clear if exists +void InitLog (const char *logfile, bool append); // Set log file name and clear if exists void SetLogVerbosity (bool verbose); void SetLogOutFunc(LogOutFunc func); // clone log output to a function void LogOut (const char *msg, ...); // Write a message to the log file @@ -23,7 +23,7 @@ void LogOut_Error (const char *func, const char *file, int line, const char *msg void LogOut_ErrorVA(const char *func, const char *file, int line, const char *msg, va_list ap); void LogOut_Warning(const char* func, const char* file, int line, const char* msg, ...); // Write general warning to log file void LogOut_WarningVA(const char* func, const char* file, int line, const char* msg, va_list ap); -void LogOut_Obsolete(char* func, char* msg = 0); // Write obsolete-function warning to log file +void LogOut_Obsolete(const char* func, const char* msg = 0); // Write obsolete-function warning to log file void LogOut_LastError (const char *func, const char *file, int line); // Write formatted string from GetLastError void LogOut_DDErr (HRESULT hr, const char *func, const char *file, int line); // Write DirectDraw error to log file void LogOut_DIErr (HRESULT hr, const char *func, const char *file, int line); // Write DirectInput error to log file diff --git a/Src/Orbiter/MenuInfoBar.cpp b/Src/Orbiter/MenuInfoBar.cpp index e3037dea4..2a6f17914 100644 --- a/Src/Orbiter/MenuInfoBar.cpp +++ b/Src/Orbiter/MenuInfoBar.cpp @@ -691,7 +691,7 @@ bool MenuInfoBar::ProcessMouse (UINT event, DWORD state, DWORD x, DWORD y) return true; case 9: extern HELPCONTEXT DefHelpContext; - DefHelpContext.topic = "/mainmenu.htm"; + DefHelpContext.topic = (char*)"/mainmenu.htm"; g_pOrbiter->OpenHelp (&DefHelpContext); return true; case 10: diff --git a/Src/Orbiter/Mfd.cpp b/Src/Orbiter/Mfd.cpp index 601d4d331..86bd3ced9 100644 --- a/Src/Orbiter/Mfd.cpp +++ b/Src/Orbiter/Mfd.cpp @@ -99,7 +99,7 @@ Instrument *Instrument::Create (int type, Pane *_pane, Instrument *Instrument::Create (ifstream &ifs, Pane *_pane, INT_PTR _id, const Spec &spec, Vessel *_vessel) { - static char *mfdstr[MAXMFD] = {"Left","Right","3","4","5","6","7","8","9","10","11","12"}; + static const char *mfdstr[MAXMFD] = {"Left","Right","3","4","5","6","7","8","9","10","11","12"}; Instrument *instr = 0; char header[64], cbuf[256], *pc; strcpy (header, "BEGIN_MFD "); @@ -198,28 +198,28 @@ void Instrument::GlobalExit (oapi::GraphicsClient *gc) void Instrument::RegisterBuiltinModes () { static MFDMODESPECEX def_mode[BUILTIN_MFD_MODES] = { - {"Orbit", OAPI_KEY_O, 0, 0}, - {"Surface", OAPI_KEY_S, 0, 0}, - {"Map", OAPI_KEY_M, 0, 0}, - {"HSI", OAPI_KEY_H, 0, 0}, - {"VOR/VTOL", OAPI_KEY_L, 0, 0}, - {"Docking", OAPI_KEY_D, 0, 0}, - {"Align Planes", OAPI_KEY_A, 0, 0}, - {"Sync Orbit", OAPI_KEY_Y, 0, 0}, - {"Transfer", OAPI_KEY_X, 0, 0}, - {"COM/NAV", OAPI_KEY_C, 0, 0} + {(char*)"Orbit", OAPI_KEY_O, 0, 0}, + {(char*)"Surface", OAPI_KEY_S, 0, 0}, + {(char*)"Map", OAPI_KEY_M, 0, 0}, + {(char*)"HSI", OAPI_KEY_H, 0, 0}, + {(char*)"VOR/VTOL", OAPI_KEY_L, 0, 0}, + {(char*)"Docking", OAPI_KEY_D, 0, 0}, + {(char*)"Align Planes", OAPI_KEY_A, 0, 0}, + {(char*)"Sync Orbit", OAPI_KEY_Y, 0, 0}, + {(char*)"Transfer", OAPI_KEY_X, 0, 0}, + {(char*)"COM/NAV", OAPI_KEY_C, 0, 0} }; static MFDMODESPEC def_oldmode[BUILTIN_MFD_MODES] = { // obsolete - {"Orbit", OAPI_KEY_O, 0}, - {"Surface", OAPI_KEY_S, 0}, - {"Map", OAPI_KEY_M, 0}, - {"HSI", OAPI_KEY_H, 0}, - {"VOR/VTOL", OAPI_KEY_L, 0}, - {"Docking", OAPI_KEY_D, 0}, - {"Align Planes", OAPI_KEY_A, 0}, - {"Sync Orbit", OAPI_KEY_Y, 0}, - {"Transfer", OAPI_KEY_X, 0}, - {"COM/NAV", OAPI_KEY_C, 0} + {(char*)"Orbit", OAPI_KEY_O, 0}, + {(char*)"Surface", OAPI_KEY_S, 0}, + {(char*)"Map", OAPI_KEY_M, 0}, + {(char*)"HSI", OAPI_KEY_H, 0}, + {(char*)"VOR/VTOL", OAPI_KEY_L, 0}, + {(char*)"Docking", OAPI_KEY_D, 0}, + {(char*)"Align Planes", OAPI_KEY_A, 0}, + {(char*)"Sync Orbit", OAPI_KEY_Y, 0}, + {(char*)"Transfer", OAPI_KEY_X, 0}, + {(char*)"COM/NAV", OAPI_KEY_C, 0} }; static int def_id[BUILTIN_MFD_MODES] = { @@ -1004,7 +1004,7 @@ void Instrument::DrawMenu () if (tex) gc->clbkBlt (tex, 0, 0, surf); } -void Instrument::OpenSelect_CelBody (char *title, Select::Callbk enter_cbk, DWORD flag) +void Instrument::OpenSelect_CelBody (const char *title, Select::Callbk enter_cbk, DWORD flag) { SelCelBodyFlag = flag; g_select->Open (title, ClbkSelect_CelBody, enter_cbk, (void*)this); @@ -1041,7 +1041,7 @@ bool Instrument::ClbkSelect_CelBody (Select *menu, int item, char *str, void *da return false; } -void Instrument::OpenSelect_Tgt (char *title, Select::Callbk enter_cbk, const CelestialBody *ref, DWORD flag) +void Instrument::OpenSelect_Tgt (const char *title, Select::Callbk enter_cbk, const CelestialBody *ref, DWORD flag) { seltgtprm.ref = ref; seltgtprm.flag = flag; diff --git a/Src/Orbiter/Mfd.h b/Src/Orbiter/Mfd.h index 27e59a298..8fdc646b0 100644 --- a/Src/Orbiter/Mfd.h +++ b/Src/Orbiter/Mfd.h @@ -269,14 +269,14 @@ class Instrument { virtual bool ReadParams (std::ifstream &ifs) = 0; virtual void WriteParams (std::ostream &ofs) const = 0; - void OpenSelect_CelBody (char *title, Select::Callbk enter_cbk, DWORD flag = 0); + void OpenSelect_CelBody (const char *title, Select::Callbk enter_cbk, DWORD flag = 0); static bool ClbkSelect_CelBody (Select *menu, int item, char *str, void *data); // Open a selection box for a celestial object. // The callback function is called if a selection is made. // The following bit flags are supported: // 1: do not include Star objects - void OpenSelect_Tgt (char *title, Select::Callbk enter_cbk, const CelestialBody *ref = 0, DWORD flag = 0); + void OpenSelect_Tgt (const char *title, Select::Callbk enter_cbk, const CelestialBody *ref = 0, DWORD flag = 0); // Open a selection box for a target object // Supported bitflags: // 1: don't display 'By name' option diff --git a/Src/Orbiter/MfdAlign.cpp b/Src/Orbiter/MfdAlign.cpp index 8f740c651..c74698b5b 100644 --- a/Src/Orbiter/MfdAlign.cpp +++ b/Src/Orbiter/MfdAlign.cpp @@ -76,7 +76,7 @@ Instrument_OPlaneAlign::~Instrument_OPlaneAlign () HELPCONTEXT *Instrument_OPlaneAlign::HelpTopic () const { extern HELPCONTEXT DefHelpContext; - DefHelpContext.topic = "/mfd_align.htm"; + DefHelpContext.topic = (char*)"/mfd_align.htm"; return &DefHelpContext; } diff --git a/Src/Orbiter/MfdComms.cpp b/Src/Orbiter/MfdComms.cpp index 16e8495cb..6ad26824e 100644 --- a/Src/Orbiter/MfdComms.cpp +++ b/Src/Orbiter/MfdComms.cpp @@ -40,7 +40,7 @@ Instrument_Comms::~Instrument_Comms () HELPCONTEXT *Instrument_Comms::HelpTopic () const { extern HELPCONTEXT DefHelpContext; - DefHelpContext.topic = "/mfd_com.htm"; + DefHelpContext.topic = (char*)"/mfd_com.htm"; return &DefHelpContext; } diff --git a/Src/Orbiter/MfdDocking.cpp b/Src/Orbiter/MfdDocking.cpp index 68e02ace9..9ee4e6ebf 100644 --- a/Src/Orbiter/MfdDocking.cpp +++ b/Src/Orbiter/MfdDocking.cpp @@ -73,7 +73,7 @@ Instrument_Docking::~Instrument_Docking () HELPCONTEXT *Instrument_Docking::HelpTopic () const { extern HELPCONTEXT DefHelpContext; - DefHelpContext.topic = "/mfd_dock.htm"; + DefHelpContext.topic = (char*)"/mfd_dock.htm"; return &DefHelpContext; } diff --git a/Src/Orbiter/MfdHsi.cpp b/Src/Orbiter/MfdHsi.cpp index 53cda3911..75d11859b 100644 --- a/Src/Orbiter/MfdHsi.cpp +++ b/Src/Orbiter/MfdHsi.cpp @@ -63,7 +63,7 @@ Instrument_HSI::~Instrument_HSI () HELPCONTEXT *Instrument_HSI::HelpTopic () const { extern HELPCONTEXT DefHelpContext; - DefHelpContext.topic = "/mfd_hsi.htm"; + DefHelpContext.topic = (char*)"/mfd_hsi.htm"; return &DefHelpContext; } @@ -82,7 +82,7 @@ void Instrument_HSI::UpdateDraw (oapi::Sketchpad *skp) }; static const INT narrowseg = 3, arrowseg[3] = {7,4,4}; - static char *label[12] = {"N", "3", "6", "E", "12", "15", "S", "21", "24", "W", "30", "33"}; + static const char *label[12] = {"N", "3", "6", "E", "12", "15", "S", "21", "24", "W", "30", "33"}; static int llen[12] = {1,1,1,1,2,2,1,2,2,1,2,2}; // gyro direction diff --git a/Src/Orbiter/MfdLanding.cpp b/Src/Orbiter/MfdLanding.cpp index c7404e9b6..e73a3478d 100644 --- a/Src/Orbiter/MfdLanding.cpp +++ b/Src/Orbiter/MfdLanding.cpp @@ -53,7 +53,7 @@ Instrument_Landing::~Instrument_Landing () HELPCONTEXT *Instrument_Landing::HelpTopic () const { extern HELPCONTEXT DefHelpContext; - DefHelpContext.topic = "/mfd_vtol.htm"; + DefHelpContext.topic = (char*)"/mfd_vtol.htm"; return &DefHelpContext; } diff --git a/Src/Orbiter/MfdMap.cpp b/Src/Orbiter/MfdMap.cpp index 5d70676bc..698e793ac 100644 --- a/Src/Orbiter/MfdMap.cpp +++ b/Src/Orbiter/MfdMap.cpp @@ -95,7 +95,7 @@ Instrument_Map::~Instrument_Map () HELPCONTEXT *Instrument_Map::HelpTopic () const { extern HELPCONTEXT DefHelpContext; - DefHelpContext.topic = "/mfd_map.htm"; + DefHelpContext.topic = (char*)"/mfd_map.htm"; return &DefHelpContext; } diff --git a/Src/Orbiter/MfdMap_old.cpp b/Src/Orbiter/MfdMap_old.cpp index 974e3bf6a..9a2df67d4 100644 --- a/Src/Orbiter/MfdMap_old.cpp +++ b/Src/Orbiter/MfdMap_old.cpp @@ -94,7 +94,7 @@ Instrument_MapOld::~Instrument_MapOld () HELPCONTEXT *Instrument_MapOld::HelpTopic () const { extern HELPCONTEXT DefHelpContext; - DefHelpContext.topic = "/mfd_map.htm"; + DefHelpContext.topic = (char*)"/mfd_map.htm"; return &DefHelpContext; } diff --git a/Src/Orbiter/MfdOrbit.cpp b/Src/Orbiter/MfdOrbit.cpp index 51269c40e..b581536f4 100644 --- a/Src/Orbiter/MfdOrbit.cpp +++ b/Src/Orbiter/MfdOrbit.cpp @@ -87,7 +87,7 @@ Instrument_Orbit::~Instrument_Orbit () HELPCONTEXT *Instrument_Orbit::HelpTopic () const { extern HELPCONTEXT DefHelpContext; - DefHelpContext.topic = "/mfd_orbit.htm"; + DefHelpContext.topic = (char*)"/mfd_orbit.htm"; return &DefHelpContext; } @@ -260,7 +260,7 @@ void Instrument_Orbit::DisplayOrbit (oapi::Sketchpad *skp, int which, oapi::IVEC void Instrument_Orbit::UpdateDraw (oapi::Sketchpad *skp) { - static char *projstr[3] = {"Ecliptic", "Ship", "Target"}; + static const char *projstr[3] = {"Ecliptic", "Ship", "Target"}; Matrix rot1, rot2, irot; bool bValidShpEl = (elref != 0); diff --git a/Src/Orbiter/MfdSurface.cpp b/Src/Orbiter/MfdSurface.cpp index fa810f007..4f38db3d7 100644 --- a/Src/Orbiter/MfdSurface.cpp +++ b/Src/Orbiter/MfdSurface.cpp @@ -179,7 +179,7 @@ void Instrument_Surface::InitDeviceObjects () HELPCONTEXT *Instrument_Surface::HelpTopic () const { extern HELPCONTEXT DefHelpContext; - DefHelpContext.topic = "/mfd_surf.htm"; + DefHelpContext.topic = (char*)"/mfd_surf.htm"; return &DefHelpContext; } diff --git a/Src/Orbiter/MfdSync.cpp b/Src/Orbiter/MfdSync.cpp index 226ee8f17..dd2e6bfa3 100644 --- a/Src/Orbiter/MfdSync.cpp +++ b/Src/Orbiter/MfdSync.cpp @@ -16,7 +16,7 @@ extern InputBox *g_input; // ======================================================================= // class Instrument_OSync -static char *modestr[7] = { +static const char *modestr[7] = { "Intersect 1", "Intersect 2", "Sh periapsis", @@ -58,7 +58,7 @@ Instrument_OSync::~Instrument_OSync () HELPCONTEXT *Instrument_OSync::HelpTopic () const { extern HELPCONTEXT DefHelpContext; - DefHelpContext.topic = "/mfd_sync.htm"; + DefHelpContext.topic = (char*)"/mfd_sync.htm"; return &DefHelpContext; } diff --git a/Src/Orbiter/MfdTransfer.cpp b/Src/Orbiter/MfdTransfer.cpp index 99f1b0c36..f42405b1d 100644 --- a/Src/Orbiter/MfdTransfer.cpp +++ b/Src/Orbiter/MfdTransfer.cpp @@ -85,7 +85,7 @@ Instrument_Transfer::~Instrument_Transfer () HELPCONTEXT *Instrument_Transfer::HelpTopic () const { extern HELPCONTEXT DefHelpContext; - DefHelpContext.topic = "/mfd_transfer.htm"; + DefHelpContext.topic = (char*)"/mfd_transfer.htm"; return &DefHelpContext; } diff --git a/Src/Orbiter/OGraphics.cpp b/Src/Orbiter/OGraphics.cpp index a776ca5d4..843584ce1 100644 --- a/Src/Orbiter/OGraphics.cpp +++ b/Src/Orbiter/OGraphics.cpp @@ -479,7 +479,7 @@ HRESULT OrbiterGraphics::ConfirmDevice (DDCAPS*, D3DDEVICEDESC7*) // ======================================================================= -HRESULT OrbiterGraphics::ReEnumerate (TCHAR* fname, DeviceData *dd) +HRESULT OrbiterGraphics::ReEnumerate (const TCHAR* fname, DeviceData *dd) { HRESULT hr; D3D7Enum_FreeResources (); @@ -559,7 +559,7 @@ bool OrbiterGraphics::clbkInitialise () { if (!GraphicsClient::clbkInitialise()) return false; - static char *DevName = "Device.dat"; + static const char *DevName = "Device.dat"; Config *pcfg = orbiter->Cfg(); bool force = pcfg->CfgDevPrm.bForceEnum; @@ -722,7 +722,7 @@ bool OrbiterGraphics::clbkDisplayFrame () HWND OrbiterGraphics::clbkCreateRenderWindow () { - extern char *strWndClass; + extern const char *strWndClass; VIDEODATA *vd = GetVideoData(); HWND hWnd; diff --git a/Src/Orbiter/OGraphics.h b/Src/Orbiter/OGraphics.h index 755d832e3..f39a15c38 100644 --- a/Src/Orbiter/OGraphics.h +++ b/Src/Orbiter/OGraphics.h @@ -177,7 +177,7 @@ class OrbiterGraphics: public GDIClient { inline void SetDeviceInfo (D3D7Enum_DeviceInfo *di) { m_pDeviceInfo = di; } inline D3D7Enum_DeviceInfo *GetDeviceInfo () { return m_pDeviceInfo; } bool SelectDevice (D3D7Enum_DeviceInfo **dev, DeviceData *dd); - HRESULT ReEnumerate (TCHAR* fname, DeviceData *dd); + HRESULT ReEnumerate (const TCHAR* fname, DeviceData *dd); HRESULT Init3DEnvironment (); HRESULT Change3DEnvironment (); void Exit3DEnvironment (); diff --git a/Src/Orbiter/Orbiter.cpp b/Src/Orbiter/Orbiter.cpp index 9899f7485..76766ed6b 100644 --- a/Src/Orbiter/Orbiter.cpp +++ b/Src/Orbiter/Orbiter.cpp @@ -76,15 +76,15 @@ const int MAX_TEXTURE_BUFSIZE = 8000000; // Texture manager buffer size. Should be determined from // memory size (System or Video?) -TCHAR* g_strAppTitle = "OpenOrbiter"; +const TCHAR* g_strAppTitle = "OpenOrbiter"; #ifdef INLINEGRAPHICS -TCHAR* MasterConfigFile = "Orbiter.cfg"; +const TCHAR* MasterConfigFile = "Orbiter.cfg"; #else -TCHAR* MasterConfigFile = "Orbiter_NG.cfg"; +const TCHAR* MasterConfigFile = "Orbiter_NG.cfg"; #endif // INLINEGRAPHICS -TCHAR* CurrentScenario = "(Current state)"; +const TCHAR* CurrentScenario = "(Current state)"; char ScenarioName[256] = "\0"; // some global string resources @@ -97,7 +97,6 @@ Orbiter* g_pOrbiter = NULL; // application BOOL g_bFrameMoving = TRUE; extern BOOL g_bAppUseZBuffer; extern BOOL g_bAppUseBackBuffer; -extern TCHAR* g_strAppTitle; double g_nearplane = 5.0; double g_farplane = 5e6; const double MinWarpLimit = 0.1; // make variable @@ -146,10 +145,10 @@ char DBG_MSG[256] = ""; // Default help context (for main help system) HELPCONTEXT DefHelpContext = { - "html/orbiter.chm", + (char*)"html/orbiter.chm", 0, - "html/orbiter.chm::/orbiter.hhc", - "html/orbiter.chm::/orbiter.hhk" + (char*)"html/orbiter.chm::/orbiter.hhc", + (char*)"html/orbiter.chm::/orbiter.hhk" }; // ======================================================================= @@ -535,7 +534,7 @@ int Orbiter::GetVersion () const { static int v = 0; if (!v) { - static char *mstr[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + static const char *mstr[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; char ms[32]; int day, month, year; sscanf (__DATE__, "%s%d%d", ms, &day, &year); @@ -923,7 +922,7 @@ void Orbiter::CloseSession () if (bRecord) ToggleRecorder(); else if (bPlayback) EndPlayback(); - char* desc = pConfig->CfgDebugPrm.bSaveExitScreen ? "CurrentState_img" : "CurrentState"; + const char* desc = pConfig->CfgDebugPrm.bSaveExitScreen ? "CurrentState_img" : "CurrentState"; SaveScenario (CurrentScenario, desc, 2); if (hScnInterp) { script->DelInterpreter (hScnInterp); @@ -992,9 +991,9 @@ void Orbiter::CloseSession () } else { LOGOUT("**** Respawning Orbiter process\r\n"); #ifdef INLINEGRAPHICS - char *name = "orbiter.exe"; + const char *name = "orbiter.exe"; #else - char *name = "modules\\server\\orbiter.exe"; + const char *name = "modules\\server\\orbiter.exe"; #endif #ifdef INLINEGRAPHICS CloseHandle (hMutex); // delete mutex so that we don't block the child diff --git a/Src/Orbiter/PlaybackEd.cpp b/Src/Orbiter/PlaybackEd.cpp index 1a5b4827e..7ff3c1f00 100644 --- a/Src/Orbiter/PlaybackEd.cpp +++ b/Src/Orbiter/PlaybackEd.cpp @@ -79,7 +79,7 @@ void PlaybackEvent::TimeStr (char *str) sprintf (str, "%0.2f", t0); } -void PlaybackEvent::WriteEvent (ofstream &ofs, char *eventtype, char *event) +void PlaybackEvent::WriteEvent (ofstream &ofs, const char *eventtype, const char *event) { ofs << t0 << ' ' << eventtype; if (event) ofs << ' ' << event; @@ -137,7 +137,7 @@ INT_PTR PlaybackEvent::MsgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar // ========================================================= -GenericEvent::GenericEvent (PlaybackEditor *_editor, double _t0, char *_tag, char *_content): PlaybackEvent (_editor, _t0) +GenericEvent::GenericEvent (PlaybackEditor *_editor, double _t0, const char *_tag, const char *_content): PlaybackEvent (_editor, _t0) { content = tag = 0; SetTag (_tag); @@ -156,7 +156,7 @@ GenericEvent::~GenericEvent () } } -void GenericEvent::SetTag (char *_tag) +void GenericEvent::SetTag (const char *_tag) { if (tag) { delete []tag; @@ -168,7 +168,7 @@ void GenericEvent::SetTag (char *_tag) } else tag = 0; } -void GenericEvent::SetContent (char *_content) +void GenericEvent::SetContent (const char *_content) { if (content) { delete []content; @@ -459,7 +459,7 @@ INT_PTR CALLBACK CameraEvent::EditProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPA // ========================================================= -NoteEvent::NoteEvent (PlaybackEditor *_editor, double _t0, char *_note): PlaybackEvent (_editor, _t0) +NoteEvent::NoteEvent (PlaybackEditor *_editor, double _t0, const char *_note): PlaybackEvent (_editor, _t0) { note = NULL; SetNote (_note); @@ -473,7 +473,7 @@ NoteEvent::~NoteEvent () } } -void NoteEvent::SetNote (char *_note) +void NoteEvent::SetNote (const char *_note) { if (note) { delete []note; @@ -849,7 +849,7 @@ INT_PTR PlaybackEditor::DlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa switch (LOWORD (wParam)) { case IDHELP: { extern HELPCONTEXT DefHelpContext; - DefHelpContext.topic = "/playbackedit.htm"; + DefHelpContext.topic = (char*)"/playbackedit.htm"; orbiter->OpenHelp (&DefHelpContext); } return TRUE; case IDCANCEL: @@ -885,7 +885,7 @@ INT_PTR PlaybackEditor::DlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa void PlaybackEditor::CreateInsertEventList (HWND hDlg) { const int nevent = 7; - static char *events[nevent] = { + static const char *events[nevent] = { "NOTE (annotation text)", "NOTEPOS (bounding box)", "NOTECOL (text colour)", diff --git a/Src/Orbiter/PlaybackEd.h b/Src/Orbiter/PlaybackEd.h index c3f7afaa8..dd6fc5ea8 100644 --- a/Src/Orbiter/PlaybackEd.h +++ b/Src/Orbiter/PlaybackEd.h @@ -20,7 +20,7 @@ class PlaybackEvent { virtual void TagStr (char *str) = 0; virtual void DescStr (char *str) { str[0] = '\0'; } virtual void Write (std::ofstream &ofs) = 0; - void WriteEvent (std::ofstream &ofs, char *eventtype, char *event); + void WriteEvent (std::ofstream &ofs, const char *eventtype, const char *event); virtual void EditEvent (PlaybackEditor *editor); virtual void CommitEdit (); virtual INT_PTR MsgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); @@ -34,10 +34,10 @@ class PlaybackEvent { class GenericEvent: public PlaybackEvent { public: - GenericEvent (PlaybackEditor *_editor, double _t0, char *_tag, char *_content); + GenericEvent (PlaybackEditor *_editor, double _t0, const char *_tag, const char *_content); ~GenericEvent (); - void SetTag (char *_tag); - void SetContent (char *_content); + void SetTag (const char *_tag); + void SetContent (const char *_content); void TagStr (char *str); void DescStr (char *str); void Write (std::ofstream &ofs); @@ -100,9 +100,9 @@ class CameraEvent: public PlaybackEvent { class NoteEvent: public PlaybackEvent { public: - NoteEvent (PlaybackEditor *_editor, double _t0, char *_note); + NoteEvent (PlaybackEditor *_editor, double _t0, const char *_note); ~NoteEvent (); - void SetNote (char *_note); + void SetNote (const char *_note); void TagStr (char *str); void DescStr (char *str); void Write (std::ofstream &ofs); diff --git a/Src/Orbiter/Psys.h b/Src/Orbiter/Psys.h index 88be0a815..9c8243b7a 100644 --- a/Src/Orbiter/Psys.h +++ b/Src/Orbiter/Psys.h @@ -14,6 +14,8 @@ class Vessel; class SuperVessel; struct TimeJumpData; +Vector SingleGacc (const Vector &rpos, const CelestialBody *body); +Vector SingleGacc_perturbation (const Vector &rpos, const CelestialBody *body); class PlanetarySystem { friend class Body; @@ -188,9 +190,6 @@ class PlanetarySystem { void BroadcastVessel (DWORD msg, void *data); // Broadcast a message to all vessels - friend Vector SingleGacc (const Vector &rpos, const CelestialBody *body); - friend Vector SingleGacc_perturbation (const Vector &rpos, const CelestialBody *body); - const std::vector &LabelList() const { return m_labelList; } std::vector& LabelList() diff --git a/Src/Orbiter/Rigidbody.cpp b/Src/Orbiter/Rigidbody.cpp index 704ed1c2c..440b2055f 100644 --- a/Src/Orbiter/Rigidbody.cpp +++ b/Src/Orbiter/Rigidbody.cpp @@ -38,6 +38,13 @@ RigidBody::PROPMODE RigidBody::PropMode[MAX_PROP_LEVEL] = {&RigidBody::RK2_LinAn const double gfielddata_updt_interval = 60.0; +inline Vector Call_EulerInv_full (RigidBody *body, const Vector &tau, const Vector &omega) +{ return body->EulerInv_full (tau, omega); } +inline Vector Call_EulerInv_simple (RigidBody *body, const Vector &tau, const Vector &omega) +{ return body->EulerInv_simple (tau, omega); } +inline Vector Call_EulerInv_zero (RigidBody *body, const Vector &tau, const Vector &omega) +{ return body->EulerInv_zero (tau, omega); } + // ======================================================================= // class RigidBody @@ -516,11 +523,11 @@ void RigidBody::SetDynamicUpdate (bool dynamic) } const char *RigidBody::PropagatorStr (DWORD idx, bool verbose) { - static char *ShortPropModeStr[NPROP_METHOD] = { + static const char *ShortPropModeStr[NPROP_METHOD] = { "RK2", "RK4", "RK5", "RK6", "RK7", "RK8", "SY2", "SY4", "SY6", "SY8" }; - static char *LongPropModeStr[NPROP_METHOD] = { + static const char *LongPropModeStr[NPROP_METHOD] = { "Runge-Kutta, 2nd order (RK2)", "Runge-Kutta, 4th order (RK4)", "Runge-Kutta, 5th order (RK5)", "Runge-Kutta, 6th order (RK6)", "Runge-Kutta, 7th order (RK7)", "Runge-Kutta, 8th order (RK8)", "Symplectic, 2nd order (SY2)", "Symplectic, 4th order (SY4)", "Symplectic, 6th order (SY6)", "Symplectic, 8th order (SY8)" diff --git a/Src/Orbiter/Rigidbody.h b/Src/Orbiter/Rigidbody.h index d1142f1e7..a3a682ca2 100644 --- a/Src/Orbiter/Rigidbody.h +++ b/Src/Orbiter/Rigidbody.h @@ -277,13 +277,6 @@ class RigidBody: public Body { int PropLevel; // current propagator stage int PropSubMax; // upper limit for number of subsamples int nPropSubsteps; // current number of subsamples - - friend Vector Call_EulerInv_full (RigidBody *body, const Vector &tau, const Vector &omega) - { return body->EulerInv_full (tau, omega); } - friend Vector Call_EulerInv_simple (RigidBody *body, const Vector &tau, const Vector &omega) - { return body->EulerInv_simple (tau, omega); } - friend Vector Call_EulerInv_zero (RigidBody *body, const Vector &tau, const Vector &omega) - { return body->EulerInv_zero (tau, omega); } }; #endif // !__RIGIDBODY_H \ No newline at end of file diff --git a/Src/Orbiter/Scene.cpp b/Src/Orbiter/Scene.cpp index 8b70cdb94..f8dc39353 100644 --- a/Src/Orbiter/Scene.cpp +++ b/Src/Orbiter/Scene.cpp @@ -130,7 +130,7 @@ Scene::Scene (OrbiterGraphics *og) strcpy (cbuf, g_pOrbiter->Cfg()->CfgDirPrm.TextureDir); strcat (cbuf, "\\exhaust.dds"); - static char *gtex_name[4] = {"Exhaust", "Horizon", "Reentry", "Contrail1"}; + static const char *gtex_name[4] = {"Exhaust", "Horizon", "Reentry", "Contrail1"}; for (i = 0; i < 4; i++) { gtex[i] = 0; if (file = g_pOrbiter->OpenTextureFile (gtex_name[i], ".dds")) { @@ -257,10 +257,10 @@ void Scene::Init3DFonts () gfont[0]->SetColorKey (DDCKEY_SRCBLT, &ck); // common labels - static char *label = "-x-y-z"; + static const char *label = "-x-y-z"; RECT sr = {0,0,0,0}; w = i = 0; - for (char *c = label; *c; c++, i++) { + for (const char *c = label; *c; c++, i++) { int idx = *c - 32; sr.left = gfont_ofs[0][idx]; sr.right = sr.left + gfont_cw[0][idx]; @@ -1072,4 +1072,4 @@ void Scene::RenderVectors() vobj[i]->RenderVectorLabels(dev); dev->SetRenderState(D3DRENDERSTATE_ZENABLE, TRUE); -} \ No newline at end of file +} diff --git a/Src/Orbiter/Select.cpp b/Src/Orbiter/Select.cpp index 40c9fdf86..ef5786b60 100644 --- a/Src/Orbiter/Select.cpp +++ b/Src/Orbiter/Select.cpp @@ -176,7 +176,7 @@ void Select::Activate () SetFocus (g_pOrbiter->GetRenderWnd()); } -void Select::Open (char *_title, Callbk submenu_cbk, Callbk enter_cbk, +void Select::Open (const char *_title, Callbk submenu_cbk, Callbk enter_cbk, void *_userdata, int _cntx, int _cnty) { if (surf) Clear (true); // this line was commented. why? @@ -312,10 +312,10 @@ void Select::AppendSeparator () listh += 3; } -void Select::SetTitle (char *_title) +void Select::SetTitle (const char *_title) { - if (strlen (_title) >= select_strlen) _title[select_strlen-1] = '\0'; - strcpy (title, _title); + strncpy(title, _title, select_strlen); + title[select_strlen - 1] = '\0'; } void Select::Push () @@ -653,7 +653,7 @@ void InputBox::Activate (int cntx, int cnty) RefreshSurface (); } -void InputBox::Open (char *_title, char *_buf, int _vislen, +void InputBox::Open (const char *_title, char *_buf, int _vislen, Callbk cbk, void *_userdata, int cntx, int cnty) { OpenEx (_title, _buf, _vislen, cbk, 0, _userdata, 0, cntx, cnty); diff --git a/Src/Orbiter/Select.h b/Src/Orbiter/Select.h index eb0cd385e..f1f4c31ba 100644 --- a/Src/Orbiter/Select.h +++ b/Src/Orbiter/Select.h @@ -66,7 +66,7 @@ class Select: public InlineDialog { int Level() const { return level; } int Append (const char *_str, BYTE flag = 0); void AppendSeparator (); - void SetTitle (char *_title); + void SetTitle (const char *_title); const char *Title () const { return title; } int ConsumeKey (UINT uMsg, WPARAM wParam, WORD mod = 0); enum { key_ignore, key_consume, key_ok, key_cancel }; @@ -74,7 +74,7 @@ class Select: public InlineDialog { void SetSubmenuCallback (Callbk cbk) { cbk_submenu = cbk; } void SetEnterCallback (Callbk cbk) { cbk_enter = cbk; } - void Open (char *_title = 0, Callbk submenu_cbk = 0, Callbk enter_cbk = 0, + void Open (const char *_title = 0, Callbk submenu_cbk = 0, Callbk enter_cbk = 0, void *_userdata = 0, int cntx = -1, int cnty = -1); // activates the menu with the specified parameters (menu items must have // been added with Append before) @@ -183,7 +183,7 @@ class InputBox: public InlineDialog { void SetEnterCallback (Callbk cbk) { cbk_enter = cbk; } // set callback function for accepting input - void Open (char *_title = 0, char *_buf = 0, int _vislen = 20, + void Open (const char *_title = 0, char *_buf = 0, int _vislen = 20, Callbk cbk = 0, void *_userdata = 0, int cntx = -1, int cnty = -1); // activates the input box with the specified parameters // combines SetTitle, InitBuffer, SetEnterCallback and Activate diff --git a/Src/Orbiter/TabExtra.cpp b/Src/Orbiter/TabExtra.cpp index ae243129f..f5e4cc723 100644 --- a/Src/Orbiter/TabExtra.cpp +++ b/Src/Orbiter/TabExtra.cpp @@ -318,13 +318,12 @@ INT_PTR CALLBACK BuiltinLaunchpadItem::DlgProc (HWND hWnd, UINT uMsg, WPARAM wPa char *ExtraPropagation::Name () { - return "Time propagation"; + return (char*)"Time propagation"; } char *ExtraPropagation::Description () { - static char *desc = "Select and configure the time propagation methods Orbiter uses to update vessel positions and velocities from one time frame to the next."; - return desc; + return (char*)"Select and configure the time propagation methods Orbiter uses to update vessel positions and velocities from one time frame to the next."; } //----------------------------------------------------------------------------- @@ -338,13 +337,12 @@ int ExtraDynamics::PropId[NPROP_METHOD] = { char *ExtraDynamics::Name () { - return "Dynamic state propagators"; + return (char*)"Dynamic state propagators"; } char *ExtraDynamics::Description () { - static char *desc = "Select the numerical integration methods used for dynamic state updates.\r\n\r\nState propagators affect the accuracy and stability of spacecraft orbits and trajectory calculations."; - return desc; + return (char*)"Select the numerical integration methods used for dynamic state updates.\r\n\r\nState propagators affect the accuracy and stability of spacecraft orbits and trajectory calculations."; } bool ExtraDynamics::clbkOpen (HWND hParent) @@ -764,13 +762,12 @@ INT_PTR CALLBACK ExtraAngDynamics::DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, char *ExtraStabilisation::Name () { - return "Orbit stabilisation"; + return (char*)"Orbit stabilisation"; } char *ExtraStabilisation::Description () { - static char *desc = "Select the parameters that determine the conditions when Orbiter switches between dynamic and stabilised state updates."; - return desc; + return (char*)"Select the parameters that determine the conditions when Orbiter switches between dynamic and stabilised state updates."; } bool ExtraStabilisation::clbkOpen (HWND hParent) @@ -898,13 +895,12 @@ INT_PTR CALLBACK ExtraStabilisation::DlgProc (HWND hWnd, UINT uMsg, WPARAM wPara char *ExtraInstruments::Name () { - return "Instruments and panels"; + return (char*)"Instruments and panels"; } char *ExtraInstruments::Description () { - static char *desc = "Select general configuration parameters for spacecraft instruments, MFD displays and instrument panels."; - return desc; + return (char*)"Select general configuration parameters for spacecraft instruments, MFD displays and instrument panels."; } //----------------------------------------------------------------------------- @@ -913,13 +909,12 @@ char *ExtraInstruments::Description () char *ExtraMfdConfig::Name() { - return "MFD parameter configuration"; + return (char*)"MFD parameter configuration"; } char *ExtraMfdConfig::Description () { - static char *desc = "Select display parameters for multifunctional displays (MFD)."; - return desc; + return (char*)"Select display parameters for multifunctional displays (MFD)."; } bool ExtraMfdConfig::clbkOpen (HWND hParent) @@ -1027,13 +1022,12 @@ INT_PTR CALLBACK ExtraMfdConfig::DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, L char *ExtraVesselConfig::Name () { - return "Vessel configuration"; + return (char*)"Vessel configuration"; } char *ExtraVesselConfig::Description () { - static char *desc = "Configure spacecraft parameters"; - return desc; + return (char*)"Configure spacecraft parameters"; } //============================================================================= @@ -1042,13 +1036,12 @@ char *ExtraVesselConfig::Description () char *ExtraPlanetConfig::Name () { - return "Celestial body configuration"; + return (char*)"Celestial body configuration"; } char *ExtraPlanetConfig::Description () { - static char *desc = "Configure options for celestial objects"; - return desc; + return (char*)"Configure options for celestial objects"; } //============================================================================= @@ -1057,13 +1050,12 @@ char *ExtraPlanetConfig::Description () char *ExtraDebug::Name () { - return "Debugging options"; + return (char*)"Debugging options"; } char *ExtraDebug::Description () { - static char *desc = "Various options that are useful for debugging and special tasks. Not generally used for standard simulation sessions."; - return desc; + return (char*)"Various options that are useful for debugging and special tasks. Not generally used for standard simulation sessions."; } //----------------------------------------------------------------------------- @@ -1072,13 +1064,12 @@ char *ExtraDebug::Description () char *ExtraShutdown::Name () { - return "Orbiter shutdown options"; + return (char*)"Orbiter shutdown options"; } char *ExtraShutdown::Description () { - static char *desc = "Set the behaviour of Orbiter after closing the simulation window: return to Launchpad, respawn or terminate."; - return desc; + return (char*)"Set the behaviour of Orbiter after closing the simulation window: return to Launchpad, respawn or terminate."; } bool ExtraShutdown::clbkOpen (HWND hParent) @@ -1150,13 +1141,12 @@ INT_PTR CALLBACK ExtraShutdown::DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LP char *ExtraFixedStep::Name () { - return "Fixed time steps"; + return (char*)"Fixed time steps"; } char *ExtraFixedStep::Description () { - static char *desc = "This option assigns a fixed simulation time interval to each frame. Useful for debugging, and when numerical accuracy and stability of the dynamic propagators are important (for example, to generate trajectory data or when recording high-fidelity playbacks).\r\n\r\nWarning: Selecting this option leads to nonlinear time flow and a simulation that is no longer real-time."; - return desc; + return (char*)"This option assigns a fixed simulation time interval to each frame. Useful for debugging, and when numerical accuracy and stability of the dynamic propagators are important (for example, to generate trajectory data or when recording high-fidelity playbacks).\r\n\r\nWarning: Selecting this option leads to nonlinear time flow and a simulation that is no longer real-time."; } bool ExtraFixedStep::clbkOpen (HWND hParent) @@ -1265,13 +1255,12 @@ INT_PTR CALLBACK ExtraFixedStep::DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, L char *ExtraRenderingOptions::Name () { - return "Rendering options"; + return (char*)"Rendering options"; } char *ExtraRenderingOptions::Description () { - static char *desc = "Some rendering options that can be used for debugging problems."; - return desc; + return (char*)"Some rendering options that can be used for debugging problems."; } bool ExtraRenderingOptions::clbkOpen (HWND hParent) @@ -1335,13 +1324,12 @@ INT_PTR CALLBACK ExtraRenderingOptions::DlgProc (HWND hWnd, UINT uMsg, WPARAM wP char *ExtraTimerSettings::Name () { - return "Timer settings"; + return (char*)"Timer settings"; } char *ExtraTimerSettings::Description () { - static char *desc = "This option allows the selection of the timer used by Orbiter to calculate time step intervals. Useful for testing and working around buggy hardware timers."; - return desc; + return (char*)"This option allows the selection of the timer used by Orbiter to calculate time step intervals. Useful for testing and working around buggy hardware timers."; } bool ExtraTimerSettings::clbkOpen (HWND hParent) @@ -1415,13 +1403,12 @@ INT_PTR CALLBACK ExtraTimerSettings::DlgProc (HWND hWnd, UINT uMsg, WPARAM wPara char *ExtraPerformanceSettings::Name () { - return "Performance options"; + return (char*)"Performance options"; } char *ExtraPerformanceSettings::Description () { - static char *desc = "This option can be used to modify Windows environment parameters that can improve the simulator performance."; - return desc; + return (char*)"This option can be used to modify Windows environment parameters that can improve the simulator performance."; } bool ExtraPerformanceSettings::clbkOpen (HWND hParent) @@ -1496,13 +1483,12 @@ INT_PTR CALLBACK ExtraPerformanceSettings::DlgProc (HWND hWnd, UINT uMsg, WPARAM char *ExtraLaunchpadOptions::Name () { - return "Launchpad options"; + return (char*)"Launchpad options"; } char *ExtraLaunchpadOptions::Description () { - static char *desc = "Configure the behaviour of the Orbiter Launchpad dialog."; - return desc; + return (char*)"Configure the behaviour of the Orbiter Launchpad dialog."; } bool ExtraLaunchpadOptions::clbkOpen (HWND hParent) @@ -1578,13 +1564,12 @@ INT_PTR CALLBACK ExtraLaunchpadOptions::DlgProc (HWND hWnd, UINT uMsg, WPARAM wP char *ExtraLogfileOptions::Name () { - return "Logfile options"; + return (char*)"Logfile options"; } char *ExtraLogfileOptions::Description () { - static char *desc = "Configure options for log file output."; - return desc; + return (char*)"Configure options for log file output."; } bool ExtraLogfileOptions::clbkOpen (HWND hParent) diff --git a/Src/Orbiter/TabScenario.cpp b/Src/Orbiter/TabScenario.cpp index 6a045a3e7..31b5beb64 100644 --- a/Src/Orbiter/TabScenario.cpp +++ b/Src/Orbiter/TabScenario.cpp @@ -19,7 +19,7 @@ using namespace std; -extern TCHAR* CurrentScenario; +extern const TCHAR* CurrentScenario; const char *htmlstyle = ""; //----------------------------------------------------------------------------- @@ -582,7 +582,6 @@ int orbiter::ScenarioTab::GetSelScenario (char *scn, int len) void orbiter::ScenarioTab::SaveCurScenario () { - extern TCHAR* CurrentScenario; ifstream ifs (pLp->App()->ScnPath (CurrentScenario), ios::in); if (ifs) { DialogBoxParam (AppInstance(), MAKEINTRESOURCE(IDD_SAVESCN), LaunchpadWnd(), SaveProc, (LPARAM)this); @@ -598,7 +597,6 @@ void orbiter::ScenarioTab::SaveCurScenario () //----------------------------------------------------------------------------- int orbiter::ScenarioTab::SaveCurScenarioAs (const char *name, char *desc, bool replace) { - extern TCHAR* CurrentScenario; string cbuf; bool skip = false; const char *path = pLp->App()->ScnPath (name); diff --git a/Src/Orbiter/TabVideo.cpp b/Src/Orbiter/TabVideo.cpp index 613c2f669..b6e6acbd6 100644 --- a/Src/Orbiter/TabVideo.cpp +++ b/Src/Orbiter/TabVideo.cpp @@ -17,9 +17,9 @@ using namespace std; #ifdef INLINEGRAPHICS -static PSTR strInfo_Default = "The built-in DX7 graphics engine."; +static PCSTR strInfo_Default = "The built-in DX7 graphics engine."; #else -static PSTR strInfo_Default = "No graphics engine has been selected. Orbiter will run in console mode."; +static PCSTR strInfo_Default = "No graphics engine has been selected. Orbiter will run in console mode."; #endif //----------------------------------------------------------------------------- @@ -156,10 +156,10 @@ void orbiter::DefVideoTab::EnumerateClients(HWND hTab) { SendDlgItemMessage(hTab, IDC_VID_COMBO_MODULE, CB_RESETCONTENT, 0, 0); #ifdef INLINEGRAPHICS - const PSTR strGraphics = "Built-in graphics engine"; + PCSTR strGraphics = "Built-in graphics engine"; SendDlgItemMessage(hTab, IDC_VID_COMBO_MODULE, CB_ADDSTRING, 0, (LPARAM)strGraphics); #else - const PSTR strConsole = "Console mode (no engine loaded)"; + PCSTR strConsole = "Console mode (no engine loaded)"; SendDlgItemMessage(hTab, IDC_VID_COMBO_MODULE, CB_ADDSTRING, 0, (LPARAM)strConsole); ScanDir(hTab, "Modules\\Plugin"); #endif @@ -186,7 +186,7 @@ static std::string GetNameWithoutFileExtension(const char* filepath) //----------------------------------------------------------------------------- //! Find Graphics engine DLLs in dir -void orbiter::DefVideoTab::ScanDir(HWND hTab, const PSTR dir) +void orbiter::DefVideoTab::ScanDir(HWND hTab, PCSTR dir) { char pattern[256], filepath[256]; sprintf(pattern, "%s\\*", dir); @@ -246,7 +246,7 @@ void orbiter::DefVideoTab::SelectClientIndex(UINT idx) SetInfoString(strInfo_Default); } -void orbiter::DefVideoTab::SetInfoString(PSTR str) +void orbiter::DefVideoTab::SetInfoString(PCSTR str) { if (strInfo) delete []strInfo; @@ -298,4 +298,4 @@ BOOL orbiter::DefVideoTab::OnMessage (HWND hWnd, UINT uMsg, WPARAM wParam, LPARA gc->LaunchpadVideoWndProc (hWnd, uMsg, wParam, lParam); return FALSE; -} \ No newline at end of file +} diff --git a/Src/Orbiter/TabVideo.h b/Src/Orbiter/TabVideo.h index 146a035b9..c107ad576 100644 --- a/Src/Orbiter/TabVideo.h +++ b/Src/Orbiter/TabVideo.h @@ -35,13 +35,13 @@ namespace orbiter { void EnumerateClients(HWND hTab); - void ScanDir(HWND hTab, const PSTR dir); + void ScanDir(HWND hTab, PCSTR dir); // scan directory dir (relative to Orbiter root) for graphics clients // and enter them in the combo box void SelectClientIndex(UINT idx); - void SetInfoString(PSTR str); + void SetInfoString(PCSTR str); static INT_PTR CALLBACK InfoProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); diff --git a/Src/Orbiter/TimeData.h b/Src/Orbiter/TimeData.h index ca582c1fd..3768a50f7 100644 --- a/Src/Orbiter/TimeData.h +++ b/Src/Orbiter/TimeData.h @@ -13,11 +13,11 @@ class TimeData { // Reset all sim and sys times to 0. Set time warp to 1 // Disable fixed step mode - void TimeData::SetFixedStep(double step); + void SetFixedStep(double step); // set a fixed time interval for each time step [s] // step=0 disables the fixed step modus - double TimeData::FixedStep() const { return (bFixedStep ? fixed_step : 0.0); } + double FixedStep() const { return (bFixedStep ? fixed_step : 0.0); } void BeginStep (double deltat, bool running); // advance time by deltat (seconds) diff --git a/Src/Orbiter/Vecmat.h b/Src/Orbiter/Vecmat.h index 6fded4c1c..cf1179f53 100644 --- a/Src/Orbiter/Vecmat.h +++ b/Src/Orbiter/Vecmat.h @@ -215,13 +215,6 @@ class Matrix { void orthogonalise (int axis); - friend Matrix IMatrix(); // returns identity matrix - - friend Vector mul (const Matrix &A, const Vector &b); // returns A * b - friend Vector tmul (const Matrix &A, const Vector &b); // returns A^T * b - friend Matrix inv (const Matrix &A); // inverse of A - friend Matrix transp (const Matrix &A); // transpose of A - friend void qrdcmp (Matrix &a, Vector &c, Vector &d, int *sing = 0); friend void qrsolv (const Matrix &a, const Vector &c, const Vector &d, Vector &b); @@ -231,6 +224,13 @@ class Matrix { }; }; +Matrix IMatrix(); // returns identity matrix + +Vector mul (const Matrix &A, const Vector &b); // returns A * b +Vector tmul (const Matrix &A, const Vector &b); // returns A^T * b +Matrix inv (const Matrix &A); // inverse of A +Matrix transp (const Matrix &A); // transpose of A + // ======================================================================= // class Vector4: 4-element vector diff --git a/Src/Orbiter/Vessel.cpp b/Src/Orbiter/Vessel.cpp index d1a44e94e..eb555033f 100644 --- a/Src/Orbiter/Vessel.cpp +++ b/Src/Orbiter/Vessel.cpp @@ -5556,8 +5556,10 @@ bool Vessel::VCRedrawEvent (int id, int event, SURFHANDLE surf) const bool Vessel::VCMouseEvent (int id, int event, Vector &p) const { - if (modIntf.v && modIntf.v->Version() >= 1) - return ((VESSEL2*)modIntf.v)->clbkVCMouseEvent (id, event, _V(p.x,p.y,p.z)); + if (modIntf.v && modIntf.v->Version() >= 1) { + VECTOR3 v = _V(p.x,p.y,p.z); + return ((VESSEL2*)modIntf.v)->clbkVCMouseEvent (id, event, v); + } else return false; } @@ -8851,4 +8853,4 @@ bool VESSEL4::UnregisterMFDMode (int mode) int VESSEL4::clbkNavProcess (int mode) { return mode; -} \ No newline at end of file +} diff --git a/Src/Orbiter/Vessel.h b/Src/Orbiter/Vessel.h index 57f8fd287..1ae3419d9 100644 --- a/Src/Orbiter/Vessel.h +++ b/Src/Orbiter/Vessel.h @@ -1087,7 +1087,7 @@ class Vessel: public VesselBase { // set/unset/toggle a particular navigation mode // and check status of a navigation mode - void Vessel::SetHoverHoldAltitude (double alt, bool terrainalt); + void SetHoverHoldAltitude (double alt, bool terrainalt); // ======================================================================== // beacon light management diff --git a/Src/Orbiter/Vobject.cpp b/Src/Orbiter/Vobject.cpp index 330338c3a..73d024496 100644 --- a/Src/Orbiter/Vobject.cpp +++ b/Src/Orbiter/Vobject.cpp @@ -47,7 +47,7 @@ void VObject::CreateDeviceObjects (OrbiterGraphics *gclient) FILE *file; gc = gclient; for (int i = 0; i < 3; i++) { - static char *fname[3] = {"Ball","Ball2","Ball3"}; + static const char *fname[3] = {"Ball","Ball2","Ball3"}; file = fopen (g_pOrbiter->TexPath (fname[i]), "rb"); if (file) { g_texmanager2->ReadTexture(file, blobtex + i); diff --git a/Src/Orbiter/cmdline.cpp b/Src/Orbiter/cmdline.cpp index 686745cb7..ff257af11 100644 --- a/Src/Orbiter/cmdline.cpp +++ b/Src/Orbiter/cmdline.cpp @@ -68,7 +68,7 @@ bool CommandLine::ParseNextOption(PSTR& cmdLine, bool& groupKey, Option& option) else { isLongKey = false; } - char* termKeyChar = (isLongKey ? " \t=" : " \t"); // '=' as key-value separator only allowed for long keys + const char* termKeyChar = (isLongKey ? " \t=" : " \t"); // '=' as key-value separator only allowed for long keys std::set termK(termKeyChar, termKeyChar + strlen(termKeyChar) + 1); // include '\0' in set PSTR endKey = cmdLine; while (termK.find(*endKey) == termK.end()) @@ -102,7 +102,7 @@ bool CommandLine::ParseNextOption(PSTR& cmdLine, bool& groupKey, Option& option) return false; // for long keys, '=' is mandatory before values if (isQuotedVal = (*cmdLine == '\"')) cmdLine++; // skip starting quotes - char* termValChar = (isQuotedParam || isQuotedVal ? "\"" : " \t"); // for quoted values, only accept quotes as terminator + const char* termValChar = (isQuotedParam || isQuotedVal ? "\"" : " \t"); // for quoted values, only accept quotes as terminator std::set termV(termValChar, termValChar + strlen(termValChar) + 1); // include '\0' in set PSTR endVal = cmdLine; while (termV.find(*endVal) == termV.end()) diff --git a/Src/Orbiter/cmdline.h b/Src/Orbiter/cmdline.h index 0ff13ce20..fefc303d2 100644 --- a/Src/Orbiter/cmdline.h +++ b/Src/Orbiter/cmdline.h @@ -25,7 +25,7 @@ class CommandLine protected: struct Key { UINT id; - PSTR longName; + PCSTR longName; char shortName; bool hasArgument; }; diff --git a/Src/Orbiter/console_ng.cpp b/Src/Orbiter/console_ng.cpp index 44526f67a..34472fbcb 100644 --- a/Src/Orbiter/console_ng.cpp +++ b/Src/Orbiter/console_ng.cpp @@ -36,7 +36,7 @@ orbiter::ConsoleNG::ConsoleNG(Orbiter* pOrbiter) , m_hStatWnd(NULL) , m_hThread(NULL) { - static const PSTR title = "Orbiter Server Console"; + static PCSTR title = "Orbiter Server Console"; static SIZE_T stackSize = 4096; s_console = this; diff --git a/Src/Orbiter/cspheremgr2.cpp b/Src/Orbiter/cspheremgr2.cpp index 7331508d3..85a087839 100644 --- a/Src/Orbiter/cspheremgr2.cpp +++ b/Src/Orbiter/cspheremgr2.cpp @@ -167,7 +167,7 @@ TileManager2::TileManager2(const char *name, int _maxres, int _grid } template<> -MATRIX4 CsphereManager::WorldMatrix(int ilng, int nlng, int ilat, int nlat) +inline MATRIX4 CsphereManager::WorldMatrix(int ilng, int nlng, int ilat, int nlat) { double lat, lng = Pi2 * (double)ilng / (double)nlng + Pi; // add pi so texture wraps at +-180° @@ -223,4 +223,4 @@ void CsphereManager::LoadZTrees() for (int i = 0; i < ntreeMgr; i++) treeMgr[i] = 0; } -} \ No newline at end of file +} diff --git a/Src/Orbiter/hud.h b/Src/Orbiter/hud.h index 518268f94..fad362b3b 100644 --- a/Src/Orbiter/hud.h +++ b/Src/Orbiter/hud.h @@ -135,7 +135,7 @@ class HUD_Orbit: public HUD { void SelectReference (); protected: - char *ModeIDString() const { return "ORBIT"; } + char *ModeIDString() const { return (char*)"ORBIT"; } void Display (oapi::Sketchpad *skp); void UpdateMesh (int &ivtx, int &iidx); void WriteParams (std::ostream &ofs) const; @@ -165,7 +165,7 @@ class HUD_Surface: public HUD { void SwitchColour (int idx); protected: - char *ModeIDString() const { return "SRFCE"; } + char *ModeIDString() const { return (char*)"SRFCE"; } void Display (oapi::Sketchpad *skp); void UpdateMesh (int &ivtx, int &iidx); void WriteParams (std::ostream &ofs) const; @@ -196,7 +196,7 @@ class HUD_Docking: public HUD { void ProcessMessage (int msg, void *data); protected: - char *ModeIDString() const { return "DOCK"; } + char *ModeIDString() const { return (char*)"DOCK"; } void Display (oapi::Sketchpad *skp); void UpdateMesh (int &ivtx, int &iidx); void WriteParams (std::ostream &ofs) const; diff --git a/Src/Orbiter/tilemgr2_imp.hpp b/Src/Orbiter/tilemgr2_imp.hpp index 6c1bc4c15..324df2858 100644 --- a/Src/Orbiter/tilemgr2_imp.hpp +++ b/Src/Orbiter/tilemgr2_imp.hpp @@ -4,8 +4,13 @@ #ifndef __TILEMGR2_IMP_HPP #define __TILEMGR2_IMP_HPP +#include "Camera.h" +#include "Orbiter.h" #include "tilemgr2.h" +extern Camera* g_camera; +extern Orbiter* g_pOrbiter; + // Implementation of template class TileManager2 // ----------------------------------------------------------------------- diff --git a/Src/Plugin/Common/Dialog/TabDlg.cpp b/Src/Plugin/Common/Dialog/TabDlg.cpp index b5b75ba4c..dd92bd06c 100644 --- a/Src/Plugin/Common/Dialog/TabDlg.cpp +++ b/Src/Plugin/Common/Dialog/TabDlg.cpp @@ -14,6 +14,9 @@ #include "Uxtheme.h" #include "OrbiterAPI.h" +INT_PTR CALLBACK DlgProcHook (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK TabProcHook (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + // ============================================================== // class TabbedDialog: Dialog containing a single tab control // ============================================================== diff --git a/Src/Plugin/ExtMFD/ExtMFD.cpp b/Src/Plugin/ExtMFD/ExtMFD.cpp index 365b7205a..49ab879ce 100644 --- a/Src/Plugin/ExtMFD/ExtMFD.cpp +++ b/Src/Plugin/ExtMFD/ExtMFD.cpp @@ -52,8 +52,8 @@ DLLCLBK void InitModule (HINSTANCE hDLL) // To allow the user to open our new dialog box, we create // an entry in the "Custom Functions" list which is accessed // in Orbiter via Ctrl-F4. - g_dwCmd = oapiRegisterCustomCmd ("External MFD", - "Opens a multifunctional display in an external window", + g_dwCmd = oapiRegisterCustomCmd ((char*)"External MFD", + (char*)"Opens a multifunctional display in an external window", OpenDlgClbk, NULL); // Load the bitmap for the "pin" title button diff --git a/Src/Plugin/FlightData/FlightData.cpp b/Src/Plugin/FlightData/FlightData.cpp index f1d3633cb..ab9cd2db1 100644 --- a/Src/Plugin/FlightData/FlightData.cpp +++ b/Src/Plugin/FlightData/FlightData.cpp @@ -191,8 +191,8 @@ oapi::FlightData::FlightData(HINSTANCE hDLL) Graph::InitGDI(); // Register the custom command for the plugin - static char* desc = "Open a window to track flight parameters of a spacecraft."; - m_dwCmd = oapiRegisterCustomCmd("Flight Data Monitor", desc, hookOpenDlg, NULL); + static char* desc = (char*)"Open a window to track flight parameters of a spacecraft."; + m_dwCmd = oapiRegisterCustomCmd((char*)"Flight Data Monitor", desc, hookOpenDlg, NULL); m_pVessel = nullptr; m_sysT = 0.0; diff --git a/Src/Plugin/Framerate/Framerate.cpp b/Src/Plugin/Framerate/Framerate.cpp index f792c028f..5a147a27b 100644 --- a/Src/Plugin/Framerate/Framerate.cpp +++ b/Src/Plugin/Framerate/Framerate.cpp @@ -160,8 +160,8 @@ oapi::Framerate::Framerate(HINSTANCE hDLL) Graph::InitGDI(); // Register the custom command for the plugin - static char* desc = "Simulation frame rate / time step monitor"; - m_dwCmd = oapiRegisterCustomCmd("Performance Meter", desc, hookOpenDlg, NULL); + static char* desc = (char*)"Simulation frame rate / time step monitor"; + m_dwCmd = oapiRegisterCustomCmd((char*)"Performance Meter", desc, hookOpenDlg, NULL); m_sysT = 0.0; m_simT = 0.0; diff --git a/Src/Plugin/LaunchpadExtensions/AtmConfig/AtmConfig.cpp b/Src/Plugin/LaunchpadExtensions/AtmConfig/AtmConfig.cpp index fe2ea0dd7..a4d6e5fdf 100644 --- a/Src/Plugin/LaunchpadExtensions/AtmConfig/AtmConfig.cpp +++ b/Src/Plugin/LaunchpadExtensions/AtmConfig/AtmConfig.cpp @@ -13,7 +13,7 @@ using namespace std; class AtmConfig; const char *CelbodyDir = "Modules\\Celbody"; -char *ModuleItem = "MODULE_ATM"; +const char *ModuleItem = "MODULE_ATM"; struct { HINSTANCE hInst; @@ -24,7 +24,7 @@ class AtmConfig: public LaunchpadItem { public: AtmConfig(); ~AtmConfig(); - char *Name() { return "Atmosphere Configuration"; } + char *Name() { return (char*)"Atmosphere Configuration"; } char *Description(); void Read (const char *celbody); void Write(const char *celbody); @@ -87,8 +87,7 @@ void AtmConfig::ClearModules () char *AtmConfig::Description() { - static char *desc = "Configure atmospheric parameters for celestial bodies."; - return desc; + return (char*)"Configure atmospheric parameters for celestial bodies."; } void AtmConfig::Read (const char *celbody) @@ -98,7 +97,7 @@ void AtmConfig::Read (const char *celbody) FILEHANDLE hFile = oapiOpenFile (cfgname, FILE_IN, CONFIG); if (hFile) { char name[256]; - oapiReadItem_string (hFile, ModuleItem, name); + oapiReadItem_string (hFile, (char*)ModuleItem, name); for (module_curr = module_first; module_curr; module_curr = module_curr->next) if (!_stricmp (module_curr->module_name, name)) break; oapiCloseFile (hFile, FILE_IN); @@ -112,9 +111,9 @@ void AtmConfig::Write (const char *celbody) FILEHANDLE hFile = oapiOpenFile (cfgname, FILE_OUT, CONFIG); if (hFile) { if (module_curr && module_curr->module_name[0]) - oapiWriteItem_string (hFile, ModuleItem, module_curr->module_name); + oapiWriteItem_string (hFile, (char*)ModuleItem, module_curr->module_name); else - oapiWriteItem_string (hFile, ModuleItem, "[None]"); + oapiWriteItem_string (hFile, (char*)ModuleItem, (char*)"[None]"); oapiCloseFile (hFile, FILE_OUT); } } @@ -204,8 +203,8 @@ void AtmConfig::Apply (HWND hWnd) void AtmConfig::OpenHelp (HWND hWnd) { HELPCONTEXT hc = { - "html/Orbiter.chm", - "extra_atmconfig", + (char*)"html/Orbiter.chm", + (char*)"extra_atmconfig", 0, 0 }; oapiOpenLaunchpadHelp (&hc); diff --git a/Src/Plugin/LuaConsole/ConsoleCfg.cpp b/Src/Plugin/LuaConsole/ConsoleCfg.cpp index 5caf593b0..69dc72122 100644 --- a/Src/Plugin/LuaConsole/ConsoleCfg.cpp +++ b/Src/Plugin/LuaConsole/ConsoleCfg.cpp @@ -16,13 +16,12 @@ ConsoleConfig::ConsoleConfig (HINSTANCE hDLL): LaunchpadItem () char *ConsoleConfig::Name () { - return "Console Configuration"; + return (char*)"Console Configuration"; } char *ConsoleConfig::Description () { - static char *desc = "Customize the appearance and behaviour of the inline Lua Console.\r\n\r\nThe console allows to run scripts during a simulation session."; - return desc; + return (char*)"Customize the appearance and behaviour of the inline Lua Console.\r\n\r\nThe console allows to run scripts during a simulation session."; bool clbkOpen (HWND hLaunchpad); } @@ -36,7 +35,7 @@ int ConsoleConfig::clbkWriteConfig () { FILEHANDLE hFile = oapiOpenFile (cfgfile, FILE_OUT, CONFIG); if (!hFile) return 1; - oapiWriteItem_int (hFile, "FSIZE", fontsize); + oapiWriteItem_int (hFile, (char*)"FSIZE", fontsize); oapiCloseFile (hFile, FILE_OUT); return 0; } @@ -66,7 +65,7 @@ bool ConsoleConfig::ReadConfig () MessageBeep (-1); return false; } - if (oapiReadItem_int (hFile, "FSIZE", d)) fontsize = (DWORD)d; + if (oapiReadItem_int (hFile, (char*)"FSIZE", d)) fontsize = (DWORD)d; oapiCloseFile (hFile, FILE_IN); return true; } diff --git a/Src/Plugin/LuaConsole/LuaConsole.cpp b/Src/Plugin/LuaConsole/LuaConsole.cpp index 492e27872..872c96a79 100644 --- a/Src/Plugin/LuaConsole/LuaConsole.cpp +++ b/Src/Plugin/LuaConsole/LuaConsole.cpp @@ -33,8 +33,8 @@ LuaConsole::LuaConsole (HINSTANCE hDLL): Module (hDLL) SetParams (); // may not be necessary here // Register a custom command for opening the console window - dwCmd = oapiRegisterCustomCmd ("Lua console window", - "Open a Lua script interpreter window.", + dwCmd = oapiRegisterCustomCmd ((char*)"Lua console window", + (char*)"Open a Lua script interpreter window.", OpenDlgClbk, this); // terminal history buffer @@ -118,7 +118,7 @@ void LuaConsole::clbkSimulationEnd () interp->Terminate(); interp->EndExec(); // give the thread opportunity to close if (WaitForSingleObject (hThread, 1000) != 0) { - oapiWriteLog ("LuaConsole: timeout while waiting for interpreter thread"); + oapiWriteLog ((char*)"LuaConsole: timeout while waiting for interpreter thread"); TerminateThread (hThread, 0); } CloseHandle (hThread); diff --git a/Src/Plugin/LuaMFD/LuaMFD.cpp b/Src/Plugin/LuaMFD/LuaMFD.cpp index 98fa1ef5b..3ba42018d 100644 --- a/Src/Plugin/LuaMFD/LuaMFD.cpp +++ b/Src/Plugin/LuaMFD/LuaMFD.cpp @@ -38,8 +38,8 @@ ScriptMFD::~ScriptMFD () char *ScriptMFD::ButtonLabel (int bt) { // The labels for the two buttons used by our MFD mode - static char *label[5] = {"INP", "NEW", "DEL", "PG>", "", "env[pg]; if (!env->interp->IsBusy()) - oapiOpenInputBox ("Input script command:", ScriptInput, 0, 40, (void*)this); + oapiOpenInputBox ((char*)"Input script command:", ScriptInput, 0, 40, (void*)this); } void ScriptMFD::CreateInterpreter () @@ -201,9 +201,8 @@ OAPI_MSGTYPE ScriptMFD::MsgProc (UINT msg, UINT mfd, WPARAM wparam, LPARAM lpara DLLCLBK void InitModule (HINSTANCE hDLL) { - static char *name = "Terminal MFD"; MFDMODESPECEX spec; - spec.name = name; + spec.name = (char*)"Terminal MFD"; spec.key = OAPI_KEY_T; spec.context = NULL; spec.msgproc = ScriptMFD::MsgProc; diff --git a/Src/Plugin/Meshdebug/Meshdebug.cpp b/Src/Plugin/Meshdebug/Meshdebug.cpp index 0e32e60ae..acfaba637 100644 --- a/Src/Plugin/Meshdebug/Meshdebug.cpp +++ b/Src/Plugin/Meshdebug/Meshdebug.cpp @@ -60,8 +60,8 @@ INT_PTR CALLBACK MsgProc (HWND, UINT, WPARAM, LPARAM); DLLCLBK void InitModule (HINSTANCE hModule) { g_hInst = hModule; - g_dwCmd = oapiRegisterCustomCmd ("Mesh debugger", - "Mark individual mesh groups in a vessel mesh", + g_dwCmd = oapiRegisterCustomCmd ((char*)"Mesh debugger", + (char*)"Mark individual mesh groups in a vessel mesh", OpenDlgClbk, NULL); } diff --git a/Src/Plugin/Rcontrol/Rcontrol.cpp b/Src/Plugin/Rcontrol/Rcontrol.cpp index f9edc7e14..4fab61532 100644 --- a/Src/Plugin/Rcontrol/Rcontrol.cpp +++ b/Src/Plugin/Rcontrol/Rcontrol.cpp @@ -135,8 +135,8 @@ oapi::RControl::RControl(HINSTANCE hDLL) , m_hDlg(NULL) { // Register the custom command for the plugin - m_dwCmd = oapiRegisterCustomCmd("Remote Vessel Control", - "Operate the engines of any spacecraft from a dialog box.", + m_dwCmd = oapiRegisterCustomCmd((char*)"Remote Vessel Control", + (char*)"Operate the engines of any spacecraft from a dialog box.", hookOpenDlg, NULL); // Register custom dialog controls diff --git a/Src/Plugin/ScnEditor/Editor.cpp b/Src/Plugin/ScnEditor/Editor.cpp index 96a1697f3..db0e7aa90 100644 --- a/Src/Plugin/ScnEditor/Editor.cpp +++ b/Src/Plugin/ScnEditor/Editor.cpp @@ -35,10 +35,10 @@ static double lengthscale[4] = {1.0, 1e-3, 1.0/AU, 1.0}; static double anglescale[2] = {DEG, 1.0}; static HELPCONTEXT g_hc = { - "html/plugin/ScnEditor.chm", + (char*)"html/plugin/ScnEditor.chm", 0, - "html/plugin/ScnEditor.chm::/ScnEditor.hhc", - "html/plugin/ScnEditor.chm::/ScnEditor.hhk" + (char*)"html/plugin/ScnEditor.chm::/ScnEditor.hhc", + (char*)"html/plugin/ScnEditor.chm::/ScnEditor.hhk" }; // ============================================================== @@ -58,8 +58,8 @@ ScnEditor::ScnEditor (HINSTANCE hDLL) treeicon_idx[3] = ImageList_Add (imglist, LoadBitmap (hInst, MAKEINTRESOURCE (IDB_TREEICON_FILE2)), 0); dwCmd = oapiRegisterCustomCmd ( - "Scenario Editor", - "Create, delete and configure spacecraft", + (char*)"Scenario Editor", + (char*)"Create, delete and configure spacecraft", ::OpenDialog, this); } @@ -272,7 +272,7 @@ bool ScnEditor::CreateVessel (char *name, char *classname) VESSELSTATUS2 vs; memset (&vs, 0, sizeof(vs)); vs.version = 2; - vs.rbody = oapiGetGbodyByName ("Earth"); + vs.rbody = oapiGetGbodyByName ((char*)"Earth"); if (!vs.rbody) vs.rbody = oapiGetGbodyByIndex (0); double rad = 1.1 * oapiGetSize (vs.rbody); double vel = sqrt (GGRAV * oapiGetMass (vs.rbody) / rad); @@ -430,16 +430,16 @@ void ScnEditorTab::Hide () char *ScnEditorTab::HelpTopic () { - return "/ScnEditor.htm"; + return (char*)"/ScnEditor.htm"; } void ScnEditorTab::OpenHelp () { static HELPCONTEXT hc = { - "html/plugin/ScnEditor.chm", + (char*)"html/plugin/ScnEditor.chm", 0, - "html/plugin/ScnEditor.chm::/ScnEditor.hhc", - "html/plugin/ScnEditor.chm::/ScnEditor.hhk" + (char*)"html/plugin/ScnEditor.chm::/ScnEditor.hhc", + (char*)"html/plugin/ScnEditor.chm::/ScnEditor.hhk" }; hc.topic = HelpTopic(); oapiOpenHelp (&hc); @@ -525,7 +525,7 @@ void EditorTab_Vessel::ScanVesselList () char *EditorTab_Vessel::HelpTopic () { - return "/ScnEditor.htm"; + return (char*)"/ScnEditor.htm"; } INT_PTR EditorTab_Vessel::TabProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -661,7 +661,7 @@ void EditorTab_New::InitTab () char *EditorTab_New::HelpTopic () { - return "/NewVessel.htm"; + return (char*)"/NewVessel.htm"; } INT_PTR EditorTab_New::TabProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -768,7 +768,7 @@ void EditorTab_New::ScanConfigDir (const char *ppath, HTREEITEM hti) FILEHANDLE hFile = oapiOpenFile (path, FILE_IN); if (hFile) { bool b; - skip = (oapiReadItem_bool (hFile, "EditorCreate", b) && !b); + skip = (oapiReadItem_bool (hFile, (char*)"EditorCreate", b) && !b); oapiCloseFile (hFile, FILE_IN); } if (skip) continue; @@ -847,7 +847,7 @@ bool EditorTab_New::UpdateVesselBmp () sprintf (pathname, "Vessels\\%s.cfg", classname); FILEHANDLE hFile = oapiOpenFile (pathname, FILE_IN, CONFIG); if (!hFile) return false; - if (oapiReadItem_string (hFile, "ImageBmp", imagename)) { + if (oapiReadItem_string (hFile, (char*)"ImageBmp", imagename)) { hVesselBmp = (HBITMAP)LoadImage (ed->InstHandle(), imagename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); } oapiCloseFile (hFile, FILE_IN); @@ -902,7 +902,7 @@ EditorTab_Save::EditorTab_Save (ScnEditor *editor) : ScnEditorTab (editor) char *EditorTab_Save::HelpTopic () { - return "/SaveScenario.htm"; + return (char*)"/SaveScenario.htm"; } INT_PTR EditorTab_Save::TabProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -947,7 +947,7 @@ void EditorTab_Date::InitTab () char *EditorTab_Date::HelpTopic () { - return "/Date.htm"; + return (char*)"/Date.htm"; } void EditorTab_Date::Apply () @@ -1324,7 +1324,7 @@ void EditorTab_Edit::InitTab () char *EditorTab_Edit::HelpTopic () { - return "/EditVessel.htm"; + return (char*)"/EditVessel.htm"; } BOOL EditorTab_Edit::AddFuncButton (EditorFuncSpec *efs) @@ -1473,7 +1473,7 @@ void EditorTab_Elements::InitTab () char *EditorTab_Elements::HelpTopic () { - return "/Elements.htm"; + return (char*)"/Elements.htm"; } void EditorTab_Elements::Apply () @@ -1783,7 +1783,7 @@ void EditorTab_Statevec::ScanVesselList () char *EditorTab_Statevec::HelpTopic () { - return "/Statevec.htm"; + return (char*)"/Statevec.htm"; } void EditorTab_Statevec::DlgLabels () @@ -2088,7 +2088,7 @@ void EditorTab_Landed::ScanVesselList () char *EditorTab_Landed::HelpTopic () { - return "/Location.htm"; + return (char*)"/Location.htm"; } INT_PTR EditorTab_Landed::TabProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -2233,7 +2233,8 @@ void EditorTab_Landed::Refresh (OBJHANDLE hV) oapiGetRelativePos (ed->hVessel, hRef, &pos); oapiGetRotationMatrix (hRef, &rot); pos = tmul (rot, pos); - Crt2Pol (pos, _V(0,0,0)); + VECTOR3 vel = _V(0,0,0); + Crt2Pol (pos, vel); sprintf (lngstr, "%lf", pos.data[1] * DEG); sprintf (latstr, "%lf", pos.data[2] * DEG); } @@ -2329,7 +2330,7 @@ void EditorTab_Orientation::InitTab () char *EditorTab_Orientation::HelpTopic () { - return "/Orientation.htm"; + return (char*)"/Orientation.htm"; } INT_PTR EditorTab_Orientation::TabProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -2484,7 +2485,7 @@ void EditorTab_AngularVel::InitTab () char *EditorTab_AngularVel::HelpTopic () { - return "/AngularVel.htm"; + return (char*)"/AngularVel.htm"; } INT_PTR EditorTab_AngularVel::TabProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -2611,7 +2612,7 @@ void EditorTab_Propellant::InitTab () char *EditorTab_Propellant::HelpTopic () { - return "/Propellant.htm"; + return (char*)"/Propellant.htm"; } INT_PTR EditorTab_Propellant::TabProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -2809,7 +2810,7 @@ void EditorTab_Docking::InitTab () char *EditorTab_Docking::HelpTopic () { - return "/Docking.htm"; + return (char*)"/Docking.htm"; } INT_PTR EditorTab_Docking::TabProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) diff --git a/Src/Plugin/ScriptMFD/ScriptMFD.cpp b/Src/Plugin/ScriptMFD/ScriptMFD.cpp index 45fbb6c25..20ce18dd8 100644 --- a/Src/Plugin/ScriptMFD/ScriptMFD.cpp +++ b/Src/Plugin/ScriptMFD/ScriptMFD.cpp @@ -38,7 +38,7 @@ struct VINTERP { // list of vessel-based interpreters } **vinterp; int nvinterp = 0; -static char *cfgfile = "Config\\MFD\\ScriptMFD.cfg"; +static const char *cfgfile = "Config\\MFD\\ScriptMFD.cfg"; // clears the global list of vessel-based interpreters static void ClearVinterpList() @@ -66,9 +66,9 @@ DLLCLBK void InitModule (HINSTANCE hDLL) ifstream ifs (cfgfile); while (ifs.getline (cbuf, 256)) { FILEHANDLE hFile = oapiOpenFile (cbuf, FILE_IN, CONFIG); - if (oapiReadItem_string (hFile, "Name", name) && - oapiReadItem_string (hFile, "Script", script) && - oapiReadItem_string (hFile, "Key", key)) { + if (oapiReadItem_string (hFile, (char*)"Name", name) && + oapiReadItem_string (hFile, (char*)"Script", script) && + oapiReadItem_string (hFile, (char*)"Key", key)) { SCRIPTMFDMODESPEC *tmp = new SCRIPTMFDMODESPEC[nmode+1]; if (nmode) { memcpy (tmp, modespec, nmode*sizeof(SCRIPTMFDMODESPEC)); @@ -85,7 +85,7 @@ DLLCLBK void InitModule (HINSTANCE hDLL) else sscanf (key, "%d", &modespec[nmode].key); modespec[nmode].persist = 0; - if (oapiReadItem_string (hFile, "Persist", persist)) + if (oapiReadItem_string (hFile, (char*)"Persist", persist)) if (!_stricmp(persist, "vessel")) modespec[nmode].persist = 1; nmode++; diff --git a/Src/Plugin/TrackIR/TrackIR.cpp b/Src/Plugin/TrackIR/TrackIR.cpp index bb4159b8a..22d3e60be 100644 --- a/Src/Plugin/TrackIR/TrackIR.cpp +++ b/Src/Plugin/TrackIR/TrackIR.cpp @@ -40,15 +40,15 @@ TrackIR::TrackIR (): ExternalCameraControl (CAMDATA_POS|CAMDATA_DIR, CAMMODE_VC) strcat (cbuf, dllPath); oapiWriteLog (cbuf); } else { - oapiWriteLog ("TrackIR module not found."); + oapiWriteLog ((char*)"TrackIR module not found."); return; } // Initialize the the TrackIR Enhanced DLL if (connected = (NPClient_Init (dllPath) == NP_OK)) { - oapiWriteLog ("TrackIR initialised"); + oapiWriteLog ((char*)"TrackIR initialised"); } else { - oapiWriteLog ("TrackIR initialisation failed"); + oapiWriteLog ((char*)"TrackIR initialisation failed"); return; } @@ -61,7 +61,7 @@ TrackIR::TrackIR (): ExternalCameraControl (CAMDATA_POS|CAMDATA_DIR, CAMMODE_VC) //sprintf (cbuf, "NaturalPoint software version %d.%02d", wNPClientVer >> 8, wNPClientVer & 0x00FF); oapiWriteLog (cbuf); } else { - oapiWriteLog ("Error querying NaturalPoint software version"); + oapiWriteLog ((char*)"Error querying NaturalPoint software version"); } laststate = 0; @@ -85,27 +85,27 @@ bool TrackIR::ReadData () double t, s; FILEHANDLE hFile = oapiOpenFile (cfgfile, FILE_IN, ROOT); if (!hFile) return false; - if (oapiReadItem_int (hFile, "CMODE", mode)) cameramode = mode; - if (oapiReadItem_string (hFile, "VCROT", cbuf) && sscanf (cbuf, "%d%lf", &mode, &t) == 2) { + if (oapiReadItem_int (hFile, (char*)"CMODE", mode)) cameramode = mode; + if (oapiReadItem_string (hFile, (char*)"VCROT", cbuf) && sscanf (cbuf, "%d%lf", &mode, &t) == 2) { vcmode.trackrotation = (mode ? true:false); vcmode.rotationrange = max (1.0*RAD, min (PI, t)); } - if (oapiReadItem_string (hFile, "VCPOS", cbuf) && sscanf (cbuf, "%d%lf", &mode, &t) == 2) { + if (oapiReadItem_string (hFile, (char*)"VCPOS", cbuf) && sscanf (cbuf, "%d%lf", &mode, &t) == 2) { vcmode.trackposition = (mode ? true:false); vcmode.positionrange = max (0.0, min (2.0, t)); } - if (oapiReadItem_string (hFile, "FREEZE", cbuf) && sscanf (cbuf, "%d%lf", &mode, &t) == 2) { + if (oapiReadItem_string (hFile, (char*)"FREEZE", cbuf) && sscanf (cbuf, "%d%lf", &mode, &t) == 2) { vcmode.freezeonmouse = (mode ? true:false); vcmode.freeze_t = max (0.0, t); } - if (oapiReadItem_string (hFile, "TRKROT", cbuf) && sscanf (cbuf, "%d%d", &mode, &i) == 2) { + if (oapiReadItem_string (hFile, (char*)"TRKROT", cbuf) && sscanf (cbuf, "%d%d", &mode, &i) == 2) { trkmode.trackrotation = (mode ? true:false); trkmode.rotationdata = (i ? TrackMode::BYPOSITION : TrackMode::BYROTATION); } - if (oapiReadItem_string (hFile, "TRKZOOM", cbuf) && sscanf (cbuf, "%d", &mode) == 1) { + if (oapiReadItem_string (hFile, (char*)"TRKZOOM", cbuf) && sscanf (cbuf, "%d", &mode) == 1) { trkmode.trackzoom = (mode ? true:false); } - if (oapiReadItem_string (hFile, "TRKPRM", cbuf) && sscanf (cbuf, "%lf%lf", &t, &s) == 2) { + if (oapiReadItem_string (hFile, (char*)"TRKPRM", cbuf) && sscanf (cbuf, "%lf%lf", &t, &s) == 2) { trkmode.deadzone = t; trkmode.speed = s; } @@ -119,9 +119,9 @@ void TrackIR::StartSimulation (HWND hWnd) { // Register your applications Window Handle if (NP_RegisterWindowHandle (hWnd) == NP_OK) - oapiWriteLog ("NPClient: Simulation window registered."); + oapiWriteLog ((char*)"NPClient: Simulation window registered."); else - oapiWriteLog ("NPClient: Error registering simulation window."); + oapiWriteLog ((char*)"NPClient: Error registering simulation window."); #ifdef UNDEF // Query for the NaturalPoint TrackIR software version @@ -157,15 +157,15 @@ void TrackIR::StartSimulation (HWND hWnd) // Stop the cursor if (NP_StopCursor() == NP_OK) - oapiWriteLog ("NPClient: Cursor stopped"); + oapiWriteLog ((char*)"NPClient: Cursor stopped"); else - oapiWriteLog ("NPClient: Error stopping cursor."); + oapiWriteLog ((char*)"NPClient: Error stopping cursor."); // Request that the TrackIR software begins sending Tracking Data if (NP_StartDataTransmission() == NP_OK) - oapiWriteLog ("NPClient: Data transmission started"); + oapiWriteLog ((char*)"NPClient: Data transmission started"); else - oapiWriteLog ("NPClient: Error starting data transmission"); + oapiWriteLog ((char*)"NPClient: Error starting data transmission"); } // ============================================================== diff --git a/Src/Plugin/TrackIR/TrackIRconfig.cpp b/Src/Plugin/TrackIR/TrackIRconfig.cpp index 9b7c250db..ad5c1c749 100644 --- a/Src/Plugin/TrackIR/TrackIRconfig.cpp +++ b/Src/Plugin/TrackIR/TrackIRconfig.cpp @@ -11,8 +11,7 @@ TrackIRconfig *TrackIRconfig::tirc = 0; char *TrackIRconfig::Description() { - static char *desc = "Configure and test the NaturalPointŪ TrackIR(tm) Optical Headtracker."; - return desc; + return (char*)"Configure and test the NaturalPointŪ TrackIR(tm) Optical Headtracker."; } bool TrackIRconfig::clbkOpen (HWND hLaunchpad) @@ -26,19 +25,19 @@ int TrackIRconfig::clbkWriteConfig () { char cbuf[256]; FILEHANDLE hFile = oapiOpenFile (cfgfile, FILE_OUT, ROOT); - oapiWriteItem_int (hFile, "CMODE", trackir->GetCameraMode()); + oapiWriteItem_int (hFile, (char*)"CMODE", trackir->GetCameraMode()); sprintf (cbuf, "%d %f", trackir->vcmode.trackrotation, trackir->vcmode.rotationrange); - oapiWriteItem_string (hFile, "VCROT", cbuf); + oapiWriteItem_string (hFile, (char*)"VCROT", cbuf); sprintf (cbuf, "%d %f", trackir->vcmode.trackposition, trackir->vcmode.positionrange); - oapiWriteItem_string (hFile, "VCPOS", cbuf); + oapiWriteItem_string (hFile, (char*)"VCPOS", cbuf); sprintf (cbuf, "%d %f", trackir->vcmode.freezeonmouse, trackir->vcmode.freeze_t); - oapiWriteItem_string (hFile, "FREEZE", cbuf); + oapiWriteItem_string (hFile, (char*)"FREEZE", cbuf); sprintf (cbuf, "%d %d", trackir->trkmode.trackrotation, trackir->trkmode.rotationdata); - oapiWriteItem_string (hFile, "TRKROT", cbuf); + oapiWriteItem_string (hFile, (char*)"TRKROT", cbuf); sprintf (cbuf, "%d", trackir->trkmode.trackzoom); - oapiWriteItem_string (hFile, "TRKZOOM", cbuf); + oapiWriteItem_string (hFile, (char*)"TRKZOOM", cbuf); sprintf (cbuf, "%0.2f %0.2f", trackir->trkmode.deadzone, trackir->trkmode.speed); - oapiWriteItem_string (hFile, "TRKPRM", cbuf); + oapiWriteItem_string (hFile, (char*)"TRKPRM", cbuf); oapiCloseFile (hFile, FILE_OUT); return 0; } @@ -221,4 +220,4 @@ INT_PTR CALLBACK TrackIRconfig::TabProc_diag (HWND hTab, UINT uMsg, WPARAM wPara break; } return 0; -} \ No newline at end of file +} diff --git a/Src/Plugin/TrackIR/TrackIRconfig.h b/Src/Plugin/TrackIR/TrackIRconfig.h index 524cc1a65..69d75c3ae 100644 --- a/Src/Plugin/TrackIR/TrackIRconfig.h +++ b/Src/Plugin/TrackIR/TrackIRconfig.h @@ -10,7 +10,7 @@ static const char *cfgfile = "TrackIR.cfg"; class TrackIRconfig: public LaunchpadItem { public: TrackIRconfig (TrackIR *_trackir): LaunchpadItem(), trackir(_trackir) {} - char *Name() { return "TrackIR Configuration"; } + char *Name() { return (char*)"TrackIR Configuration"; } char *Description(); bool clbkOpen (HWND hLaunchpad); int clbkWriteConfig (); diff --git a/Src/Plugin/TransX/TransXFunction.cpp b/Src/Plugin/TransX/TransXFunction.cpp index 53e26f391..e4f0de971 100644 --- a/Src/Plugin/TransX/TransXFunction.cpp +++ b/Src/Plugin/TransX/TransXFunction.cpp @@ -57,7 +57,7 @@ TransXFunction::~TransXFunction() void TransXFunction::saveself(FILEHANDLE scn) { //Write terminator - oapiWriteScenario_string(scn,"Finish","TransXFunction"); + oapiWriteScenario_string(scn,(char*)"Finish",(char*)"TransXFunction"); } //Should never be used - overloaded by further functions void TransXFunction::restoreself(FILEHANDLE scn) @@ -120,14 +120,14 @@ void TransXFunction::savedouble(FILEHANDLE scn, double savenumber) { char buffer[80]=""; sprintf(buffer," %.12g",savenumber); - oapiWriteScenario_string(scn,"Double",buffer); + oapiWriteScenario_string(scn,(char*)"Double",buffer); } void TransXFunction::savevector(FILEHANDLE scn, VECTOR3 &vector) { char buffer[100]=""; sprintf(buffer," %.12g %.12g %.12g",vector.x,vector.y,vector.z); - oapiWriteScenario_string(scn,"Vector",buffer); + oapiWriteScenario_string(scn,(char*)"Vector",buffer); } @@ -216,7 +216,7 @@ void TransXFunction::savehandle(FILEHANDLE scn, OBJHANDLE handle) oapiGetObjectName(handle,namebuffer,30); else strcpy(namebuffer,"NULL"); - oapiWriteScenario_string(scn,"Handle",namebuffer); + oapiWriteScenario_string(scn,(char*)"Handle",namebuffer); return; } @@ -228,7 +228,7 @@ void TransXFunction::saveorbit(FILEHANDLE scn, const OrbitElements &saveorbit) strcpy(validvalue,"True"); else strcpy(validvalue,"False"); - oapiWriteScenario_string(scn,"Orbit",validvalue); + oapiWriteScenario_string(scn,(char*)"Orbit",validvalue); if (!saveorbit.isvalid()) return; VECTOR3 tpos,tvel; saveorbit.getcurrentvectors(&tpos,&tvel); @@ -370,7 +370,7 @@ oapi::Brush* TransXFunction::SelectBrush(oapi::Sketchpad *sketchpad, int value) return sketchpad->SetBrush(NULL); } -void TransXFunction::sethelp(char *help1,char *help2,char *help3,char *help4,char *help5) +void TransXFunction::sethelp(const char *help1, const char *help2, const char *help3, const char *help4, const char *help5) { strcpy(helpstring1,help1); strcpy(helpstring2,help2); diff --git a/Src/Plugin/TransX/TransXFunction.h b/Src/Plugin/TransX/TransXFunction.h index 2ca079e32..a86325a20 100644 --- a/Src/Plugin/TransX/TransXFunction.h +++ b/Src/Plugin/TransX/TransXFunction.h @@ -74,7 +74,7 @@ class TransXFunction: public MFDFunction public: void UpdateAllPlans(); static oapi::Pen* SelectDefaultPen(oapi::Sketchpad *sketchpad, int value); - static oapi::Brush* TransXFunction::SelectBrush(oapi::Sketchpad *sketchpad, int value); + static oapi::Brush* SelectBrush(oapi::Sketchpad *sketchpad, int value); MFDvarhandler* getvariablehandler();//Passes pointer to variable handler TransXFunction(class transxstate *tstate, OBJHANDLE thmajor, OBJHANDLE thminor, OBJHANDLE thtarget, OBJHANDLE thcraft, OBJHANDLE thbase);//Constructor @@ -106,7 +106,7 @@ class TransXFunction: public MFDFunction bool sethmajtarget(OBJHANDLE handle); void sethcraft(OBJHANDLE handle); void sethbase(OBJHANDLE handle); - void sethelp(char *help1,char *help2,char *help3,char *help4,char *help5); + void sethelp(const char *help1, const char *help2, const char *help3, const char *help4, const char *help5); void gethelp(char *help1,char *help2,char *help3,char *help4,char *help5) const; }; diff --git a/Src/Plugin/TransX/basefunction.cpp b/Src/Plugin/TransX/basefunction.cpp index ad0d00048..c71c93448 100644 --- a/Src/Plugin/TransX/basefunction.cpp +++ b/Src/Plugin/TransX/basefunction.cpp @@ -337,13 +337,13 @@ void basefunction::saveself(FILEHANDLE scn) { id=planpointer->getplanid(); } - oapiWriteScenario_int(scn,"Int",id);//Saves the plan type + oapiWriteScenario_int(scn, (char*)"Int", id);//Saves the plan type saveorbit(scn,basisorbit); savehandle(scn,hmajor); savehandle(scn,hminor); savehandle(scn,hmajtarget); vars.saveallvariables(scn); - oapiWriteScenario_string(scn,"Finish","BaseFunction"); + oapiWriteScenario_string(scn, (char*)"Finish", (char*)"BaseFunction"); } void basefunction::restoreself(FILEHANDLE scn) diff --git a/Src/Plugin/TransX/basefunction.h b/Src/Plugin/TransX/basefunction.h index 6f8d10c7f..0ba8896f7 100644 --- a/Src/Plugin/TransX/basefunction.h +++ b/Src/Plugin/TransX/basefunction.h @@ -66,7 +66,7 @@ class basefunction : public TransXFunction public: class basefunction *getpreviousfunc(){return previousfunc;}; class basefunction *getnextfunc(){return nextfunc;}; - void basefunction::onplaceindeletebuffer();//Do not call unless you know what it's for. + void onplaceindeletebuffer();//Do not call unless you know what it's for. void calculate(VECTOR3 *targetvel); int calcnewview(int oldview,bool firststage); bool soistatus(); @@ -96,7 +96,7 @@ class basefunction : public TransXFunction double GetTimeIntercept(); double GetHohmannDVExtend(double r1, double r2, double mass); double GetHohmannDV(); // Calculate Hohmann transfer dv - VECTOR3 basefunction::GetPlaneAxis(const OBJHANDLE hObj, const OBJHANDLE hRef); + VECTOR3 GetPlaneAxis(const OBJHANDLE hObj, const OBJHANDLE hRef); VECTOR3 GetLineOfNodes(); }; diff --git a/Src/Plugin/TransX/mfdvariable.cpp b/Src/Plugin/TransX/mfdvariable.cpp index f18d16c75..0efddcedb 100644 --- a/Src/Plugin/TransX/mfdvariable.cpp +++ b/Src/Plugin/TransX/mfdvariable.cpp @@ -78,7 +78,7 @@ void MFDvariable::setcmdnugget(cmdnugget *nugget) inugget=nugget; } -bool MFDvariable::showgeneric(oapi::Sketchpad *sketchpad,int width,int line, char *inbuff) +bool MFDvariable::showgeneric(oapi::Sketchpad *sketchpad, int width, int line, const char *inbuff) { // This is a helper function that formats output to the MFD screen char buffer[MAX_NAME_LENGTH]=""; @@ -134,7 +134,7 @@ void MFDvariable::gethelpstrings(char *help1,char *help2) const strcpy(help2,helpstring2); } -void MFDvariable::sethelpstrings(char *help1,char *help2) +void MFDvariable::sethelpstrings(const char *help1, const char *help2) { strcpy(helpstring1,help1); strcpy(helpstring2,help2); diff --git a/Src/Plugin/TransX/mfdvariable.h b/Src/Plugin/TransX/mfdvariable.h index 98b6f25e5..1292baca4 100644 --- a/Src/Plugin/TransX/mfdvariable.h +++ b/Src/Plugin/TransX/mfdvariable.h @@ -48,10 +48,10 @@ class MFDvariable : listelement void initialise(class MFDvarhandler *vars,int viewmode1,int viewmode2); virtual ~MFDvariable(); void setshow(bool value); - bool showgeneric(oapi::Sketchpad *sketchpad,int width,int line, char *inbuff); + bool showgeneric(oapi::Sketchpad *sketchpad, int width, int line, const char *inbuff); virtual void showadjustment(oapi::Sketchpad *sketchpad, int width, int line) const {}; //Show the adjustment mode void gethelpstrings(char *help1, char *help2) const;//Returns help strings - void sethelpstrings(char *help1, char *help2);//Sets help strings + void sethelpstrings(const char *help1, const char *help2);//Sets help strings void getname(char *buffer) const; virtual void getsaveline(char *buffer) const = 0 ;//Creates second line of save - overloaded virtual bool loadvalue(char *buffer);//Set value according to string diff --git a/Src/Plugin/TransX/mfdvartypes.cpp b/Src/Plugin/TransX/mfdvartypes.cpp index 0f2822073..1f24b0303 100644 --- a/Src/Plugin/TransX/mfdvartypes.cpp +++ b/Src/Plugin/TransX/mfdvartypes.cpp @@ -36,14 +36,14 @@ liststring::liststring(bool manageme) : listelement(manageme) ZeroMemory(buffer, MAX_STRING_LENGTH); } -void MFDsemiintdiscrete::init(MFDvarhandler *vars,int viewmode1,int viewmode2,char *vname,int tvalue) +void MFDsemiintdiscrete::init(MFDvarhandler *vars, int viewmode1, int viewmode2, const char *vname, int tvalue) { value=tvalue; initialise(vars,viewmode1,viewmode2); strcpy(name,vname); } -void MFDvarmoon::init(MFDvarhandler *vars,int viewmode1,int viewmode2,char *vname,OBJHANDLE tcentralbody) +void MFDvarmoon::init(MFDvarhandler *vars, int viewmode1, int viewmode2, const char *vname, OBJHANDLE tcentralbody) { adjMode = Planet; initialise(vars,viewmode1,viewmode2); @@ -146,7 +146,7 @@ void MFDvarmoon::dec_variable() } } else - oapiOpenInputBox("Select Ship",SelectVariableBody,0,20, (void*)this); + oapiOpenInputBox((char*)"Select Ship",SelectVariableBody,0,20, (void*)this); } void MFDvarmoon::initvalidate() @@ -157,9 +157,9 @@ void MFDvarmoon::initvalidate() void MFDvarmoon::enter_variable() { if (adjMode == Planet) { - oapiOpenInputBox("Select Planet (STUB) Only ships",SelectVariableBody,0,20, (void*)this); + oapiOpenInputBox((char*)"Select Planet (STUB) Only ships",SelectVariableBody,0,20, (void*)this); } else { - oapiOpenInputBox("Select Ship",SelectVariableBody,0,20, (void*)this); + oapiOpenInputBox((char*)"Select Ship",SelectVariableBody,0,20, (void*)this); } } @@ -194,7 +194,7 @@ void MFDvarmoon::inc_variable() } } else - oapiOpenInputBox("Select Ship",SelectVariableBody,0,20, (void*)this); + oapiOpenInputBox((char*)"Select Ship",SelectVariableBody,0,20, (void*)this); } void MFDvarmoon::ch_adjmode() @@ -333,7 +333,7 @@ MFDvarfloat::MFDvarfloat() continuous = true; } -void MFDvarfloat::init(MFDvarhandler *vars,int viewmode1,int viewmode2,char *vname, double vvalue, double vmin, double vmax, double vincrement, double vlogborder) +void MFDvarfloat::init(MFDvarhandler *vars, int viewmode1, int viewmode2, const char *vname, double vvalue, double vmin, double vmax, double vincrement, double vlogborder) { initialise(vars,viewmode1,viewmode2); strcpy(name,vname); @@ -372,7 +372,7 @@ OBJHANDLE MFDvarshiplist::gethandle() const } void MFDvarshiplist::enter_variable() { - oapiOpenInputBox("Select Ship",SelectVariableBody,0,20, (void*)this); + oapiOpenInputBox((char*)"Select Ship",SelectVariableBody,0,20, (void*)this); } void MFDvarshiplist::inc_variable() @@ -483,7 +483,7 @@ void MFDvarfloat::showadjustment(oapi::Sketchpad *sketchpad, int width, int line void MFDvarfloat::enter_variable() { char tbuffer[128]; sprintf_s(tbuffer,"%.12g",value); - oapiOpenInputBox("Enter number. 'x' to reset, 'number+/number-' to inc/decrement",SelectVariableFloat,tbuffer,20, (void*)this); + oapiOpenInputBox((char*)"Enter number. 'x' to reset, 'number+/number-' to inc/decrement",SelectVariableFloat,tbuffer,20, (void*)this); } bool MFDvarfloat::floatvalidate(char * str, double * dfinal, double valcurrent, double valdefault) { @@ -655,13 +655,13 @@ void MFDvarMJD::dec_variable() CalcAdjustedValue(false); } -void MFDvarshiplist::init(MFDvarhandler *vars,int viewmode1,int viewmode2,char *vname) +void MFDvarshiplist::init(MFDvarhandler *vars, int viewmode1, int viewmode2, const char *vname) { initialise(vars,viewmode1,viewmode2); strcpy(name,vname);//brings in variable name } -void MFDvardiscrete::init(MFDvarhandler *vars,int viewmode1,int viewmode2,char *vname, int vvalue, int vlimit, char *st1, char *st2, char *st3, char *st4, char *st5) +void MFDvardiscrete::init(MFDvarhandler *vars, int viewmode1, int viewmode2, const char *vname, int vvalue, int vlimit, const char *st1, const char *st2, const char *st3, const char *st4, const char *st5) { initialise(vars,viewmode1,viewmode2); strcpy(name,vname); @@ -711,7 +711,7 @@ void MFDvardiscrete::inc_variable() value=0; } -void MFDvarangle::init(MFDvarhandler *vars,char *vname, bool vloop) +void MFDvarangle::init(MFDvarhandler *vars, const char *vname, bool vloop) { initialise(vars,3,3); //FIXME strcpy(name,vname); @@ -733,7 +733,7 @@ bool MFDvarangle::show(oapi::Sketchpad *sketchpad, int width, int line) void MFDvarangle::enter_variable() { char tbuffer[128]; sprintf_s(tbuffer,"%.12g", (value/PI)*180 ); - oapiOpenInputBox("Enter cookie, but no bufu. 'x' to reset, 'num+/num-' to inc/decrement",SelectVariableAngle,tbuffer,20, (void*)this); + oapiOpenInputBox((char*)"Enter cookie, but no bufu. 'x' to reset, 'num+/num-' to inc/decrement",SelectVariableAngle,tbuffer,20, (void*)this); } bool MFDvarangle::SetVariableAngle(char *str) { // FIXME: silly code duplication diff --git a/Src/Plugin/TransX/mfdvartypes.h b/Src/Plugin/TransX/mfdvartypes.h index a1cbf39c9..6feedcd9a 100644 --- a/Src/Plugin/TransX/mfdvartypes.h +++ b/Src/Plugin/TransX/mfdvartypes.h @@ -53,7 +53,7 @@ class MFDvarshiplist : public MFDvariable virtual void enter_variable(); virtual void inc_variable(); virtual void dec_variable(); - void init(MFDvarhandler *vars,int viewmode1, int viewmode2, char *vname); + void init(MFDvarhandler *vars, int viewmode1, int viewmode2, const char *vname); MFDvarshiplist(); virtual ~MFDvarshiplist(); @@ -94,7 +94,7 @@ class MFDvarmoon : public MFDvariable { virtual void getsaveline(char *buffer) const; void updatecentralbody(OBJHANDLE tcentral){centralbody=tcentral;}; operator int(){return value;} - void init(MFDvarhandler *vars,int viewmode1,int viewmode2,char *vname,OBJHANDLE tcentralbody); + void init(MFDvarhandler *vars, int viewmode1, int viewmode2, const char *vname,OBJHANDLE tcentralbody); protected: virtual void InheritValues(MFDvariable *var) {value = ((MFDvarmoon*)var)->value;}; }; @@ -141,7 +141,7 @@ class MFDvarfloat : public MFDvariable { void setvalue(double tvalue); virtual void getsaveline(char *buffer) const; virtual bool loadvalue(char *buffer); - void init(MFDvarhandler *vars,int viewmode1,int viewmode2,char *vname, double vvalue, double vmin, double vmax, double vincrement, double vlogborder); + void init(MFDvarhandler *vars, int viewmode1, int viewmode2, const char *vname, double vvalue, double vmin, double vmax, double vincrement, double vlogborder); bool ShouldBeOptimised(); // Could be optimised actively, or passively, through the date MFDvarfloat(); ~MFDvarfloat(); @@ -175,7 +175,7 @@ class MFDvardiscrete: public MFDvariable { bool show(oapi::Sketchpad *sketchpad, int width, int line); virtual void getsaveline(char *buffer) const; virtual bool loadvalue(char *buffer); - void init(MFDvarhandler *vars,int viewmode1,int viewmode2,char *vname, int vvalue, int vlimit, char *st1, char *st2, char *st3, char *st4, char *st5); + void init(MFDvarhandler *vars, int viewmode1, int viewmode2, const char *vname, int vvalue, int vlimit, const char *st1, const char *st2, const char *st3, const char *st4, const char *st5); protected: virtual void InheritValues(MFDvariable *var) {value = ((MFDvardiscrete*)var)->value;}; }; @@ -189,7 +189,7 @@ class MFDsemiintdiscrete: public MFDvariable { double operator = (double tvalue){value=int(2.0*tvalue);return value;}; virtual void getsaveline(char *buffer) const; virtual bool loadvalue(char *buffer); - void init(MFDvarhandler *vars,int viewmode1,int viewmode2,char *vname,int tvalue); + void init(MFDvarhandler *vars, int viewmode1, int viewmode2, const char *vname, int tvalue); virtual bool show(oapi::Sketchpad *sketchpad, int width, int line); MFDsemiintdiscrete(){value=0;}; protected: @@ -208,7 +208,7 @@ class MFDvarangle: public MFDvarfloat { bool show(oapi::Sketchpad *sketchpad, int width, int line); double getsin() const; double getcos() const; - void init(MFDvarhandler *vars,char *vname, bool vloop); + void init(MFDvarhandler *vars, const char *vname, bool vloop); }; #endif diff --git a/Src/Plugin/TransX/shiplist.cpp b/Src/Plugin/TransX/shiplist.cpp index 70d9bc9df..390ac10d6 100644 --- a/Src/Plugin/TransX/shiplist.cpp +++ b/Src/Plugin/TransX/shiplist.cpp @@ -142,7 +142,7 @@ void shipptrs::restoreallships(FILEHANDLE scn) void shipptrs::savecurrent(FILEHANDLE scn) { - oapiWriteScenario_string(scn,"Ship ",shipname); + oapiWriteScenario_string(scn,(char*)"Ship ",shipname); state->savecurrent(scn); } diff --git a/Src/Plugin/TransX/transx.cpp b/Src/Plugin/TransX/transx.cpp index ea0d3a14d..542de8220 100644 --- a/Src/Plugin/TransX/transx.cpp +++ b/Src/Plugin/TransX/transx.cpp @@ -118,8 +118,8 @@ OAPI_MSGTYPE TransxMFD::MsgProc (UINT msg, UINT mfd, WPARAM wparam, LPARAM lpara char *TransxMFD::ButtonLabel (int bt) // Routine to pass button label back to Orbiter. Called by Orbiter { - char *label[] = {"HLP","FWD","BCK", "VW","VAR","-VR", "ADJ", "-AJ","++", "--","EXE","ENT"}; - return (bt < sizeof(label) / sizeof(char*) ? label[bt] : 0); + const char *label[] = {"HLP","FWD","BCK", "VW","VAR","-VR", "ADJ", "-AJ","++", "--","EXE","ENT"}; + return (char*)(bt < sizeof(label) / sizeof(char*) ? label[bt] : 0); } int TransxMFD::ButtonMenu (const MFDBUTTONMENU **menu) const diff --git a/Src/Vessel/Atlantis/Atlantis/AscentAP.cpp b/Src/Vessel/Atlantis/Atlantis/AscentAP.cpp index e6ab5ae45..c579c31e1 100644 --- a/Src/Vessel/Atlantis/Atlantis/AscentAP.cpp +++ b/Src/Vessel/Atlantis/Atlantis/AscentAP.cpp @@ -503,10 +503,10 @@ void AscentAP::SaveState (FILEHANDLE scn) char cbuf[256]; sprintf (cbuf, "%0.3f %0.3f %0.3f %0.3f", met, met_meco, met_oms_start, met_oms_end); - oapiWriteScenario_string (scn, "MET", cbuf); + oapiWriteScenario_string (scn, (char*)"MET", cbuf); sprintf (cbuf, "%d %d %d %0.0f %0.4f %0.5f %0.5f", (int)active, (int)met_active, (int)do_oms2, tgt_alt, launch_azimuth, launch_lng, launch_lat); - oapiWriteScenario_string (scn, "ASCENTAP", cbuf); + oapiWriteScenario_string (scn, (char*)"ASCENTAP", cbuf); } // -------------------------------------------------------------- @@ -714,18 +714,18 @@ void AscentApMfd::DrawGimbal (oapi::Sketchpad *skp, int cx, int cy, double pitch char *AscentApMfd::ButtonLabel (int bt) { if (!bt) - return (ap->Active() ? "DA" : ap->GetVessel()->status == 0 ? "L" : "EA"); + return (char*)(ap->Active() ? "DA" : ap->GetVessel()->status == 0 ? "L" : "EA"); if (bt <= 2) { - static char *label[2] = {"PG-", "PG+"}; - return label[bt-1]; + static const char *label[2] = {"PG-", "PG+"}; + return (char*)label[bt-1]; } switch (cpg) { case 0: { if (ap->Active() || ap->GetVessel()->status) return 0; - static char *label[5] = {"AZ-", "AZ+", "AL-", "AL+", "OM2"}; - return (bt < 8 ? label[bt-3] : 0); + static const char *label[5] = {"AZ-", "AZ+", "AL-", "AL+", "OM2"}; + return (char*)(bt < 8 ? label[bt-3] : 0); } } diff --git a/Src/Vessel/Atlantis/Atlantis/Atlantis.cpp b/Src/Vessel/Atlantis/Atlantis/Atlantis.cpp index 06e41a6cd..cbc0b5dd3 100644 --- a/Src/Vessel/Atlantis/Atlantis/Atlantis.cpp +++ b/Src/Vessel/Atlantis/Atlantis/Atlantis.cpp @@ -37,13 +37,13 @@ GDIParams g_Param; -char *ActionString[5] = {"STOPPED", "ISCLOSED", "ISOPEN", "CLOSE", "OPEN"}; +const char *ActionString[5] = {"STOPPED", "ISCLOSED", "ISOPEN", "CLOSE", "OPEN"}; HELPCONTEXT g_hc = { - "html/vessels/Atlantis.chm", + (char*)"html/vessels/Atlantis.chm", 0, - "html/vessels/Atlantis.chm::/Atlantis.hhc", - "html/vessels/Atlantis.chm::/Atlantis.hhk" + (char*)"html/vessels/Atlantis.chm::/Atlantis.hhc", + (char*)"html/vessels/Atlantis.chm::/Atlantis.hhk" }; @@ -200,7 +200,7 @@ void Atlantis::CreateSSME() thg_main = CreateThrusterGroup (th_main, 3, THGROUP_MAIN); gimbal_pos = THRUSTGIMBAL_LAUNCH; // the initial pitch gimbal setting positions the SSMEs to cancel pitch moment in launch configuration - SURFHANDLE tex_main = oapiRegisterExhaustTexture ("Exhaust_atsme"); + SURFHANDLE tex_main = oapiRegisterExhaustTexture ((char*)"Exhaust_atsme"); for (int i = 0; i < 3; i++) AddExhaust (th_main[i], 30.0, 2.0, tex_main); } @@ -224,7 +224,7 @@ void Atlantis::CreateOMS() // -------------------------------------------------------------- void Atlantis::CreateRCS() { - SURFHANDLE tex_rcs = oapiRegisterExhaustTexture ("Exhaust_atrcs"); + SURFHANDLE tex_rcs = oapiRegisterExhaustTexture ((char*)"Exhaust_atrcs"); const double eh = 6.0; // exhaust length scale const double ew1 = 0.4, ew2 = 0.8; // exhaust width scales @@ -674,9 +674,9 @@ void Atlantis::DefineAnimations (void) // -------------------------------------------------------------- int Atlantis::RegisterAscentApMfd () { - static char *name = "AscentAP"; + static const char *name = "AscentAP"; MFDMODESPECEX spec; - spec.name = name; + spec.name = (char*)name; spec.key = OAPI_KEY_B; spec.context = NULL; spec.msgproc = AscentApMfd::MsgProc; @@ -1314,7 +1314,7 @@ void Atlantis::clbkSetClassCaps (FILEHANDLE cfg) SetTrimScale (0.05); launchelev = 0.0; - if (!oapiReadItem_bool (cfg, "RenderCockpit", render_cockpit)) + if (!oapiReadItem_bool (cfg, (char*)"RenderCockpit", render_cockpit)) render_cockpit = false; } @@ -1423,33 +1423,33 @@ void Atlantis::clbkSaveState (FILEHANDLE scn) VESSEL4::clbkSaveState (scn); // custom parameters - oapiWriteScenario_int (scn, "CONFIGURATION", status); + oapiWriteScenario_int (scn, (char*)"CONFIGURATION", status); //if (status == 1) // oapiWriteScenario_float (scn, "MET", oapiGetSimTime()-t0); sprintf (cbuf, "%d %0.4f", gear_status-1, gear_proc); - oapiWriteScenario_string (scn, "GEAR", cbuf); + oapiWriteScenario_string (scn, (char*)"GEAR", cbuf); if (spdb_status != AnimState::CLOSED) { sprintf (cbuf, "%d %0.4f", spdb_status-1, spdb_proc); - oapiWriteScenario_string (scn, "SPEEDBRAKE", cbuf); + oapiWriteScenario_string (scn, (char*)"SPEEDBRAKE", cbuf); } //if (status == 0 && launchelev) // oapiWriteScenario_float (scn, "LAUNCHELEVATION", launchelev); sprintf (cbuf, "%0.4f %0.4f %0.4f %0.4f %0.4f %0.4f", arm_sy, arm_sp, arm_ep, arm_wp, arm_wy, arm_wr); - oapiWriteScenario_string (scn, "ARM_STATUS", cbuf); + oapiWriteScenario_string (scn, (char*)"ARM_STATUS", cbuf); - oapiWriteScenario_float (scn, "SAT_OFS_X", ofs_sts_sat.x); - oapiWriteScenario_float (scn, "SAT_OFS_Y", ofs_sts_sat.y); - oapiWriteScenario_float (scn, "SAT_OFS_Z", ofs_sts_sat.z); + oapiWriteScenario_float (scn, (char*)"SAT_OFS_X", ofs_sts_sat.x); + oapiWriteScenario_float (scn, (char*)"SAT_OFS_Y", ofs_sts_sat.y); + oapiWriteScenario_float (scn, (char*)"SAT_OFS_Z", ofs_sts_sat.z); if (do_cargostatic) { - oapiWriteScenario_string (scn, "CARGO_STATIC_MESH", cargo_static_mesh_name); + oapiWriteScenario_string (scn, (char*)"CARGO_STATIC_MESH", cargo_static_mesh_name); if (cargo_static_ofs.x || cargo_static_ofs.y || cargo_static_ofs.z) - oapiWriteScenario_vec (scn, "CARGO_STATIC_OFS", cargo_static_ofs); + oapiWriteScenario_vec (scn, (char*)"CARGO_STATIC_OFS", cargo_static_ofs); } // save bay door operations status @@ -2239,7 +2239,7 @@ DLLCLBK void InitModule (HINSTANCE hModule) g_Param.tkbk_label = oapiCreateSurface (LOADBMP (IDB_TKBKLABEL)); // allocate GDI resources - g_Param.font[0] = oapiCreateFont(-11, false, "Arial"); + g_Param.font[0] = oapiCreateFont(-11, false, (char*)"Arial"); g_Param.brush[0] = oapiCreateBrush(0x000000); } diff --git a/Src/Vessel/Atlantis/Atlantis/PlBayOp.cpp b/Src/Vessel/Atlantis/Atlantis/PlBayOp.cpp index 06970c527..28e3b558b 100644 --- a/Src/Vessel/Atlantis/Atlantis/PlBayOp.cpp +++ b/Src/Vessel/Atlantis/Atlantis/PlBayOp.cpp @@ -9,7 +9,7 @@ extern GDIParams g_Param; extern HELPCONTEXT g_hc; -extern char *ActionString[5]; +extern const char *ActionString[5]; INT_PTR CALLBACK PlOp_DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static Atlantis *sts_dlg; @@ -260,13 +260,13 @@ bool PayloadBayOp::ParseScenarioLine (char *line) void PayloadBayOp::SaveState (FILEHANDLE scn) { if (!BayDoorStatus.Closed()) - WriteScenario_state (scn, "CARGODOOR", BayDoorStatus); + WriteScenario_state (scn, (char*)"CARGODOOR", BayDoorStatus); if (!RadiatorStatus.Closed()) - WriteScenario_state (scn, "RADIATOR", RadiatorStatus); + WriteScenario_state (scn, (char*)"RADIATOR", RadiatorStatus); if (!RadLatchStatus.Closed()) - WriteScenario_state (scn, "RADLATCH", RadLatchStatus); + WriteScenario_state (scn, (char*)"RADLATCH", RadLatchStatus); if (!KuAntennaStatus.Closed()) - WriteScenario_state (scn, "KUBAND", KuAntennaStatus); + WriteScenario_state (scn, (char*)"KUBAND", KuAntennaStatus); } // ============================================================== @@ -529,7 +529,7 @@ void PayloadBayOp::UpdateDialog (HWND hWnd) } oapiSetSwitchState (GetDlgItem (hWnd, IDC_PLBD), BayDoorOp == BDO_OPEN ? 0 : BayDoorOp == BDO_CLOSE ? 1 : 2, true); - static char *PLBDstr[5] = {"===","CL","OP","\\\\\\\\\\","\\\\\\\\\\"}; + static const char *PLBDstr[5] = {"===","CL","OP","\\\\\\\\\\","\\\\\\\\\\"}; SetWindowText (GetDlgItem (hWnd, IDC_PLBD_TLKBK), PLBDstr[BayDoorStatus.action]); for (i = 0; i < 2; i++) { @@ -539,7 +539,7 @@ void PayloadBayOp::UpdateDialog (HWND hWnd) } for (i = 0; i < 2; i++) { - static char *RDCTstr[5] = {"===","STO","DPL","\\\\\\\\\\","\\\\\\\\\\"}; + static const char *RDCTstr[5] = {"===","STO","DPL","\\\\\\\\\\","\\\\\\\\\\"}; int rad_ctrl[2] = {IDC_RADA, IDC_RADB}; int rad_tlkbk[2] = {IDC_RADS_TLKBK, IDC_RADP_TLKBK}; oapiSetSwitchState (GetDlgItem (hWnd, rad_ctrl[i]), RadiatorCtrl[i] == RC_DEPLOY ? 0 : RadiatorCtrl[i] == RC_OFF ? 2 : 1, true); @@ -547,7 +547,7 @@ void PayloadBayOp::UpdateDialog (HWND hWnd) } for (i = 0; i < 2; i++) { - static char *LTCTstr[5] = {"===","LAT","REL","\\\\\\\\\\","\\\\\\\\\\"}; + static const char *LTCTstr[5] = {"===","LAT","REL","\\\\\\\\\\","\\\\\\\\\\"}; int lat_ctrl[2] = {IDC_LATCHA, IDC_LATCHB}; int lat_tlkbk[2] = {IDC_LATCHS_TLKBK, IDC_LATCHP_TLKBK}; oapiSetSwitchState (GetDlgItem (hWnd, lat_ctrl[i]), RadLatchCtrl[i] == LC_RELEASE ? 0 : RadLatchCtrl[i] == LC_OFF ? 2 : 1, true); @@ -556,7 +556,7 @@ void PayloadBayOp::UpdateDialog (HWND hWnd) oapiSetSwitchState (GetDlgItem (hWnd, IDC_KU), KuCtrl == KU_DEPLOY ? 0 : KuCtrl == KU_STOW ? 1 : 2, true); oapiSetSwitchState (GetDlgItem (hWnd, IDC_KU_DIRECT), KuDirectCtrl == KU_DIRECT_ON ? 0 : 1, true); - static char *KUstr[5] = {"===","STO","DPL","\\\\\\\\\\","\\\\\\\\\\"}; + static const char *KUstr[5] = {"===","STO","DPL","\\\\\\\\\\","\\\\\\\\\\"}; SetWindowText (GetDlgItem (hWnd, IDC_KU_TLKBK), KUstr[KuAntennaStatus.action]); } @@ -580,7 +580,7 @@ INT_PTR PayloadBayOp::DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara case WM_COMMAND: switch (LOWORD(wParam)) { case IDHELP: - g_hc.topic = "/BayOp.htm"; + g_hc.topic = (char*)"/BayOp.htm"; oapiOpenHelp (&g_hc); return TRUE; case IDCANCEL: diff --git a/Src/Vessel/Atlantis/AtlantisConfig/AtlantisConfig.cpp b/Src/Vessel/Atlantis/AtlantisConfig/AtlantisConfig.cpp index 4d2aa6363..8fc81550d 100644 --- a/Src/Vessel/Atlantis/AtlantisConfig/AtlantisConfig.cpp +++ b/Src/Vessel/Atlantis/AtlantisConfig/AtlantisConfig.cpp @@ -11,12 +11,12 @@ class VesselConfig; class AtlantisConfig; -static char *tex_hires_enabled = "Textures2\\Atlantis"; -static char *tex_hires_disabled = "Textures2\\~Atlantis"; +static const char *tex_hires_enabled = "Textures2\\Atlantis"; +static const char *tex_hires_disabled = "Textures2\\~Atlantis"; -static char *vcmsh_fname = "Meshes\\Atlantis\\AtlantisVC.msh"; -static char *msh_hires_bkup = "Meshes\\Atlantis\\~AtlantisVC_hi.msh"; -static char *msh_lores_bkup = "Meshes\\Atlantis\\~AtlantisVC_lo.msh"; +static const char *vcmsh_fname = "Meshes\\Atlantis\\AtlantisVC.msh"; +static const char *msh_hires_bkup = "Meshes\\Atlantis\\~AtlantisVC_hi.msh"; +static const char *msh_lores_bkup = "Meshes\\Atlantis\\~AtlantisVC_lo.msh"; struct { HINSTANCE hInst; @@ -26,7 +26,7 @@ struct { class AtlantisConfig: public LaunchpadItem { public: AtlantisConfig(): LaunchpadItem() {} - char *Name() { return "Atlantis Configuration"; } + char *Name() { return (char*)"Atlantis Configuration"; } char *Description(); bool clbkOpen (HWND hLaunchpad); bool TexHiresEnabled() const; @@ -40,8 +40,7 @@ class AtlantisConfig: public LaunchpadItem { char *AtlantisConfig::Description() { - static char *desc = "Global configuration for the default Space Shuttle Atlantis."; - return desc; + return (char*)"Global configuration for the default Space Shuttle Atlantis."; } bool AtlantisConfig::clbkOpen (HWND hLaunchpad) diff --git a/Src/Vessel/Atlantis/Atlantis_SRB/Atlantis_SRB.cpp b/Src/Vessel/Atlantis/Atlantis_SRB/Atlantis_SRB.cpp index 609eba6f3..280adc3c4 100644 --- a/Src/Vessel/Atlantis/Atlantis_SRB/Atlantis_SRB.cpp +++ b/Src/Vessel/Atlantis/Atlantis_SRB/Atlantis_SRB.cpp @@ -172,8 +172,8 @@ void Atlantis_SRB::clbkSetClassCaps (FILEHANDLE cfg) // main engine th_main = CreateThruster (_V(0,0,-21), THRUSTGIMBAL_LAUNCH, SRB_THRUST, ph_main, SRB_ISP0, SRB_ISP1); - SURFHANDLE tex = oapiRegisterExhaustTexture ("Exhaust2"); - srb_exhaust.tex = oapiRegisterParticleTexture ("Contrail2"); + SURFHANDLE tex = oapiRegisterExhaustTexture ((char*)"Exhaust2"); + srb_exhaust.tex = oapiRegisterParticleTexture ((char*)"Contrail2"); AddExhaust (th_main, 16.0, 2.0, tex); AddExhaustStream (th_main, _V(0,0,-30), &srb_contrail); AddExhaustStream (th_main, _V(0,0,-25), &srb_exhaust); @@ -236,7 +236,7 @@ void Atlantis_SRB::clbkSaveState (FILEHANDLE scn) { VESSEL2::clbkSaveState (scn); if (bMainEngine) - oapiWriteScenario_float(scn, "MET", oapiGetSimTime()-t0); + oapiWriteScenario_float(scn, (char*)"MET", oapiGetSimTime()-t0); } // Simulation time step diff --git a/Src/Vessel/DeltaGlider/AAPSubsys.cpp b/Src/Vessel/DeltaGlider/AAPSubsys.cpp index f169a53a8..ba6e20d1f 100644 --- a/Src/Vessel/DeltaGlider/AAPSubsys.cpp +++ b/Src/Vessel/DeltaGlider/AAPSubsys.cpp @@ -274,7 +274,7 @@ void AAP::WriteScenario (FILEHANDLE scn) sprintf (cbuf, "%s%d:%g", i ? " ":"", active[i], tgt[i]); strcat (line, cbuf); } - oapiWriteScenario_string (scn, "AAP", line); + oapiWriteScenario_string (scn, (char*)"AAP", line); } void AAP::SetState (const char *str) @@ -321,4 +321,4 @@ void AAP::UpdateStr (char *str, char *pstr, int n, NTVERTEX *vtx) vtx[i*4+j].tu = (x + (j%2)*dx)/texw; } } -} \ No newline at end of file +} diff --git a/Src/Vessel/DeltaGlider/AerodynSubsys.cpp b/Src/Vessel/DeltaGlider/AerodynSubsys.cpp index 09c0410a3..e90e72c6e 100644 --- a/Src/Vessel/DeltaGlider/AerodynSubsys.cpp +++ b/Src/Vessel/DeltaGlider/AerodynSubsys.cpp @@ -477,7 +477,7 @@ ElevatorTrim::ElevatorTrim (AerodynCtrlSubsystem *_subsys) void ElevatorTrim::clbkSaveState (FILEHANDLE scn) { double trim = DG()->GetControlSurfaceLevel (AIRCTRL_ELEVATORTRIM); - if (trim) oapiWriteScenario_float (scn, "TRIM", trim); + if (trim) oapiWriteScenario_float (scn, (char*)"TRIM", trim); } // -------------------------------------------------------------- diff --git a/Src/Vessel/DeltaGlider/DGConfigurator/DGConfigurator.cpp b/Src/Vessel/DeltaGlider/DGConfigurator/DGConfigurator.cpp index ac8f0b4dc..4579ccc22 100644 --- a/Src/Vessel/DeltaGlider/DGConfigurator/DGConfigurator.cpp +++ b/Src/Vessel/DeltaGlider/DGConfigurator/DGConfigurator.cpp @@ -11,8 +11,8 @@ class VesselConfig; class DGConfig; -static char *hires_enabled = "Textures2\\DG"; -static char *hires_disabled = "Textures2\\~DG"; +static const char *hires_enabled = "Textures2\\DG"; +static const char *hires_disabled = "Textures2\\~DG"; struct { HINSTANCE hInst; @@ -22,7 +22,7 @@ struct { class DGConfig: public LaunchpadItem { public: DGConfig(): LaunchpadItem() {} - char *Name() { return "DG Configuration"; } + char *Name() { return (char*)"DG Configuration"; } char *Description(); bool clbkOpen (HWND hLaunchpad); bool HiresEnabled() const; @@ -34,8 +34,7 @@ class DGConfig: public LaunchpadItem { char *DGConfig::Description() { - static char *desc = "Global configuration for the default Delta-glider."; - return desc; + return (char*)"Global configuration for the default Delta-glider."; } bool DGConfig::clbkOpen (HWND hLaunchpad) @@ -121,4 +120,4 @@ DLLCLBK void ExitModule (HINSTANCE hDLL) // Unregister the launchpad items oapiUnregisterLaunchpadItem (gParams.item); delete gParams.item; -} \ No newline at end of file +} diff --git a/Src/Vessel/DeltaGlider/DeltaGlider.cpp b/Src/Vessel/DeltaGlider/DeltaGlider.cpp index 801ae3ab3..6368ba8ee 100644 --- a/Src/Vessel/DeltaGlider/DeltaGlider.cpp +++ b/Src/Vessel/DeltaGlider/DeltaGlider.cpp @@ -44,10 +44,10 @@ GDIParams g_Param; static HELPCONTEXT g_hc = { - "html/vessels/deltaglider.chm", + (char*)"html/vessels/deltaglider.chm", 0, - "html/vessels/deltaglider.chm::/deltaglider.hhc", - "html/vessels/deltaglider.chm::/deltaglider.hhk" + (char*)"html/vessels/deltaglider.chm::/deltaglider.hhc", + (char*)"html/vessels/deltaglider.chm::/deltaglider.hhk" }; static const DWORD ntdvtx_geardown = 13; @@ -308,7 +308,7 @@ void DeltaGlider::PaintMarkings (SURFHANDLE tex) { oapi::Sketchpad *skp = oapiGetSketchpad (tex); if (skp) { - oapi::Font *font1 = oapiCreateFont(38, true, "Sans", FONT_BOLD); + oapi::Font *font1 = oapiCreateFont(38, true, (char*)"Sans", FONT_BOLD); skp->SetFont (font1); skp->SetTextColor (0xD0D0D0); skp->SetTextAlign (oapi::Sketchpad::CENTER); @@ -318,7 +318,7 @@ void DeltaGlider::PaintMarkings (SURFHANDLE tex) skp->Text (193, 10, cbuf, len); skp->Text (193, 74, cbuf, len); oapiReleaseFont(font1); - oapi::Font *font2 = oapiCreateFont(36, true, "Sans", FONT_BOLD); + oapi::Font *font2 = oapiCreateFont(36, true, (char*)"Sans", FONT_BOLD); skp->SetFont(font2); skp->SetTextColor (0x808080); skp->SetTextAlign (oapi::Sketchpad::RIGHT); @@ -402,7 +402,7 @@ bool DeltaGlider::clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, oapi::Sketchpa skp->Line (cx-d,cy-d,cx+d,cy+d); skp->Line (cx-d,cy+d,cx+d,cy-d); } - char *str = "NOSECONE"; + const char *str = "NOSECONE"; int w = skp->GetTextWidth (str); skp->Text (cx-w/2, cy-d, str, 8); } @@ -875,7 +875,7 @@ void DeltaGlider::clbkSetClassCaps (FILEHANDLE cfg) bool b; int i; - if (oapiReadItem_bool (cfg, "SCRAMJET", b) && b) // set up scramjet configuration + if (oapiReadItem_bool (cfg, (char*)"SCRAMJET", b) && b) // set up scramjet configuration AddSubsystem (ssys_scram = new ScramSubsystem (this)); ComponentVessel::SetEmptyMass (ssys_scram ? EMPTY_MASS_SC : EMPTY_MASS); @@ -923,7 +923,7 @@ void DeltaGlider::clbkSetClassCaps (FILEHANDLE cfg) double ispscale = (modelidx ? 0.8 : 1.0); // Reduction of thrust efficiency at normal pressure - contrail_tex = oapiRegisterParticleTexture ("Contrail1a"); + contrail_tex = oapiRegisterParticleTexture ((char*)"Contrail1a"); PARTICLESTREAMSPEC contrail = { 0, 8.0, 4, 150, 0.25, 3.0, 4, 2.0, PARTICLESTREAMSPEC::DIFFUSE, @@ -1159,23 +1159,23 @@ void DeltaGlider::clbkSaveState (FILEHANDLE scn) snprintf (cbuf, sizeof(cbuf) - 1, "%d", i+1); for (++i; i < 4; i++) if (psngr[i]) sprintf (cbuf+strlen(cbuf), " %d", i+1); - oapiWriteScenario_string (scn, "PSNGR", cbuf); + oapiWriteScenario_string (scn, (char*)"PSNGR", cbuf); break; } if (skinpath[0]) - oapiWriteScenario_string (scn, "SKIN", skinpath); + oapiWriteScenario_string (scn, (char*)"SKIN", skinpath); if (panelcol) { - oapiWriteScenario_int (scn, "PANELCOL", panelcol); + oapiWriteScenario_int (scn, (char*)"PANELCOL", panelcol); } for (i = 0; i < 8; i++) if (beacon[i].active) { snprintf (cbuf, sizeof(cbuf) - 1, "%d %d %d %d", beacon[0].active, beacon[3].active, beacon[5].active, beacon[7].active); - oapiWriteScenario_string (scn, "LIGHTS", cbuf); + oapiWriteScenario_string (scn, (char*)"LIGHTS", cbuf); break; } if (tankconfig) - oapiWriteScenario_int (scn, "TANKCONFIG", tankconfig); + oapiWriteScenario_int (scn, (char*)"TANKCONFIG", tankconfig); } // -------------------------------------------------------------- @@ -1676,7 +1676,7 @@ INT_PTR CALLBACK EdPg1Proc (HWND hTab, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_COMMAND: switch (LOWORD (wParam)) { case IDHELP: - g_hc.topic = "/SE_Anim.htm"; + g_hc.topic = (char*)"/SE_Anim.htm"; oapiOpenHelp (&g_hc); return TRUE; case IDC_GEAR_UP: diff --git a/Src/Vessel/DeltaGlider/HoverSubsys.cpp b/Src/Vessel/DeltaGlider/HoverSubsys.cpp index 01109db14..2385d6e1b 100644 --- a/Src/Vessel/DeltaGlider/HoverSubsys.cpp +++ b/Src/Vessel/DeltaGlider/HoverSubsys.cpp @@ -233,11 +233,11 @@ void HoverAttitudeComponent::clbkSaveState (FILEHANDLE scn) { if (mode) { if (mode == 1) { // auto - oapiWriteScenario_int (scn, "HOVERMODE", mode); + oapiWriteScenario_int (scn, (char*)"HOVERMODE", mode); } else { // manual char cbuf[256]; sprintf (cbuf, "%d %0.3lf %0.3lf", mode, phover_cmd, rhover_cmd); - oapiWriteScenario_string (scn, "HOVERMODE", cbuf); + oapiWriteScenario_string (scn, (char*)"HOVERMODE", cbuf); } } } @@ -450,7 +450,7 @@ void HoverHoldComponent::clbkSaveState (FILEHANDLE scn) { char cbuf[256]; sprintf (cbuf, "%d %d %0.4le %0.4le", (int)active, (int)hovermode, holdalt, holdvspd); - oapiWriteScenario_string (scn, "HOVERHOLD", cbuf); + oapiWriteScenario_string (scn, (char*)"HOVERHOLD", cbuf); } // -------------------------------------------------------------- diff --git a/Src/Vessel/DeltaGlider/HudCtrl.cpp b/Src/Vessel/DeltaGlider/HudCtrl.cpp index b896f8300..7d34c2400 100644 --- a/Src/Vessel/DeltaGlider/HudCtrl.cpp +++ b/Src/Vessel/DeltaGlider/HudCtrl.cpp @@ -57,9 +57,9 @@ HUDControl::HUDControl (DeltaGlider *vessel) void HUDControl::clbkSaveState(FILEHANDLE scn) { if (last_mode != HUD_NONE) - oapiWriteScenario_int(scn, "HUDMode", last_mode); + oapiWriteScenario_int(scn, (char*)"HUDMode", last_mode); if (hud_brightness < 1.0) - oapiWriteScenario_float(scn, "HUDBrightness", hud_brightness); + oapiWriteScenario_float(scn, (char*)"HUDBrightness", hud_brightness); } // -------------------------------------------------------------- @@ -440,4 +440,4 @@ bool HUDUpDownSwitch::ProcessMouseVC (int event, VECTOR3 &p) return true; } return false; -} \ No newline at end of file +} diff --git a/Src/Vessel/DeltaGlider/LightSubsys.cpp b/Src/Vessel/DeltaGlider/LightSubsys.cpp index 45c4ed2a8..63f16f802 100644 --- a/Src/Vessel/DeltaGlider/LightSubsys.cpp +++ b/Src/Vessel/DeltaGlider/LightSubsys.cpp @@ -109,7 +109,7 @@ void InstrumentLight::clbkSaveState (FILEHANDLE scn) if (light_on || light_col || brightness != 0.5) { char cbuf[256]; sprintf (cbuf, "%d %d %0.2lf", (int)light_on, light_col, brightness); - oapiWriteScenario_string (scn, "INSTRLIGHT", cbuf); + oapiWriteScenario_string (scn, (char*)"INSTRLIGHT", cbuf); } } @@ -265,7 +265,7 @@ void CockpitLight::clbkSaveState (FILEHANDLE scn) if (light_mode || brightness != 0.7) { char cbuf[256]; sprintf (cbuf, "%d %0.2lf", light_mode, brightness); - oapiWriteScenario_string (scn, "FLOODLIGHT", cbuf); + oapiWriteScenario_string (scn, (char*)"FLOODLIGHT", cbuf); } } @@ -398,7 +398,7 @@ void LandDockLight::SetLight (int mode, bool force) void LandDockLight::clbkSaveState (FILEHANDLE scn) { if (light_mode) - oapiWriteScenario_int (scn, "LANDDOCKLIGHT", light_mode); + oapiWriteScenario_int (scn, (char*)"LANDDOCKLIGHT", light_mode); } // -------------------------------------------------------------- @@ -526,7 +526,7 @@ void StrobeLight::SetLight (bool on) void StrobeLight::clbkSaveState (FILEHANDLE scn) { if (light_on) - oapiWriteScenario_int (scn, "STROBELIGHT", (int)light_on); + oapiWriteScenario_int (scn, (char*)"STROBELIGHT", (int)light_on); } // -------------------------------------------------------------- @@ -655,7 +655,7 @@ void NavLight::SetLight (bool on) void NavLight::clbkSaveState (FILEHANDLE scn) { if (light_on) - oapiWriteScenario_int (scn, "NAVLIGHT", (int)light_on); + oapiWriteScenario_int (scn, (char*)"NAVLIGHT", (int)light_on); } // -------------------------------------------------------------- diff --git a/Src/Vessel/DeltaGlider/MainRetroSubsys.cpp b/Src/Vessel/DeltaGlider/MainRetroSubsys.cpp index edad3e327..4b5113cd1 100644 --- a/Src/Vessel/DeltaGlider/MainRetroSubsys.cpp +++ b/Src/Vessel/DeltaGlider/MainRetroSubsys.cpp @@ -422,12 +422,12 @@ void GimbalControl::clbkSaveState (FILEHANDLE scn) { if (mode) { if (mode == 1) { // auto - oapiWriteScenario_int (scn, "MGIMBALMODE", mode); + oapiWriteScenario_int (scn, (char*)"MGIMBALMODE", mode); } else { // manual char cbuf[256]; sprintf (cbuf, "%d %0.3lf %0.3lf %0.3lf %0.3lf", mode, mpgimbal_cmd[0], mpgimbal_cmd[1], mygimbal_cmd[0], mygimbal_cmd[1]); - oapiWriteScenario_string (scn, "MGIMBALMODE", cbuf); + oapiWriteScenario_string (scn, (char*)"MGIMBALMODE", cbuf); } } } diff --git a/Src/Vessel/DeltaGlider/ThermalSubsys.cpp b/Src/Vessel/DeltaGlider/ThermalSubsys.cpp index bc4ab0142..73c2524fb 100644 --- a/Src/Vessel/DeltaGlider/ThermalSubsys.cpp +++ b/Src/Vessel/DeltaGlider/ThermalSubsys.cpp @@ -203,7 +203,7 @@ void ThermalSubsystem::clbkSaveState (FILEHANDLE scn) char cbuf[1024]; sprintf (cbuf, "%0.2lf %0.2lf %0.2lf %0.2lf %0.2lf %0.2lf %0.2lf %0.2lf %0.2lf %0.2lf %0.2lf %0.2lf %0.2lf", cprm[0].T, cprm[1].T, cprm[2].T, cprm[3].T, cprm[4].T, cprm[5].T, cprm[6].T, cprm[7].T, cprm[8].T, cprm[9].T, cprm[10].T, cprm[11].T, cprm[12].T); - oapiWriteScenario_string (scn, "COMPARTMENT_TEMP", cbuf); + oapiWriteScenario_string (scn, (char*)"COMPARTMENT_TEMP", cbuf); DGSubsystem::clbkSaveState (scn); } @@ -720,7 +720,7 @@ void CoolantLoop::clbkSaveState (FILEHANDLE scn) { char cbuf[1024]; sprintf (cbuf, "%d %0.3lf %0.3lf", bPumpActive ? 1:0, pumprate, Tref_tgt); - oapiWriteScenario_string (scn, "COOLANT_STATE", cbuf); + oapiWriteScenario_string (scn, (char*)"COOLANT_STATE", cbuf); DGSubsystem::clbkSaveState (scn); } diff --git a/Src/Vessel/Dragonfly/Dragonfly.cpp b/Src/Vessel/Dragonfly/Dragonfly.cpp index e17f20481..f53efe4ba 100644 --- a/Src/Vessel/Dragonfly/Dragonfly.cpp +++ b/Src/Vessel/Dragonfly/Dragonfly.cpp @@ -241,15 +241,15 @@ void Dragonfly::SaveState (FILEHANDLE scn) // custom parameters sprintf (cbuf, "%f %f %i %i %i", UP_pos ,UY_pos,UP_handle, UY_handle,UAnt_handle); - oapiWriteScenario_string (scn, "UPPERANT", cbuf); + oapiWriteScenario_string (scn, (char*)"UPPERANT", cbuf); sprintf (cbuf, "%f %f %i %i %i", LP_pos ,LY_pos,LP_handle, LY_handle,LAnt_handle); - oapiWriteScenario_string (scn, "LOWERANT", cbuf); + oapiWriteScenario_string (scn, (char*)"LOWERANT", cbuf); sprintf(cbuf,"%f %i",dock_latched,latch_handle); - oapiWriteScenario_string (scn, "HATCH", cbuf); + oapiWriteScenario_string (scn, (char*)"HATCH", cbuf); //char *name; if (Dock_target_object) { oapiGetObjectName(Dock_target_object,cbuf,256); - oapiWriteScenario_string (scn, "ANTTRG", cbuf); + oapiWriteScenario_string (scn, (char*)"ANTTRG", cbuf); } } void Dragonfly::DockEvent (int dock, OBJHANDLE connected) diff --git a/Src/Vessel/Dragonfly/Esystems.cpp b/Src/Vessel/Dragonfly/Esystems.cpp index f6883ee47..1557f8fb6 100644 --- a/Src/Vessel/Dragonfly/Esystems.cpp +++ b/Src/Vessel/Dragonfly/Esystems.cpp @@ -86,7 +86,7 @@ void Socket::Load(FILEHANDLE scn) void Socket::Save(FILEHANDLE scn) { char cbuf[50]; sprintf (cbuf, "%i",curent); - oapiWriteScenario_string (scn, " SOCKET ", cbuf); + oapiWriteScenario_string (scn, (char*)" SOCKET ", cbuf); } //----------------------------------- FUEL CELL -------------------------------------- @@ -267,7 +267,7 @@ void FCell::Load(FILEHANDLE scn) void FCell::Save(FILEHANDLE scn) { char cbuf[50]; sprintf (cbuf, "%i %0.4f ",status, clogg); - oapiWriteScenario_string (scn, " FCELL ", cbuf); + oapiWriteScenario_string (scn, (char*)" FCELL ", cbuf); } //-------------------------------------- BATTERY --------------------------------- Battery::Battery(e_object *i_src, double i_power) @@ -319,7 +319,7 @@ void Battery::Load(FILEHANDLE scn) void Battery::Save(FILEHANDLE scn) { char cbuf[50]; sprintf (cbuf, "%0.0f %0.4f %i",loading, power,c_breaker); - oapiWriteScenario_string (scn, " BATTERY ", cbuf); + oapiWriteScenario_string (scn, (char*)" BATTERY ", cbuf); } @@ -392,7 +392,7 @@ void DCbus::Load(FILEHANDLE scn) void DCbus::Save(FILEHANDLE scn) { char cbuf[50]; sprintf (cbuf, "%0.4f ",branch_amps); - oapiWriteScenario_string (scn, " DC ", cbuf); + oapiWriteScenario_string (scn, (char*)" DC ", cbuf); } //------------------------ AC BUS ------------------------------------------------- @@ -466,7 +466,7 @@ void ACbus::Load(FILEHANDLE scn) void ACbus::Save(FILEHANDLE scn) { char cbuf[50]; sprintf (cbuf, "%0.4f ",branch_amps); - oapiWriteScenario_string (scn, " AC ", cbuf); + oapiWriteScenario_string (scn, (char*)" AC ", cbuf); } Heater::Heater(therm_obj *i_term,float *iw_SRC, float i_max,float i_min,float i_power,float amps,e_object *i_SRC) @@ -509,7 +509,7 @@ void Heater::Load(FILEHANDLE scn) void Heater::Save(FILEHANDLE scn) { char cbuf[20]; sprintf (cbuf, "%i ",on); - oapiWriteScenario_string (scn, " HT ", cbuf); + oapiWriteScenario_string (scn, (char*)" HT ", cbuf); } Fan::Fan(Valve *ih_SRC,Tank *i_TRG,float i_max,float i_amps,e_object *i_SRC) @@ -544,7 +544,7 @@ void Fan::Load(FILEHANDLE scn) void Fan::Save(FILEHANDLE scn) { char cbuf[20]; sprintf (cbuf, "%i ",on); - oapiWriteScenario_string (scn, " FAN ", cbuf); + oapiWriteScenario_string (scn, (char*)" FAN ", cbuf); } Boiler::Boiler(int i_open,int ct,float i_maxf, Valve *i_src,float temps,float i_boil, e_object *ie_SRC):Valve(i_open,ct,i_maxf,i_src) diff --git a/Src/Vessel/Dragonfly/Hsystems.cpp b/Src/Vessel/Dragonfly/Hsystems.cpp index 25b922a80..104fedfec 100644 --- a/Src/Vessel/Dragonfly/Hsystems.cpp +++ b/Src/Vessel/Dragonfly/Hsystems.cpp @@ -120,7 +120,7 @@ if (open) void Valve::Save(FILEHANDLE scn) {char cbuf[50]; sprintf (cbuf, "%i %0.4f", open,pz); - oapiWriteScenario_string (scn, " VALVE ", cbuf); + oapiWriteScenario_string (scn, (char*)" VALVE ", cbuf); }; void Valve::Load(FILEHANDLE scn) { @@ -328,7 +328,7 @@ void Manifold::Save(FILEHANDLE scn) { char cbuf[50]; sprintf (cbuf, "%i %i %i %i %i %i", X[0].open,X[1].open,X[2].open,OV[0].open,OV[1].open,OV[2].open); - oapiWriteScenario_string (scn, " MANIFOLD ", cbuf); + oapiWriteScenario_string (scn, (char*)" MANIFOLD ", cbuf); } //-------------------------------------- TANK ---------------------------------- Tank::Tank() @@ -400,7 +400,7 @@ void Tank::PutMass(double i_mass, double i_temp) //add this much subst, at this void Tank::Save(FILEHANDLE scn) { char cbuf[50]; sprintf (cbuf, "%i %0.4f %0.0f %0.2f", open,pz,mass,Temp); - oapiWriteScenario_string (scn, " TANK ", cbuf); + oapiWriteScenario_string (scn, (char*)" TANK ", cbuf); }; void Tank::Load(FILEHANDLE scn) { diff --git a/Src/Vessel/Dragonfly/Internal.cpp b/Src/Vessel/Dragonfly/Internal.cpp index 2cc0eac8c..c520faa2b 100644 --- a/Src/Vessel/Dragonfly/Internal.cpp +++ b/Src/Vessel/Dragonfly/Internal.cpp @@ -133,8 +133,8 @@ static TEXT_LIST TL0[67]={{35,60,"OPEN"},{35,120,"CLOSE"},{35,140,"OPEN"},//3 {595,600,"FAN"}//67 }; - static char names[7][12]={"FC1","FC2","BAT","DC1","DC2","AC1"}; - static char cy_names[7][12]={"TK1","TK2","TK3"}; + static const char names[7][12]={"FC1","FC2","BAT","DC1","DC2","AC1"}; + static const char cy_names[7][12]={"TK1","TK2","TK3"}; EGauge *eg1,*eg2; HGauge *hg1,*hg2,*hg3; Rotary *rot1; @@ -735,17 +735,17 @@ void ShipInternal::Save(FILEHANDLE scn) { char cbuf[50]; strcpy(cbuf,"v1.0.0B"); - oapiWriteScenario_string (scn, "INTERNAL:", cbuf); + oapiWriteScenario_string (scn, (char*)"INTERNAL:", cbuf); cbuf[0]=0; - oapiWriteScenario_string (scn, " HYDRAULICS:", cbuf); + oapiWriteScenario_string (scn, (char*)" HYDRAULICS:", cbuf); H_systems.Save(scn); - oapiWriteScenario_string (scn, " ELECTRICAL:", cbuf); + oapiWriteScenario_string (scn, (char*)" ELECTRICAL:", cbuf); E_systems.Save(scn); - oapiWriteScenario_string (scn, " PANEL :", cbuf); + oapiWriteScenario_string (scn, (char*)" PANEL :", cbuf); PanelList[0].Save(scn); PanelList[1].Save(scn); PanelList[2].Save(scn); PanelList[3].Save(scn); PanelList[4].Save(scn); - oapiWriteScenario_string (scn, " END INTERNAL", cbuf); -}; \ No newline at end of file + oapiWriteScenario_string (scn, (char*)" END INTERNAL", cbuf); +}; diff --git a/Src/Vessel/Dragonfly/instruments.cpp b/Src/Vessel/Dragonfly/instruments.cpp index 28d19664f..9f5134e3f 100644 --- a/Src/Vessel/Dragonfly/instruments.cpp +++ b/Src/Vessel/Dragonfly/instruments.cpp @@ -256,7 +256,7 @@ else { }; //------------------------------------ EGAUGE ------------------------------------------ - EGauge::EGauge(int x, int y, float *i_SRC,char i_unit[5],int i_min,int i_max, float i_scale,Panel* i_parent):instrument(x,y,i_parent) + EGauge::EGauge(int x, int y, float *i_SRC,const char i_unit[5],int i_min,int i_max, float i_scale,Panel* i_parent):instrument(x,y,i_parent) {MinV=i_max;MaxV=i_min;scale=i_scale;SRC=i_SRC; strcpy(unit,i_unit); temps=oapiCreateSurface(40,40); @@ -347,7 +347,7 @@ Polygon(hDC,S,3);// then the pointer oapiReleaseDC(parent->surf,hDC); }; //----------------------------------- HGAUGE ------------------------------------------ -HGauge::HGauge(int x,int y, int i_w,int i_h,float* i_SRC1,float* i_SRC2,char i_unit[15],int i_min,int i_max, float i_scale,int i_fig,int i_lin,Panel *parent):instrument(x,y,parent) +HGauge::HGauge(int x,int y, int i_w,int i_h,float* i_SRC1,float* i_SRC2,const char i_unit[15],int i_min,int i_max, float i_scale,int i_fig,int i_lin,Panel *parent):instrument(x,y,parent) { Hght=i_h;Wdth=i_w;SRC1=i_SRC1;SRC2=i_SRC2; MaxV=i_max;MinV=i_min;scale=i_scale;NrFig=i_fig;NrLin=i_lin; strcpy(unit,i_unit); @@ -426,7 +426,7 @@ oapiBlt(parent->surf,temps,85-22,0,10,0,9,190); }; //---------------------------- ROTARY -------------------------------------------- -Rotary::Rotary(int x,int y,char i_name[15],char i_names[7][12], int i_set, int i_poz,Panel* parent):instrument(x,y,parent) +Rotary::Rotary(int x,int y,const char i_name[15],const char i_names[7][12], int i_set, int i_poz,Panel* parent):instrument(x,y,parent) { strcpy(screentext,i_name); for (int i=0;i<7;i++) strcpy(names[i],i_names[i]); @@ -576,7 +576,7 @@ bool bounds::test() return false; }; -CW::CW(int x,int y,char *i_text,Panel *i_parent):instrument(x,y,i_parent) +CW::CW(int x,int y,const char *i_text,Panel *i_parent):instrument(x,y,i_parent) {b_list.next=NULL;last=&b_list; strcpy(text,i_text);alarm=1; temps=oapiCreateSurface(100,31); diff --git a/Src/Vessel/Dragonfly/instruments.h b/Src/Vessel/Dragonfly/instruments.h index 5e3bd7a01..50a53f5fb 100644 --- a/Src/Vessel/Dragonfly/instruments.h +++ b/Src/Vessel/Dragonfly/instruments.h @@ -83,7 +83,7 @@ class EGauge:public instrument int MaxV,MinV; // min & max values on the scale float scale; // scale between displayed values and actual pointer value (usually 10,100,1000); float *SRC; - EGauge(int x, int y, float* i_SRC,char i_unit[5],int i_min,int i_max, float i_scale,Panel* i_parent); + EGauge(int x, int y, float* i_SRC,const char i_unit[5],int i_min,int i_max, float i_scale,Panel* i_parent); virtual ~EGauge(){ oapiDestroySurface(temps);}; void RegisterMe(int index); void PaintMe(); @@ -102,7 +102,7 @@ class HGauge:public instrument float scale; // scale between displayed values and actual source value (usually 10,100 or1000) int NrFig,NrLin; // nubmer of markers & numbers ( gradations) on the gauge int lastdraw1,lastdraw2; // where did we last draw this ? - HGauge(int x,int y, int i_w,int i_h,float* i_SRC1,float* i_SRC2,char i_unit[15],int i_min,int i_max, float i_scale,int i_fig,int i_lin,Panel *parent); + HGauge(int x,int y, int i_w,int i_h,float* i_SRC1,float* i_SRC2,const char i_unit[15],int i_min,int i_max, float i_scale,int i_fig,int i_lin,Panel *parent); virtual ~HGauge(){ oapiDestroySurface(temps);}; void RegisterMe(int index); void PaintMe(); @@ -133,7 +133,7 @@ class Rotary:public instrument int set; // position of rotary (0 being the leftmost) int poznr; // total number of positions POINT draw[6]; // data used to store the handle draw - Rotary(int x,int y,char i_name[15],char i_names[7][12], int i_set, int i_poz,Panel* parent); + Rotary(int x,int y,const char i_name[15],const char i_names[7][12], int i_set, int i_poz,Panel* parent); void RegisterMe(int index); void PaintMe(); void LBD(int x,int y); @@ -188,7 +188,7 @@ class CW:public instrument char text[20]; int alarm; //are we activated? SURFHANDLE temps; - CW(int x,int y,char *i_text,Panel *i_parent); + CW(int x,int y,const char *i_text,Panel *i_parent); virtual ~CW(); void RegisterMe(int index); void PaintMe(); diff --git a/Src/Vessel/Dragonfly/panel.cpp b/Src/Vessel/Dragonfly/panel.cpp index c5c907fb8..237378cb6 100644 --- a/Src/Vessel/Dragonfly/panel.cpp +++ b/Src/Vessel/Dragonfly/panel.cpp @@ -43,7 +43,7 @@ SURFHANDLE hADIBorder; SURFHANDLE hFront_Panel_SRF[7]; bool Panel_Resources_Loaded; -int LoadOGLBitmap(char *filename) +int LoadOGLBitmap(const char *filename) { unsigned char *l_texture; int l_index, l_index2=0; @@ -251,7 +251,7 @@ void Panel::Save(FILEHANDLE scn) runner=runner->next; //every 5 switches save if (index==5) {sprintf (cbuf, "%i %i %i %i %i ",int_sv[0],int_sv[1],int_sv[2],int_sv[3],int_sv[4]); - oapiWriteScenario_string (scn, " SW ", cbuf); + oapiWriteScenario_string (scn, (char*)" SW ", cbuf); index=0; } }; @@ -260,11 +260,11 @@ void Panel::Save(FILEHANDLE scn) { int_sv[index]=99; sprintf (cbuf, "%i %i %i %i %i ",int_sv[0],int_sv[1],int_sv[2],int_sv[3],int_sv[4]); - oapiWriteScenario_string (scn, " SW ", cbuf); + oapiWriteScenario_string (scn, (char*)" SW ", cbuf); index=0; }; cbuf[0]=0; - oapiWriteScenario_string (scn, " SW END ", cbuf); + oapiWriteScenario_string (scn, (char*)" SW END ", cbuf); //save the rotary runner=instruments; index=0; @@ -274,7 +274,7 @@ void Panel::Save(FILEHANDLE scn) runner=runner->next; //every 5 switches save if (index==5) {sprintf (cbuf, "%i %i %i %i %i ",int_sv[0],int_sv[1],int_sv[2],int_sv[3],int_sv[4]); - oapiWriteScenario_string (scn, " ROT ", cbuf); + oapiWriteScenario_string (scn, (char*)" ROT ", cbuf); index=0; } }; @@ -283,11 +283,11 @@ void Panel::Save(FILEHANDLE scn) { int_sv[index]=99; sprintf (cbuf, "%i %i %i %i %i ",int_sv[0],int_sv[1],int_sv[2],int_sv[3],int_sv[4]); - oapiWriteScenario_string (scn, " ROT ", cbuf); + oapiWriteScenario_string (scn, (char*)" ROT ", cbuf); index=0; }; cbuf[0]=0; - oapiWriteScenario_string (scn, " ROT END ", cbuf); + oapiWriteScenario_string (scn, (char*)" ROT END ", cbuf); runner=instruments; //index=0; while (runner) @@ -297,12 +297,12 @@ void Panel::Save(FILEHANDLE scn) sprintf(cbuf,"%0.4f %0.4f %0.4f %i %i %0.4f %0.4f %0.4f",adi_p->now.x,adi_p->now.y,adi_p->now.z, adi_p->orbital_ecliptic,adi_p->function_mode, adi_p->reference.x,adi_p->reference.y,adi_p->reference.z); - oapiWriteScenario_string (scn, " ADI ", cbuf); + oapiWriteScenario_string (scn, (char*)" ADI ", cbuf); };//end of if runner=runner->next; };//end of while cbuf[0]=0; - oapiWriteScenario_string (scn, " PAN END ", cbuf); + oapiWriteScenario_string (scn, (char*)" PAN END ", cbuf); } void Panel::Load(FILEHANDLE scn) { instrument_list *runner=instruments; diff --git a/Src/Vessel/Dragonfly/vectors.cpp b/Src/Vessel/Dragonfly/vectors.cpp index a62c6dd8b..e55c56b3f 100644 --- a/Src/Vessel/Dragonfly/vectors.cpp +++ b/Src/Vessel/Dragonfly/vectors.cpp @@ -124,7 +124,7 @@ void vector3::selfnormalize() double vector3::length() { return sqrtf(x*x+y*y+z*z); } -double vector3::mod() +double vector3::mod() const { return sqrtf(x*x+y*y+z*z); } @@ -132,7 +132,7 @@ double vector3::distance(vector3 &v) {return (*this-v).length(); } -double vector3::angle(vector3 &v) +double vector3::angle(const vector3 &v) { return (double) acos((*this % v)/((*this).mod()*v.mod())); //acos( (p1%p2) / ([p1]*[p2]) ) } diff --git a/Src/Vessel/Dragonfly/vectors.h b/Src/Vessel/Dragonfly/vectors.h index 24358df42..38acf8b7e 100644 --- a/Src/Vessel/Dragonfly/vectors.h +++ b/Src/Vessel/Dragonfly/vectors.h @@ -16,7 +16,8 @@ class vector3 //constructors vector3(double _x,double _y,double _z) {set(_x,_y,_z);} vector3() {set(0.0,0.0,0.0);} - vector3(vector3 &v) {set(v.x,v.y,v.z);} + vector3(const vector3 &v) {set(v.x,v.y,v.z);} + //operators //vector to vector vector3 operator+ (vector3); @@ -45,12 +46,12 @@ class vector3 vector3 normalize(); void selfnormalize(); double length(); - double mod(); + double mod() const; double distance(vector3 &v); - double angle(vector3 &v); + double angle(const vector3 &v); vector3 inplane(vector3 &v1,vector3 &v2); //return the projection of this onto plane v1,v2 }; vector3 _vector3(double _x, double _y, double _z); -#endif \ No newline at end of file +#endif diff --git a/Src/Vessel/HST/HST.cpp b/Src/Vessel/HST/HST.cpp index 4f0aee69b..cae8d2300 100644 --- a/Src/Vessel/HST/HST.cpp +++ b/Src/Vessel/HST/HST.cpp @@ -151,11 +151,11 @@ void HST::clbkSaveState (FILEHANDLE scn) char cbuf[256]; SaveDefaultState (scn); sprintf (cbuf, "%d %0.4f", ant_status, ant_proc); - oapiWriteScenario_string (scn, "ANT", cbuf); + oapiWriteScenario_string (scn, (char*)"ANT", cbuf); sprintf (cbuf, "%d %0.4f", hatch_status, hatch_proc); - oapiWriteScenario_string (scn, "HATCH", cbuf); + oapiWriteScenario_string (scn, (char*)"HATCH", cbuf); sprintf (cbuf, "%d %0.4f", array_status, array_proc); - oapiWriteScenario_string (scn, "FOLD", cbuf); + oapiWriteScenario_string (scn, (char*)"FOLD", cbuf); } // -------------------------------------------------------------- diff --git a/Src/Vessel/ScriptVessel/ScriptVessel.cpp b/Src/Vessel/ScriptVessel/ScriptVessel.cpp index 3e06981fb..25e9c86e8 100644 --- a/Src/Vessel/ScriptVessel/ScriptVessel.cpp +++ b/Src/Vessel/ScriptVessel/ScriptVessel.cpp @@ -101,7 +101,7 @@ void ScriptVessel::clbkSetClassCaps (FILEHANDLE cfg) int i; // Load the vessel script - oapiReadItem_string (cfg, "Script", script); + oapiReadItem_string (cfg, (char*)"Script", script); sprintf (cmd, "run_global('Config/Vessels/%s')", script); oapiExecScriptCmd (hInterp, cmd); diff --git a/Src/Vessel/ShuttleA/ShuttleA.cpp b/Src/Vessel/ShuttleA/ShuttleA.cpp index 35f829f81..ad4d895da 100644 --- a/Src/Vessel/ShuttleA/ShuttleA.cpp +++ b/Src/Vessel/ShuttleA/ShuttleA.cpp @@ -1116,7 +1116,7 @@ void ShuttleA::clbkSetClassCaps (FILEHANDLE cfg) EnableTransponder (true); adi_layout = 0; - if (oapiReadItem_int (cfg, "ADI_DEFAULT_LAYOUT", adi_layout)) + if (oapiReadItem_int (cfg, (char*)"ADI_DEFAULT_LAYOUT", adi_layout)) adi_layout = max (0, min (1, adi_layout)); // ******************** NAV radios ************************** @@ -1373,31 +1373,31 @@ void ShuttleA::clbkSaveState (FILEHANDLE scn) // custom parameters sprintf (cbuf, "%0.4f %0.4f", pod_angle[0], pod_angle[1]); - oapiWriteScenario_string (scn, "PODANGLE", cbuf); + oapiWriteScenario_string (scn, (char*)"PODANGLE", cbuf); sprintf (cbuf, "%d %0.4f", dock_status, dock_proc); - oapiWriteScenario_string (scn, "DOCKSTATE", cbuf); + oapiWriteScenario_string (scn, (char*)"DOCKSTATE", cbuf); if (lock_status[0] != DOOR_CLOSED) { sprintf (cbuf, "%d %0.4f", lock_status[0], lock_proc[0]); - oapiWriteScenario_string (scn, "AIRLOCK", cbuf); + oapiWriteScenario_string (scn, (char*)"AIRLOCK", cbuf); } if (lock_status[1] != DOOR_CLOSED) { sprintf (cbuf, "%d %0.4f", lock_status[1], lock_proc[1]); - oapiWriteScenario_string (scn, "IAIRLOCK", cbuf); + oapiWriteScenario_string (scn, (char*)"IAIRLOCK", cbuf); } sprintf (cbuf, "%d %0.4f", gear_status, gear_proc); - oapiWriteScenario_string (scn, "GEAR", cbuf); + oapiWriteScenario_string (scn, (char*)"GEAR", cbuf); sprintf (cbuf, "%0.1f %d", payload_mass,cargo_arm_status); - oapiWriteScenario_string (scn, "PAYLOAD MASS", cbuf); + oapiWriteScenario_string (scn, (char*)"PAYLOAD MASS", cbuf); sprintf (cbuf, "%d %d %d", attref->GetMode(), attref->GetTgtmode(), attref->GetNavid()); - oapiWriteScenario_string (scn, "ATTREF", cbuf); + oapiWriteScenario_string (scn, (char*)"ATTREF", cbuf); - oapiWriteScenario_int (scn, "ADI_LAYOUT", adi_layout); + oapiWriteScenario_int (scn, (char*)"ADI_LAYOUT", adi_layout); } // -------------------------------------------------------------- @@ -2436,7 +2436,7 @@ void ShuttleA::PaintMarkings (SURFHANDLE tex) oapi::Sketchpad *skp = oapiGetSketchpad (main_tex); if (skp) { - oapi::Font *font1 = oapiCreateFont(22, true, "Impact", FONT_BOLD); + oapi::Font *font1 = oapiCreateFont(22, true, (char*)"Impact", FONT_BOLD); skp->SetFont (font1); skp->SetTextColor (0xD0D0D0); skp->SetTextAlign (oapi::Sketchpad::CENTER); @@ -2469,7 +2469,7 @@ DLLCLBK void InitModule (HINSTANCE hModule) oapiRegisterCustomControls (hModule); // allocate Sketchpad resources - g_Param.pFont[0] = oapiCreateFont(-10, false, "Arial"); + g_Param.pFont[0] = oapiCreateFont(-10, false, (char*)"Arial"); g_Param.pPen[0] = oapiCreatePen(1, 3, RGB(120, 220, 120)); g_Param.pPen[1] = oapiCreatePen(1, 1, RGB(220, 220, 120)); g_Param.pPen[2] = oapiCreatePen(1, 1, RGB(0, 0, 0)); diff --git a/Src/Vessel/ShuttleA/ShuttleA_PL/ShuttleA_pl.cpp b/Src/Vessel/ShuttleA/ShuttleA_PL/ShuttleA_pl.cpp index 494512dcb..8a96a4454 100644 --- a/Src/Vessel/ShuttleA/ShuttleA_PL/ShuttleA_pl.cpp +++ b/Src/Vessel/ShuttleA/ShuttleA_PL/ShuttleA_pl.cpp @@ -177,10 +177,10 @@ void ShuttleA_PL::clbkSaveState (FILEHANDLE scn) // custom parameters sprintf (cbuf, "%d", Parachute_mode); - oapiWriteScenario_string (scn, "PARACHUTE", cbuf); + oapiWriteScenario_string (scn, (char*)"PARACHUTE", cbuf); sprintf (cbuf, "%0.1f", timer); - oapiWriteScenario_string (scn, "TIMER", cbuf); + oapiWriteScenario_string (scn, (char*)"TIMER", cbuf); } // -------------------------------------------------------------- diff --git a/Tests/Lua.Interpreter.cpp b/Tests/Lua.Interpreter.cpp index 0713aff84..0966a2321 100644 --- a/Tests/Lua.Interpreter.cpp +++ b/Tests/Lua.Interpreter.cpp @@ -2,8 +2,12 @@ #include +// these collide with std::min/max +#undef min +#undef max + #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file -#include "catch2\catch_all.hpp" +#include "catch2/catch_all.hpp" using std::make_unique; using std::string;