Differences From Artifact [11dc4e9109]:
- File src/cube.h — part of check-in [0a0d4f9155] at 2024-07-20 15:08:41 on branch trunk — Run clang-format on the entire codebase (user: js, size: 12272) [annotate] [blame] [check-ins using]
To Artifact [ac53062292]:
- File
src/cube.h
— part of check-in
[1ee33c9983]
at
2024-08-03 14:50:31
on branch trunk
— Don't depend on global constructors for commands
This breaks when using ObjC, as these can run before the ObjC module is initialized, resulting in non-working message sends as the selectors are not registered yet. (user: js, size: 14172) [annotate] [blame] [check-ins using]
1 2 3 4 5 6 7 8 9 | // one big bad include file for the whole engine... nasty! #include "tools.h" enum // block types, order matters! { SOLID = 0, // entirely solid cube [only specifies wtex] CORNER, // half full corner of a wall FHF, // floor heightfield using neighbour vdelta values | > > | 1 2 3 4 5 6 7 8 9 10 11 | // one big bad include file for the whole engine... nasty! #import <ObjFW/ObjFW.h> #include "tools.h" enum // block types, order matters! { SOLID = 0, // entirely solid cube [only specifies wtex] CORNER, // half full corner of a wall FHF, // floor heightfield using neighbour vdelta values |
︙ | ︙ | |||
386 387 388 389 390 391 392 | ARG_2EST, ARG_VARI }; // nasty macros for registering script functions, abuses globals to avoid // excessive infrastructure #define COMMANDN(name, fun, nargs) \ | > > > | > > > > > > | > > > > > > | > > > | > > > | > > > > > > | | > > | 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 | ARG_2EST, ARG_VARI }; // nasty macros for registering script functions, abuses globals to avoid // excessive infrastructure #define COMMANDN(name, fun, nargs) \ OF_CONSTRUCTOR() \ { \ enqueueInit(#name, ^{ \ addcommand(#name, (void (*)())fun, nargs); \ }); \ } #define COMMAND(name, nargs) COMMANDN(name, name, nargs) #define VARP(name, min, cur, max) \ int name; \ OF_CONSTRUCTOR() \ { \ enqueueInit(#name, ^{ \ name = variable(#name, min, cur, max, &name, NULL, true); \ }); \ } #define VAR(name, min, cur, max) \ int name; \ OF_CONSTRUCTOR() \ { \ enqueueInit(#name, ^{ \ name = variable(#name, min, cur, max, &name, NULL, false); \ }); \ } #define VARF(name, min, cur, max, body) \ void var_##name(); \ static int name; \ OF_CONSTRUCTOR() \ { \ enqueueInit(#name, ^{ \ name = variable( \ #name, min, cur, max, &name, var_##name, false); \ }); \ } \ void var_##name() { body; } #define VARFP(name, min, cur, max, body) \ void var_##name(); \ static int name; \ OF_CONSTRUCTOR() \ { \ enqueueInit(#name, ^{ \ name = \ variable(#name, min, cur, max, &name, var_##name, true); \ }); \ } \ void var_##name() { body; } #define ATOI(s) strtol(s, NULL, 0) // supports hexadecimal numbers #ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include "windows.h" |
︙ | ︙ |