SOURCE CODE


FILE world.h //03/21/2023
#define ELEMENTS 70
class world
{
public:
int map[ELEMENTS][ELEMENTS];
    world();
    ~world();
void print_x_y();
world& world_generate(int southsizeseed1, int westsizeseed2,int northsizeseed3, int Eastsizeseed4,int seed1a,int seed1b,int seed2a,int seed2b,int seed3a,int seed3b,int seed4a,int seed4b);
};


FILE world.cpp // 03/21/2023
#include "world.h"
#include < malloc.h >
#include < math.h >
#include < stdio.h >
#include < stdlib.h >
#include < stdarg.h >
#include < ctime >
#include < iostream >
#include < unistd.h >
#include < random >
using namespace std;
//LINKED MENU3
int num10;
int ghost_one=0;
world::world() {
map[ELEMENTS][ELEMENTS];
}
world& world::world_generate(int southsizeseed1, int westsizeseed2, int northsizeseed3, int eastsizeseed4, int seed1a, int seed1b, int seed2a, int seed2b, int seed3a, int seed3b, int seed4a, int seed4b){
//MAP MATRIX
   int x,y;
   srand(time(NULL));
for (int x=0; x    for (int y=0; y     map[x][y]=30;}}
// MAP MATRIX END
// procedural var
int rando, xx, yy, P=1;
static int ya, xa;
bool dex, six, down, up;
map[x=35][y=35]=num10;
num10=20;
xx=x;
yy=y;
xa=x;
ya=y;
int r, base3=0;
int n=1;//this increases by 1 each time
int h=3;// this increase by h+2 each time
int j=2;
int vb=20; // for bottom left, start vortex
int count=0;// for no check first element
int contatore;
printf("procedurale 100\n");
map[35][36]=num10;
for (y; y>yy-35; y-- ){x=xx; printf("procedurale 10x\n");;
   for (x=xx-P; x<=xx+P; x++){ printf("procedurale 10y\n");
   if (y==yy){map[x][y]=num10; continue;}
   if (y==yy-n){base3++; //count for trigger other 3 cicle for// this back 0 each time
   if (n==1){
    r=rand()%100;
    if(r>southsizeseed1){ map[x][y]=num10+1;}else{map[x][y]=num10;}}
   if(n>1){
   count++;
   int v; v=map[x][y+1];// map check
   r=rand()%100; if(r>southsizeseed1){if(v>=(num10+30))goto vortex; map[x][y]=v+1;}else{map[x][y]=v;}// check and horizontal creation
   if(count==1){ vb=map[x+1][y+1]; if(r>southsizeseed1){ map[x][y]=vb+1; continue; }else map[x][y]=vb; continue;}// tilted check and value setting
int vy;
   vy=map[x-1][y];
int vyv; vyv=v-vy;
   //blur parameters
   if (vyv>seed1a){ map[x][y]=v-1; }
   if (vyv>seed1b){ map[x][y]=v-1; }
   if (vyv<-seed1a){ map[x][y]=v+1; }
   if (vyv<-seed1b){ map[x][y]=v+1; }
  }
vortex:
   if (base3==h){// end cycle square base
/////////////////////////////////////////////////////////////////////////////////////////////
   contatore=0; //count for no check first vertical element
   // y right ascendant vortex
   for (int a=y; a<=y+j; a++){
    int v; v=map[x-1][a];//check map
   contatore++;
   r=rand()%100; if(r>westsizeseed2){ if(v>=(num10+30))continue; map[x][a]=v+1;}else{map[x][a]=v;}// check and vertical creation
   // equalizer vertical
   if(contatore==1)continue;
int vy;
   vy=map[x][a-1];
int vyv; vyv=v-vy;
  //blur parameters
   if (vyv>seed2a){ map[x][a]=v-1; }
   if (vyv>seed2b){ map[x][a]=v-1; }
   if (vyv<-seed2a){ map[x][a]=v+1; }
   if (vyv<-seed2b){ map[x][a]=v+1; }
   }//end ascendant vortex
////////////////////////////////////////////////////////////////////////////////
     contatore=0;
   // leftward vortex
   for (int a=x; a>=x-j; a--){
     contatore++;
   int v; v=map[a][y+j-1];// map check
   r=rand()%100; if(r>northsizeseed3){if(v>=(num10+30))continue; map[a][y+j]=v+1;}else{map[a][y+j]=v;}// check and horizontali creation
   if(contatore==1)continue;
int vy;
   vy=map[a+1][y+j];
int vyv; vyv=v-vy;
   //blur parameters
    if (vyv>seed3a){ map[a][y+j]=v-1; }
    if (vyv>seed3b){ map[a][y+j]=v-1; }
    if (vyv<-seed3a){ map[a][y+j]=v+1;}
    if (vyv<-seed3b){ map[a][y+j]=v+1;}
    }//end leftward vortex
    contatore=0;
////////////////////////////////////////////////////////////////////////////////
//
    // left vortex descending
    for (int a=y+j; a>=y; a--){
   contatore++;
    int v; v=map[x-j+1][a];// map check
    r=rand()%100; if(r>eastsizeseed4){if(v>=(num10+30))continue; map[x-j][a]=v+1;}else{map[x-j][a]=v;}// check and vertical creation
    if(contatore==1)continue;
int vy;
   vy=map[x-j][a+1];
int vyv; vyv=v-vy;
   // blur parameters
   if (vyv>seed4a){ map[x-j][a]=v-1;}
   if (vyv>seed4b){ map[x-j][a]=v-1;}
   if(vyv<-seed4a){ map[x-j][a]=v+1;}
   if(vyv<-seed4b){ map[x-j][a]=v+1;}
   }//end down vortex
contatore=0;
  /// parameters for procedural vortex
  base3=0;
  n++;
  h=h+2;
  j=j+2;
  }}
/////////////////////////
}// fine for x
count=0;
P=P+1;
printf("end cycle X\n");
}// fine for y
printf("matrix cells value 1-------------------------------------------------------------------------------");
for (int x=0; x    for (int y=0; y     if (map[x][y]>29||map[x][y]<20)map[x][y]=1;// delete all matrix value ( setting value 1)
   }}
printf("matrix edge cells value 1-------------------------------------------------------------------------------");
for (int x=0; x    for (int y=0; y<1; y++){
    map[x][y]=1;// delete all matrix rim value ( setting value 1)
  }}
printf("matrix edge cells value 1-------------------------------------------------------------------------------");
for (int y=0; y    for (int x=0; x<1; x++){
    map[x][y]=1;// delete all matrix rim value ( setting value 1)
  }}
printf("matrix edge cells value 1-------------------------------------------------------------------------------");
for (int y=0; y    for (int x=69; x>68; x--){
    map[x][y]=1;// delete all matrix rim value ( setting value 1)
  }}
printf("matrix edge cells value 1-------------------------------------------------------------------------------");
for (int x=0; y    for (int y=69; y>68; y--){
    map[x][y]=1;// delete all matrix rim value ( setting value 1)
  }}
printf("check matrix cells vertical--------------------------------");
for (int x=0; x    for (int y=0; y    if (map[x][y]>=20 && map[x][y+1]==1 && map[x][y-1]==1)map[x][y]=1;// to cut the horizontal long branches
  }}
printf("check matrix cells vertical--------------------------------");
for (int y=0; y   for (int x=0; x    if (map[x][y]>=20 && map[x+1][y]==1 && map[x-1][y]==1)map[x][y]=1;// to cut the vertical long branches
}}
fine:
return *this;
}
//PRINT MAP'S ELEMENTS VALUE
void world::print_x_y(){
int x,y;
   for (x=0;x     for(y=0;y    printf("valore di map %i X-%i Y-%i\n",map[x][y],x,y);
  }
}}








