#include <stdio.h>
#include <iostream>
#include <string>


#define MAX_EXITS_NUM 5
#define MAX_EXITS_NPC 10


template<int N>
std::string operator+(const std::string &first, const std::string (&second)[N]) {
    std::string result = first;
    for (auto iter = std::begin(second); iter != std::end(second); ++iter) {
        result += *iter;
    }
    
    return result;
}
 
 
class location {
public:
    std::string name;
    
    std::string desc;
     
    int num_of_exits;
    
    std::string exits[MAX_EXITS_NUM];
    
    int num_of_NPC;
    
    std::string NPCs[MAX_EXITS_NPC];
    
    
    location () {};
    
    ~location () {};
    
    location load_location(std::string) ;
    
    std::string format_text_to_output();
};


int main () {
	std::cout <<"Hello world\n";
 
	//make new location
	location asd;
	asd = asd.load_location("main");
	std:: cout << asd.format_text_to_output();
 
	return 0;
}
 
location location::load_location(std::string new_loc_name) {
 
	//asking SDL to load file with location description
	//?
	//searching in file for new_loc_name string
	//?
	//parcing part of file from new_loc_name
	//somehow getting data from file
	int num_of_exits = 3;
	std::string exits [num_of_exits] = {"first exit\n", "second exit\n", "third exit\n"};
	int num_of_NPC = 1;
	std::string NPCs [num_of_NPC] = {"Gay_nigger\n"};
	location new_loc;
	new_loc.name = "Имя локацции " + new_loc_name;
	for (int i = 0; i < num_of_exits; i++) {
		new_loc.exits[i] = exits [i];
    }
    
	new_loc.num_of_exits = num_of_exits;
	new_loc.num_of_NPC = num_of_NPC;
	for (int i = 0; i < num_of_NPC; i++) {
        new_loc.NPCs[i] = NPCs[i];
    }
    
	new_loc.desc = "Большое и длинное описание локации\n";
 
	return new_loc;
}
 
std::string location::format_text_to_output() {
	std::string output;
	output = name +"\n\n" + desc + "possible exits\n\n" + exits + "\nNPC\n\n" + this->NPCs;
	return output;
}