Skip to content

Commit 2bce8fa

Browse files
committed
Updating compiler to latest 5.00 build 2450 22 May 2020
1 parent c6ed60b commit 2bce8fa

19 files changed

+1069
-681
lines changed

engine/metaeditor64.exe

5.53 MB
Binary file not shown.

vsts-extension/CompileMql5Task/Include/Canvas/DX/DXUtils.mqh

+3-3
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,8 @@ bool DXComputeSphere(float radius,uint tessellation,TVertex &vertices[],uint &in
471471
{
472472
DXVector2 tcoord=DXVector2(0.0f,1.0f-(float)i/segments_y);
473473
float latitude=(i*DX_PI/segments_y)-DX_PI_DIV2;
474-
float dy =(float)sin(latitude)*radius;
475-
float dxz=(float)cos(latitude)*radius;
474+
float dy =(float)sin(latitude);
475+
float dxz=(float)cos(latitude);
476476
//--- create a single ring of vertices at this latitude.
477477
for(uint j=0; j<=segments_xz; j++,idx++)
478478
{
@@ -579,7 +579,7 @@ bool DXComputeTorus(float outer_radius,float inner_radius,uint tessellation,TVer
579579
template <typename TVertex>
580580
bool DXComputeCylinder(float radius,float height,uint tessellation,TVertex &vertices[],uint &indices[])
581581
{
582-
return(ComputeTruncatedCone(radius,radius,height,tessellation,vertices,indices));
582+
return(DXComputeTruncatedCone(radius,radius,height,tessellation,vertices,indices));
583583
}
584584
//+------------------------------------------------------------------+
585585
//| Truncated Cone |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
//+------------------------------------------------------------------+
2+
//| FileBMP.mqh |
3+
//| Copyright 2020, MetaQuotes Software Corp. |
4+
//| https://www.mql5.com |
5+
//+------------------------------------------------------------------+
6+
#include <Object.mqh>
7+
8+
//+------------------------------------------------------------------+
9+
//| Bitmap headers |
10+
//+------------------------------------------------------------------+
11+
struct BITMAPFILEHEADER
12+
{
13+
ushort bfType;
14+
uint bfSize;
15+
ushort bfReserved1;
16+
ushort bfReserved2;
17+
uint bfOffBits;
18+
};
19+
struct BITMAPINFOHEADER
20+
{
21+
uint biSize;
22+
int biWidth;
23+
int biHeight;
24+
ushort biPlanes;
25+
ushort biBitCount;
26+
uint biCompression;
27+
uint biSizeImage;
28+
int biXPelsPerMeter;
29+
int biYPelsPerMeter;
30+
uint biClrUsed;
31+
uint biClrImportant;
32+
};
33+
#define BM 0x4D42
34+
//+------------------------------------------------------------------+
35+
//| Class CFileBMP |
36+
//| Purpose: Special class to read and write bmp file |
37+
//| Derives from class CObject. |
38+
//+------------------------------------------------------------------+
39+
class CFileBMP : public CObject
40+
{
41+
protected:
42+
int m_handle;
43+
BITMAPFILEHEADER m_file_header;
44+
BITMAPINFOHEADER m_info_header;
45+
46+
public:
47+
CFileBMP(void);
48+
~CFileBMP(void);
49+
int OpenWrite(const string file_name,bool common_flag=false);
50+
int OpenRead(const string file_name,bool common_flag=false);
51+
int Write32BitsArray(uint& uint_array[],const int width,const int height);
52+
int Read32BitsArray(uint& uint_array[],int& width,int& height);
53+
void Close(void);
54+
};
55+
//+------------------------------------------------------------------+
56+
//| Constructor |
57+
//+------------------------------------------------------------------+
58+
CFileBMP::CFileBMP(void) : m_handle(INVALID_HANDLE)
59+
{
60+
ZeroMemory(m_file_header);
61+
ZeroMemory(m_info_header);
62+
}
63+
//+------------------------------------------------------------------+
64+
//| Destructor |
65+
//+------------------------------------------------------------------+
66+
CFileBMP::~CFileBMP(void)
67+
{
68+
Close();
69+
}
70+
//+------------------------------------------------------------------+
71+
//| Open the file |
72+
//+------------------------------------------------------------------+
73+
int CFileBMP::OpenWrite(const string file_name,bool common_flag)
74+
{
75+
Close();
76+
//--- action
77+
int open_flags=FILE_BIN|FILE_WRITE|FILE_SHARE_READ|FILE_SHARE_WRITE;
78+
if(common_flag)
79+
open_flags|=FILE_COMMON;
80+
//--- open
81+
m_handle=FileOpen(file_name,open_flags);
82+
//--- result
83+
return(m_handle);
84+
}
85+
//+------------------------------------------------------------------+
86+
//| Open the file |
87+
//+------------------------------------------------------------------+
88+
int CFileBMP::OpenRead(const string file_name,bool common_flag)
89+
{
90+
Close();
91+
//--- action
92+
int open_flags=FILE_BIN|FILE_READ|FILE_SHARE_READ|FILE_SHARE_WRITE;
93+
if(common_flag)
94+
open_flags|=FILE_COMMON;
95+
//--- open
96+
m_handle=FileOpen(file_name,open_flags);
97+
//--- check bmp headers
98+
if(m_handle!=INVALID_HANDLE)
99+
{
100+
uint fileheader_size=FileReadStruct(m_handle,m_file_header);
101+
uint infoheader_size=FileReadStruct(m_handle,m_info_header);
102+
//--- it should be a simple 32-bit bmp
103+
if(fileheader_size!=sizeof(m_file_header) ||
104+
infoheader_size!=sizeof(m_info_header) ||
105+
m_file_header.bfType!=BM ||
106+
m_file_header.bfOffBits!=sizeof(m_file_header)+sizeof(m_info_header) ||
107+
m_info_header.biBitCount!=32 ||
108+
m_info_header.biClrUsed!=0)
109+
Close();
110+
}
111+
//--- result
112+
return(m_handle);
113+
}
114+
//+------------------------------------------------------------------+
115+
//| Write the file |
116+
//+------------------------------------------------------------------+
117+
int CFileBMP::Write32BitsArray(uint& uint_array[],const int width,const int height)
118+
{
119+
if(m_handle==INVALID_HANDLE)
120+
return(-1);
121+
//--- check size
122+
int size=width*height;
123+
if(size==0)
124+
return(0);
125+
if(size<0)
126+
size=-size;
127+
if(ArraySize(uint_array)<size)
128+
return(-2);
129+
//--- prepare headers
130+
ZeroMemory(m_file_header);
131+
ZeroMemory(m_info_header);
132+
m_file_header.bfType=BM;
133+
m_file_header.bfSize=sizeof(m_file_header)+sizeof(m_info_header)+size*sizeof(uint);
134+
m_file_header.bfOffBits=sizeof(m_file_header)+sizeof(m_info_header);
135+
m_info_header.biSize=sizeof(m_info_header);
136+
m_info_header.biWidth=width;
137+
m_info_header.biHeight=height;
138+
m_info_header.biPlanes=1;
139+
m_info_header.biBitCount=32;
140+
m_info_header.biSizeImage=size*32;
141+
//--- write bmp-file
142+
FileSeek(m_handle,0,SEEK_SET);
143+
FileWriteStruct(m_handle,m_file_header);
144+
FileWriteStruct(m_handle,m_info_header);
145+
uint written=FileWriteArray(m_handle,uint_array,0,size);
146+
//--- bytes written
147+
return((int)written*32);
148+
}
149+
//+------------------------------------------------------------------+
150+
//| Read the file |
151+
//+------------------------------------------------------------------+
152+
int CFileBMP::Read32BitsArray(uint& uint_array[],int& width,int& height)
153+
{
154+
if(m_handle==INVALID_HANDLE)
155+
return(-1);
156+
//--- store dimensions from header
157+
width=m_info_header.biWidth;
158+
height=m_info_header.biHeight;
159+
//--- check size
160+
int size=width*height;
161+
if(size==0)
162+
return(0);
163+
if(size<0)
164+
size=-size;
165+
//--- read bmp-file
166+
FileSeek(m_handle,sizeof(m_file_header)+sizeof(m_info_header),SEEK_SET);
167+
uint read=FileReadArray(m_handle,uint_array,0,size);
168+
//--- bytes read
169+
return((int)read*32);
170+
}
171+
//+------------------------------------------------------------------+
172+
//| Close the file |
173+
//+------------------------------------------------------------------+
174+
void CFileBMP::Close(void)
175+
{
176+
//--- check handle
177+
if(m_handle!=INVALID_HANDLE)
178+
{
179+
FileClose(m_handle);
180+
m_handle=INVALID_HANDLE;
181+
}
182+
}
183+
//+------------------------------------------------------------------+

vsts-extension/CompileMql5Task/Include/Trade/AccountInfo.mqh

+31-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//+------------------------------------------------------------------+
22
//| AccountInfo.mqh |
3-
//| Copyright 2009-2017, MetaQuotes Software Corp. |
3+
//| Copyright 2009-2020, MetaQuotes Software Corp. |
44
//| http://www.mql5.com |
55
//+------------------------------------------------------------------+
66
#include <Object.mqh>
@@ -90,10 +90,17 @@ string CAccountInfo::TradeModeDescription(void) const
9090
//---
9191
switch(TradeMode())
9292
{
93-
case ACCOUNT_TRADE_MODE_DEMO : str="Demo trading account"; break;
94-
case ACCOUNT_TRADE_MODE_CONTEST: str="Contest trading account"; break;
95-
case ACCOUNT_TRADE_MODE_REAL : str="Real trading account"; break;
96-
default : str="Unknown trade account";
93+
case ACCOUNT_TRADE_MODE_DEMO:
94+
str="Demo trading account";
95+
break;
96+
case ACCOUNT_TRADE_MODE_CONTEST:
97+
str="Contest trading account";
98+
break;
99+
case ACCOUNT_TRADE_MODE_REAL:
100+
str="Real trading account";
101+
break;
102+
default:
103+
str="Unknown trade account";
97104
}
98105
//---
99106
return(str);
@@ -121,9 +128,14 @@ string CAccountInfo::StopoutModeDescription(void) const
121128
//---
122129
switch(StopoutMode())
123130
{
124-
case ACCOUNT_STOPOUT_MODE_PERCENT: str="Level is specified in percentage"; break;
125-
case ACCOUNT_STOPOUT_MODE_MONEY : str="Level is specified in money"; break;
126-
default : str="Unknown stopout mode";
131+
case ACCOUNT_STOPOUT_MODE_PERCENT:
132+
str="Level is specified in percentage";
133+
break;
134+
case ACCOUNT_STOPOUT_MODE_MONEY:
135+
str="Level is specified in money";
136+
break;
137+
default:
138+
str="Unknown stopout mode";
127139
}
128140
//---
129141
return(str);
@@ -144,10 +156,17 @@ string CAccountInfo::MarginModeDescription(void) const
144156
//---
145157
switch(MarginMode())
146158
{
147-
case ACCOUNT_MARGIN_MODE_RETAIL_NETTING: str="Netting"; break;
148-
case ACCOUNT_MARGIN_MODE_EXCHANGE : str="Exchange"; break;
149-
case ACCOUNT_MARGIN_MODE_RETAIL_HEDGING: str="Hedging"; break;
150-
default : str="Unknown margin mode";
159+
case ACCOUNT_MARGIN_MODE_RETAIL_NETTING:
160+
str="Netting";
161+
break;
162+
case ACCOUNT_MARGIN_MODE_EXCHANGE:
163+
str="Exchange";
164+
break;
165+
case ACCOUNT_MARGIN_MODE_RETAIL_HEDGING:
166+
str="Hedging";
167+
break;
168+
default:
169+
str="Unknown margin mode";
151170
}
152171
//---
153172
return(str);

0 commit comments

Comments
 (0)