コード例 #1
0
ファイル: map_fragment.cpp プロジェクト: Martin9295/wesnoth
void map_fragment::add_tile(const gamemap& map, const map_location& loc)
{
	if (area_.find(loc) == area_.end()) {
		items_.push_back(tile_info(map, loc));
		area_.insert(loc);
	}
}
コード例 #2
0
ファイル: main.c プロジェクト: IllegalLeft/Urban-Sprawl
// check_command
//	- checks the command against the programmed commands
int check_command(char *word[100], struct person *player)
//struct playercharacteristics *player
{

	//printf("check_command word[0]: %s\n", word[0]);
	//printf("check_command word[1]: %s\n", word[1]);
	//printf("check_command word[2]: %s\n", word[2]);

	if (word[0] == NULL)
		return 1;
	// ENTER
	//else if (strcmp("enter", word[0]) == 0)
	//	enter();
	// EXIT
	else if ((strcmp("exit", word[0]) == 0) || (strcmp("quit", word[0]) == 0))
	{
		printf("Good bye!");
		pause();
		exit(0);
	}
	// HELP
	else if (strcmp("help", word[0]) == 0)
		help();
	// INVENTORY
	//else if (strcmp("inventory", word[0]) == 0)
	//	inventory();
	// MAP
	else if (strcmp("map", word[0]) == 0)
		print_map(player->map, player->position, word);
	// TILE INFO
	else if ((strcmp("tile", word[0]) == 0) && (strcmp("info", word[1]) == 0))
		tile_info(player->map, player->position);
	// WALK
	else if (strcmp("walk", word[0]) == 0)
		move(word[1], player->position);
	// NO COMMAND
	else
	{
		printf("Command not recognized.\n");
		pause();
	}

	return 0;
}