Skip to content

Commit

Permalink
Merge pull request #11 from ejatgit/My-Local-Cpp
Browse files Browse the repository at this point in the history
Checking my branch work for the night
  • Loading branch information
ejatgit authored May 17, 2024
2 parents badf589 + 40c665d commit 0f6ab91
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 60 deletions.
2 changes: 1 addition & 1 deletion CPP/High_Voltage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif()
project ("High_Voltage")

# Add source to this project's executable.
add_executable (High_Voltage "High_Voltage.cpp" "High_Voltage.h" "cPlayer.cpp" "cInterceptor.cpp" "cPlayer.h" "cInterceptor.h" "GlobalVariables.h")
add_executable (High_Voltage "High_Voltage.cpp" "High_Voltage.h" "cPlayer.cpp" "cInterceptor.cpp" "cPlayer.h" "cInterceptor.h" "GlobalVariables.h" "mBuildMaze.h")

if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET High_Voltage PROPERTY CXX_STANDARD 20)
Expand Down
3 changes: 2 additions & 1 deletion CPP/High_Voltage/GlobalVariables.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//using namespace std;

#include "cPlayer.h"
#include "cInterceptor.h"
#ifndef GlobalVariables_H
#define GlobalVariables_H

Expand Down Expand Up @@ -72,7 +73,7 @@ class CustomCollection {
return m_items[ItemKey];
}
};
CustomCollection interceptorCollection;
CustomCollection<cInterceptor> interceptorCollection;
//Public cActivePlayer As cPlayer
cPlayer cActivePlayer{};

Expand Down
8 changes: 6 additions & 2 deletions CPP/High_Voltage/mBuildMaze.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#include<iostream>

#include "cPlayer.h"
#include "cInterceptor.h"
#include "GlobalVariables.h"
#include<iostream>

#include "mBuildMaze.h"

//Attribute VB_Name = "mBuildMaze"
//Option Explicit
//
#include "mBuildMaze.h"

void SpawnPlayer(){
//Sub SpawnPlayer()
//Dim iCount As Integer
Expand Down
6 changes: 6 additions & 0 deletions CPP/High_Voltage/mBuildMaze.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
#ifndef mBuildMaze_H
#define mBuildMaze_H

void SpawnPlayer();
void Spawninterceptors();
void InstallHighVoltageBarriers();
void ClearMaze();
void InitialFillMaze();

#endif
134 changes: 78 additions & 56 deletions CPP/High_Voltage/mFunctions.cpp
Original file line number Diff line number Diff line change
@@ -1,74 +1,96 @@
#include"GlobalVariables.h"
#include "mFunctions.h"
//Attribute VB_Name = "mFunctions"
//Option Explicit
//
//Function offsetRowBy(ByVal iValue As Integer) As Integer
//
//If 1 <= iValue And iValue <= 3 Then
// offsetRowBy = 1
//ElseIf 7 <= iValue And iValue <= 9 Then
// offsetRowBy = -1
//Else
// offsetRowBy = 0
//End If
//
//End Function
//
//Function offsetColumnBy(ByVal iValue As Integer) As Integer
//
//If iValue = 3 Or iValue = 6 Or iValue = 9 Then
// offsetColumnBy = 1
//ElseIf iValue = 1 Or iValue = 4 Or iValue = 7 Then
// offsetColumnBy = -1
//Else
// offsetColumnBy = 0
//End If
//
//End Function
//
//Function interceptorRowOffset(ByVal iValue As Integer) As Integer
//Dim iTest As Integer
//
//iTest = cActivePlayer.Row - iValue
//
//If iTest > 0 Then
// interceptorRowOffset = 1
//ElseIf iTest < 0 Then
// interceptorRowOffset = -1
//Else
// interceptorRowOffset = 0
//End If
//
//End Function
//
//Function interceptorColumnOffset(ByVal iValue As Integer) As Integer
//Dim iTest As Integer
int offsetRowBy(int iValue) {
//Function offsetRowBy(ByVal iValue As Integer) As Integer
//
//If 1 <= iValue And iValue <= 3 Then
// offsetRowBy = 1
//ElseIf 7 <= iValue And iValue <= 9 Then
// offsetRowBy = -1
//Else
// offsetRowBy = 0
//End If
//
//End Function
}
//
//iTest = cActivePlayer.Column - iValue
int offsetColumnBy(int iValue) {
//Function offsetColumnBy(ByVal iValue As Integer) As Integer
//
//If iValue = 3 Or iValue = 6 Or iValue = 9 Then
// offsetColumnBy = 1
//ElseIf iValue = 1 Or iValue = 4 Or iValue = 7 Then
// offsetColumnBy = -1
//Else
// offsetColumnBy = 0
//End If
//
//End Function
}
//
//If iTest > 0 Then
// interceptorColumnOffset = 1
//ElseIf iTest < 0 Then
// interceptorColumnOffset = -1
//Else
// interceptorColumnOffset = 0
//End If
int interceptorRowOffset(int iValue) {
//Function interceptorRowOffset(ByVal iValue As Integer) As Integer
//Dim iTest As Integer
//
//iTest = cActivePlayer.Row - iValue
//
//If iTest > 0 Then
// interceptorRowOffset = 1
//ElseIf iTest < 0 Then
// interceptorRowOffset = -1
//Else
// interceptorRowOffset = 0
//End If
//
//End Function
}
//
//End Function
int interceptorColumnOffset(Int iValue) {
//Function interceptorColumnOffset(ByVal iValue As Integer) As Integer
//Dim iTest As Integer
//
//iTest = cActivePlayer.Column - iValue
//
//If iTest > 0 Then
// interceptorColumnOffset = 1
//ElseIf iTest < 0 Then
// interceptorColumnOffset = -1
//Else
// interceptorColumnOffset = 0
//End If
//
//End Function
}
//
bool CheckInterceptorsAlive{
bool CheckInterceptorsAlive(){
//Function CheckInterceptorsAlive() As Boolean
//Dim cNowinterceptor As cInterceptor
cIneterceptor cNowInterceptor;
//
//For Each cNowinterceptor In interceptorCollection
for(do something here)left off here
for (size_t i = 0; i < myVector.size(); ++i)
for (int i = 0; i < interceptorCollection.count,++i)//left off here
{
cNowInterceptor = interceptorCollection[i];
// If cNowinterceptor.Alive Then
// CheckInterceptorsAlive = True
// Exit For
if (cNowInterceptor.Alive) {
// CheckInterceptorsAlive = True
return true;
// Exit For
break;
}
// Else
// CheckInterceptorsAlive = False
// End If
else
{
// CheckInterceptorsAlive = False
return false;
// End If
}
//Next cNowinterceptor
//
}
//End Function
}
11 changes: 11 additions & 0 deletions CPP/High_Voltage/mFunctions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

#ifndef mFunctions_H
#define mFunctions_H
int offsetRowBy(int iValue);
int offsetColumnBy(int iValue);
int interceptorRowOffset(int iValue);
int interceptorColumnOffset(Int iValue);
bool CheckInterceptorsAlive();
#endif

0 comments on commit 0f6ab91

Please sign in to comment.