MCPcopy Create free account
hub / github.com/assaultcube/AC / execbind

Function execbind

source/src/console.cpp:458–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458void execbind(keym &k, bool isdown)
459{
460 loopv(releaseactions)
461 {
462 releaseaction &ra = releaseactions[i];
463 if(ra.key==&k)
464 {
465 if(!isdown) execute(ra.action);
466 delete[] ra.action;
467 releaseactions.remove(i--);
468 }
469 }
470 if(isdown)
471 {
472 int state = keym::ACTION_DEFAULT;
473 if(editmode) state = keym::ACTION_EDITING;
474 else if(player1->isspectating()) state = keym::ACTION_SPECTATOR;
475 char *&action = k.actions[state][0] ? k.actions[state] : k.actions[keym::ACTION_DEFAULT];
476 keyaction = action;
477 keypressed = &k;
478 execute(keyaction);
479 keypressed = NULL;
480 if(keyaction!=action) delete[] keyaction;
481 }
482 k.pressed = isdown;
483}
484
485void consolekey(int code, bool isdown, SDL_Keymod mod)
486{

Callers 1

keypressFunction · 0.85

Calls 2

executeFunction · 0.85
isspectatingMethod · 0.80

Tested by

no test coverage detected