Pol
Revision:c08e511
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
testwalk1.cpp
Go to the documentation of this file.
1
7
/* TODO: REWORK ME!! */
8
9
#include "../clib/logfacility.h"
10
//#include "../pol/uconst.h"
11
//#include "../pol/uobject.h"
12
//
13
//#include "realm.h"
14
//#include "mapserver.h"
15
namespace
Pol
16
{
17
namespace
Plib
18
{
19
// using namespace Items;
20
// using namespace Multi;
21
// using namespace Core;
22
int
failures
;
23
int
successes
;
24
25
void
inc_failures
()
26
{
27
++
failures
;
28
}
29
30
void
inc_successes
()
31
{
32
++
successes
;
33
}
34
void
display_test_results
()
35
{
36
INFO_PRINT
<<
"Successes: "
<< successes <<
"\n"
37
<<
"Failures: "
<< failures <<
"\n"
;
38
}
39
//
40
//
41
// bool pol_walkheight( unsigned short x, unsigned short y, short oldz,
42
// short* newz,
43
// UMulti** psupporting_multi,
44
// Item** pwalkon_item,
45
// bool doors_block = true,
46
// MOVEMODE movemode = MOVEMODE_LAND );
47
//
48
// Realm* p_test_realm;
49
//
50
// static void test_walk( unsigned short /*oldx*/, unsigned short /*oldy*/, short oldz,
51
// unsigned short newx, unsigned short newy, bool exp_result, short exp_z )
52
// {
53
// RealmDescriptor r1 = RealmDescriptor::Load( "britannia" );
54
// RealmDescriptor r2 = RealmDescriptor::Load( "ilshenar" );
55
// if ( p_test_realm == NULL )
56
// p_test_realm = new Realm( "britannia" );
57
//
58
// short newz;
59
//
60
// INFO_PRINT << "WalkHeight(" << newx << "," << newy << "," << oldz << "): "
61
// << "Expect " << exp_result << "," << exp_z << ": ";
62
// UMulti* multi;
63
// Item* itm;
64
// bool res = p_test_realm->walkheight( newx, newy, oldz, &newz, &multi, &itm, true/*doors
65
//block*/, MOVEMODE_LAND );
66
//
67
// INFO_PRINT << "Got " << res << "," << newz << ": ";
68
//
69
// if ( exp_result != res )
70
// {
71
// INFO_PRINT << "Failure!\n";
72
// inc_failures();
73
// return;
74
// }
75
// if ( exp_result ) // Z is only defined if result is true
76
// {
77
// if ( exp_z != newz )
78
// {
79
// INFO_PRINT << "Failure!\n";
80
// inc_failures();
81
// return;
82
// }
83
// }
84
// inc_successes();
85
// INFO_PRINT << "Ok!\n";
86
// }
87
// static void test_walk2( unsigned short /*oldx*/, unsigned short /*oldy*/, short oldz,
88
// unsigned short newx, unsigned short newy, bool doors_block, MOVEMODE movemode, bool
89
//exp_result, short exp_z )
90
// {
91
// if ( p_test_realm == NULL )
92
// p_test_realm = new Realm( "britannia" );
93
//
94
// short newz;
95
//
96
// INFO_PRINT << "WalkHeight(" << newx << "," << newy << "," << oldz << "): "
97
// << "Expect " << exp_result << "," << exp_z << ": ";
98
// UMulti* multi;
99
// Item* itm;
100
// bool res = p_test_realm->walkheight( newx, newy, oldz, &newz, &multi, &itm, doors_block,
101
//movemode );
102
//
103
// INFO_PRINT << "Got " << res << "," << newz << ": ";
104
//
105
// if ( exp_result != res )
106
// {
107
// INFO_PRINT << "Failure!\n";
108
// inc_failures();
109
// return;
110
// }
111
// if ( exp_result ) // Z is only defined if result is true
112
// {
113
// if ( exp_z != newz )
114
// {
115
// INFO_PRINT << "Failure!\n";
116
// inc_failures();
117
// return;
118
// }
119
// }
120
// inc_successes();
121
// INFO_PRINT << "Ok!\n";
122
// }
123
//
124
//
125
// void pol_walk_test()
126
// {
127
// INFO_PRINT << "POL datafile tests:\n";
128
// test_walk( 1344, 1637, 72, 1345, 1637, true, 72 );
129
//
130
// // walk down some stairs in Castle Britannia
131
// test_walk( 1352, 1635, 72, 1352, 1634, true, 72 );
132
// test_walk( 1352, 1634, 72, 1352, 1633, true, 72 );
133
// test_walk( 1352, 1633, 72, 1352, 1632, true, 69 );
134
// test_walk( 1352, 1632, 69, 1352, 1631, true, 64 );
135
// test_walk( 1352, 1631, 64, 1352, 1630, true, 59 );
136
// test_walk( 1352, 1630, 59, 1352, 1629, true, 54 );
137
// test_walk( 1352, 1629, 54, 1352, 1628, true, 50 );
138
// test_walk( 1352, 1628, 50, 1352, 1627, true, 50 );
139
//
140
// test_walk( 1381, 1625, 30, 1382, 1625, true, 30 );
141
// test_walk( 1382, 1626, 30, 1383, 1625, true, 30 );
142
//
143
// test_walk( 1386, 1628, 30, 1386, 1629, true, 30 );
144
//
145
// // on the bridge
146
// test_walk( 1402, 1626, 28, 1402, 1625, true, 28 );
147
// // leaving the bridge
148
// test_walk( 1408, 1625, 28, 1409, 1625, true, 28 );
149
// test_walk( 1409, 1625, 28, 1410, 1625, true, 28 );
150
// test_walk( 1410, 1625, 28, 1411, 1625, true, 26 );
151
// test_walk( 1411, 1625, 26, 1412, 1625, true, 25 );
152
// test_walk( 1412, 1625, 25, 1413, 1625, true, 24 );
153
// test_walk( 1413, 1625, 25, 1414, 1625, true, 23 );
154
// test_walk( 1414, 1625, 25, 1415, 1625, true, 22 );
155
// test_walk( 1415, 1625, 25, 1416, 1625, true, 21 );
156
// test_walk( 1416, 1625, 25, 1417, 1625, true, 20 );
157
// test_walk( 1417, 1625, 25, 1418, 1625, true, 20 );
158
// test_walk( 1418, 1625, 25, 1419, 1625, true, 20 );
159
//
160
// //static_debug_on = true;
161
// test_walk( 1377, 1759, 1, 1378, 1759, true, 1 );
162
//
163
// // try walking through a static wall
164
// test_walk( 1345, 1649, 72, 1346, 1649, false, 0 );
165
//
166
// // test the walking on a floor, with a dynamic below you, screwing up.
167
// test_walk( 1347, 1659, 72, 1347, 1658, true, 72 );
168
// test_walk( 1347, 1658, 72, 1347, 1657, true, 72 );
169
//
170
//
171
// // back on the bridge
172
// //static_debug_on = true;
173
// test_walk( 1398, 1624, 29, 1399, 1624, true, 28 );
174
//
175
// // try walking through a portcullis
176
// test_walk( 1399, 1625, 27, 1398, 1625, false, 0 );
177
//
178
// // try walking onto a stone step
179
// test_walk( 1310, 1630, 30, 1309, 1630, true, 31 );
180
//
181
// // try walking onto a dungeon ramp
182
// test_walk( 1311, 1637, 30, 1311, 1636, true, 32 );
183
//
184
// // try walking under a stone arch
185
// test_walk( 1311, 1650, 30, 1311, 1649, true, 30 );
186
//
187
// // try walking through a secret door
188
// test_walk( 1316, 1649, 30, 1316, 1648, true, 30 );
189
//
190
// // try walking through a hide-type door
191
// test_walk( 1314, 1654, 30, 1313, 1654, true, 30 );
192
//
193
// // try walking under a dungeon arch
194
// test_walk( 1313, 1658, 30, 1313, 1657, true, 30 );
195
//
196
// // try walking over a black pearl
197
// test_walk( 1315, 1657, 30, 1315, 1658, true, 30 );
198
//
199
//
200
// // walk down some stairs, um, somewhere
201
// test_walk( 5920, 40, 44, 5920, 41, true, 41 );
202
// test_walk( 5920, 41, 41, 5920, 42, true, 36 );
203
// test_walk( 5920, 42, 36, 5920, 43, true, 31 );
204
// test_walk( 5920, 43, 31, 5920, 44, true, 26 );
205
// test_walk( 5920, 44, 26, 5920, 45, true, 22 );
206
// test_walk( 5920, 45, 22, 5921, 45, true, 22 );
207
// test_walk( 5921, 45, 22, 5922, 45, true, 22 );
208
// // walk up those same stairs
209
// test_walk( 5920, 45, 22, 5920, 44, true, 26 );
210
// test_walk( 5920, 44, 26, 5920, 43, true, 31 );
211
// test_walk( 5920, 43, 31, 5920, 42, true, 36 );
212
// test_walk( 5920, 42, 36, 5920, 41, true, 41 );
213
// test_walk( 5920, 41, 41, 5920, 40, true, 44 );
214
// test_walk( 5920, 40, 44, 5920, 39, true, 44 );
215
// test_walk( 5921, 40, 44, 5922, 40, true, 44 );
216
//
217
// // static_debug_on = true;
218
// // walking onto a table?
219
// test_walk( 3664, 2589, 0, 3664, 2588, false, 0 );
220
// // walking onto a table
221
// test_walk( 1594, 1588, 20, 1594, 1587, false, 0 );
222
//
223
// test_walk( 1262, 1246, 0, 1262, 1245, true, 0 );
224
// test_walk( 1264, 1253, 0, 1264, 1252, true, 0 );
225
//
226
// test_walk( 1441, 1660, 9, 1442, 1660, true, 10 /*9*/ );
227
//
228
// // near the britain bank,a steep walk
229
// test_walk( 1426, 1703, 3, 1425, 1704, true, 9 );
230
//
231
// // walk up into an orc fort
232
// test_walk( 2163, 1330, 0, 2163, 1329, true, 7 );
233
//
234
// // walk through the gates of Cove
235
// test_walk( 2284, 1209, 0, 2283, 1209, true, 0 );
236
//
237
// // weird stairs in a dungeon
238
// test_walk( 5177, 188, 10, 5177, 187, true, 20 );
239
//
240
// // wind is pissinhg me off...
241
// test_walk( 5166, 179, 17, 5166, 180, true, 25 );
242
//
243
// // a steep grade in ocllo
244
// test_walk( 3773, 2654, 0, 3772, 2654, true, 14 );
245
//
246
// // walk onto a teleporter
247
// test_walk( 1175, 2636, 0, 1175, 2635, true, 0 );
248
//
249
// // walking on a peninsula
250
// test_walk( 1909, 51, 0, 1909, 50, true, 0 );
251
// test_walk( 1909, 50, 0, 1910, 50, true, -2 );
252
// test_walk( 1909, 50, 0, 1909, 49, true, -1 );
253
// test_walk( 1909, 50, 0, 1908, 49, true, -2 );
254
// test_walk( 1908, 49, -2, 1907, 49, true, -3 );
255
//
256
// // This is known to fail - diagonal movement here should fail, but is allowed.
257
// test_walk( 1908, 51, 0, 1907, 50, false, 0 );
258
//
259
// test_walk( 1908, 51, 0, 1908, 50, true, 0 );
260
// test_walk( 1908, 50, 0, 1907, 50, true, -1 );
261
// test_walk( 1909, 51, 0, 1908, 50, true, 0 );
262
// test_walk( 1908, 50, 0, 1907, 49, true, -3 );
263
// test_walk( 1907, 49, -3, 1906, 49, true, -4 );
264
//
265
// // ladders
266
// test_walk( 2069, 817, 20, 2068, 817, true, 26 );
267
// test_walk( 2068, 817, 26, 2067, 817, true, 37 );
268
// test_walk( 2043, 807, 20, 2042, 807, true, 26 );
269
// test_walk( 2042, 807, 26, 2041, 807, true, 37 );
270
//
271
// // stairs in T2A
272
// test_walk( 2675, 2280, -40, 2675, 2279, true, -35 );
273
// test_walk( 2675, 2279, -35, 2675, 2278, true, -29 );
274
// // this one asks to be able to step up 9 squares
275
// test_walk( 2675, 2278, -29, 2675, 2277, true, -20 );
276
//
277
// // Ladder by Yew
278
// test_walk( 968, 709, -40, 967, 709, true, -35 );
279
// test_walk( 967, 709, -35, 966, 709, true, -24 );
280
// test_walk( 966, 709, -24, 965, 709, true, -20 );
281
//
282
// // walking on water
283
// test_walk2( 481, 306, -5, 481, 307, true, MOVEMODE_SEA, true, -5 );
284
// test_walk2( 481, 306, -5, 481, 307, true, MOVEMODE_LAND, false, 0 );
285
//
286
// // try walking through a fence
287
// test_walk( 1377, 1492, 10, 1377, 1493, false, 0 );
288
//
289
// // check a static roof tile (shouldn't be able to walk there)
290
// test_walk( 1508, 1551, 45, 1508, 1552, false, 0 );
291
//
292
// // some odd brambles that shouldn't block movement.
293
// test_walk( 1058, 1449, 0, 1059, 1449, true, 0 );
294
//
295
//
296
// // an odd cave
297
// test_walk( 2605, 458, 60, 2605, 457, true, 60 );
298
// test_walk( 2605, 457, 60, 2605, 456, true, 60 );
299
// test_walk( 2605, 456, 62, 2605, 455, true, 60 );
300
// test_walk( 4723, 3814, 0, 4723, 3813, true, 0 );
301
// test_walk( 4110, 431, 5, 4110, 430, true, 5 );
302
// test_walk( 1661, 2938, 0, 1661, 2937, true, 0 );
303
// test_walk( 1652, 2893, 0, 1651, 2893, true, 0 );
304
//
305
// // a secret door through the ground:
306
// test_walk( 1146, 2228, 20, 1145, 2228, true, 20 );
307
// test_walk( 1145, 2228, 20, 1144, 2228, true, 20 );
308
// test_walk( 1144, 2228, 20, 1143, 2228, true, 20 );
309
// test_walk( 1143, 2228, 20, 1142, 2228, true, 20 );
310
// test_walk( 1142, 2228, 20, 1141, 2228, true, 20 );
311
//
312
// }
313
//
314
// void pol_test_multiwalk()
315
// {
316
// INFO_PRINT << "POL datafile multi walk tests:\n";
317
// // now we have a small house in the hills
318
// test_walk( 2016, 1332, 0, 2016, 1331, true, 4 );
319
// test_walk( 2016, 1331, 4, 2017, 1331, true, 4 );
320
// test_walk( 2017, 1331, 4, 2018, 1331, true, 0 );
321
// test_walk( 2018, 1331, 0, 2018, 1330, false, 0 ); // walk N, blocked
322
// test_walk( 2018, 1331, 0, 2019, 1331, true, 0 );
323
// test_walk( 2019, 1331, 0, 2019, 1330, false, 0 );
324
// test_walk( 2019, 1331, 0, 2020, 1331, true, 0 );
325
// test_walk( 2020, 1331, 0, 2020, 1330, true, 0 );
326
// test_walk( 2016, 1331, 4, 2016, 1330, true, 7 );
327
// test_walk( 2016, 1330, 7, 2015, 1330, false, 0 );
328
// test_walk( 2016, 1330, 7, 2017, 1330, false, 0 );
329
//
330
//
331
// // try walking around on a boat
332
// test_walk( 1487, 1770, -2, 1487, 1769, true, -2 );
333
// test_walk( 1487, 1769, -2, 1487, 1768, false, 0 ); // try to walk into the mast
334
// test_walk( 1487, 1769, -2, 1486, 1769, true, -2 );
335
// test_walk( 1486, 1769, -2, 1486, 1768, true, -2 );
336
// // this commented out because the planks are both retracted.
337
// //test_walk( 1486, 1768, -2, 1485, 1768, true, -4 ); // on the gangplank
338
// test_walk( 1485, 1768, -4, 1485, 1769, false, 0 ); // try to walk into the water
339
// test_walk( 1485, 1768, -4, 1485, 1767, false, 0 ); // try to walk into the water
340
// test_walk( 1485, 1768, -4, 1484, 1768, true, -2 );
341
// test_walk( 1487, 1765, -2, 1487, 1764, true, -2 ); // try to walk onto the hold
342
//
343
// // try walking around on a boat in deeper water
344
// test_walk( 1497, 1781, -2, 1497, 1780, true, -2 );
345
// test_walk( 1497, 1780, -2, 1497, 1779, false, 0 ); // try to walk into the mast
346
// test_walk( 1497, 1780, -2, 1496, 1780, true, -2 );
347
// test_walk( 1496, 1780, -2, 1496, 1779, true, -2 );
348
// test_walk( 1496, 1779, -2, 1495, 1779, true, -4 ); // on the gangplank
349
// test_walk( 1495, 1779, -4, 1495, 1778, false, 0 ); // try to walk into the water
350
// test_walk( 1495, 1779, -4, 1495, 1780, false, 0 ); // try to walk into the water
351
// test_walk( 1495, 1779, -4, 1494, 1779, false, 0 );
352
//
353
// // try walking on a long boat, next to its plank
354
// test_walk( 1496, 1817, -2, 1495, 1817, true, -2 );
355
//
356
// }
357
//
358
}
359
}
Pol::Plib::inc_failures
void inc_failures()
Definition:
testwalk1.cpp:25
Pol::Plib::failures
int failures
Definition:
testwalk1.cpp:22
Pol::Plib::display_test_results
void display_test_results()
Definition:
testwalk1.cpp:34
Pol::Plib::successes
int successes
Definition:
testwalk1.cpp:23
INFO_PRINT
#define INFO_PRINT
Definition:
logfacility.h:220
Pol
Definition:
berror.cpp:11
Pol::Plib::inc_successes
void inc_successes()
Definition:
testwalk1.cpp:30
plib
testwalk1.cpp
Generated on Wed Dec 14 2016 02:40:44 for Pol by
1.8.11