bwapi-sys 0.1.2

FFI bindings to the bwapi-c library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
#include <Game.h>
#include <BwString.h>

#include "IteratorImpl.hpp"
#include "Interface.hpp"
#include <cassert>

void BWAPIC_setGame(Game* game) {
    BWAPI::BroodwarPtr = reinterpret_cast<BWAPI::Game*>(game);
}

Game* BWAPIC_getGame() {
    return reinterpret_cast<Game*>(BWAPI::BroodwarPtr);
}

ForceIterator* Game_getForces(Game* self) {
    const auto& forces = reinterpret_cast<BWAPI::Game*>(self)->getForces();
    return as_iter<ForceIterator>(forces);
}

PlayerIterator* Game_getPlayers(Game* self) {
    const auto& players = reinterpret_cast<BWAPI::Game*>(self)->getPlayers();
    return as_iter<PlayerIterator>(players);
}

BulletIterator* Game_getBullets(Game* self) {
    const auto& bullets = reinterpret_cast<BWAPI::Game*>(self)->getBullets();
    return as_iter<BulletIterator>(bullets);
}

PositionIterator* Game_getNukeDots(Game* self) {
    const auto& dots = reinterpret_cast<BWAPI::Game*>(self)->getNukeDots();
    return as_value_iter<PositionIterator>(dots);
}

EventIterator* Game_getEvents(Game* self) {
    const auto& events = reinterpret_cast<BWAPI::Game*>(self)->getEvents();
    return as_value_iter<EventIterator>(events);
}

UnitIterator* Game_getAllUnits(Game* self) {
    const auto& units = reinterpret_cast<BWAPI::Game*>(self)->getAllUnits();
    return as_iter<UnitIterator>(units);
}

UnitIterator* Game_getMinerals(Game* self) {
    const auto& minerals = reinterpret_cast<BWAPI::Game*>(self)->getMinerals();
    return as_iter<UnitIterator>(minerals);
}

UnitIterator* Game_getGeysers(Game* self) {
    const auto& geysers = reinterpret_cast<BWAPI::Game*>(self)->getGeysers();
    return as_iter<UnitIterator>(geysers);
}

UnitIterator* Game_getNeutralUnits(Game* self) {
    const auto& units = reinterpret_cast<BWAPI::Game*>(self)->getNeutralUnits();
    return as_iter<UnitIterator>(units);
}

UnitIterator* Game_getStaticMinerals(Game* self) {
    const auto& minerals = reinterpret_cast<BWAPI::Game*>(self)->getStaticMinerals();
    return as_iter<UnitIterator>(minerals);
}

UnitIterator* Game_getStaticGeysers(Game* self) {
    const auto& geysers = reinterpret_cast<BWAPI::Game*>(self)->getStaticGeysers();
    return as_iter<UnitIterator>(geysers);
}

UnitIterator* Game_getStaticNeutralUnits(Game* self) {
    const auto& units = reinterpret_cast<BWAPI::Game*>(self)->getStaticNeutralUnits();
    return as_iter<UnitIterator>(units);
}

Force* Game_getForce(Game* self, int forceID) {
    return reinterpret_cast<Force*>( reinterpret_cast<BWAPI::Game*>(self)->getForce(forceID) );
}

Player* Game_getPlayer(Game* self, int playerID) {
    return reinterpret_cast<Player*>( reinterpret_cast<BWAPI::Game*>(self)->getPlayer(playerID) );
}

Unit* Game_getUnit(Game* self, int unitID) {
    return reinterpret_cast<Unit*>( reinterpret_cast<BWAPI::Game*>(self)->getUnit(unitID) );
}

Unit* Game_indexToUnit(Game* self, int unitIndex) {
    return reinterpret_cast<Unit*>( reinterpret_cast<BWAPI::Game*>(self)->indexToUnit(unitIndex) );
}

Region* Game_getRegion(Game* self, int regionID) {
    return reinterpret_cast<Region*>( reinterpret_cast<BWAPI::Game*>(self)->getRegion(regionID) );
}

GameType Game_getGameType(Game* self) {
    return cast_from_bw( reinterpret_cast<BWAPI::Game*>(self)->getGameType() );
}

int Game_getLatency(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getLatency();
}

int Game_getFrameCount(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getFrameCount();
}

