25 #include "config_auto.h"
37 if (pt1.
x () <= pt2.
x ()) {
38 if (pt1.
y () <= pt2.
y ()) {
43 bot_left =
ICOORD (pt1.
x (), pt2.
y ());
44 top_right =
ICOORD (pt2.
x (), pt1.
y ());
48 if (pt1.
y () <= pt2.
y ()) {
49 bot_left =
ICOORD (pt2.
x (), pt1.
y ());
50 top_right =
ICOORD (pt1.
x (), pt2.
y ());
67 : bot_left(left, bottom), top_right(right, top) {
74 ICOORD top_left(bot_left.
x(), top_right.
y());
75 ICOORD bottom_right(top_right.
x(), bot_left.
y());
77 bottom_right.rotate(vec);
79 TBOX box2(top_left, bottom_right);
89 const TBOX &box)
const {
95 if (box.bot_left.
x () > bot_left.
x ())
96 left = box.bot_left.
x ();
100 if (box.top_right.
x () < top_right.
x ())
101 right = box.top_right.
x ();
103 right = top_right.
x ();
105 if (box.bot_left.
y () > bot_left.
y ())
106 bottom = box.bot_left.
y ();
108 bottom = bot_left.
y ();
110 if (box.top_right.
y () < top_right.
y ())
111 top = box.top_right.
y ();
113 top = top_right.
y ();
121 return TBOX (left, bottom, right, top);
131 const TBOX &box)
const {
135 if (box.bot_left.
x () < bot_left.
x ())
136 bl.
set_x (box.bot_left.
x ());
140 if (box.top_right.
x () > top_right.
x ())
141 tr.
set_x (box.top_right.
x ());
143 tr.
set_x (top_right.
x ());
145 if (box.bot_left.
y () < bot_left.
y ())
146 bl.
set_y (box.bot_left.
y ());
150 if (box.top_right.
y () > top_right.
y ())
151 tr.
set_y (box.top_right.
y ());
153 tr.
set_y (top_right.
y ());
154 return TBOX (bl, tr);
163 #ifndef GRAPHICS_DISABLED
169 fd->
Brush(fill_colour);
170 fd->
Pen(border_colour);
177 if (!bot_left.
Serialize(fp))
return false;
178 if (!top_right.
Serialize(fp))
return false;
185 if (!top_right.
DeSerialize(swap, fp))
return false;
199 if (op2.bot_left.
x () < op1.bot_left.
x ())
200 op1.bot_left.
set_x (op2.bot_left.
x ());
202 if (op2.top_right.
x () > op1.top_right.
x ())
203 op1.top_right.
set_x (op2.top_right.
x ());
205 if (op2.bot_left.
y () < op1.bot_left.
y ())
206 op1.bot_left.
set_y (op2.bot_left.
y ());
208 if (op2.top_right.
y () > op1.top_right.
y ())
209 op1.top_right.
set_y (op2.top_right.
y ());
223 if (op2.bot_left.
x () > op1.bot_left.
x ())
224 op1.bot_left.
set_x (op2.bot_left.
x ());
226 if (op2.top_right.
x () < op1.top_right.
x ())
227 op1.top_right.
set_x (op2.top_right.
x ());
229 if (op2.bot_left.
y () > op1.bot_left.
y ())
230 op1.bot_left.
set_y (op2.bot_left.
y ());
232 if (op2.top_right.
y () < op1.top_right.
y ())
233 op1.top_right.
set_y (op2.top_right.
y ());
245 return (abs(
left() - box.
left()) <= tolerance &&
250 return (abs(
left() - box.
left()) <= tolerance &&
252 abs(
top() - box.
top()) <= tolerance &&