When you connect to an Access Point, your computer communicates only with the Access Point. Even if you send data to another computer in the same WiFi network, data travels to the AP first, then the AP repeats it in the air for the target machine. That mode is called Infrastructure Mode. All participants in the network should be in the range of the AP, and the whole network fails if the AP goes wrong.
On the other hand, there is Ad-Hoc Mode (also called IBSS), when all computers in that network are peers with equal rights, and send data directly to each other. Daihinia adds a bit of smartness to this mode by relaying packets from one computer to another computer by using a computer in the middle, but only in those cases when such a relaying is absolutely needed, i.e. when the first two computers are out of range for each other.