| 561 | |
| 562 | |
| 563 | void ConsoleValue::setStackStringValue(const char *value) |
| 564 | { |
| 565 | if (value == NULL) value = typeValueEmpty; |
| 566 | |
| 567 | if(type <= ConsoleValue::TypeInternalString) |
| 568 | { |
| 569 | // sval might still be temporarily present so we need to check and free it |
| 570 | if (bufferLen > 0) |
| 571 | { |
| 572 | dFree(sval); |
| 573 | bufferLen = 0; |
| 574 | } |
| 575 | |
| 576 | if (value == typeValueEmpty) |
| 577 | { |
| 578 | sval = typeValueEmpty; |
| 579 | fval = 0.f; |
| 580 | ival = 0; |
| 581 | type = TypeInternalString; |
| 582 | return; |
| 583 | } |
| 584 | |
| 585 | U32 stringLen = dStrlen(value); |
| 586 | if(stringLen < 256) |
| 587 | { |
| 588 | fval = dAtof(value); |
| 589 | ival = dAtoi(value); |
| 590 | } |
| 591 | else |
| 592 | { |
| 593 | fval = 0.f; |
| 594 | ival = 0; |
| 595 | } |
| 596 | |
| 597 | type = TypeInternalStackString; |
| 598 | sval = (char*)value; |
| 599 | bufferLen = 0; |
| 600 | } |
| 601 | else |
| 602 | Con::setData(type, dataPtr, 0, 1, &value, enumTable); |
| 603 | } |
| 604 | |
| 605 | void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue) |
| 606 | { |
no test coverage detected