teşekkürler.
C++:bool CHARACTER_MANAGER::IsBeenKilledBefore(DWORD dwVnum) const { auto it = m_map_dwMobKillCount.find(dwVnum); return it != m_map_dwMobKillCount.end(); }
return m_map_dwMobKillCount.contains(dwVnum);
return m_map_dwMobKillCount.contains(dwVnum);
C++:
#include <iostream>
#include <unordered_map>
class CHARACTER_MANAGER {
private:
// A private member variable using an unordered_map to store mob kill counts with DWORD keys
std::unordered_map<DWORD, int> m_map_dwMobKillCount;
public:
// Other member functions can be added here
// Function to check if a mob with the given Vnum has been killed before
bool IsBeenKilledBefore(DWORD dwVnum) const {
// Define an iterator type for the map
using MapIteratorType = std::unordered_map<DWORD, int>::const_iterator;
// Find the iterator for the given dwVnum in the map
MapIteratorType it = m_map_dwMobKillCount.find(dwVnum);
// Check if the iterator points to the end of the map, indicating the element was not found
if (it == m_map_dwMobKillCount.end())
// Return false if the element is not found
return false;
// Return true if the element is found
return true;
}
};
int main() {
// Example usage
CHARACTER_MANAGER characterManager;
// Adding some mob kill counts for demonstration
characterManager.IsBeenKilledBefore(1001); // Assume mob with Vnum 1001 has been killed
// Checking if a mob with Vnum 1001 has been killed before
if (characterManager.IsBeenKilledBefore(1001)) {
std::cout << "Mob with Vnum 1001 has been killed before." << std::endl;
} else {
std::cout << "Mob with Vnum 1001 has not been killed before." << std::endl;
}
// Checking if a mob with Vnum 2002 has been killed before
if (characterManager.IsBeenKilledBefore(2002)) {
std::cout << "Mob with Vnum 2002 has been killed before." << std::endl;
} else {
std::cout << "Mob with Vnum 2002 has not been killed before." << std::endl;
}
return 0;
}
Aynen bomba gibi fixteşekkür ederim güzel fix