Define NOMINMAX globally to work around VS nonsense.

This commit is contained in:
dongresource 2020-10-02 20:31:22 +02:00
parent 35a2110698
commit 21b7500e13
3 changed files with 6 additions and 9 deletions

View File

@ -7,6 +7,7 @@
#include <stdint.h> #include <stdint.h>
#ifdef _WIN32 #ifdef _WIN32
// windows // windows
#define NOMINMAX
#define _WINSOCK_DEPRECATED_NO_WARNINGS #define _WINSOCK_DEPRECATED_NO_WARNINGS
#include <winsock2.h> #include <winsock2.h>
#include <windows.h> #include <windows.h>

View File

@ -47,7 +47,10 @@ void CNShardServer::keepAliveTimer(CNServer* serv, time_t currTime) {
} }
void CNShardServer::periodicSaveTimer(CNServer* serv, time_t currTime) { void CNShardServer::periodicSaveTimer(CNServer* serv, time_t currTime) {
std::cout << "[INFO] Saving players to DB..." << std::endl; if (PlayerManager::players.empty())
return;
std::cout << "[INFO] Saving " << PlayerManager::players.size() << " players to DB..." << std::endl;
for (auto& pair : PlayerManager::players) { for (auto& pair : PlayerManager::players) {
Database::updatePlayer(pair.second.plr); Database::updatePlayer(pair.second.plr);

View File

@ -7,13 +7,6 @@
#include <cmath> #include <cmath>
#include <assert.h> #include <assert.h>
#ifndef MIN
# define MIN(A,B) ((A)<(B)?(A):(B))
#endif
#ifndef MAX
# define MAX(A,B) ((A)>(B)?(A):(B))
#endif
std::map<int32_t, Mob*> MobManager::Mobs; std::map<int32_t, Mob*> MobManager::Mobs;
std::queue<int32_t> MobManager::RemovalQueue; std::queue<int32_t> MobManager::RemovalQueue;
@ -649,7 +642,7 @@ std::pair<int,int> MobManager::getDamage(int attackPower, int defensePower, bool
std::pair<int,int> ret = {}; std::pair<int,int> ret = {};
int damage = (MAX(40, attackPower - defensePower) * (34 + crutchLevel) + MIN(attackPower, attackPower * attackPower / defensePower) * (36 - crutchLevel)) / 70; int damage = (std::max(40, attackPower - defensePower) * (34 + crutchLevel) + std::min(attackPower, attackPower * attackPower / defensePower) * (36 - crutchLevel)) / 70;
ret.first = damage * (rand() % 40 + 80) / 100; // 20% variance ret.first = damage * (rand() % 40 + 80) / 100; // 20% variance
ret.second = 1; ret.second = 1;