I'm having trouble with sending NULL as an argument for a pointer. The functions and calls are as follows:
Code:
void room::build_connections(room* uparg, room* downarg, room* northarg, room* southarg, room* eastarg, room* westarg, room* currarg)
{
to_up=uparg;
to_down=downarg;
to_north=northarg;
to_south=southarg;
to_east=eastarg;
to_west=westarg;
currroom=currarg;
if (to_up != NULL) up_exist=true;
else up_exist=false;
if (to_down != NULL) down_exist=true;
else down_exist=false;
if (to_north != NULL) north_exist=true;
else north_exist=false;
if (to_south != NULL) south_exist=true;
else south_exist=false;
if (to_east != NULL) east_exist=true;
else east_exist=false;
if (to_west != NULL) west_exist=true;
else west_exist=false;
}
Code:
room room1("Sup", "Heya", "Wat");
room room2("Desu", "Da ne", "Nyoron~");
room1.build_connections(NULL, NULL, room2, NULL, NULL, NULL, room1);
room2.build_connections(NULL, NULL, NULL, room1, NULL, NULL, room2);