mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 11:28:56 +00:00
Replace SWAP
with std::swap
This commit is contained in:
parent
88d1dfa948
commit
582970d9ef
@ -104,6 +104,8 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "gr.h"
|
||||
#include "lib2d.h"
|
||||
#include "renderer.h"
|
||||
@ -377,9 +379,9 @@ int grViewport::clip_rect(int &l, int &t, int &r, int &b) {
|
||||
int clipped = 0;
|
||||
|
||||
if (l > r)
|
||||
SWAP(l, r);
|
||||
std::swap(l, r);
|
||||
if (t > b)
|
||||
SWAP(t, b);
|
||||
std::swap(t, b);
|
||||
|
||||
if (l > CLIP_RIGHT || t > CLIP_BOTTOM || r < CLIP_LEFT || b < CLIP_TOP)
|
||||
return 2;
|
||||
|
@ -40,6 +40,9 @@
|
||||
*
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "procedurals.h"
|
||||
#include "bitmap.h"
|
||||
#include "gr.h"
|
||||
@ -55,7 +58,6 @@
|
||||
#include <memory.h>
|
||||
#include "psrand.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define BRIGHT_COLOR 254
|
||||
#define PROC_SIZE 128
|
||||
@ -283,8 +285,8 @@ void DrawProceduralLine(int x1, int y1, int x2, int y2, uint8_t color) {
|
||||
|
||||
// Check to see if our x coords are reversed
|
||||
if (x1 > x2) {
|
||||
SWAP(x1, x2);
|
||||
SWAP(y1, y2);
|
||||
std::swap(x1, x2);
|
||||
std::swap(y1, y2);
|
||||
}
|
||||
DX = x2 - x1;
|
||||
DY = y2 - y1;
|
||||
|
@ -16,6 +16,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef NEWEDITOR
|
||||
#include "../neweditor/stdafx.h"
|
||||
@ -62,8 +63,8 @@ void editorSelectorManager::StartSelection(CWnd *wnd, void (*func)(editorSelecto
|
||||
|
||||
m_OwnerWnd->GetClientRect(&client_rect);
|
||||
r_l = m_l; r_t = m_t; r_r = m_r; r_b = m_b;
|
||||
if (r_r < r_l) SWAP(r_l, r_r);
|
||||
if (r_b < r_t) SWAP(r_t, r_b);
|
||||
if (r_r < r_l) std::swap(r_l, r_r);
|
||||
if (r_b < r_t) std::swap(r_t, r_b);
|
||||
if (r_l < client_rect.left) r_l = client_rect.left;
|
||||
if (r_t < client_rect.top) r_t = client_rect.top;
|
||||
if (r_r > client_rect.right) r_r = client_rect.right;
|
||||
@ -98,8 +99,8 @@ void editorSelectorManager::GetSelectedRect(int *l, int *t, int *r, int *b)
|
||||
// make sure selected rectangle is clipped to the owner window and normalized.
|
||||
m_OwnerWnd->GetClientRect(&client_rect);
|
||||
|
||||
if (m_r < m_l) SWAP(m_l, m_r);
|
||||
if (m_b < m_t) SWAP(m_t, m_b);
|
||||
if (m_r < m_l) std::swap(m_l, m_r);
|
||||
if (m_b < m_t) std::swap(m_t, m_b);
|
||||
if (m_l < client_rect.left) m_l = client_rect.left;
|
||||
if (m_t < client_rect.top) m_t = client_rect.top;
|
||||
if (m_r > client_rect.right) m_r = client_rect.right;
|
||||
@ -154,8 +155,8 @@ void editorSelectorManager::Defer()
|
||||
|
||||
// get current selected rect, normalize rectangle if left,top is invalid for drawing.
|
||||
r_l = m_l; r_t = m_t; r_r = m_r; r_b = m_b;
|
||||
if (r_r < r_l) SWAP(r_l, r_r);
|
||||
if (r_b < r_t) SWAP(r_t, r_b);
|
||||
if (r_r < r_l) std::swap(r_l, r_r);
|
||||
if (r_b < r_t) std::swap(r_t, r_b);
|
||||
if (r_l < client_rect.left) r_l = client_rect.left;
|
||||
if (r_t < client_rect.top) r_t = client_rect.top;
|
||||
if (r_r > client_rect.right) r_r = client_rect.right;
|
||||
@ -166,8 +167,8 @@ void editorSelectorManager::Defer()
|
||||
m_b = m_b + mdy;
|
||||
|
||||
r_l = m_l; r_t = m_t; r_r = m_r; r_b = m_b;
|
||||
if (r_r < r_l) SWAP(r_l, r_r);
|
||||
if (r_b < r_t) SWAP(r_t, r_b);
|
||||
if (r_r < r_l) std::swap(r_l, r_r);
|
||||
if (r_b < r_t) std::swap(r_t, r_b);
|
||||
if (r_l < client_rect.left) r_l = client_rect.left;
|
||||
if (r_t < client_rect.top) r_t = client_rect.top;
|
||||
if (r_r > client_rect.right) r_r = client_rect.right;
|
||||
@ -203,8 +204,8 @@ void editorSelectorManager::EndSelection()
|
||||
// clip drawing rectangle to owner window.
|
||||
m_OwnerWnd->GetClientRect(&client_rect);
|
||||
r_l = m_l; r_t = m_t; r_r = m_r; r_b = m_b;
|
||||
if (r_r < r_l) SWAP(r_l, r_r);
|
||||
if (r_b < r_t) SWAP(r_t, r_b);
|
||||
if (r_r < r_l) std::swap(r_l, r_r);
|
||||
if (r_b < r_t) std::swap(r_t, r_b);
|
||||
if (r_l < client_rect.left) r_l = client_rect.left;
|
||||
if (r_t < client_rect.top) r_t = client_rect.top;
|
||||
if (r_r > client_rect.right) r_r = client_rect.right;
|
||||
|
@ -60,12 +60,6 @@
|
||||
*/
|
||||
#ifndef _MACROS_H
|
||||
#define _MACROS_H
|
||||
#define SWAP(a, b) \
|
||||
do { \
|
||||
int _swap_var_ = (a); \
|
||||
(a) = (b); \
|
||||
(b) = _swap_var_; \
|
||||
} while (0)
|
||||
#define CHECK_FLAG(_var, _flag) ((_var) & (_flag))
|
||||
#define makeword(_h, _l) (((_h) << 16) + ((_l) & 0xffff))
|
||||
#define hiword(_v) ((_v) >> 16)
|
||||
|
Loading…
Reference in New Issue
Block a user