Skip to content

Commit b63beb6

Browse files
committed
Fix compiling issue.
1 parent 971d660 commit b63beb6

12 files changed

+91
-26
lines changed

Algorithms/DepthFirstSearch.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ namespace Algorithm
102102
else if (!IsMarked(adjacentedVertexIndex))
103103
{
104104
m_edgeTo[adjacentedVertexIndex] = startVertex;
105-
DirectedGraphDFS(graph, adjacentedVertexIndex);
105+
DirectedGraphDFS(graph, adjacentedVertexIndex, outCircle);
106106
}
107107
else if (m_onStack[adjacentedVertexIndex])
108108
{

Algorithms/FiniteStateMachine.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace Algorithm
2828

2929
void FSMState::Enter(FiniteStateMachine& fsm)
3030
{
31-
31+
fsm;
3232
}
3333

3434
void FSMState::Update(FiniteStateMachine& fsm)
@@ -44,7 +44,7 @@ namespace Algorithm
4444

4545
void FSMState::Exit(FiniteStateMachine& fsm)
4646
{
47-
47+
fsm;
4848
}
4949

5050
//OpenFSM

Algorithms/LinkedList.h

+12-9
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ namespace Algorithm
4343
void AddRearNode(const T& valeu);
4444
T RemoveRearNode();
4545
private:
46-
Node* m_front = nullptr;
47-
Node* m_rear = nullptr;
46+
Node<T>* m_front = nullptr;
47+
Node<T>* m_rear = nullptr;
4848
};
4949

5050
template<typename T>
@@ -69,9 +69,9 @@ namespace Algorithm
6969
template<typename T>
7070
void Algorithm::LinkedList<T>::Destory()
7171
{
72-
for (Node* current = m_front; current != nullptr; )
72+
for (Node<T>* current = m_front; current != nullptr; )
7373
{
74-
Node* next = current->m_next;
74+
Node<T>* next = current->m_next;
7575
delete current;
7676
current = next;
7777
}
@@ -80,7 +80,7 @@ namespace Algorithm
8080
template<typename T>
8181
void Algorithm::LinkedList<T>::AddFrontNode(const T& value)
8282
{
83-
Node* newFront = new Node(value);
83+
Node<T>* newFront = new Node<T>(value);
8484
newFront->m_next = m_front;
8585
if (m_front)
8686
{
@@ -92,19 +92,22 @@ namespace Algorithm
9292
template<typename T>
9393
T Algorithm::LinkedList<T>::RemoveFrontNode()
9494
{
95-
Node* newFront = m_front->m_next;
95+
Node<T>* newFront = m_front->m_next;
96+
T returnValue = m_front->m_value;
9697
if (newFront)
9798
{
9899
newFront->m_previous = nullptr;
99100
}
100101
delete m_front;
101102
m_front = newFront;
103+
104+
return returnValue;
102105
}
103106

104107
template<typename T>
105-
void Algorithm::LinkedList<T>::AddRearNode(const T& valeu)
108+
void Algorithm::LinkedList<T>::AddRearNode(const T& value)
106109
{
107-
Node* newRear = new Node(value);
110+
Node<T>* newRear = new Node<T>(value);
108111
newRear->m_previous = m_rear;
109112
if (m_rear)
110113
{
@@ -134,7 +137,7 @@ namespace Algorithm
134137
bool IsEmpty() const;
135138

136139
private:
137-
LinkedList m_linkedList;
140+
LinkedList<T> m_linkedList;
138141
};
139142

140143
template<typename T>

Algorithms/String.h

+49
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ namespace Algorithm
4949
StringBase<T>& operator=(const T* rhs);
5050
bool operator==(const StringBase<T>& rhs)const;
5151
bool operator!=(const StringBase<T>& rhs)const;
52+
bool operator<(const StringBase<T>& rhs)const;
53+
bool operator<=(const StringBase<T>& rhs)const;
54+
bool operator>(const StringBase<T>& rhs)const;
55+
bool operator>=(const StringBase<T>& rhs)const;
5256
StringBase<T> operator+(const StringBase<T> text)const;
5357

5458
void Add(T value);
@@ -213,6 +217,51 @@ namespace Algorithm
213217
return !((*this) == rhs);
214218
}
215219

220+
template<typename T>
221+
bool Algorithm::StringBase<T>::operator<(const StringBase<T>& rhs) const
222+
{
223+
if (Count() < rhs.Count())
224+
{
225+
return true;
226+
}
227+
for (int i = 0; i < Count(); i++)
228+
{
229+
if (m_string[i] < rhs[i])
230+
{
231+
return true;
232+
}
233+
}
234+
return false;
235+
}
236+
template<typename T>
237+
bool Algorithm::StringBase<T>::operator<=(const StringBase<T>& rhs) const
238+
{
239+
if (Count() <= rhs.Count())
240+
{
241+
return true;
242+
}
243+
for (int i = 0; i < Count(); i++)
244+
{
245+
if (m_string[i] <= rhs[i])
246+
{
247+
return true;
248+
}
249+
}
250+
return false;
251+
}
252+
253+
template<typename T>
254+
bool Algorithm::StringBase<T>::operator>(const StringBase<T>& rhs) const
255+
{
256+
return !((*this) <= rhs);
257+
}
258+
259+
template<typename T>
260+
bool Algorithm::StringBase<T>::operator>=(const StringBase<T>& rhs) const
261+
{
262+
return !((*this) < rhs);
263+
}
264+
216265
template<typename T>
217266
Algorithm::StringBase<T> Algorithm::StringBase<T>::operator+(const StringBase<T> text) const
218267
{

Algorithms/StringSort.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace Algorithm
3434
}
3535
for (int i = 1; i < TOTAL_LENGTH; i++)
3636
{
37-
// Avaliable value from 1 is empty and 2 ~ 257 => 0 is empty index, 1 ~ 256 become character index
37+
// Available value from 1 is empty and 2 ~ 257 => 0 is empty index, 1 ~ 256 become character index
3838
msdCharacterArray[i] += msdCharacterArray[i - 1];
3939
}
4040
for (int i = low; i <= high; i++)

Algorithms/Vector.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define SAINTMATHEMATICS_VECOTR_H
33

44
//class Iterator;
5-
//#include <cstring>
5+
#include <cstring> // for memset and memcpy
66
#include <cassert>
77

88
namespace Algorithm

Engine/Graphic/Graphic2D.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ namespace XenonEngine
102102
errorY -= 2 * (float)deltaX;
103103
}
104104
}
105+
106+
if (isFlip)
107+
{
108+
DrawPixel(startPos.y, startPos.x, rgba);
109+
}
110+
else
111+
{
112+
DrawPixel(startPos.x, startPos.y, rgba);
113+
}
105114
}
106115

