//////////////////////////////////////////////////////////////////////////// log a string to the console and or to the file with support for different languages
| 503 | //log a string to the console and or to the file with support for different |
| 504 | //languages |
| 505 | void CScriptObjectSystem::LogString(IFunctionHandler *pH,bool bToConsoleOnly) |
| 506 | { |
| 507 | const char *sParam=NULL; |
| 508 | string szText; |
| 509 | |
| 510 | //get the text |
| 511 | /*ScriptVarType varType=pH->GetParamType(1); |
| 512 | |
| 513 | if (varType==svtString) |
| 514 | { |
| 515 | //this is a string, set directly |
| 516 | pH->GetParam(1,sParam); |
| 517 | } |
| 518 | else |
| 519 | if (varType==svtNumber) |
| 520 | { |
| 521 | int nStringID; |
| 522 | //this is an id of a string table for different languages |
| 523 | if (pH->GetParam(1,nStringID)) |
| 524 | { |
| 525 | szText="MUST BE PUT BACK"; //m_pGame->m_StringTableMgr.EnumString(nStringID); |
| 526 | sParam=szText.c_str(); |
| 527 | } |
| 528 | }*/ |
| 529 | |
| 530 | pH->GetParam(1,sParam); |
| 531 | |
| 532 | if (sParam) |
| 533 | { |
| 534 | // add the "<Lua> " prefix to understand that this message |
| 535 | // has been called from a script function |
| 536 | char sLogMessage[1024]; |
| 537 | |
| 538 | if(sParam[0]<=5 && sParam[0]!=0) |
| 539 | { |
| 540 | sLogMessage[0] = sParam[0]; |
| 541 | strcpy(&sLogMessage[1], "<Lua> "); |
| 542 | strncat(sLogMessage, &sParam[1], sizeof(sLogMessage)-6); |
| 543 | } |
| 544 | else |
| 545 | { |
| 546 | strcpy(sLogMessage, "<Lua> "); |
| 547 | strncat(sLogMessage, sParam, sizeof(sLogMessage)-6); |
| 548 | } |
| 549 | |
| 550 | sLogMessage[sizeof(sLogMessage)-1]=0; |
| 551 | |
| 552 | if (bToConsoleOnly) |
| 553 | m_pLog->LogToConsole(sLogMessage); |
| 554 | else |
| 555 | m_pLog->Log(sLogMessage); |
| 556 | } |
| 557 | |
| 558 | } |
| 559 | |
| 560 | ///////////////////////////////////////////////////////////////////////////////// |
| 561 | ///////////////////////////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected