Make map a char array

This commit is contained in:
Ultracoolguy 2020-11-07 12:54:13 -04:00 committed by Eyal Sawady
parent da55a652c7
commit aae642876e
No known key found for this signature in database
GPG Key ID: 604D3459E53A9952
1 changed files with 22 additions and 24 deletions

46
main.c
View File

@ -184,27 +184,27 @@ const char descriptions[][256] = {
[LOC_NAVIGATION] = "You are all the way in the front of the ship in a room with the ship controls and a great view of space\n",
};
const char map[][100] = {
"|\\----------------|--------------|----------------|--------------\\\n",
"| \\\n",
"| UPPER ENGINE CAFETERIA WEAPONS \\\n",
"| |- --------| | \\\n",
"|/--------| |--| MEDBAY | | \\\n",
" | | | | \\------\\\n",
"/---------| |-------\\ | |----------| | \\\n",
"| | | \\ |---| |------| | |\n",
"| \\ | | |\n",
"| REACTOR SECURITY | | ADMIN OFFICE | O2 NAVIGATION |\n",
"| | | | | |\n",
"| | | | |---| |----|-|----------| |\n",
"\\---------| |----------|------| | | /\n",
" | | | /------/\n",
"|\\--------| |--| | /\n",
"| | | |-- --| /\n",
"| LOWER ENGINE ELECTRICAL STORAGE | COMMS | SHIELDS /\n",
"| | | /\n",
"|/----------------|--------------|--------------|--------|-------/\n",
};
const char map[] =
"|\\----------------|--------------|----------------|--------------\\\n"
"| \\\n"
"| UPPER ENGINE CAFETERIA WEAPONS \\\n"
"| |- --------| | \\\n"
"|/--------| |--| MEDBAY | | \\\n"
" | | | | \\------\\\n"
"/---------| |-------\\ | |----------| | \\\n"
"| | | \\ |---| |------| | |\n"
"| \\ | | |\n"
"| REACTOR SECURITY | | ADMIN OFFICE | O2 NAVIGATION |\n"
"| | | | | |\n"
"| | | | |---| |----|-|----------| |\n"
"\\---------| |----------|------| | | /\n"
" | | | /------/\n"
"|\\--------| |--| | /\n"
"| | | |-- --| /\n"
"| LOWER ENGINE ELECTRICAL STORAGE | COMMS | SHIELDS /\n"
"| | | /\n"
"|/----------------|--------------|--------------|--------|-------/\n"
;
enum player_state {
PLAYER_STATE_ALIVE,
@ -975,9 +975,7 @@ adventure(size_t pid, char *input)
break;
}
} else if (strncmp(input, "map", 3) == 0) {
for(int l=0;l<19;l++) {
write(players[pid].fd, map[l], strlen(map[l]));
}
write(players[pid].fd, map, strlen(map));
snprintf(buf, sizeof(buf), "# ");
} else {
// check if it was a task