107116
void Graphic2D::DrawLine(const Vector2f& lhs, const Vector2f&rhs, const SColorRGBA& rgba /*= CrossPlatform::WHITE*/) const

Engine/IO/ObjectImporter.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ namespace XenonEngine
6262
int numOfVertex = (int)attrib.vertices.size() / 3;
6363
Vector<Vector3f> vertexs;
6464
vertexs.Initialize(numOfVertex);
65-
vertexs.Resize(numOfVertex);
65+
vertexs.ResetCount(numOfVertex);
6666
for (size_t i = 0; i < attrib.vertices.size(); i += 3)
6767
{
6868
vertexs[(int)i / 3].x = attrib.vertices[(int)(i + 0)];
@@ -73,7 +73,7 @@ namespace XenonEngine
7373
int numOfNormal = (int)attrib.normals.size() / 3;
7474
Vector<Vector3f> normals;
7575
normals.Initialize(numOfNormal);
76-
normals.Resize(numOfNormal);
76+
normals.ResetCount(numOfNormal);
7777
if (numOfNormal > 0)
7878
{
7979
//normals = new Vector3f[numOfNormal];
@@ -90,7 +90,7 @@ namespace XenonEngine
9090
if (numOfTextureCoordinate > 0)
9191
{
9292
uv.Initialize(numOfTextureCoordinate);
93-
uv.Resize(numOfTextureCoordinate);
93+
uv.ResetCount(numOfTextureCoordinate);
9494
for (size_t i = 0; i < attrib.texcoords.size(); i+= 2)
9595
{
9696
uv[(int)i / 2].x = attrib.texcoords[(int)(i + 0)];
@@ -161,7 +161,7 @@ namespace XenonEngine
161161
Vector<Polygon3D::TriangleIndex> vertexIndex;
162162
int numOfIndex = (int)shapes[s].mesh.indices.size() / 3;
163163
vertexIndex.Initialize(numOfIndex);
164-
vertexIndex.Resize(numOfIndex);
164+
vertexIndex.ResetCount(numOfIndex);
165165
size_t index_offset = 0;
166166
for (size_t f = 0; f < shapes[s].mesh.num_face_vertices.size(); f++)
167167
{

Engine/Physics/Physics2D.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ namespace XenonPhysics
3535
}
3636

3737
bool Physics2D::FixedUpdate(long timeInterval)
38-
{
39-
float deltaTime = timeInterval;
38+
{
39+
float deltaTime = (float)timeInterval;
4040

4141
//CollisionInfo collisionInfo;
4242

Engine/XenonEngineEdtior.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace XenonEngine
99
using namespace Algorithm;
1010

1111

12-
void EditorModeState::Enter(FiniteStateMachine& fsm)
12+
void EditorModeState::Enter(FiniteStateMachine& /*fsm*/)
1313
{
1414
}
1515

@@ -22,11 +22,11 @@ namespace XenonEngine
2222
}
2323
}
2424

25-
void EditorModeState::Exit(FiniteStateMachine& fsm)
25+
void EditorModeState::Exit(FiniteStateMachine& /*fsm*/)
2626
{
2727
}
2828

29-
void RuntimeModeState::Enter(FiniteStateMachine& fsm)
29+
void RuntimeModeState::Enter(FiniteStateMachine& /*fsm*/)
3030
{
3131
compiler = new XenonCompiler;
3232
compiler->Initialize();
@@ -43,7 +43,7 @@ namespace XenonEngine
4343
compiler->RunScript();
4444
}
4545

46-
void RuntimeModeState::Exit(FiniteStateMachine& fsm)
46+
void RuntimeModeState::Exit(FiniteStateMachine& /*fsm*/)
4747
{
4848
delete compiler;
4949
}

Engine/XenonEngineEdtior.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#pragma once
22

33
#include "Algorithms/FiniteStateMachine.h"
4+
#include "VirtualMachine/XenonCompiler.h"
5+
6+
using Algorithm::FSMState;
7+
using Algorithm::FiniteStateMachine;
48

59
namespace XenonEngine
610
{
@@ -39,6 +43,6 @@ namespace XenonEngine
3943
bool IsEditorMode() const;
4044
protected:
4145
private:
42-
Algorithm::FiniteStateMachine m_editorStateMachine;
46+
FiniteStateMachine m_editorStateMachine;
4347
};
4448
}

Library/ImGuiFileDialog

0 commit comments

Comments
 (0)