FILE menu3.h
#include "SFML/Graphics.hpp"
#include "SFML/Network.hpp"
#define MAX_N 4
class menu3
{
public:
        menu3(float base, float altezza);
       void disegna_menu3(sf::RenderWindow &finestra);
       void Moveup();
       void Movedown();
       void Moveright();
       void Moveleft();
    sf::Font carattere1, carattere2, carattere3;
    sf::Text testo[MAX_N];
            int ritorna_contatore_menu3();
            int get_count1();
            int get_count2();
            void menu3a(float x, float y);
private:
int contatore=0;
int count1=35;
int count2=35;


};
FILE menu3.cpp
#include "menu3.h"
#include "world.h"
#include "SFML/Graphics.hpp"
sf::RectangleShape world_zone[ELEMENTS][ELEMENTS];//(sf::Vector2f(10.0,10.0));
extern world sic_mundus_creatus_est;
sf::Color grey(55,55,55,255);
sf::Color dark_green(50,120,30);
sf::Color rosso1(255,28,0), rosso2(255,56,0),rosso3(255,85,0),rosso4(255,113,0),rosso5(255,141,0),rosso6(255,170,0),
rosso7(255,198,0),rosso8(255,226,0),rosso9(255,255,0); double x_vector=10.0, y_vector=10.0;
int x_position=300, y_position=690, x_ghost=0, y_ghost=0;
menu3::menu3(float base, float altezza) {
if (!carattere1.loadFromFile("font/Fipp.ttf") || !carattere2.loadFromFile("font/Pixeled.ttf") ||
!carattere3.loadFromFile("font/arcade.ttf")) {
printf("errore font non trovato");
}
// COSTRUTTO GRAFICA MAPPA
// CITTÀ DIAMETRO 70
//PRIMA RIGA - 24 PER PARTE
for (int x=0; x for (int y=0; y printf("ciclo numero %i\n",x);
world_zone[x][y].setSize(sf::Vector2f(x_vector,y_vector));
if (sic_mundus_creatus_est.map[x][y]==1){ world_zone[x][y].setFillColor(dark_green);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]>=10 && sic_mundus_creatus_est.map[x][y]<20){ world_zone[x][y].setFillColor(grey);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==20){ world_zone[x][y].setFillColor(sf::Color::Red);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==21){ world_zone[x][y].setFillColor(rosso1);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==22){ world_zone[x][y].setFillColor(rosso2);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==23){ world_zone[x][y].setFillColor(rosso3);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==24){ world_zone[x][y].setFillColor(rosso4);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==25){ world_zone[x][y].setFillColor(rosso5);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==26){ world_zone[x][y].setFillColor(rosso6);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==27){ world_zone[x][y].setFillColor(rosso7);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==28){ world_zone[x][y].setFillColor(rosso8);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]==29){ world_zone[x][y].setFillColor(rosso9);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]>=30 && sic_mundus_creatus_est.map[x][y]<31)
{ world_zone[x][y].setFillColor(dark_green);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]>=31 && sic_mundus_creatus_est.map[x][y]<35)
{ world_zone[x][y].setFillColor(sf::Color::Green);goto sotto;}
if (sic_mundus_creatus_est.map[x][y]>=70 && sic_mundus_creatus_est.map[x][y]<80)
{ world_zone[x][y].setFillColor(sf::Color::Magenta);goto
sotto;}
if (sic_mundus_creatus_est.map[x][y]>=90 && sic_mundus_creatus_est.map[x][y]<100)
{ world_zone[x][y].setFillColor(sf::Color::Cyan);goto
sotto;}
else world_zone[x][y].setFillColor(grey);
sotto:
world_zone[x][y].setPosition(x_position+(x*x_vector), y_position-(y*y_vector));
}//fine for y
printf("fine ciclo y");
}// fine for x
printf("fine ciclo x");
}// End
void menu3::disegna_menu3(sf::RenderWindow &finestra) {
for(int x=0; x for(int y=0; y finestra.draw(world_zone[x][y]);
}
}
};
// double x_vector=10.0, y_vector=10.0;
float thick=2.0;
//int x_position=300, y_position=690, x_ghost, y_ghost;
// int count1;
void menu3::Moveup() {
if (count2 + 1 < ELEMENTS) {
count2++;
world_zone[count1][count2].setSize(sf::Vector2f(x_vector-thick*2,y_vector-thick*2));
world_zone[count1][count2].setPosition(x_position+(count1*x_vector)+(thick), y_position-(count2*y_vector)+(thick));
world_zone[count1][count2].setOutlineColor(sf::Color::Blue);
world_zone[count1][count2].setOutlineThickness(thick);
// sf::Vector2f pos=world_zone[count1][count2].getPosition(); //cut off offset
world_zone[count1][count2-1].setOutlineThickness(0.0);
world_zone[count1][count2-1].setSize(sf::Vector2f(x_vector,y_vector));
// world_zone[count1][count2-1].setPosition(pos.x-thick,pos.y+thick*2); // cut the offset
world_zone[count1][count2-1].setPosition(x_position+(count1*x_vector),y_position-((count2-1)*y_vector));
}
}
void menu3::Movedown() {
if (count2 - 1 >= 0 ) {
count2--;
world_zone[count1][count2].setSize(sf::Vector2f(x_vector-thick*2,y_vector-thick*2));
world_zone[count1][count2].setPosition(x_position+(count1*x_vector)+(thick), y_position-(count2*y_vector)+(thick));
world_zone[count1][count2].setOutlineColor(sf::Color::Blue);
world_zone[count1][count2].setOutlineThickness(thick);
// sf::Vector2f pos=world_zone[count1][count2+1].getPosition();
world_zone[count1][count2+1].setOutlineThickness(0.0);
world_zone[count1][count2+1].setSize(sf::Vector2f(x_vector,y_vector));
world_zone[count1][count2+1].setPosition(x_position+(count1*x_vector),y_position-((count2+1)*y_vector));
}
}
void menu3::Moveright() {
if (count1 + 1 count1++;
world_zone[count1][count2].setSize(sf::Vector2f(x_vector-thick*2,y_vector-thick*2));
world_zone[count1][count2].setPosition(x_position+(count1*x_vector)+(thick), y_position-(count2*y_vector)+(thick));
world_zone[count1][count2].setOutlineColor(sf::Color::Blue);
world_zone[count1][count2].setOutlineThickness(thick);
// sf::Vector2f posD=world_zone[count1-1][count2].getPosition();
world_zone[count1-1][count2].setOutlineThickness(0.0);
world_zone[count1-1][count2].setSize(sf::Vector2f(x_vector,y_vector));
world_zone[count1-1][count2].setPosition(x_position+((count1-1)*x_vector),y_position-(count2*y_vector));
}
}
void menu3::Moveleft() {
if (count1 - 1 >= 0 ) {
count1--;
world_zone[count1][count2].setSize(sf::Vector2f(x_vector-thick*2,y_vector-thick*2));
world_zone[count1][count2].setPosition(x_position+(count1*x_vector)+(thick), y_position-(count2*y_vector)+(thick));
world_zone[count1][count2].setOutlineColor(sf::Color::Blue);
world_zone[count1][count2].setOutlineThickness(thick);
// sf::Vector2f posD=world_zone[count1+1][count2].getPosition();
world_zone[count1+1][count2].setOutlineThickness(0.0);
world_zone[count1+1][count2].setSize(sf::Vector2f(x_vector,y_vector));
world_zone[count1+1][count2].setPosition(x_position+((count1+1)*x_vector),y_position-(count2*y_vector));
}
}
int menu3::get_count1(){
return count1;
}
int menu3::get_count2(){
return count2;
}
void menu3::menu3a(float x, float y){
}
int menu3::ritorna_contatore_menu3() {
return contatore;
}




