Thanks for the feedback. I've checked through my code again, and all I'm not missing, nor do I have extra, semicolons.
@codekiddy: First error is :
1 2 3 4
|
list.h(28): error C2143: syntax error : missing ';' before '*'
list.h(28): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
list.h(28): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
list.h(28): warning C4183: 'get_char': missing return type; assumed to be a member function returning 'int'
|
Referring to get_char. It also gives the same errors for the me pointer. And, as I've said before, this is in code I haven't changed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
class monster_node
{
public:
monster_node();
Character * get_char();
monster_node * get_prev();
monster_node * get_next();
void set_next( monster_node * ptr_next );
void set_prev( monster_node * ptr_prev );
void create();
void remove();
void set( int ID, int X, int Y );
private:
Character * me;
monster_node * prev;
monster_node * next;
};
|
The only headers I'm using are ones that I've written, SDL.h, SDL_image.h, string, cstdlib, time.h, and fstream. Except for the ones I've written, which I've checked and look right, I've been using these libraries since before the last working compile.
@dadabe: Character is defined, the compiler has never had a problem with the class before, and it was one of the first classes I put in.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
header:
#ifndef CHARACTER_H
#define CHARACTER_H
#include "SDL.h"
#include "init.h"
#include "Map.h"
#include "list.h"
#include <string>
#include <fstream>
#include <cstdlib>
class Character
{
public:
Character();
void set_Up(int set_x, int set_y, int set_ID );
int get_Color() { return color; }
int get_BGcolor() { return bg_color; }
char get_Tile() { return tile; }
int get_X() { return location.X; }
int get_Y() { return location.Y; }
void move( int delt_X, int delt_y );
void save( std::ofstream &file );
void load( std::ifstream &file );
int process_Turn();
coord path_request();
private:
int color, bg_color, creatureID;
coord location, destination;
char tile;
void set_attrib();
};
#endif
and source:
#include "character.h"
Character::Character()
{
}
void Character::set_Up( int set_x, int set_y, int set_ID )
{
location.X = set_x;
location.Y = set_y;
creatureID = set_ID;
set_attrib();
}
void Character::move( int delt_X, int delt_Y )
{
location.X += delt_X;
location.Y += delt_Y;
}
void Character::set_attrib()
{
switch ( creatureID )
{
case PC_ID:
color = PC_COLOR;
bg_color = PC_BG;
tile = PC_TILE;
break;
case GOB_ID:
color = GOB_COLOR;
bg_color = GOB_BG;
tile = GOB_TILE;
break;
case DOG_ID:
color = DOG_COLOR;
bg_color = DOG_BG;
tile = DOG_TILE;
break;
}
}
void Character::save( std::ofstream &file )
{
file << location.X << " " << location.Y << " " << creatureID << " ";
}
void Character::load( std::ifstream &file )
{
file >> location.X;
file >> location.Y;
file >> creatureID;
set_attrib();
}
coord Character::path_request()
{
if( location == destination)
{
coord newdest;
newdest.X = rand() % ( WORLD_X - 1 );
newdest.Y = rand() % ( WORLD_Y - 1 );
destination = newdest;
return newdest;
}
return destination;
}
int Character::process_Turn()
{
//Poll current state
//Decide what to do
if( creatureID != PC_ID ) //PCs don't have to plan turns
{
/*if( !move_plan.move_again() )
return MON_PATH;
return MON_MOVE;*/
}
return MON_NOTHING;
}
|
@iHutch105: A terminator? What do you mean? All the references I see when I google terminator c++ are to using NULL to end strings and arrays. If I add class to the search I just get information about some Terminator class someone wrote.