int Game_getReplayFrameCount(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getReplayFrameCount();
}

int Game_getFPS(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getFPS();
}

double Game_getAverageFPS(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getAverageFPS();
}

Position Game_getMousePosition(Game* self) {
    return cast_from_bw( reinterpret_cast<BWAPI::Game*>(self)->getMousePosition() );
}

bool Game_getMouseState(Game* self, MouseButton button) {
    return reinterpret_cast<BWAPI::Game*>(self)->getMouseState(cast_to_bw(button));
}

bool Game_getKeyState(Game* self, KeyButton key) {
    return reinterpret_cast<BWAPI::Game*>(self)->getKeyState(cast_to_bw(key));
}

Position Game_getScreenPosition(Game* self) {
    return cast_from_bw( reinterpret_cast<BWAPI::Game*>(self)->getScreenPosition() );
}

void Game_setScreenPosition(Game* self, Position p) {
    reinterpret_cast<BWAPI::Game*>(self)->setScreenPosition(cast_to_bw(p));
}

void Game_pingMinimap(Game* self, Position p) {
    reinterpret_cast<BWAPI::Game*>(self)->pingMinimap(cast_to_bw(p));
}

bool Game_isFlagEnabled(Game* self, int flag) {
    return reinterpret_cast<BWAPI::Game*>(self)->isFlagEnabled(flag);
}

void Game_enableFlag(Game* self, int flag) {
    reinterpret_cast<BWAPI::Game*>(self)->enableFlag(flag);
}

UnitIterator* Game_getUnitsOnTile(Game* self, TilePosition tile, UnaryUnitFilter pred) {
    auto pred_filter = reinterpret_cast<bool (*)(BWAPI::Unit)>(pred);
    auto&& units = reinterpret_cast<BWAPI::Game*>(self)->getUnitsOnTile(cast_to_bw(tile), pred_filter);
    return into_iter<UnitIterator>(std::move(units));
}

UnitIterator* Game_getUnitsInRectangle(Game* self, Position topLeft, Position bottomRight, UnaryUnitFilter pred) {
    auto pred_filter = reinterpret_cast<bool (*)(BWAPI::Unit)>(pred);
    auto&& units = reinterpret_cast<BWAPI::Game*>(self)->getUnitsInRectangle(cast_to_bw(topLeft), cast_to_bw(bottomRight), pred_filter);
    return into_iter<UnitIterator>(std::move(units));
}

UnitIterator* Game_getUnitsInRadius(Game* self, Position center, int radius, UnaryUnitFilter pred) {
    auto pred_filter = reinterpret_cast<bool (*)(BWAPI::Unit)>(pred);
    auto&& units = reinterpret_cast<BWAPI::Game*>(self)->getUnitsInRadius(cast_to_bw(center), radius, pred_filter);
    return into_iter<UnitIterator>(std::move(units));
}

Unit* Game_getClosestUnit(Game* self, Position center, UnaryUnitFilter pred, int radius) {
    auto pred_filter = reinterpret_cast<bool (*)(BWAPI::Unit)>(pred);
    auto unit = reinterpret_cast<BWAPI::Game*>(self)->getClosestUnit(cast_to_bw(center), pred_filter, radius);
    return reinterpret_cast<Unit*>(unit);
}

Unit* Game_getClosestUnitInRectangle(Game* self, Position center, UnaryUnitFilter pred, int left, int top, int right, int bottom) {
    auto pred_filter = reinterpret_cast<bool (*)(BWAPI::Unit)>(pred);
    auto unit = reinterpret_cast<BWAPI::Game*>(self)->getClosestUnitInRectangle(cast_to_bw(center), pred_filter, left, top, right, bottom);
    return reinterpret_cast<Unit*>(unit);
}

Unit* Game_getBestUnit(Game* self, BestUnitFilter best, UnaryUnitFilter pred, Position center, int radius) {
    auto best_filter = reinterpret_cast<BWAPI::Unit (*)(BWAPI::Unit, BWAPI::Unit)>(best);
    auto pred_filter = reinterpret_cast<bool (*)(BWAPI::Unit)>(pred);
    auto unit = reinterpret_cast<BWAPI::Game*>(self)->getBestUnit(best_filter, pred_filter, cast_to_bw(center), radius);
    return reinterpret_cast<Unit*>(unit);
}

