| 841 | } |
| 842 | |
| 843 | void ScriptExt::VariablesHandler(TeamClass* pTeam, PhobosScripts eAction, int nArg) |
| 844 | { |
| 845 | struct operation_set { int operator()(const int& a, const int& b) { return b; } }; |
| 846 | struct operation_add { int operator()(const int& a, const int& b) { return a + b; } }; |
| 847 | struct operation_minus { int operator()(const int& a, const int& b) { return a - b; } }; |
| 848 | struct operation_multiply { int operator()(const int& a, const int& b) { return a * b; } }; |
| 849 | struct operation_divide { int operator()(const int& a, const int& b) { return a / b; } }; |
| 850 | struct operation_mod { int operator()(const int& a, const int& b) { return a % b; } }; |
| 851 | struct operation_leftshift { int operator()(const int& a, const int& b) { return a << b; } }; |
| 852 | struct operation_rightshift { int operator()(const int& a, const int& b) { return a >> b; } }; |
| 853 | struct operation_reverse { int operator()(const int& a, const int& b) { return ~a; } }; |
| 854 | struct operation_xor { int operator()(const int& a, const int& b) { return a ^ b; } }; |
| 855 | struct operation_or { int operator()(const int& a, const int& b) { return a | b; } }; |
| 856 | struct operation_and { int operator()(const int& a, const int& b) { return a & b; } }; |
| 857 | |
| 858 | int nLoArg = LOWORD(nArg); |
| 859 | int nHiArg = HIWORD(nArg); |
| 860 | |
| 861 | switch (eAction) |
| 862 | { |
| 863 | case PhobosScripts::LocalVariableSet: |
| 864 | ScriptExt::VariableOperationHandler<false, operation_set>(pTeam, nLoArg, nHiArg); break; |
| 865 | case PhobosScripts::LocalVariableAdd: |
| 866 | ScriptExt::VariableOperationHandler<false, operation_add>(pTeam, nLoArg, nHiArg); break; |
| 867 | case PhobosScripts::LocalVariableMinus: |
| 868 | ScriptExt::VariableOperationHandler<false, operation_minus>(pTeam, nLoArg, nHiArg); break; |
| 869 | case PhobosScripts::LocalVariableMultiply: |
| 870 | ScriptExt::VariableOperationHandler<false, operation_multiply>(pTeam, nLoArg, nHiArg); break; |
| 871 | case PhobosScripts::LocalVariableDivide: |
| 872 | ScriptExt::VariableOperationHandler<false, operation_divide>(pTeam, nLoArg, nHiArg); break; |
| 873 | case PhobosScripts::LocalVariableMod: |
| 874 | ScriptExt::VariableOperationHandler<false, operation_mod>(pTeam, nLoArg, nHiArg); break; |
| 875 | case PhobosScripts::LocalVariableLeftShift: |
| 876 | ScriptExt::VariableOperationHandler<false, operation_leftshift>(pTeam, nLoArg, nHiArg); break; |
| 877 | case PhobosScripts::LocalVariableRightShift: |
| 878 | ScriptExt::VariableOperationHandler<false, operation_rightshift>(pTeam, nLoArg, nHiArg); break; |
| 879 | case PhobosScripts::LocalVariableReverse: |
| 880 | ScriptExt::VariableOperationHandler<false, operation_reverse>(pTeam, nLoArg, nHiArg); break; |
| 881 | case PhobosScripts::LocalVariableXor: |
| 882 | ScriptExt::VariableOperationHandler<false, operation_xor>(pTeam, nLoArg, nHiArg); break; |
| 883 | case PhobosScripts::LocalVariableOr: |
| 884 | ScriptExt::VariableOperationHandler<false, operation_or>(pTeam, nLoArg, nHiArg); break; |
| 885 | case PhobosScripts::LocalVariableAnd: |
| 886 | ScriptExt::VariableOperationHandler<false, operation_and>(pTeam, nLoArg, nHiArg); break; |
| 887 | case PhobosScripts::GlobalVariableSet: |
| 888 | ScriptExt::VariableOperationHandler<true, operation_set>(pTeam, nLoArg, nHiArg); break; |
| 889 | case PhobosScripts::GlobalVariableAdd: |
| 890 | ScriptExt::VariableOperationHandler<true, operation_add>(pTeam, nLoArg, nHiArg); break; |
| 891 | case PhobosScripts::GlobalVariableMinus: |
| 892 | ScriptExt::VariableOperationHandler<true, operation_minus>(pTeam, nLoArg, nHiArg); break; |
| 893 | case PhobosScripts::GlobalVariableMultiply: |
| 894 | ScriptExt::VariableOperationHandler<true, operation_multiply>(pTeam, nLoArg, nHiArg); break; |
| 895 | case PhobosScripts::GlobalVariableDivide: |
| 896 | ScriptExt::VariableOperationHandler<true, operation_divide>(pTeam, nLoArg, nHiArg); break; |
| 897 | case PhobosScripts::GlobalVariableMod: |
| 898 | ScriptExt::VariableOperationHandler<true, operation_mod>(pTeam, nLoArg, nHiArg); break; |
| 899 | case PhobosScripts::GlobalVariableLeftShift: |
| 900 | ScriptExt::VariableOperationHandler<true, operation_leftshift>(pTeam, nLoArg, nHiArg); break; |
nothing calls this directly
no outgoing calls
no test coverage detected