Beispiel #1
0
void show_inventory(playerType *player, objectBase *objectdb)
{
	if( player->n_object_ids == 0 )
		printf("You are carrying nothing\n");
	else {
		printf("You are carring the following objects:\n");
		int i;
		objectType *current_object;
		for(i=0; i<player->n_object_ids; i++) {
			current_object = get_object_from_id(player->inventory[i], objectdb);
			if( current_object ) {
				if( (i + 1) != player->n_object_ids )
					printf("%s, ", current_object->name);
				else
					printf("%s\n", current_object->name);
			}
		}
	}
}
Beispiel #2
0
void show_room_content(roomType *room, objectBase *objectdb)
{
	if( room->locked ) {
		printf("You cannot enter the %s.\n", room->name);
		printf("%s\n", room->locked_description);
		return;
	}
	printf("You are in the %s.\n%s\n", room->name, room->description);
	if( room->n_object_ids > 0 ) {
		printf("You see the following objects:\n");
		int i;
		objectType *current_object;
		for(i=0; i<room->n_object_ids; i++) {
			current_object = get_object_from_id(room->object_ids[i], objectdb);
			if( current_object ) {
				if( (i + 1) != room->n_object_ids )
					printf("%s, ", current_object->name);
				else
					printf("%s\n", current_object->name);
			}
		}
	}
}
Beispiel #3
0
	ObjectPtr ObjectController::operator[](const ID& in_id) const {
		return get_object_from_id(in_id);
	}