Error Game_getLastError(Game* self) {
    return cast_from_bw( reinterpret_cast<BWAPI::Game*>(self)->getLastError() );
}

bool Game_setLastError(Game* self, Error e) {
    return reinterpret_cast<BWAPI::Game*>(self)->setLastError(cast_to_bw(e));
}

int Game_mapWidth(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->mapWidth();
}

int Game_mapHeight(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->mapHeight();
}

BwString* Game_mapFileName(Game* self) {
    const std::string& name = reinterpret_cast<BWAPI::Game*>(self)->mapFileName();
    return BwString_new(name.c_str(), name.length());
}

BwString* Game_mapPathName(Game* self) {
    const std::string& name = reinterpret_cast<BWAPI::Game*>(self)->mapPathName();
    return BwString_new(name.c_str(), name.length());
}

BwString* Game_mapName(Game* self) {
    const std::string& name = reinterpret_cast<BWAPI::Game*>(self)->mapName();
    return BwString_new(name.c_str(), name.length());
}

BwString* Game_mapHash(Game* self) {
    const std::string& hash = reinterpret_cast<BWAPI::Game*>(self)->mapHash();
    return BwString_new(hash.c_str(), hash.length());
}

bool Game_isWalkable(Game* self, WalkPosition position) {
    return reinterpret_cast<BWAPI::Game*>(self)->isWalkable(cast_to_bw(position));
}

int Game_getGroundHeight(Game* self, TilePosition position) {
    return reinterpret_cast<BWAPI::Game*>(self)->getGroundHeight(cast_to_bw(position));
}

bool Game_isBuildable(Game* self, TilePosition position, bool includeBuildings) {
    return reinterpret_cast<BWAPI::Game*>(self)->isBuildable(cast_to_bw(position), includeBuildings);
}

bool Game_isVisible(Game* self, TilePosition position) {
    return reinterpret_cast<BWAPI::Game*>(self)->isVisible(cast_to_bw(position));
}

bool Game_isExplored(Game* self, TilePosition position) {
    return reinterpret_cast<BWAPI::Game*>(self)->isExplored(cast_to_bw(position));
}

bool Game_hasCreep(Game* self, TilePosition position) {
    return reinterpret_cast<BWAPI::Game*>(self)->hasCreep(cast_to_bw(position));
}

bool Game_hasPowerPrecise(Game* self, Position position, UnitType unitType) {
    return reinterpret_cast<BWAPI::Game*>(self)->hasPowerPrecise(cast_to_bw(position), cast_to_bw(unitType));
}

bool Game_hasPower(Game* self, TilePosition position, UnitType unitType) {
    return reinterpret_cast<BWAPI::Game*>(self)->hasPower(cast_to_bw(position), cast_to_bw(unitType));
}

bool Game_hasPowerWH(Game* self, TilePosition position, int tileWidth, int tileHeight, UnitType unitType) {
    return reinterpret_cast<BWAPI::Game*>(self)->hasPower(cast_to_bw(position), tileWidth, tileHeight, cast_to_bw(unitType));
}

bool Game_canBuildHere(Game* self, TilePosition position, UnitType type, Unit* builder, bool checkExplored) {
    return reinterpret_cast<BWAPI::Game*>(self)->canBuildHere(cast_to_bw(position), cast_to_bw(type), reinterpret_cast<BWAPI::Unit>(builder), checkExplored);
}

bool Game_canMake(Game* self, UnitType type, Unit* builder) {
    return reinterpret_cast<BWAPI::Game*>(self)->canMake(cast_to_bw(type), reinterpret_cast<BWAPI::Unit>(builder));
}

bool Game_canResearch(Game* self, TechType type, Unit* unit, bool checkCanIssueCommandType) {
    return reinterpret_cast<BWAPI::Game*>(self)->canResearch(cast_to_bw(type), reinterpret_cast<BWAPI::Unit>(unit), checkCanIssueCommandType);
}

bool Game_canUpgrade(Game* self, UpgradeType type, Unit* unit, bool checkCanIssueCommandType) {
    return reinterpret_cast<BWAPI::Game*>(self)->canUpgrade(cast_to_bw(type), reinterpret_cast<BWAPI::Unit>(unit), checkCanIssueCommandType);
}

