Skip to content

Commit

Permalink
Indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Eli2 committed Jun 4, 2014
1 parent bac7505 commit 552f096
Showing 1 changed file with 155 additions and 155 deletions.
310 changes: 155 additions & 155 deletions src/gui/Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,167 +881,57 @@ void GetInfosCombineWithIO(Entity * _pWithIO)
{
if(!COMBINE)
return;

std::string tcIndent = COMBINE->idString();

char tTxtCombineDest[256];

if(_pWithIO && _pWithIO != COMBINE && _pWithIO->script.data) {
char* pCopyScript = new char[_pWithIO->script.size + 1];
pCopyScript[_pWithIO->script.size] = '\0';
memcpy(pCopyScript, _pWithIO->script.data, _pWithIO->script.size);

char* pCopyOverScript = NULL;

if(_pWithIO->over_script.data) {
pCopyOverScript = new char[_pWithIO->over_script.size + 1];
pCopyOverScript[_pWithIO->over_script.size] = '\0';
memcpy(pCopyOverScript, _pWithIO->over_script.data, _pWithIO->over_script.size);
}

char *pcFound = NULL;

if(pCopyOverScript) {
pcFound = strstr((char*)pCopyOverScript, "on combine");

if(pcFound) {
unsigned int uiNbOpen = 0;

char *pcToken = strtok(pcFound, "\r\n");

if(strstr(pcToken, "{")) {
uiNbOpen++;
}

while(pcToken) {
pcToken = strtok(NULL, "\r\n");

bool bCanCombine = false;
char* pStartString;
char* pEndString;

pStartString = findParam(pcToken, "isclass");
if(pStartString) {
pStartString = strstr(pStartString, "\"");

if(pStartString) {
pStartString++;
pEndString = strstr(pStartString, "\"");

if(pEndString) {
memcpy(tTxtCombineDest, pStartString, pEndString - pStartString);
tTxtCombineDest[pEndString - pStartString] = 0;

if(tTxtCombineDest == COMBINE->className()) {
//same class
bCanCombine = true;
}
}
}
} else {
pStartString = findParam(pcToken, "==");
if(pStartString) {
pStartString = strstr(pStartString, "\"");

if(pStartString) {
pStartString++;
pEndString = strstr(pStartString, "\"");

if(pEndString) {
memcpy(tTxtCombineDest, pStartString, pEndString - pStartString);
tTxtCombineDest[pEndString - pStartString] = 0;

if(tTxtCombineDest == tcIndent) {
//same class
bCanCombine=true;
}
}
}
} else {
pStartString = findParam(pcToken, "isgroup");
if(pStartString) {
pStartString = strstr(pStartString, " ");

if(pStartString) {
pStartString++;
pEndString = strstr(pStartString, " ");
char* pEndString2 = strstr(pStartString, ")");

if(pEndString2 < pEndString) {
pEndString = pEndString2;
}

if(pEndString) {
memcpy(tTxtCombineDest, pStartString, pEndString - pStartString);
tTxtCombineDest[pEndString - pStartString] = 0;
if(COMBINE->groups.find(tTxtCombineDest) != COMBINE->groups.end()) {
//same class
bCanCombine = true;
}
}
}
}
}
}

if(strstr(pcToken, "{")) {
uiNbOpen++;
}

if(strstr(pcToken, "}")) {
uiNbOpen--;
}

if(bCanCombine) {
uiNbOpen = 0;
_pWithIO->ioflags |= IO_CAN_COMBINE;
} else {
_pWithIO->ioflags &= ~IO_CAN_COMBINE;
}

if(!uiNbOpen) {
break;
}
}
}
}

if(_pWithIO->ioflags & IO_CAN_COMBINE) {
delete[] pCopyScript;
delete[] pCopyOverScript;
return;
}

pcFound = strstr((char*)pCopyScript, "on combine");

char tTxtCombineDest[256];

if(_pWithIO && _pWithIO != COMBINE && _pWithIO->script.data) {
char* pCopyScript = new char[_pWithIO->script.size + 1];
pCopyScript[_pWithIO->script.size] = '\0';
memcpy(pCopyScript, _pWithIO->script.data, _pWithIO->script.size);

char* pCopyOverScript = NULL;

if(_pWithIO->over_script.data) {
pCopyOverScript = new char[_pWithIO->over_script.size + 1];
pCopyOverScript[_pWithIO->over_script.size] = '\0';
memcpy(pCopyOverScript, _pWithIO->over_script.data, _pWithIO->over_script.size);
}

char *pcFound = NULL;

if(pCopyOverScript) {
pcFound = strstr((char*)pCopyOverScript, "on combine");

if(pcFound) {
unsigned int uiNbOpen=0;

unsigned int uiNbOpen = 0;
char *pcToken = strtok(pcFound, "\r\n");

if(strstr(pcToken,"{")) {
if(strstr(pcToken, "{")) {
uiNbOpen++;
}

while(pcToken) {
pcToken = strtok(NULL, "\r\n");

bool bCanCombine = false;
char* pStartString;
char* pEndString;

pStartString = findParam(pcToken, "isclass");
if(pStartString) {
pStartString = strstr(pStartString, "\"");

if(pStartString) {
pStartString++;
pEndString = strstr(pStartString, "\"");

if(pEndString) {
memcpy(tTxtCombineDest, pStartString, pEndString - pStartString);
tTxtCombineDest[pEndString - pStartString] = 0;

if(tTxtCombineDest == COMBINE->className()) {
//same class
bCanCombine = true;
Expand All @@ -1052,73 +942,183 @@ void GetInfosCombineWithIO(Entity * _pWithIO)
pStartString = findParam(pcToken, "==");
if(pStartString) {
pStartString = strstr(pStartString, "\"");

if(pStartString) {
pStartString++;
pEndString = strstr(pStartString, "\"");

if(pEndString) {
memcpy(tTxtCombineDest, pStartString, pEndString - pStartString);
tTxtCombineDest[pEndString - pStartString] = 0;

if(tTxtCombineDest == tcIndent) {
//same class
bCanCombine = true;
bCanCombine=true;
}
}
}
} else {
pStartString = findParam(pcToken, "isgroup");
if(pStartString) {
pStartString = strstr(pStartString, " ");

if(pStartString) {
pStartString++;
pEndString = strstr(pStartString, " ");
char* pEndString2 = strstr(pStartString, ")");

if(pEndString2 < pEndString) {
pEndString = pEndString2;
}

if(pEndString) {
memcpy(tTxtCombineDest, pStartString, pEndString - pStartString);
tTxtCombineDest[pEndString - pStartString] = 0;

if(COMBINE->groups.find(tTxtCombineDest) != COMBINE->groups.end()) {
// same class
//same class
bCanCombine = true;
}
}
}
}
}
}

if(strstr(pcToken, "{")) {
uiNbOpen++;
}

if(strstr(pcToken, "}")) {
uiNbOpen--;
}

if(bCanCombine) {
uiNbOpen = 0;
_pWithIO->ioflags |= IO_CAN_COMBINE;
} else {
_pWithIO->ioflags &= ~IO_CAN_COMBINE;
}

if(!uiNbOpen) {
break;
}
}
}

}

if(_pWithIO->ioflags & IO_CAN_COMBINE) {
delete[] pCopyScript;
delete[] pCopyOverScript;
return;
}

pcFound = strstr((char*)pCopyScript, "on combine");

if(pcFound) {
unsigned int uiNbOpen=0;

char *pcToken = strtok(pcFound, "\r\n");

if(strstr(pcToken,"{")) {
uiNbOpen++;
}

while(pcToken) {
pcToken = strtok(NULL, "\r\n");

bool bCanCombine = false;
char* pStartString;
char* pEndString;

pStartString = findParam(pcToken, "isclass");
if(pStartString) {
pStartString = strstr(pStartString, "\"");

if(pStartString) {
pStartString++;
pEndString = strstr(pStartString, "\"");

if(pEndString) {
memcpy(tTxtCombineDest, pStartString, pEndString - pStartString);
tTxtCombineDest[pEndString - pStartString] = 0;

if(tTxtCombineDest == COMBINE->className()) {
//same class
bCanCombine = true;
}
}
}
} else {
pStartString = findParam(pcToken, "==");
if(pStartString) {
pStartString = strstr(pStartString, "\"");

if(pStartString) {
pStartString++;
pEndString = strstr(pStartString, "\"");

if(pEndString) {
memcpy(tTxtCombineDest, pStartString, pEndString - pStartString);
tTxtCombineDest[pEndString - pStartString] = 0;

if(tTxtCombineDest == tcIndent) {
//same class
bCanCombine = true;
}
}
}
} else {
pStartString = findParam(pcToken, "isgroup");
if(pStartString) {
pStartString = strstr(pStartString, " ");

if(pStartString) {
pStartString++;
pEndString = strstr(pStartString, " ");
char* pEndString2 = strstr(pStartString, ")");

if(pEndString2 < pEndString) {
pEndString = pEndString2;
}

if(pEndString) {
memcpy(tTxtCombineDest, pStartString, pEndString - pStartString);
tTxtCombineDest[pEndString - pStartString] = 0;

if(COMBINE->groups.find(tTxtCombineDest) != COMBINE->groups.end()) {
// same class
bCanCombine = true;
}
}
}
}
}
}

if(strstr(pcToken, "{")) {
uiNbOpen++;
}

if(strstr(pcToken, "}")) {
uiNbOpen--;
}

if(bCanCombine) {
uiNbOpen = 0;
_pWithIO->ioflags |= IO_CAN_COMBINE;
} else {
_pWithIO->ioflags &= ~IO_CAN_COMBINE;
}

if(!uiNbOpen) {
break;
}
}
}

delete[] pCopyScript;
delete[] pCopyOverScript;
}
}

//-------------------------------------------------------------------------------
Expand Down

0 comments on commit 552f096

Please sign in to comment.