Skip to content
This repository was archived by the owner on Jun 12, 2025. It is now read-only.

Commit 1fa9bf9

Browse files
author
Patrick Rye
committed
Update to v4.0.0-rc.1
Finally it seems to be working! (Sorta) Made all the class members that were private to public and this fixed everything! I don't understand why I needed to do this; but I'm ready to be done with v4.0.0 A few clean ups are in order as well as a few small bugs I need to iron out but for the most part its working
1 parent 8746789 commit 1fa9bf9

File tree

7 files changed

+44
-38
lines changed

7 files changed

+44
-38
lines changed

Source/entity.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void clsEntity::nextplayer(void) {
130130

131131
//Records the last player into the array of players, and logs directions to file if that is enabled.
132132
if (CnfgValues.blnLogging) {logFile = fopen(FileName,"a");} //Open log file in append mode.
133-
if (Global::blnDebugMode) {printf("Player finished with fitness: %2.3f\n",plyPlayer.fitness); getchar(); }
133+
if (Global::blnDebugMode) {printf("Player finished with fitness: %2.3f\n",plyPlayer.fitness); }
134134

135135
genPastPlayers[uchrPlayerNum].fitness = plyPlayer.fitness;
136136
if (CnfgValues.blnLogging) {fprintf(logFile,"Generation: %2d, Player: %2d, Fitness: %2.2f",uchrGenNum,uchrPlayerNum + 1,plyPlayer.fitness);}
@@ -313,7 +313,7 @@ void clsEntity::setMonster(uchar num, MNSTR MonsterSet) {
313313
}
314314
/**********************************************************************************************************************************************/
315315
PLYR clsEntity::getPlayer(void) {
316-
if(Global::blnDebugMode) {printf("Get Player's values, x = %d, y = %d, fitness = %3.2f, score = %d.\n",plyPlayer.location.x,plyPlayer.location.y,plyPlayer.fitness,plyPlayer.score);}
316+
//if(Global::blnDebugMode) {printf("Get Player's values, x = %d, y = %d, fitness = %3.2f, score = %d.\n",plyPlayer.location.x,plyPlayer.location.y,plyPlayer.fitness,plyPlayer.score);}
317317
return plyPlayer;
318318
}
319319
/**********************************************************************************************************************************************/

Source/entity.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,42 @@
66
#include <new>
77
/**********************************************************************************************************************************************/
88
class clsEntity {
9-
private :
9+
//private :
10+
public:
1011
//Functions
1112
float getFitness(void);
1213
void getBest(void);
1314
void nextplayer(void);
1415
void makeplayer(void);
15-
16+
1617
//Members
1718
uint uintStepNum;
1819
GEN genPastPlayers[DEFINED_PLAYERS_PER_GEN];
1920
GEN genBestPlayers[DEFINED_BEST_PLAYER_NUM];
2021
uint uintGenSteps;
2122
const char* FileName = DEFINED_LOG_FILE_NAME;
2223
FILE* logFile;
23-
24+
2425
PLYR plyPlayer;
2526
MNSTR *pmstMonsters;
26-
27-
public :
27+
28+
//public :
2829
//Default Constructor
2930
clsEntity();
3031
~clsEntity();
31-
32+
3233
//Members
3334
uchar uchrGenNum;
3435
uchar uchrPlayerNum;
35-
36+
3637
//Functions
3738
void start(void);
3839
void killMonster(uchar,uchar);
3940
void allocateMonsters(uchar);
40-
41+
4142
MNSTR getMonster(uchar);
4243
void setMonster(uchar, MNSTR);
43-
44+
4445
PLYR getPlayer(void);
4546
void setPlayer(LOC);
4647
};

Source/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
#include "map.h"
1010
#include "entity.h"
1111
#include "globals.h"
12+
/**********************************************************************************************************************************************/
13+
//General Todos
14+
// TODO (Patrick.Rye#1#): Move class values back to being non public
15+
// TODO (Patrick#1#): Fitness is messed up (all of the place then shoots up really high)
16+
// TODO (Patrick#1#): Fitness seems to be decreasing even when Hard Mode is off
17+
1218
/**********************************************************************************************************************************************/
1319
//Globals
1420
namespace Global {

Source/map.cpp

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,21 @@ void clsMap::restart(void) {
8181

8282
MNSTR tempMonster;
8383

84-
// if (pmstBaseMonsters != nullptr) {
85-
// for (uchar i = 0; i < numMonsters; i++) {
86-
//
87-
// /* TODO (Patrick.Rye#1#08/20/15): Figure out why program crashes when accessing basemonster 0 */
88-
// tempMonster.location.x = pmstBaseMonsters[i].location.x;
89-
// tempMonster.location.y = pmstBaseMonsters[i].location.y;
90-
// tempMonster.living = pmstBaseMonsters[i].living;
91-
// tempMonster.movingright = pmstBaseMonsters[i].movingright;
92-
//
93-
// Global::Enty.setMonster(i,tempMonster);
94-
//
95-
// if (Global::blnDebugMode) {printf("Finished Monster %d.\n",i);}
96-
// }
97-
// if (Global::blnDebugMode) {printf("Base monsters placed.\n");}
98-
// } else {if (Global::blnDebugMode) {printf("Base monsters equals nullptr.\n");}}
84+
if (pmstBaseMonsters != nullptr) {
85+
for (uchar i = 0; i < numMonsters; i++) {
86+
87+
/* TODO (Patrick.Rye#1#08/20/15): Figure out why program crashes when accessing basemonster 0 */
88+
tempMonster.location.x = pmstBaseMonsters[i].location.x;
89+
tempMonster.location.y = pmstBaseMonsters[i].location.y;
90+
tempMonster.living = pmstBaseMonsters[i].living;
91+
tempMonster.movingright = pmstBaseMonsters[i].movingright;
92+
93+
Global::Enty.setMonster(i,tempMonster);
94+
95+
if (Global::blnDebugMode) {printf("Finished Monster %d.\n",i);}
96+
}
97+
if (Global::blnDebugMode) {printf("Base monsters placed.\n");}
98+
} else {if (Global::blnDebugMode) {printf("Base monsters equals nullptr.\n");}}
9999

100100
Global::Enty.setPlayer(locBasePlayer);
101101

@@ -143,10 +143,8 @@ char clsMap::move(uchar direction) {
143143
PLYR tempPlayer;
144144
tempPlayer = Global::Enty.getPlayer();
145145

146-
if(Global::blnDebugMode) {printf("Temp Player's values, x = %d, y = %d, fitness = %3.2f, score = %d.\n",tempPlayer.location.x,tempPlayer.location.y,tempPlayer.fitness,tempPlayer.score); getchar();}
147-
148146
/* TODO (Patrick.Rye#5#): Get rid of this line when I solve the issue of location being really high */
149-
if (tempPlayer.location.x > DEFINED_MAP_WIDTH || tempPlayer.location.y > DEFINED_MAP_HEIGHT) {tempPlayer.location.x = 5; tempPlayer.location.y = 11;}
147+
//if (tempPlayer.location.x > DEFINED_MAP_WIDTH || tempPlayer.location.y > DEFINED_MAP_HEIGHT) {tempPlayer.location.x = 5; tempPlayer.location.y = 11;}
150148

151149

152150
tempx = tempPlayer.location.x;

Source/map.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ enum tile {
1818
};
1919
/**********************************************************************************************************************************************/
2020
class clsMap {
21-
private:
21+
public:
22+
//private:
2223
//Members
2324
const uchar basemap[DEFINED_MAP_HEIGHT][DEFINED_MAP_WIDTH] = {{1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
2425
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
@@ -39,7 +40,7 @@ class clsMap {
3940
LOC locBasePlayer; //The base player, which just holds the x and y values where they start.
4041
MNSTR *pmstBaseMonsters;//the monsters on the map while restarting (see load if this is confusing)
4142

42-
public:
43+
//public:
4344
//Default Constructor
4445
clsMap();
4546
~clsMap();

Source/tick.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
#include <cmath>
77
/**********************************************************************************************************************************************/
88
class clsTick {
9-
private:
9+
public:
10+
//private:
1011
//Members
1112
uchar uchrFPS;
1213
ulong ulngSleepTime;
1314
uint uClock;
1415

15-
public:
16+
//public:
1617
//Default Constructor
1718
clsTick();
1819
~clsTick();

Source/version.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@
1818

1919
//Miscellaneous Version Types
2020
//Don't forget to increment the build number before each build
21-
#define DEFINED_VER_RC_FILEVERSION 4,0,0,136
22-
#define DEFINED_VER_RC_FILEVERSION_STRING "4, 0, 0, 136\0"
23-
#define DEFINED_VER_FULLVERSION_STRING "4.0.0-beta.12"
21+
#define DEFINED_VER_RC_FILEVERSION 4,0,0,140
22+
#define DEFINED_VER_RC_FILEVERSION_STRING "4, 0, 0, 140\0"
23+
#define DEFINED_VER_FULLVERSION_STRING "4.0.0-rc.1"
2424

2525
//If this is not commented out then the build is meant to be a private build
2626
//as such it will be in debug mode.
2727
#define DEFINED_BUILD_MODE_PRIVATE
2828

2929
//Software Status
30-
#define DEFINED_VER_STATUS "Beta"
31-
#define DEFINED_VER_STATUS_SHORT "b"
30+
#define DEFINED_VER_STATUS "rc"
3231

3332

3433
#endif //__VERSION_HEADER__

0 commit comments

Comments
 (0)