TilePositionIterator* Game_getStartLocations(Game* self) {
    const auto& tiles = reinterpret_cast<BWAPI::Game*>(self)->getStartLocations();
    return as_value_iter<TilePositionIterator>(tiles);
}

void Game_printf(Game* self, const char* format, ...) {
    va_list args;
    va_start(args, format);
    Game_vPrintf(self, format, args);
    va_end(args);
}

void Game_vPrintf(Game* self, const char* format, va_list args) {
    reinterpret_cast<BWAPI::Game*>(self)->vPrintf(format, args);
}

void Game_sendText(Game* self, const char* format, ...)
{
    va_list args;
    va_start(args, format);
    Game_vSendText(self, format, args);
    va_end(args);
}

void Game_vSendText(Game* self, const char* format, va_list args) {
    reinterpret_cast<BWAPI::Game*>(self)->vSendText(format, args);
}

void Game_sendTextEx(Game* self, bool toAllies, const char* format, ...) {
    va_list args;
    va_start(args, format);
    Game_vSendTextEx(self, toAllies, format, args);
    va_end(args);
}

void Game_vSendTextEx(Game* self, bool toAllies, const char* format, va_list args) {
    reinterpret_cast<BWAPI::Game*>(self)->vSendTextEx(toAllies, format, args);
}

bool Game_isInGame(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->isInGame();
}

bool Game_isMultiplayer(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->isMultiplayer();
}

bool Game_isBattleNet(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->isBattleNet();
}

bool Game_isPaused(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->isPaused();
}

bool Game_isReplay(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->isReplay();
}

void Game_pauseGame(Game* self) {
    reinterpret_cast<BWAPI::Game*>(self)->pauseGame();
}

void Game_resumeGame(Game* self) {
    reinterpret_cast<BWAPI::Game*>(self)->resumeGame();
}

void Game_leaveGame(Game* self) {
    reinterpret_cast<BWAPI::Game*>(self)->leaveGame();
}

void Game_restartGame(Game* self) {
    reinterpret_cast<BWAPI::Game*>(self)->restartGame();
}

void Game_setLocalSpeed(Game* self, int speed) {
    reinterpret_cast<BWAPI::Game*>(self)->setLocalSpeed(speed);
}

bool Game_issueCommand(Game* self, UnitIterator* units, UnitCommand command) {
    IteratorBase* iter = reinterpret_cast<IteratorBase*>(units);
    assert(iter->id() == itUnit);
    BWAPI::Unitset unitset;
    for (; iter->valid(); iter->next()) {
        Unit* const unit = reinterpret_cast<Unit*>(iter->get());
        assert(unit);
        unitset.insert(cast_to_bw(unit));
    }
    return reinterpret_cast<BWAPI::Game*>(self)->issueCommand(unitset, cast_to_bw(command));
}

UnitIterator* Game_getSelectedUnits(Game* self) {
    const auto& units = reinterpret_cast<BWAPI::Game*>(self)->getSelectedUnits();
    return as_iter<UnitIterator>(units);
}

Player* Game_self(Game* self) {
    return reinterpret_cast<Player*>( reinterpret_cast<BWAPI::Game*>(self)->self() );
}

Player* Game_enemy(Game* self) {
    return reinterpret_cast<Player*>( reinterpret_cast<BWAPI::Game*>(self)->enemy() );
}

Player* Game_neutral(Game* self) {
    return reinterpret_cast<Player*>( reinterpret_cast<BWAPI::Game*>(self)->neutral() );
}

PlayerIterator* Game_allies(Game* self) {
    const auto& allies = reinterpret_cast<BWAPI::Game*>(self)->allies();
    return as_iter<PlayerIterator>(allies);
}

PlayerIterator* Game_enemies(Game* self) {
    const auto& enemies = reinterpret_cast<BWAPI::Game*>(self)->enemies();
    return as_iter<PlayerIterator>(enemies);
}

PlayerIterator* Game_observers(Game* self) {
    const auto& observers = reinterpret_cast<BWAPI::Game*>(self)->observers();
    return as_iter<PlayerIterator>(observers);
}

