restrict "std" namespace using .

This commit is contained in:
Zero Fanker 2024-04-25 19:11:06 -04:00
parent fc363aa59d
commit 00753d2ff2
17 changed files with 36 additions and 32 deletions

View file

@ -163,7 +163,7 @@ void CBasic::OnChangeName()
void CBasic::UpdateData()
{
// MessageBox("This function ( UpdateData() ) should not be called here... please report to the author.");
errstream << "CBasic::UpdateData() called - should not be called" << endl;
errstream << "CBasic::UpdateData() called - should not be called" << std::endl;
errstream.flush();
}

View file

@ -32,7 +32,7 @@
#include <vector>
using namespace std;
using std::vector;
#define COMBOUINPUT_HOUSES 0
#define COMBOUINPUT_COUNTRIES 1

View file

@ -112,7 +112,7 @@ CFinalSunApp::CFinalSunApp()
log += "finalalert2log.txt";
#endif
m_u8LogFileName = log;
errstream.open(m_u8LogFileName, ios_base::trunc);
errstream.open(m_u8LogFileName, std::ios_base::trunc);
errstream << "\uFEFF"; // BOM
#ifdef TS_MODE

View file

@ -69,6 +69,8 @@ static char THIS_FILE[] = __FILE__;
#include <io.h>
#include <stdio.h>
using std::endl;
extern ACTIONDATA AD;
extern BOOL bNoDraw;

View file

