diff options
author | krzys-h <krzys_h@interia.pl> | 2014-10-19 16:18:36 +0200 |
---|---|---|
committer | krzys-h <krzys_h@interia.pl> | 2014-10-19 16:18:36 +0200 |
commit | 0245fdc6c328edf65b4fd9f45be4f440ef92b6eb (patch) | |
tree | d8237bdeacdee273c2eabaefc14f21637c1f489a /src/ui/displayinfo.cpp | |
parent | d7ef0a1a5f7cee44eb8faaafefb7bb78e69be1f6 (diff) | |
parent | 83abb8ca8e74176d64944e9681d74aa11ef6cdf9 (diff) | |
download | colobot-0245fdc6c328edf65b4fd9f45be4f440ef92b6eb.tar.gz colobot-0245fdc6c328edf65b4fd9f45be4f440ef92b6eb.tar.bz2 colobot-0245fdc6c328edf65b4fd9f45be4f440ef92b6eb.zip |
Merge branch 'dev-physfs' into dev
Conflicts:
src/app/app.cpp
Diffstat (limited to 'src/ui/displayinfo.cpp')
-rw-r--r-- | src/ui/displayinfo.cpp | 282 |
1 files changed, 0 insertions, 282 deletions
diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp index 891c1ab..aceb5b0 100644 --- a/src/ui/displayinfo.cpp +++ b/src/ui/displayinfo.cpp @@ -344,8 +344,6 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc m_index = index; m_bSoluce = bSoluce; -//? CreateObjectsFile(); - m_bEditLock = m_main->GetEditLock(); if ( m_bEditLock ) // edition running program? { @@ -937,284 +935,4 @@ CObject* CDisplayInfo::SearchToto() return 0; } - -// Creating the list of objects. - -struct ObjectList -{ - int total; - ObjectType type; -}; - -void ObjectAdd(ObjectList list[], ObjectType type) -{ - int i; - - for ( i=0 ; i<200 ; i++ ) - { - if ( list[i].total == 0 ) - { - list[i].total ++; - list[i].type = type; - list[i+1].total = 0; - return; - } - if ( list[i].type == type ) - { - list[i].total ++; - return; - } - } -} - -void ObjectWrite(FILE* file, ObjectList list[], int i) -{ - std::string line; - - if ( list[i].total < 10 ) - { - line = StrUtils::Format("\\c; %dx \\n;\\l;", list[i].total); - } - else - { - line = StrUtils::Format("\\c;%dx \\n;\\l;", list[i].total); - } - - std::string res; - GetResource(RES_OBJECT, list[i].type, res); - if (res.empty()) - return; - - line += res; - - line += "\\u "; - - std::string helpFilename = GetHelpFilename(list[i].type); - if (helpFilename.empty()) - return; - - line += helpFilename.substr(7); // skip "help\?\" - - auto pos = line.find(".txt"); - if (pos != std::string::npos) - { - line = line.substr(0, pos); - } - - line += ";\n"; - - fputs(line.c_str(), file); -} - -// Creates the file containing the list of objects. - -void CDisplayInfo::CreateObjectsFile() -{ - FILE* file; - CObject* pObj; - ObjectType type; - ObjectList list[200]; - std::string line; - int i; - bool bRadar, bAtLeast; - - CInstanceManager* iMan = CInstanceManager::GetInstancePointer(); - - file = fopen((std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("objects.txt")).c_str(), "w"); - if ( file == 0 ) return; - - list[0].total = 0; // empty list - bRadar = false; - for ( i=0 ; i<1000000 ; i++ ) - { - pObj = static_cast<CObject*>(iMan->SearchInstance(CLASS_OBJECT, i)); - if ( pObj == 0 ) break; - - if ( !pObj->GetActif() ) continue; - if ( !pObj->GetSelectable() ) continue; - if ( pObj->GetProxyActivate() ) continue; - - type = pObj->GetType(); - if ( type == OBJECT_NULL ) continue; - if ( type == OBJECT_FIX ) continue; - - ObjectAdd(list, type); - - if ( type == OBJECT_RADAR ) bRadar = true; - } - - if ( bRadar ) - { - GetResource(RES_TEXT, RT_SATCOM_LIST, line); - fputs(line.c_str(), file); - bAtLeast = false; - for ( i=0 ; i<200 ; i++ ) - { - if ( list[i].total == 0 ) break; // end of the list? - - if ( list[i].type == OBJECT_BASE || - list[i].type == OBJECT_HUMAN ) - { - ObjectWrite(file, list, i); - bAtLeast = true; - } - } - if ( !bAtLeast ) - { - GetResource(RES_TEXT, RT_SATCOM_NULL, line); - fputs(line.c_str(), file); - } - - fputs("\n", file); - GetResource(RES_TEXT, RT_SATCOM_BOT, line); - fputs(line.c_str(), file); - bAtLeast = false; - for ( i=0 ; i<200 ; i++ ) - { - if ( list[i].total == 0 ) break; // end of the list? - - if ( list[i].type == OBJECT_MOBILEwt || - list[i].type == OBJECT_MOBILEtt || - list[i].type == OBJECT_MOBILEft || - list[i].type == OBJECT_MOBILEit || - list[i].type == OBJECT_MOBILEwa || - list[i].type == OBJECT_MOBILEta || - list[i].type == OBJECT_MOBILEfa || - list[i].type == OBJECT_MOBILEia || - list[i].type == OBJECT_MOBILEwc || - list[i].type == OBJECT_MOBILEtc || - list[i].type == OBJECT_MOBILEfc || - list[i].type == OBJECT_MOBILEic || - list[i].type == OBJECT_MOBILEwi || - list[i].type == OBJECT_MOBILEti || - list[i].type == OBJECT_MOBILEfi || - list[i].type == OBJECT_MOBILEii || - list[i].type == OBJECT_MOBILEws || - list[i].type == OBJECT_MOBILEts || - list[i].type == OBJECT_MOBILEfs || - list[i].type == OBJECT_MOBILEis || - list[i].type == OBJECT_MOBILErt || - list[i].type == OBJECT_MOBILErc || - list[i].type == OBJECT_MOBILErr || - list[i].type == OBJECT_MOBILErs || - list[i].type == OBJECT_MOBILEsa || - list[i].type == OBJECT_MOBILEtg || - list[i].type == OBJECT_MOBILEdr ) - { - ObjectWrite(file, list, i); - bAtLeast = true; - } - } - if ( !bAtLeast ) - { - GetResource(RES_TEXT, RT_SATCOM_NULL, line); - fputs(line.c_str(), file); - } - - fputs("\n", file); - GetResource(RES_TEXT, RT_SATCOM_BUILDING, line); - fputs(line.c_str(), file); - bAtLeast = false; - for ( i=0 ; i<200 ; i++ ) - { - if ( list[i].total == 0 ) break; // end of the list? - - if ( list[i].type == OBJECT_DERRICK || - list[i].type == OBJECT_FACTORY || - list[i].type == OBJECT_STATION || - list[i].type == OBJECT_CONVERT || - list[i].type == OBJECT_REPAIR || - list[i].type == OBJECT_DESTROYER|| - list[i].type == OBJECT_TOWER || - list[i].type == OBJECT_NEST || - list[i].type == OBJECT_RESEARCH || - list[i].type == OBJECT_RADAR || - list[i].type == OBJECT_ENERGY || - list[i].type == OBJECT_LABO || - list[i].type == OBJECT_NUCLEAR || - list[i].type == OBJECT_START || - list[i].type == OBJECT_END || - list[i].type == OBJECT_INFO || - list[i].type == OBJECT_PARA || - list[i].type == OBJECT_TARGET1 || - list[i].type == OBJECT_TARGET2 || - list[i].type == OBJECT_SAFE || - list[i].type == OBJECT_HUSTON ) - { - ObjectWrite(file, list, i); - bAtLeast = true; - } - } - if ( !bAtLeast ) - { - GetResource(RES_TEXT, RT_SATCOM_NULL, line); - fputs(line.c_str(), file); - } - - fputs("\n", file); - GetResource(RES_TEXT, RT_SATCOM_FRET, line); - fputs(line.c_str(), file); - bAtLeast = false; - for ( i=0 ; i<200 ; i++ ) - { - if ( list[i].total == 0 ) break; // end of the list? - - if ( list[i].type == OBJECT_STONE || - list[i].type == OBJECT_URANIUM || - list[i].type == OBJECT_METAL || - list[i].type == OBJECT_POWER || - list[i].type == OBJECT_ATOMIC || - list[i].type == OBJECT_BULLET || - list[i].type == OBJECT_BBOX || - list[i].type == OBJECT_TNT ) - { - ObjectWrite(file, list, i); - bAtLeast = true; - } - } - if ( !bAtLeast ) - { - GetResource(RES_TEXT, RT_SATCOM_NULL, line); - fputs(line.c_str(), file); - } - - fputs("\n", file); - GetResource(RES_TEXT, RT_SATCOM_ALIEN, line); - fputs(line.c_str(), file); - bAtLeast = false; - for ( i=0 ; i<200 ; i++ ) - { - if ( list[i].total == 0 ) break; // end of the list? - - if ( list[i].type == OBJECT_MOTHER || - list[i].type == OBJECT_ANT || - list[i].type == OBJECT_BEE || - list[i].type == OBJECT_WORM || - list[i].type == OBJECT_SPIDER ) - { - ObjectWrite(file, list, i); - bAtLeast = true; - } - } - if ( !bAtLeast ) - { - GetResource(RES_TEXT, RT_SATCOM_NULL, line); - fputs(line.c_str(), file); - } - } - else - { - GetResource(RES_TEXT, RT_SATCOM_ERROR1, line); - fputs(line.c_str(), file); - GetResource(RES_TEXT, RT_SATCOM_ERROR2, line); - fputs(line.c_str(), file); - } - - fputs("\n", file); - - fclose(file); -} - - } - |