Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include <unistd.h>
#include <cstring>
#include <iostream>
#include <ncurses.h>
#include <libgrandmaze/colour.hpp>
#include <libgrandmaze/mapfile.hpp>
#include "main.hpp"
int initialise(void)
{
int error = setCwd();
if (error)
{
return error;
}
initHub();
initscr();
cbreak();
noecho();
start_color();
curs_set(0);
keypad(stdscr, true);
GrandMaze::initColour();
return 0;
}
int initHub(void)
{
GrandMaze::FileMapReader r;
CurrentMap = r.load(Cwd + "/maps/final_map.map");
return 0;
}
int setCwd(void)
{
// set the current working directory
char *tmp = new char[1024];
if (getcwd(tmp, 1024) == NULL)
{
return errno;
}
Cwd = tmp;
delete tmp;
return 0;
}
int main(int argc, char *argv[])
{
int error = initialise();
if (error)
{
std::cerr << "An error occurred: " << strerror(error) << std::endl;
return error;
}
CurrentMap->draw(stdscr);
getch();
endwin();
delete CurrentMap;
return 0;
}