@ -38,7 +38,8 @@
#include <ios>
#include "IniHelper.h"
using namespace std;
using std::vector;
using std::map;
class CIniFileSection
{

View file

@ -358,8 +358,8 @@ __forceinline void BlitTerrain(void* dst, int x, int y, int dleft, int dtop, int
short& left = st.vborder[e].left;
short& right = st.vborder[e].right;
auto l = max(left, srcRect.left);
auto r = min(right, static_cast<short>(srcRect.right - 1));
auto l = std::max(left, srcRect.left);
auto r = std::min(right, static_cast<short>(srcRect.right - 1));
for (i = l; i <= r; i++) {
//if (i < srcRect.left || i >= srcRect.right)
{
@ -640,7 +640,7 @@ __forceinline void BlitPic(void* dst, int x, int y, int dleft, int dtop, int dpi
int l = pLighting[spos];
BYTE* bc = reinterpret_cast<BYTE*>(&c);
for (int i = 0; i < 4; ++i)
bc[i] = min(255, bc[i] * (200 + l * 300 / 255) / 255); // game seems to overbrighten and have a lot of ambient - if you change this, also change Loading.cpp shp lighting value so that shp light stays at 1.0
bc[i] = std::min(255, bc[i] * (200 + l * 300 / 255) / 255); // game seems to overbrighten and have a lot of ambient - if you change this, also change Loading.cpp shp lighting value so that shp light stays at 1.0
//bc[i] = min(255, bc[i] * (0 + l * (255 - 0) / 255) / 255);
}
memcpy(dest, &c, bpp);
@ -3674,7 +3674,7 @@ void CIsoView::DrawTube(const CTube& tube, const DDSURFACEDESC2* lockedDDSD, con
const auto col = color ? m_color_converter->GetColor(*color) : (type0 ? m_color_converter->GetColor(255, 0, 0) : m_color_converter->GetColor(0, 0, 255));
ProjectedVec lineOffset = type0 ? ProjectedVec() : ProjectedVec(1, 1);
int lowestHeight = min(Map->GetHeightAt(tube.getStartCoords()), Map->GetHeightAt(tube.getEndCoords()));
int lowestHeight = std::min(Map->GetHeightAt(tube.getStartCoords()), Map->GetHeightAt(tube.getEndCoords()));
LineDrawer ld(lockedDDSD->lpSurface, bpp, lockedDDSD->dwWidth, lockedDDSD->dwHeight, lockedDDSD->lPitch);
auto startDraw = GetRenderTargetCoordinates(tube.getStartCoords(), lowestHeight);
ld.MoveTo(startDraw.x + f_x / 2 + lineOffset.x, startDraw.y + f_y / 2 + lineOffset.y);
@ -4681,7 +4681,7 @@ void CIsoView::OnTimer(UINT_PTR nIDEvent)
InvalidateRect(NULL, FALSE);
} else {
errstream << "Timer calls InitTMPs()" << endl;
errstream << "Timer calls InitTMPs()" << std::endl;
errstream.flush();
theApp.m_loading->InitTMPs();
@ -5062,10 +5062,10 @@ void CIsoView::DrawMap()
auto topRight = GetMapCoordinatesFromClientCoordinates(CPoint(cr.right, 0), false, true);
auto bottomLeft = GetMapCoordinatesFromClientCoordinates(CPoint(0, cr.bottom), false, true);
auto bottomRight = GetMapCoordinatesFromClientCoordinates(CPoint(cr.right, cr.bottom), false, true);
left = min(topLeft.x, topRight.x);
top = min(topLeft.y, topRight.y);
right = max(bottomLeft.x, bottomRight.x);
bottom = max(bottomLeft.y, bottomRight.y);
left = std::min(topLeft.x, topRight.x);
top = std::min(topLeft.y, topRight.y);
right = std::max(bottomLeft.x, bottomRight.x);
bottom = std::max(bottomLeft.y, bottomRight.y);
}
// some large buildings may be out of reach:
@ -6029,7 +6029,7 @@ void CIsoView::OnKillFocus(CWnd* pNewWnd)
CView::OnKillFocus(pNewWnd);
if (rscroll) {
errstream << "Killing scroll" << endl;
errstream << "Killing scroll" << std::endl;
errstream.flush();
ReleaseCapture();

View file

@ -4562,7 +4562,7 @@ void CLoading::LoadStrings()
BYTE* lpData = NULL;
DWORD dwSize;
if (DoesFileExist((std::string(TSPath) + "\\" + file).c_str())) {
std::ifstream f(std::string(TSPath) + "\\" + file, ios::binary);
std::ifstream f(std::string(TSPath) + "\\" + file, std::ios::binary);
if (f.good()) {
f.seekg(0, std::ios::end);
auto size = f.tellg();
@ -4582,7 +4582,7 @@ void CLoading::LoadStrings()
//HMIXFILE hMix=m_hLanguage;
if (hMix) {
if (FSunPackLib::XCC_ExtractFile(file, u8AppDataPath + "\\RA2Tmp.csf", hMix)) {
std::ifstream f(u8AppDataPath + "\\RA2Tmp.csf", ios::binary);
std::ifstream f(u8AppDataPath + "\\RA2Tmp.csf", std::ios::binary);
if (f.good()) {
f.seekg(0, std::ios::end);
auto size = f.tellg();

View file

@ -34,7 +34,7 @@
extern TILEDATA** tiledata;
extern DWORD* tiledata_count;
extern ofstream errstream;
extern std::ofstream errstream;
extern map<int, int> tilesets_start;
extern CIniFile* tiles;
extern CFinalSunApp theApp;

View file

@ -97,10 +97,10 @@ void CMiniMap::OnDraw(CDC* pDC)
auto topRight = Map->GetMiniMapPos(isoview.GetMapCoordinatesFromClientCoordinates(CPoint(cr.right, 0), false, true));
auto bottomLeft = Map->GetMiniMapPos(isoview.GetMapCoordinatesFromClientCoordinates(CPoint(0, cr.bottom), false, true));
auto bottomRight = Map->GetMiniMapPos(isoview.GetMapCoordinatesFromClientCoordinates(CPoint(cr.right, cr.bottom), false, true));
auto left = min(topLeft.x, topRight.x);
auto top = min(topLeft.y, topRight.y);
auto right = max(bottomLeft.x, bottomRight.x);
auto bottom = max(bottomLeft.y, bottomRight.y);
auto left = std::min(topLeft.x, topRight.x);
auto top = std::min(topLeft.y, topRight.y);
auto right = std::max(bottomLeft.x, bottomRight.x);
auto bottom = std::max(bottomLeft.y, bottomRight.y);
CPoint center(r.right / 2, r.bottom / 2);
selRect.left = left * m_scale;

View file

@ -347,7 +347,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug YR|x64'">
<ClCompile>
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NOMINMAX;RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\MissionEditorPackLib</AdditionalIncludeDirectories>
</ClCompile>
<ResourceCompile>
@ -419,7 +419,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease YR|x64'">
<ClCompile>
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NOMINMAX;RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\MissionEditorPackLib</AdditionalIncludeDirectories>
</ClCompile>
<ResourceCompile>

View file

@ -28,8 +28,7 @@
#pragma once
#endif
#define VC_EXTRALEAN
#define NOMINMAX
#define VC_EXTRALEAN
#pragma warning(disable: 4503)
#pragma warning(disable: 4786)
@ -56,7 +55,7 @@
#include "resource.h"
#include "TipDlg.h"
using std::endl;
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ inserts additional declarations exactly above this line.

View file

@ -164,7 +164,7 @@ ProjectedVec TextDrawer::GetExtent(const std::string& text) const
cur.set(0, cur.y + ch + lineOffset);
} else if (c >= 32 && c <= 126) {
cur.x += cw;
maxpos.set(max(maxpos.x, cur.x), max(maxpos.y, cur.y + ch));
maxpos.set(std::max(maxpos.x, cur.x), std::max(maxpos.y, cur.y + ch));
}
}

View file

@ -1280,10 +1280,10 @@ CString GetFreeID()
"Actions",
"AITriggerTypes",
};
if (find(std::begin(typeListSections), std::end(typeListSections), input) != std::end(typeListSections)) {
if (std::find(std::begin(typeListSections), std::end(typeListSections), input) != std::end(typeListSections)) {
return true;
}
if (find(std::begin(idListSections), std::end(idListSections), input) != std::end(idListSections)) {
if (std::find(std::begin(idListSections), std::end(idListSections), input) != std::end(idListSections)) {
return true;
}
return false;

View file

@ -25,6 +25,8 @@
#include <memory>
#include <array>
using std::string;
bool deleteFile(const std::string& u8FilePath);
// set the status bar text in the main dialog

View file

@ -195,7 +195,7 @@ inline CString SetParam(const CString& data, const int param, const CString& val
if (param < 0)
return data;
std::vector<CString> params = SplitParams(data);
params.resize(max(param + 1, static_cast<int>(params.size())));
params.resize(std::max(param + 1, static_cast<int>(params.size())));
params[param] = value;
return Join(",", params);
}

View file

@ -183,7 +183,7 @@ SMUDGE_INFO smudgeinfo[0x0F00];
#endif
/* error output */
ofstream errstream;
std::ofstream errstream;
/* the finalsun app object */
CFinalSunApp theApp;

View file

@ -114,7 +114,7 @@ extern SMUDGE_INFO smudgeinfo[0x0F00];
extern CFinalSunApp theApp;
/* error output */
extern ofstream errstream;
extern std::ofstream errstream;
// application path
extern char AppPath[MAX_PATH + 1];