Skip to content
Snippets Groups Projects
Commit 5e915281 authored by Ian Prins's avatar Ian Prins
Browse files
parents 1d1c89e6 4bc8ca75
No related branches found
No related tags found
No related merge requests found
# Lab 3 files
*.aux
# Compiled files
*.exe
*.o
# Editor files
*.swp
# General
*.tmp
\ No newline at end of file
File added
#ifndef COORD_H
#define COORD_H
class Coord {
public:
int& operator[](int);
Coord operator+(Coord, Coord);
Coord operator-(Coord, Coord);
Coord operator+(Coord);
Coord operator-(Coord);
private:
int x, int y;
}
int x;
int y;
};
#endif
#include "coord.h"
#include <string>
#ifndef ITEM_H
#define ITEM_H
class Item {
public:
static const enum Location {OnGround, InPack};
static const enum Identified {Known, Unknown};
enum Location {OnGround, InPack};
enum Identified {Known, Unknown};
Coord getCoord();
std::string getName();
Location getLocation();
......@@ -14,4 +18,6 @@ class Item {
std::string name;
Location location;
Identified knowledge;
}
};
#endif
#include "item.h"
#include <vector>
#ifndef ITEMZONE_H
#define ITEMZONE_H
class ItemZone {
public:
Item operator[](int);
......@@ -8,5 +11,6 @@ class ItemZone {
void add(Item);
private:
std::vector<Item> contents;
}
};
#endif
......@@ -2,6 +2,9 @@
#include "coord.h"
#include "itemzone.h"
#ifndef PLAYERCHAR_H
#define PLAYERCHAR_H
class PlayerChar {
public:
int getStrength();
......@@ -22,4 +25,6 @@ class PlayerChar {
Coord coord;
ItemZone backpack;
int level;
}
};
#endif
#include <random>
#ifndef RANDOM_H
#define RANDOM_H
class Generator {
public:
Generator();
......@@ -7,3 +10,5 @@ class Generator {
private:
std::mt19937 gen;
}
#endif
#ifndef TERRAIN_H
#define TERRAIN_H
class Terrain {
public:
static enum Passability {Blocked, Passable};
......@@ -10,3 +15,5 @@ class Terrain {
Visibility visible;
Passability passable;
}
#endif
......@@ -15,7 +15,7 @@ void putString(int x, int y, std::string text) {
/**
* Execution starts here
*/
int main() {
int main(int argv, char** args) {
std::cout << "Welcome to Rogue Reborn!" << std::endl;
TCODConsole::setCustomFont("assets/terminal-large.png");
......
#include <string>
#include <iostream>
#include <vector>
#include "include/playerchar.h"
#include "include/coord.h"
int PlayerChar::getHP() {
return HP;
}
int PlayerChar::getMaxHP() {
return maxHP;
}
int PlayerChar::getArmor() {
return armor;
}
int PlayerChar::getStrength() {
return strength;
}
int PlayerChar::getGold() {
return gold;
}
std::string PlayerChar::getName() {
return name;
}
Coord PlayerChar::getCoord() {
return coord;
}
int PlayerChar::getLevel() {
return level;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment