[Orxonox-commit 732] r3262 - in branches/core4/src: core orxonox/objects/worldentities orxonox/objects/worldentities/pawns orxonox/overlays/console util
rgrieder at orxonox.net
rgrieder at orxonox.net
Wed Jul 1 10:04:55 CEST 2009
Author: rgrieder
Date: 2009-07-01 10:04:54 +0200 (Wed, 01 Jul 2009)
New Revision: 3262
Modified:
branches/core4/src/core/CommandLine.cc
branches/core4/src/core/Executor.cc
branches/core4/src/core/Executor.h
branches/core4/src/orxonox/objects/worldentities/Backlight.cc
branches/core4/src/orxonox/objects/worldentities/Camera.cc
branches/core4/src/orxonox/objects/worldentities/pawns/Pawn.cc
branches/core4/src/orxonox/overlays/console/InGameConsole.cc
branches/core4/src/util/Math.h
Log:
Replaced orxonox::min and orxonox::max with std version (which do exactly the same).
The std version are in the <algorithm> header.
Modified: branches/core4/src/core/CommandLine.cc
===================================================================
--- branches/core4/src/core/CommandLine.cc 2009-06-30 15:32:17 UTC (rev 3261)
+++ branches/core4/src/core/CommandLine.cc 2009-07-01 08:04:54 UTC (rev 3262)
@@ -28,6 +28,7 @@
#include "CommandLine.h"
+#include <algorithm>
#include <sstream>
#include <boost/filesystem.hpp>
Modified: branches/core4/src/core/Executor.cc
===================================================================
--- branches/core4/src/core/Executor.cc 2009-06-30 15:32:17 UTC (rev 3261)
+++ branches/core4/src/core/Executor.cc 2009-07-01 08:04:54 UTC (rev 3262)
@@ -98,15 +98,15 @@
return false;
// assign all given arguments to the multitypes
- for (unsigned int i = 0; i < min(tokens.size(), (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
+ for (unsigned int i = 0; i < std::min(tokens.size(), (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
param[i] = tokens[i];
// fill the remaining multitypes with default values
- for (unsigned int i = tokens.size(); i < min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
+ for (unsigned int i = tokens.size(); i < std::min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
param[i] = this->defaultValue_[i];
// evaluate the param types through the functor
- for (unsigned int i = 0; i < min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
+ for (unsigned int i = 0; i < std::min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
this->functor_->evaluateParam(i, param[i]);
return true;
Modified: branches/core4/src/core/Executor.h
===================================================================
--- branches/core4/src/core/Executor.h 2009-06-30 15:32:17 UTC (rev 3261)
+++ branches/core4/src/core/Executor.h 2009-07-01 08:04:54 UTC (rev 3262)
@@ -32,6 +32,9 @@
#include "CorePrereqs.h"
+#include <algorithm>
+#include <string>
+
#include "util/Debug.h"
#include "util/Math.h"
#include "util/StringUtils.h"
@@ -100,7 +103,7 @@
} \
COUT(5) << tokens[i]; \
} \
- COUT(5) << ") and " << max((int)paramCount - (int)tokens.size(), 0) << " default values ("; \
+ COUT(5) << ") and " << std::max((int)paramCount - (int)tokens.size(), 0) << " default values ("; \
for (unsigned int i = tokens.size(); i < paramCount; i++) \
{ \
param[i] = this->defaultValue_[i]; \
Modified: branches/core4/src/orxonox/objects/worldentities/Backlight.cc
===================================================================
--- branches/core4/src/orxonox/objects/worldentities/Backlight.cc 2009-06-30 15:32:17 UTC (rev 3261)
+++ branches/core4/src/orxonox/objects/worldentities/Backlight.cc 2009-07-01 08:04:54 UTC (rev 3262)
@@ -28,6 +28,7 @@
#include "Backlight.h"
+#include <algorithm>
#include <OgreRibbonTrail.h>
#include <OgreSceneManager.h>
#include <OgreSceneNode.h>
@@ -174,7 +175,7 @@
void Backlight::stopturnonoff()
{
- this->postprocessingtime_ = max(0.0f, this->lifetime_ - this->turnofftime_);
+ this->postprocessingtime_ = std::max(0.0f, this->lifetime_ - this->turnofftime_);
FadingBillboard::stopturnonoff();
Modified: branches/core4/src/orxonox/objects/worldentities/Camera.cc
===================================================================
--- branches/core4/src/orxonox/objects/worldentities/Camera.cc 2009-06-30 15:32:17 UTC (rev 3261)
+++ branches/core4/src/orxonox/objects/worldentities/Camera.cc 2009-07-01 08:04:54 UTC (rev 3262)
@@ -28,6 +28,7 @@
#include "Camera.h"
+#include <algorithm>
#include <OgreCamera.h>
#include <OgreSceneManager.h>
#include <OgreSceneNode.h>
@@ -103,7 +104,7 @@
if (this->bDrag_)
{
// this stuff here may need some adjustments
- float coeff = min(1.0f, 15.0f * dt);
+ float coeff = std::min(1.0f, 15.0f * dt);
Vector3 offset = this->getWorldPosition() - this->cameraNode_->_getDerivedPosition();
this->cameraNode_->translate(coeff * offset);
Modified: branches/core4/src/orxonox/objects/worldentities/pawns/Pawn.cc
===================================================================
--- branches/core4/src/orxonox/objects/worldentities/pawns/Pawn.cc 2009-06-30 15:32:17 UTC (rev 3261)
+++ branches/core4/src/orxonox/objects/worldentities/pawns/Pawn.cc 2009-07-01 08:04:54 UTC (rev 3262)
@@ -28,6 +28,8 @@
#include "Pawn.h"
+#include <algorithm>
+
#include "core/CoreIncludes.h"
#include "core/GameMode.h"
#include "core/XMLPort.h"
@@ -151,7 +153,7 @@
void Pawn::setHealth(float health)
{
- this->health_ = min(health, this->maxHealth_);
+ this->health_ = std::min(health, this->maxHealth_);
}
void Pawn::damage(float damage, Pawn* originator)
Modified: branches/core4/src/orxonox/overlays/console/InGameConsole.cc
===================================================================
--- branches/core4/src/orxonox/overlays/console/InGameConsole.cc 2009-06-30 15:32:17 UTC (rev 3261)
+++ branches/core4/src/orxonox/overlays/console/InGameConsole.cc 2009-07-01 08:04:54 UTC (rev 3262)
@@ -29,6 +29,7 @@
#include "InGameConsole.h"
+#include <algorithm>
#include <string>
#include <OgreOverlay.h>
#include <OgreOverlayElement.h>
@@ -424,7 +425,7 @@
this->desiredTextWidth_ = (int) (this->windowW_ * this->relativeWidth) - 12;
if (LINES > 0)
- this->maxCharsPerLine_ = max((unsigned int)10, (unsigned int) ((float)this->desiredTextWidth_ / CHAR_WIDTH));
+ this->maxCharsPerLine_ = std::max((unsigned int)10, (unsigned int) ((float)this->desiredTextWidth_ / CHAR_WIDTH));
else
this->maxCharsPerLine_ = 10;
Modified: branches/core4/src/util/Math.h
===================================================================
--- branches/core4/src/util/Math.h 2009-06-30 15:32:17 UTC (rev 3261)
+++ branches/core4/src/util/Math.h 2009-07-01 08:04:54 UTC (rev 3262)
@@ -80,24 +80,6 @@
}
/**
- @brief Returns the smaller of two values.
- */
- template <typename T>
- inline T min(T a, T b)
- {
- return (a <= b) ? a : b;
- }
-
- /**
- @brief Returns the greater of two values.
- */
- template <typename T>
- inline T max(T a, T b)
- {
- return (a >= b) ? a : b;
- }
-
- /**
@brief Keeps a value between a lower and an upper limit.
@param x The value
@param min The lower limit
More information about the Orxonox-commit
mailing list