Commit e079c3de authored by Robert Scott James's avatar Robert Scott James

CRASHES X for some reason going to debug

 Changes to be committed:
	modified:   ../src/entity/vision/alive/hero/basicSolverHero.cpp
	modified:   ../src/entity/vision/vision.cpp
	modified:   ../src/game/game.cpp
parent 6f43a5fe
......@@ -5,7 +5,7 @@
#include "hero.h"
BasicSolverHero::BasicSolverHero(Dungeon &_dungeon,int _x,int _y,int _viewDistance) : Hero(_dungeon,_x,_y,_viewDistance){
std::cerr << &_dungeon << std::endl;
//std::cerr << &_dungeon << std::endl;
std::stack<std::tuple<int,int>> trail;
findSolution();
}
......@@ -26,7 +26,7 @@ void BasicSolverHero::findSolution(){
int doY = std::get<1>(pos);
int doN = tiles[doX*height+doY]+1;
std::cerr << doX << "," << doY << "," << doN << std::endl;
//std::cerr << doX << "," << doY << "," << doN << std::endl;
if(dungeon.getTile(doX,doY) == STAIRS_DOWN){
trail.push(std::make_tuple(doX,doY));
......
......@@ -172,13 +172,18 @@ void Vision::drawLevel(Display*& dpy,Window& w,GC& gc,int scale){
void Vision::drawTiles(Display *& dpy, Window &w, GC &gc,int scale, unsigned char **tiles){
Colormap colormap;
colormap = DefaultColormap(dpy, 0);
const int VIEW_DIAM = viewDistance * 2 + 1;
const int VIEW_DIAM = (viewDistance * 2) + 1;
for(int sx=0;sx<VIEW_DIAM;sx++){
for(int sy=0;sy<VIEW_DIAM;sy++){
int mapX = (x+sx-viewDistance);
int mapY = (y+sy-viewDistance);
unsigned char *tData = tiles[fov[ mapY*dungeon.getWidth() + mapX ]];
for(int sx=0; sx < VIEW_DIAM; sx++){
for(int sy=0; sy < VIEW_DIAM; sy++){
int mapX = ( x + sx - viewDistance);
int mapY = ( y + sy - viewDistance);
if(mapX < 0 || mapY < 0 || mapX >= dungeon.getWidth() || mapY >= dungeon.getHeight() ){
continue;
}
std::cerr << "(" << x << "," << y << ")" << " - " << "(" << mapX << "," << mapY << ")" << " - " << fov[ mapY * dungeon.getWidth() + mapX ] << std::endl;
unsigned char *tData = tiles[ fov[ mapY * dungeon.getWidth() + mapX ]];
XCreatePixmapFromBitmapData(dpy, w, (char*) tData, 32, 32, 0, 0, 32);
}
}
......
......@@ -67,7 +67,7 @@ void Game::loop(){
// Create hero at coordinates of the dungeon start
std::tuple<int,int> heroStart = levels.back()->upStairPosition();
std::cerr << std::get<0>(heroStart) << ","<< std::get<0>(heroStart) << std::endl;
//std::cerr << std::get<0>(heroStart) << ","<< std::get<0>(heroStart) << std::endl;
BasicSolverHero levelHero = BasicSolverHero( *levels.back() ,std::get<0>(heroStart), std::get<1>(heroStart),256 /*vision*/);
//Hero levelHero = Hero(levels.back(),std::get<0>(heroStart), std::get<1>(heroStart),20 /*vision*/);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment