mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-12-23 11:50:04 +00:00
Define NOMINMAX globally to work around VS nonsense.
This commit is contained in:
parent
35a2110698
commit
21b7500e13
@ -7,6 +7,7 @@
|
||||
#include <stdint.h>
|
||||
#ifdef _WIN32
|
||||
// windows
|
||||
#define NOMINMAX
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
|
@ -47,7 +47,10 @@ void CNShardServer::keepAliveTimer(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) {
|
||||
Database::updatePlayer(pair.second.plr);
|
||||
|
@ -7,13 +7,6 @@
|
||||
#include <cmath>
|
||||
#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::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 = {};
|
||||
|
||||
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.second = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user