| 38 | // ----- |
| 39 | |
| 40 | void SIntConfigVariable::CommandCallback(IConsole::IResult *pResult, void *pUserData) |
| 41 | { |
| 42 | SIntConfigVariable *pData = static_cast<SIntConfigVariable *>(pUserData); |
| 43 | |
| 44 | if(pResult->NumArguments()) |
| 45 | { |
| 46 | if(pData->CheckReadOnly()) |
| 47 | return; |
| 48 | |
| 49 | int Value = pResult->GetInteger(0); |
| 50 | |
| 51 | // do clamping |
| 52 | if(pData->m_Min != pData->m_Max) |
| 53 | { |
| 54 | if(Value < pData->m_Min) |
| 55 | Value = pData->m_Min; |
| 56 | if(pData->m_Max != 0 && Value > pData->m_Max) |
| 57 | Value = pData->m_Max; |
| 58 | } |
| 59 | |
| 60 | *pData->m_pVariable = Value; |
| 61 | if(pResult->m_ClientId != IConsole::CLIENT_ID_GAME) |
| 62 | pData->m_OldValue = Value; |
| 63 | } |
| 64 | else |
| 65 | { |
| 66 | char aBuf[32]; |
| 67 | str_format(aBuf, sizeof(aBuf), "Value: %d", *pData->m_pVariable); |
| 68 | pData->m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "config", aBuf); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | void SIntConfigVariable::Register() |
| 73 | { |
nothing calls this directly
no test coverage detected