void Game_setTextSize(Game* self, TextSize size) {
    reinterpret_cast<BWAPI::Game*>(self)->setTextSize(cast_to_bw(size));
}

void Game_vDrawText(Game* self, CoordinateType ctype, int x, int y, const char* format, va_list args) {
    reinterpret_cast<BWAPI::Game*>(self)->vDrawText(cast_to_bw(ctype), x, y, format, args);
}

void Game_drawText(Game* self, CoordinateType ctype, int x, int y, const char* format, ...) {
    va_list args;
    va_start(args, format);
    reinterpret_cast<BWAPI::Game*>(self)->vDrawText(cast_to_bw(ctype), x, y, format, args);
    va_end(args);
}

void Game_drawTextMap(Game* self, Position p, const char* format, ...) {
    va_list args;
    va_start(args, format);
    reinterpret_cast<BWAPI::Game*>(self)->vDrawText(BWAPI::CoordinateType::Map, p.x, p.y, format, args);
    va_end(args);
}

void Game_drawTextMouse(Game* self, Position p, const char* format, ...) {
    va_list args;
    va_start(args, format);
    reinterpret_cast<BWAPI::Game*>(self)->vDrawText(BWAPI::CoordinateType::Mouse, p.x, p.y, format, args);
    va_end(args);
}

void Game_drawTextScreen(Game* self, Position p, const char* format, ...) {
    va_list args;
    va_start(args, format);
    reinterpret_cast<BWAPI::Game*>(self)->vDrawText(BWAPI::CoordinateType::Screen, p.x, p.y, format, args);
    va_end(args);
}

void Game_drawBox(Game* self, CoordinateType ctype, int left, int top, int right, int bottom, Color color, bool isSolid) {
    reinterpret_cast<BWAPI::Game*>(self)->drawBox(cast_to_bw(ctype), left, top, right, bottom, cast_to_bw(color), isSolid);
}

void Game_drawBoxMap(Game* self, Position leftTop, Position rightBottom, Color color, bool isSolid) {
    return reinterpret_cast<BWAPI::Game*>(self)->drawBoxMap(cast_to_bw(leftTop), cast_to_bw(rightBottom), cast_to_bw(color), isSolid);
}

void Game_drawBoxMouse(Game* self, Position leftTop, Position rightBottom, Color color, bool isSolid) {
    return reinterpret_cast<BWAPI::Game*>(self)->drawBoxMouse(cast_to_bw(leftTop), cast_to_bw(rightBottom), cast_to_bw(color), isSolid);
}

void Game_drawBoxScreen(Game* self, Position leftTop, Position rightBottom, Color color, bool isSolid) {
    reinterpret_cast<BWAPI::Game*>(self)->drawBoxScreen(cast_to_bw(leftTop), cast_to_bw(rightBottom), cast_to_bw(color), isSolid);
}

void Game_drawTriangle(Game* self, CoordinateType ctype, int ax, int ay, int bx, int by, int cx, int cy, Color color, bool isSolid) {
    reinterpret_cast<BWAPI::Game*>(self)->drawTriangle(cast_to_bw(ctype), ax, ay, bx, by, cx, cy, cast_to_bw(color), isSolid);
}

void Game_drawTriangleMap(Game* self, Position a, Position b, Position c, Color color, bool isSolid) {
    reinterpret_cast<BWAPI::Game*>(self)->drawTriangleMap(cast_to_bw(a), cast_to_bw(b), cast_to_bw(c), cast_to_bw(color), isSolid);
}

void Game_drawTriangleMouse(Game* self, Position a, Position b, Position c, Color color, bool isSolid) {
    reinterpret_cast<BWAPI::Game*>(self)->drawTriangleMouse(cast_to_bw(a), cast_to_bw(b), cast_to_bw(c), cast_to_bw(color), isSolid);
}

void Game_drawTriangleScreen(Game* self, Position a, Position b, Position c, Color color, bool isSolid) {
    reinterpret_cast<BWAPI::Game*>(self)->drawTriangleScreen(cast_to_bw(a), cast_to_bw(b), cast_to_bw(c), cast_to_bw(color), isSolid);
}

void Game_drawCircle(Game* self, CoordinateType ctype, int x, int y, int radius, Color color, bool isSolid) {
    reinterpret_cast<BWAPI::Game*>(self)->drawCircle(cast_to_bw(ctype), x, y, radius, cast_to_bw(color), isSolid);
}