//#define ELEMENTS 70 #include "var.h" #ifndef MAP_SECTOR_H #define MAP_SECTOR_H //extern int n_apartments; //#include "var.h" class map_sector { public: int map_sectors[TEMP_ELEMENTS][TEMP_ELEMENTS][MAP_SECTOR_ELEMENTS+1][MAP_SECTOR_ELEMENTS+1]; // int map_sectors[80][80][80][80]; map_sector(); // ~map_sector(); map_sector& map_sectors_generate(); void to_search_house_zone(); void record_coordinates_zone_house(); }; #endif



#include "map_sector.h" #include "world.h" #include #include #include #include #include #include #include #include #include //#include //#include //#include //#include //#include //#include "var.h" using namespace std; //LINKED MENU_MAP_SECTOR.cpp //extern world sic_mundus_creatus_est; home_entity *apartments; vector V_home_entity; int n_apartments; map_sector::map_sector() { map_sectors[TEMP_ELEMENTS][TEMP_ELEMENTS][MAP_SECTOR_ELEMENTS+1][MAP_SECTOR_ELEMENTS+1]; //map_sectors[80][80][80][80]; } map_sector& map_sector::map_sectors_generate(){ //MAP_SECTOR MATRIX // int x,y; srand(time(NULL)); //map[x][y]; int support; int x_spectrum=1; int n_roads_vertical, n_roads_horizontal; int x_neighborhoods,y_neighborhoods; /* for (int x=0; x19){ if (x!=x_spectrum){n_roads_vertical=(rand()%3)+2;n_roads_horizontal=(rand()%3)+2;x_spectrum=x; //generate new random number each new sector x_neighborhoods=MAP_SECTOR_ELEMENTS/n_roads_vertical;y_neighborhoods=MAP_SECTOR_ELEMENTS/n_roads_horizontal;} //generate x and y neighborhoods printf("VERTICAL road|||||||\n"); for(int z=0; z19 printf("close if >19\n"); }}// close cycles x y printf("close cycles x y\n"); //int rand0, rand1, rand2, rand3; //rand0=rand()%2+3 int x_array[2],y_array[2]; int x_sector_below_left=150,y_sector_below_left=250,x_sector_top_right=250,y_sector_top_right=90; map_sectors[4][4][x_sector_below_left][y_sector_below_left]=99; // these numbers will have a random placement map_sectors[6][6][x_sector_top_right][y_sector_top_right]=99; // these numbers will have a random placement for(int x=0,y=0; ; y++,x++){ if(map_sectors[4][4][x_sector_below_left+x][y_sector_below_left+y]==3){x_array[0]=x_sector_below_left+x;y_array[0]=y_sector_below_left+y;break;} }//x for(int x=0,y=0; x<1000,y<1000; y--,x--){ if(map_sectors[6][6][x+x_sector_top_right][y+y_sector_top_right]==3){x_array[1]=x+x_sector_top_right;y_array[1]=y+y_sector_top_right;break;} }//y map_sectors[4][4][x_array[0]][y_array[0]]=1; // test map_sectors[6][6][x_array[1]][y_array[1]]=1; // test printf("array 0x value=%i\n array 0y value=%i\n",x_array[0],y_array[0]); printf("array 1x value=%i\n array 1y value=%i\n",x_array[1],y_array[1]); ///////////////////////////////////////////////////////////////////////// /* //inclined streets int ax,axx,by,byy; int x_spectrum_a, y_spectrum_a,x_spectrum_b,y_spectrum_b; int a=4,b=4, a_phantom, b_phantom, spectre_a, spectre_b; int a1=6,b1=6; bool end=true; static int n = 0, cont = 0, cont1 = 0, possesso = 1, x,y; double dist, seno, cosen, distp, incr = 0, incrY = 0, incrX = 0, prova; int new_x,new_y,new_x1,new_y1; new_x=0; new_y=0;// new_x1=(350-x_array[0])+(a1-a-1)*350+x_array[1]; new_y1=(350-y_array[0])+(b1-b-1)*350+y_array[1]; if (aa1){ new_x1=(350-x_array[1])+(a-a1-1)*350+x_array[0]; new_y1=(350-y_array[0])+(b1-b-1)*350+y_array[1];} do{ printf("N_VALUE= %i \n", n); //////// BOTTOM-LEFT TO TOP-RIGHT // MOVE X // ANGLE <45 ////////////////////////////////////////////////////////////// if (new_x1 > new_x && new_y1 > new_y) { /// check position n++;// if (incrY != 0) { goto skip1; }// skip the check and the calculate if (incrX != 0) { goto skip2; }// idem if(n==1){x_spectrum_a=x_array[0];y_spectrum_a=y_array[0];a_phantom=a; b_phantom=b;} x = new_x1 - new_x;// put out long int /////distance calculation y = new_y1 - new_y;//put out long int dist = sqrt(x * x + y * y); printf("dist x=%i dist y=%i",x,y); if (x > y) {//////// seno = y / dist; // cosen = x / dist; // distp = n / cosen; // incr = distp * seno; printf("seno=%f\n cos=%f\n distp=%f\n incr=%f\n", seno, cosen, distp, incr);// // skip1:// incrY = incr * n; printf("INCRy= %f \n", incrY); new_x++; new_y=(int)incrY; goto skip; }////////END BOTTOM-LEFT TO TOP-RIGHT // MOVE X // ANGLE <45 if (x == y) {///////// ANGLE 45 new_x++; new_y++; goto skip; }///////// END ANGLE 45 if (y > x) {////////ANGLE >45 MOVE Y: seno = x / dist; // cosen = y / dist; // distp = n / cosen; // incr = distp * seno; printf("seno=%f\n cos=%f\n distp=%f\n incr=%f\n", seno, cosen, distp, incr); skip2: incrX = incr * n; printf("INCRx= %f \n", incrX); new_y++;// //new_x=0; new_x=(int)incrX; goto skip; }////////END ANGLE >45 //MOVE Y //goto skip; }/////END ALL MOVE T BOTTOM-LEFT TO TOP-RIGHT //////// BOTTOM-RIGHT TO TOP-LEFT // MOVE X // ANGLE <45 ////////////////////////////////////////////////////////////// if (new_x1 < new_x && new_y1 > new_y) { /// check position n++;// if (incrY != 0) { goto skip3; }// skip the check and the calculate if (incrX != 0) { goto skip4; }// idem if(n==1){x_spectrum_a=x_array[0];y_spectrum_a=y_array[0];a_phantom=a; b_phantom=b;} x = new_x - new_x1;// put out long int /////distance calculation y = new_y1 - new_y;//put out long int dist = sqrt(x * x + y * y); printf("dist x=%i dist y=%i",x,y); if (x > y) {//////// seno = y / dist; // cosen = x / dist; // distp = n / cosen; // incr = distp * seno; printf("seno=%f\n cos=%f\n distp=%f\n incr=%f\n", seno, cosen, distp, incr);// // skip3:// incrY = incr * n; printf("INCRy= %f \n", incrY); new_x--; new_y=(int)incrY; goto skip; }////////END BOTTOM-RIGHT TO TOP-LEFT // MOVE X // ANGLE <45 if (x == y) {///////// ANGLE 45 new_x--; new_y++; goto skip; }///////// END ANGLE 45 if (y > x) {////////ANGLE >45 MOVE Y: seno = x / dist; // cosen = y / dist; // distp = n / cosen; // incr = distp * seno; printf("seno=%f\n cos=%f\n distp=%f\n incr=%f\n", seno, cosen, distp, incr); skip4: incrX = incr * n; printf("INCRx= %f \n", incrX); new_y++;// //new_x=0; new_x=-(int)incrX; goto skip; }////////END ANGLE >45 //MOVE Y //goto skip; }/////END ALL MOVE BOTTOM-RIGHT TO TOP-LEFT //inclined streed skip: printf("x_array 0= %i \n", new_x); printf("y_array 0= %i \n", new_y); //skip: if(a==a_phantom)x_array[0]=x_spectrum_a+new_x; if(b==b_phantom)y_array[0]=y_spectrum_a+new_y; if(a!=a_phantom){spectre_a=a-a_phantom-1;x_spectrum_b=350-x_spectrum_a;x_array[0]=new_x-x_spectrum_b-spectre_a*350;} if(b!=b_phantom){spectre_b=b-b_phantom-1;y_spectrum_b=350-y_spectrum_a;y_array[0]=new_y-y_spectrum_b-spectre_b*350;} //if (x_array[0]==349&&y_array[0]==349){a++;b++;} if (x_array[0]==349){a++;} if (y_array[0]==349){b++;} map_sectors[a][b][x_array[0]][y_array[0]]=3; map_sectors[a][b][x_array[0]][y_array[0]-1]=3; map_sectors[a][b][x_array[0]][y_array[0]-2]=3; map_sectors[a][b][x_array[0]][y_array[0]-3]=3; map_sectors[a][b][x_array[0]][y_array[0]-4]=3; if(a==a1 && b==b1 && x_array[0]==x_array[1])end=false; }while (end); */ return *this; } void map_sector::to_search_house_zone(){ printf("start"); //var final printf int px,py,pz,pw; int LIST=0; //int n_apartments; //home_entity *apartments; n_apartments=100; //extern var.h //// //save house apartments=(home_entity *)malloc(n_apartments*sizeof(home_entity)); //extern var.h /// // neighborhoods bool go=false; int vertex1[]={0,0}; int vertex2[]={0,0}; int vertex3[]={0,0}; int vertex4[]={0,0};// create vertex class for (int x=0; x<=TEMP_ELEMENTS; x++){ for (int y=0; y<=TEMP_ELEMENTS; y++){if (map_sectors[x][y][MAP_SECTOR_ELEMENTS][MAP_SECTOR_ELEMENTS]!=20)continue; for(int z=0; z<=MAP_SECTOR_ELEMENTS; z++){ for(int w=0; w<=MAP_SECTOR_ELEMENTS; w++){ //vertex1 bot left if (map_sectors[x][y][MAP_SECTOR_ELEMENTS][MAP_SECTOR_ELEMENTS]==20&& // red zone map_sectors[x][y][z][w]==2 && (map_sectors[x][y][z-1][w]==3||((z-1)<0)) && (map_sectors[x][y][z-1][w-1]==3 || ((w-1)<0)|| ((z-1)<0)) && (map_sectors[x][y][z][w-1]==3||((w-1)<0)) ){ go=true; vertex1[0]=z; vertex1[1]=w; map_sectors[x][y][z][w]=4; //house wall -vertical left for(int u=1;; u++ ){//printf("second vertex\n"); // vertex2 top left if( map_sectors[x][y][z][w+u]==3){//printf(" if second vertex\n"); vertex2[0]=z; vertex2[1]=(w+u-1); vertex4[1]=vertex2[1];// y vertex4 top right goto next; } map_sectors[x][y][z][w+u]=4;//house wall -vertical right }//second if //vertex2 //end //vertex3 bot right next: //printf("vertex third\n"); for (int k=1;; k++){ if (map_sectors[x][y][z+k][w]==3) {vertex3[0]=(z+k-1); vertex3[1]=w; vertex4[0]=vertex3[0]; //x vertex4 top right for(int wb=w;wb<=vertex4[1];wb++){map_sectors[x][y][z+k-1][wb]=4;} goto perimetral; } //printf("matrix value %i \n",map_sectors[x][y][z+k][w]=4); map_sectors[x][y][z+k][w]=4;//house wall -horizontal bot map_sectors[x][y][z+k][vertex2[1]]=4;//house wall -horizontal top }//next // if// end //end perimetral wall perimetral: //start internal perimetral parking courtyard //printf("perimetral\n"); int base,height,thickness,internal_base, internal_height; thickness=20; base=vertex3[0]-vertex1[0]; height=vertex2[1]-vertex1[1]; internal_base=base-(thickness*2); internal_height=height-(thickness*2); for(int b_temp=0; b_tempinternal_height)indicator=true; else indicator=false; if(indicator){n_height=height/thickness;height_new=n_height*thickness;height_difference=(height-height_new)/n_height; height_real=height_difference+thickness; printf("vertex1_x-%i y-%i vertex2_x-%i y-%i vertex3_x-%i y-%i vertex4_x-%i y-%i\n", vertex1[0],vertex1[1],vertex2[0],vertex2[1],vertex3[0],vertex3[1],vertex4[0],vertex4[1]); for(int h_temp=0;h_tempE_vertex1; //auto it =V_home_entity.begin(); home_entity_FILE<E_vertex1[0]<<"vertex 1 x"<E_vertex1[1]<<"vertex 1 y"<E_vertex2[0]<<"vertex 2 x"<E_vertex2[1]<<"vertex 2 y"<E_vertex3[0]<<"vertex 3 x"<E_vertex3[1]<<"vertex 3 y"<E_vertex4[0]<<"vertex 4 x"<E_vertex4[1]<<"vertex 4 y"<door_leaf1[0]<<" door1"<door_leaf1[1]<<" door1"<door_leaf2[0]<<" door2"<door_leaf2[1]<<" door2"<E_vertex1[0]][it->E_vertex1[1]]=6; map_sectors[5][5][it->E_vertex2[0]][it->E_vertex2[1]]=6; map_sectors[5][5][it->E_vertex3[0]][it->E_vertex3[1]]=6; map_sectors[5][5][it->E_vertex4[0]][it->E_vertex4[1]]=6; }// for home_entity_FILE.close(); cout<