| 5900 | } |
| 5901 | |
| 5902 | void playerDebugTests(Entity* my) |
| 5903 | { |
| 5904 | #ifndef NDEBUG |
| 5905 | if ( !my ) { return; } |
| 5906 | if ( !(svFlags & SV_FLAG_CHEATS) ) |
| 5907 | { |
| 5908 | return; |
| 5909 | } |
| 5910 | if ( multiplayer == CLIENT || intro ) |
| 5911 | { |
| 5912 | return; |
| 5913 | } |
| 5914 | |
| 5915 | static ConsoleVariable<bool> cvar_test_frameskip("/test_frameskip", false); |
| 5916 | if ( *cvar_test_frameskip && ticks % (5 * TICKS_PER_SECOND) == 0 ) |
| 5917 | { |
| 5918 | SDL_Delay(250); |
| 5919 | } |
| 5920 | |
| 5921 | static ConsoleVariable<int> cvar_test_xp("/test_xp", 0); |
| 5922 | struct XPGain_t |
| 5923 | { |
| 5924 | int numKills = 0; |
| 5925 | int numXP = 0; |
| 5926 | }; |
| 5927 | static std::map<std::string, XPGain_t> xpGained; |
| 5928 | static std::map<std::string, std::map<std::string, XPGain_t>> xpGainedBiome; |
| 5929 | static std::map<int, bool> killingDoneLookup; |
| 5930 | if ( currentlevel == 0 ) |
| 5931 | { |
| 5932 | xpGained.clear(); |
| 5933 | killingDoneLookup.clear(); |
| 5934 | xpGainedBiome.clear(); |
| 5935 | } |
| 5936 | else if ( *cvar_test_xp && ticks % 2 == 0 && ticks > 5 && my->skill[2] == 0 ) |
| 5937 | { |
| 5938 | bool killingDone = true; |
| 5939 | for ( auto node = map.entities->first; node; node = node->next ) |
| 5940 | { |
| 5941 | if ( Entity* entity = (Entity*)node->element ) |
| 5942 | { |
| 5943 | if ( entity->behavior == &actMonster ) |
| 5944 | { |
| 5945 | if ( entity->getStats() && entity->getStats()->HP > 0 ) |
| 5946 | { |
| 5947 | messagePlayer(0, MESSAGE_DEBUG, "Kill mon: %d", entity->getMonsterTypeFromSprite()); |
| 5948 | entity->setHP(0); |
| 5949 | Sint32 oldXP = stats[0]->EXP; |
| 5950 | if ( *cvar_test_xp == 3 || *cvar_test_xp == 5 ) |
| 5951 | { |
| 5952 | if ( local_rng.rand() % 4 > 0 ) |
| 5953 | { |
| 5954 | my->awardXP(entity, true, true); |
| 5955 | } |
| 5956 | } |
| 5957 | else |
| 5958 | { |
| 5959 | my->awardXP(entity, true, true); |
no test coverage detected