void Game_drawCircleMap(Game* self, Position p, int radius, Color color, bool isSolid) {
    return reinterpret_cast<BWAPI::Game*>(self)->drawCircleMap(cast_to_bw(p), radius, cast_to_bw(color), isSolid);
}

void Game_drawCircleMouse(Game* self, Position p, int radius, Color color, bool isSolid) {
    return reinterpret_cast<BWAPI::Game*>(self)->drawCircleMouse(cast_to_bw(p), radius, cast_to_bw(color), isSolid);
}

void Game_drawCircleScreen(Game* self, Position p, int radius, Color color, bool isSolid) {
    return reinterpret_cast<BWAPI::Game*>(self)->drawCircleScreen(cast_to_bw(p), radius, cast_to_bw(color), isSolid);
}

void Game_drawEllipse(Game* self, CoordinateType ctype, int x, int y, int xrad, int yrad, Color color, bool isSolid) {
    reinterpret_cast<BWAPI::Game*>(self)->drawEllipse(cast_to_bw(ctype), x, y, xrad, yrad, cast_to_bw(color), isSolid);
}

void Game_drawEllipseMap(Game* self, Position p, int xrad, int yrad, Color color, bool isSolid) {
    return reinterpret_cast<BWAPI::Game*>(self)->drawEllipseMap(cast_to_bw(p), xrad, yrad, cast_to_bw(color), isSolid);
}

void Game_drawEllipseMouse(Game* self, Position p, int xrad, int yrad, Color color, bool isSolid) {
    reinterpret_cast<BWAPI::Game*>(self)->drawEllipseMouse(cast_to_bw(p), xrad, yrad, cast_to_bw(color), isSolid);
}

void Game_drawEllipseScreen(Game* self, Position p, int xrad, int yrad, Color color, bool isSolid) {
    reinterpret_cast<BWAPI::Game*>(self)->drawEllipseScreen(cast_to_bw(p), xrad, yrad, cast_to_bw(color), isSolid);
}

void Game_drawDot(Game* self, CoordinateType ctype, int x, int y, Color color) {
    reinterpret_cast<BWAPI::Game*>(self)->drawDot(cast_to_bw(ctype), x, y, cast_to_bw(color));
}

void Game_drawDotMap(Game* self, Position p, Color color) {
    reinterpret_cast<BWAPI::Game*>(self)->drawDotMap(cast_to_bw(p), cast_to_bw(color));
}

void Game_drawDotMouse(Game* self, Position p, Color color) {
    reinterpret_cast<BWAPI::Game*>(self)->drawDotMouse(cast_to_bw(p), cast_to_bw(color));
}

void Game_drawDotScreen(Game* self, Position p, Color color) {
    reinterpret_cast<BWAPI::Game*>(self)->drawDotScreen(cast_to_bw(p), cast_to_bw(color));
}

void Game_drawLine(Game* self, CoordinateType ctype, int x1, int y1, int x2, int y2, Color color) {
    reinterpret_cast<BWAPI::Game*>(self)->drawLine(cast_to_bw(ctype), x1, y1, x2, y2, cast_to_bw(color));
}

void Game_drawLineMap(Game* self, Position a, Position b, Color color) {
    reinterpret_cast<BWAPI::Game*>(self)->drawLineMap(cast_to_bw(a), cast_to_bw(b), cast_to_bw(color));
}

void Game_drawLineMouse(Game* self, Position a, Position b, Color color) {
    reinterpret_cast<BWAPI::Game*>(self)->drawLineMouse(cast_to_bw(a), cast_to_bw(b), cast_to_bw(color));
}

void Game_drawLineScreen(Game* self, Position a, Position b, Color color) {
    reinterpret_cast<BWAPI::Game*>(self)->drawLineScreen(cast_to_bw(a), cast_to_bw(b), cast_to_bw(color));
}

int Game_getLatencyFrames(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getLatencyFrames();
}

int Game_getLatencyTime(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getLatencyTime();
}

int Game_getRemainingLatencyFrames(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getRemainingLatencyFrames();
}

int Game_getRemainingLatencyTime(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getRemainingLatencyTime();
}

int Game_getRevision(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getRevision();
}

