proszę bardzo
plik Word.h
tutaj twierdzi że nie może dołączyć <vector> ani <string>
Cannot find include file <vector>
#include "Cell.h"
#include <string>
#include <vector>
using namespace std;
class Word {
public:
Word();
//Word(const Word& orig);
//virtual ~Word();
void put( Cell a);
int getP();
string getW();
void clr();
private:
vector<Cell> CWord;
};
plik Word.cpp
tutak natomiast przy każdym polu, metodzie, funkcji vectora
wywala komunikat w stylu
Unable to resolve identifier clear
#include "Word.h"
#include "Alphabet.h"
using namespace std;
Word::Word() {
CWord.clear();
}
void Word::put( Cell a){
CWord.push_back( a);
}
int Word::getP(){
int i;
int bonusW=1;
int size=CWord.size();
int points=0;
CWord.pop_back();
for( i=0; i<=size; i++){
if( CWord[i].bonusWord != 1) bonusW=CWord[i].bonusWord;
points=points+( CWord[i].bonusLetter*CWord[i].point);
}
points=points*CWord[i].bonusWord;
return points;
}
string Word::getW(){
int i;
int size=CWord.size();
string w;
CWord.pop_back();
for( i=0; i<=size; i++){
w=w+CWord[i].letter;
}
return w;
}
void Word::clr(){
CWord.clear();
}
i dla jasności klasa Cell
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <stdio.h>
class Cell {
public:
Cell();
//Cell(const Cell &orig);
//virtual ~Cell();
//void put(int x, int y, char Z);
//char get(int x, int y);
SDL_Surface *gfx;
int x;
int y;
char letter;
int point;
int bonusLetter;
int bonusWord;
int number;
bool state;
};
jeszcze fragment main'a który odpowiada za składanie słowa
if ( event.key.keysym.sym == SDLK_RETURN ){
//skladanie slowa
words.clr();
for ( j=0; j<=14; j++ ){
for ( i=0; i<=14; i++ ){
if ( plansza.getL(i,j) != tempBoard.getL(i,j)){
words.put( plansza.get(i,j));
}
}
}
generalnie push_back() działa, jednak pop_back() i clear() nie chcą
tak dla ścisłości to maja być docelowo scrabble :)
zapomniałem maina ;p