| 1793 | // |
| 1794 | |
| 1795 | static void playingLoop() { |
| 1796 | // start timing |
| 1797 | BzTime::setTick(); |
| 1798 | |
| 1799 | worldDownLoader = new WorldDownLoader; |
| 1800 | |
| 1801 | // main loop |
| 1802 | while (!CommandsStandard::isQuit()) { |
| 1803 | BZDBCache::update(); |
| 1804 | |
| 1805 | canSpawn = true; |
| 1806 | |
| 1807 | // set this step game time |
| 1808 | GameTime::setStepTime(); |
| 1809 | |
| 1810 | // get delta time |
| 1811 | BzTime prevTime = BzTime::getTick(); |
| 1812 | BzTime::setTick(); |
| 1813 | const float dt = float(BzTime::getTick() - prevTime); |
| 1814 | |
| 1815 | doMessages(); // handle incoming packets |
| 1816 | |
| 1817 | if (world) { |
| 1818 | world->checkCollisionManager(); // see if the world collision grid needs to be updated |
| 1819 | } |
| 1820 | |
| 1821 | handlePendingJoins(); |
| 1822 | |
| 1823 | struct in_addr inAddress; |
| 1824 | if (dnsLookupDone(inAddress)) { |
| 1825 | joinInternetGame(&inAddress); |
| 1826 | } |
| 1827 | |
| 1828 | callPlayingCallbacks(); // invoke callbacks |
| 1829 | |
| 1830 | if (CommandsStandard::isQuit()) { // quick out |
| 1831 | break; |
| 1832 | } |
| 1833 | |
| 1834 | checkForServerBail(); |
| 1835 | |
| 1836 | doUpdates(dt); |
| 1837 | |
| 1838 | doNetworkStuff(); |
| 1839 | |
| 1840 | if (checkForCompleteDownloads()) { |
| 1841 | joinInternetGame2(); // we did the inital downloads, so we should join |
| 1842 | } |
| 1843 | |
| 1844 | doEnergySaver(); |
| 1845 | |
| 1846 | if (serverLink) { |
| 1847 | serverLink->flush(); |
| 1848 | } |
| 1849 | |
| 1850 | } // end main client loop |
| 1851 | |
| 1852 |
no test coverage detected