int Game_getClientVersion(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getClientVersion();
}

bool Game_isDebug(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->isDebug();
}

bool Game_isLatComEnabled(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->isLatComEnabled();
}

void Game_setLatCom(Game* self, bool isEnabled) {
    reinterpret_cast<BWAPI::Game*>(self)->setLatCom(isEnabled);
}

bool Game_isGUIEnabled(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->isGUIEnabled();
}

void Game_setGUI(Game* self, bool enabled) {
    reinterpret_cast<BWAPI::Game*>(self)->setGUI(enabled);
}

int Game_getInstanceNumber(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getInstanceNumber();
}

int Game_getAPM(Game* self, bool includeSelects) {
    return reinterpret_cast<BWAPI::Game*>(self)->getAPM(includeSelects);
}

bool Game_setMap(Game* self, const char* mapFileName) {
    return reinterpret_cast<BWAPI::Game*>(self)->setMap(mapFileName);
}

void Game_setFrameSkip(Game* self, int frameSkip) {
    reinterpret_cast<BWAPI::Game*>(self)->setFrameSkip(frameSkip);
}

bool Game_hasPath(Game* self, Position source, Position destination) {
    return reinterpret_cast<BWAPI::Game*>(self)->hasPath(cast_to_bw(source), cast_to_bw(destination));
}

bool Game_setAlliance(Game* self, Player* player, bool allied, bool alliedVictory) {
    return reinterpret_cast<BWAPI::Game*>(self)->setAlliance(reinterpret_cast<BWAPI::Player>(player), allied, alliedVictory);
}

bool Game_setVision(Game* self, Player* player, bool enabled) {
    return reinterpret_cast<BWAPI::Game*>(self)->setVision(reinterpret_cast<BWAPI::Player>(player), enabled);
}

int Game_elapsedTime(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->elapsedTime();
}

void Game_setCommandOptimizationLevel(Game* self, int level) {
    return reinterpret_cast<BWAPI::Game*>(self)->setCommandOptimizationLevel(level);
}

int Game_countdownTimer(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->countdownTimer();
}

RegionIterator* Game_getAllRegions(Game* self) {
    const auto& regions = reinterpret_cast<BWAPI::Game*>(self)->getAllRegions();
    return as_iter<RegionIterator>(regions);
}

Region* Game_getRegionAt(Game* self, Position position) {
    return reinterpret_cast<Region*>( reinterpret_cast<BWAPI::Game*>(self)->getRegionAt(cast_to_bw(position)) );
}

int Game_getLastEventTime(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getLastEventTime();
}

bool Game_setRevealAll(Game* self, bool reveal) {
    return reinterpret_cast<BWAPI::Game*>(self)->setRevealAll(reveal);
}

TilePosition Game_getBuildLocation(Game* self, UnitType type, TilePosition desiredPosition, int maxRange, bool creep) {
    return cast_from_bw( reinterpret_cast<BWAPI::Game*>(self)->getBuildLocation(cast_to_bw(type), cast_to_bw(desiredPosition), maxRange, creep) );
}

int Game_getDamageFrom(Game* self, UnitType fromType, UnitType toType, Player* fromPlayer, Player* toPlayer) {
    return reinterpret_cast<BWAPI::Game*>(self)->getDamageFrom(cast_to_bw(fromType), cast_to_bw(toType), reinterpret_cast<BWAPI::Player>(fromPlayer), reinterpret_cast<BWAPI::Player>(toPlayer));
}

int Game_getDamageTo(Game* self, UnitType toType, UnitType fromType, Player* toPlayer, Player* fromPlayer) {
    return reinterpret_cast<BWAPI::Game*>(self)->getDamageTo(cast_to_bw(toType), cast_to_bw(fromType), reinterpret_cast<BWAPI::Player>(toPlayer), reinterpret_cast<BWAPI::Player>(fromPlayer));
}

unsigned Game_getRandomSeed(Game* self) {
    return reinterpret_cast<BWAPI::Game*>(self)->getRandomSeed();
}

void Game_registerEvent(Game* self, void (* const action)(Game*), bool (* const condition)(Game*),
                        int timesToRun, int framesToCheck) {
    Interface_registerEvent<Game>(self, action, condition, timesToRun, framesToCheck);
}